ftp.nice.ch/pub/next/graphics/convertors/Convert_MacPaint.NIHS.bs.tar.gz#/Convert_MacPaint/Source/shared.subproj/ResultObject.h

This is ResultObject.h in view mode; [Download] [Up]

/***********************************************************************\
Common class providing a multiple-result interface in all Convert objects
Copyright (C) 1993 David John Burrowes

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

The author, David John Burrowes, can be reached at:
	davidjohn@kira.net.netcom.com
	David John Burrowes
	1926 Ivy #10
	San Mateo, CA 94403-1367
\***********************************************************************/

/*
====================================================================
This is the interface file for the ResultObject class.  Full documentation for this class can be found in the ResultObject.rtf file.  I will not duplicate all that fine information here.
	This is $Revision: 1.4 $ of this file
	It was last modified by $Author: death $ on $Date: 93/04/04 23:45:08 $
Note that this file was created while using the New Century Schoolbook Roman typeface.  You may find that some things line up strangely if you don't use that family.
$Log:	ResultObject.h,v $
 * Revision 1.4  93/04/04  23:45:08  death
 * Sun Apr  4 23:45:07 PDT 1993
 * 
 * Revision 1.3  93/01/10  15:08:43  death
 * Sun Jan 10 15:08:43 PST 1993
 * 
 * Revision 1.2  92/07/26  13:59:06  death
 * Update of the result object...
 * 
====================================================================
*/

//
// Import our standard data type definitios
//
#import "common.h"
#import <objc/Object.h>
//
//	Declare an struct for a data type, and a flag indicating whether we own
//	the data or not (e.g. Objects are always not owned).
//
typedef struct
{
	DataType	StoredData;
	Boolean		IOwnData;
}
StorageArea;
//
//	Declare the number of storage areas we can have (including the special ones for error code,
//	error text and owr own error code), and the number of storage areas actually usable.
//
#define MAXAREAS 8
#define	NUMSTORAGEAREAS	MAXAREAS - 3

//
//	Now, define our interface.   Again, see the ResultObject.rtf document for general info.
//
@interface ResultObject:Object
{
	Integer	ErrorCode;
	CString	ErrorText;
	Boolean	IOwnErrorText;
	//
	//	Define an array of storage areas.  Note that we don't use storage area 0 for
	//	now.  Probably reserving it for an error code generated by these routines.
	//
	StorageArea	ReturnVals[MAXAREAS];
}

- (Instance) CopyCString: (CString) data;
- (Instance) CopyCString: (CString) data Into: (Integer) reference;
- (Instance) CopyPointer: (Pointer) data WithLength: (PositiveInteger) length ;
- (Instance) CopyPointer: (Pointer) data WithLength: (PositiveInteger) length Into: (Integer) reference;
- (Instance) init;
- free;
- (Boolean) GetBoolean;
- (Boolean) GetBooleanFrom: (Integer) reference;
- (Character) GetCharacter;
- (Character) GetCharacterFrom: (Integer) reference;
- (CString) GetCString;
- (CString) GetCStringFrom: (Integer) reference;
- (GenericType) GetDataWithType: (Integer) theType From: (Integer) storage;
- (Integer) GetErrorCode;
- (CString) GetErrorText;
- (Integer) GetInteger;
- (Integer) GetIntegerFrom: (Integer) reference;
- (Integer) GetMyError;
- (Instance) GetObject;
- (Instance) GetObjectFrom: (Integer) reference;
- (Pointer) GetPointer;
- (Pointer) GetPointerFrom: (Integer) reference;
- (PositiveInteger) GetPositiveInteger;
- (PositiveInteger) GetPositiveIntegerFrom: (PositiveInteger) reference;
- (Instance) PutBoolean: (Boolean) data Into: (Integer) reference;
- (Instance) PutCharacter: (Character) data Into: (Integer) reference;
- (Instance) PutCString: (CString) data Into: (Integer) reference;
- (Instance) PutData: (GenericType) theData WithType: (Integer) theType
	Into: (Integer) storage DoIOwn: (Boolean) ownit;
- (Instance) PutInteger: (Integer) data Into: (Integer) reference;
- (Instance) PutObject: (Instance) data Into: (Integer) reference;
- (Instance) PutPointer: (Pointer) data Into: (Integer) reference;
- (Instance) PutPositiveInteger: (PositiveInteger) data Into: (Integer) reference;
- (Instance) ResetResults;
- (Instance) StoreErrorCode: (Integer) code AndText: (CString) text;
- (Instance) StoreErrorCode: (Integer) code AndCopyOfText: (CString) text;
- (Instance) StoreBoolean: (Boolean) data;
- (Instance) StoreCharacter: (Character) data;
- (Instance) StoreCString: (CString) data;
- (Instance) StoreInteger: (Integer) data;
- (Instance) StoreMyError: (Integer) errorcode;
- (Instance) StoreObject: (Instance) data;
- (Instance) StorePointer: (Pointer) data;
- (Instance) StorePositiveInteger: (PositiveInteger) data;
@end


/* Types used by ResultObjects */
#define ERR_OK	0
#define ERR_PEACHY	0
#define ERR_ALLISWELL	0
#define ERR_GROOVY	0

#define ERR_NOSUCHAREA -1234
#define ERR_NOSUCHTYPE -1235
#define ERR_CANTSTORE	-1236

/* Altnerate error defines.  I prefer this style, I think.  92.05.04 djb */
#define	errOK	0

#define FIRST_RESULT	3
#define SECOND_RESULT	4
#define THIRD_RESULT	5
#define FOURTH_RESULT	6
#define FIFTH_RESULT	7

#define MYERROR_RESULT	0
#define ERRORCODE_RESULT	1
#define ERRORTEXT_RESULT	2

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.