ftp.nice.ch/Attic/openStep/implementation/gnustep/sources/libFoundation.0.7.tgz#/libFoundation-0.7/libFoundation/Foundation/NSArchiver.h

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

/* 
   NSArchiver.h

   Copyright (C) 1995, 1996 Ovidiu Predescu and Mircea Oancea.
   All rights reserved.

   Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>

   This file is part of libFoundation.

   Permission to use, copy, modify, and distribute this software and its
   documentation for any purpose and without fee is hereby granted, provided
   that the above copyright notice appear in all copies and that both that
   copyright notice and this permission notice appear in supporting
   documentation.

   We disclaim all warranties with regard to this software, including all
   implied warranties of merchantability and fitness, in no event shall
   we be liable for any special, indirect or consequential damages or any
   damages whatsoever resulting from loss of use, data or profits, whether in
   an action of contract, negligence or other tortious action, arising out of
   or in connection with the use or performance of this software.
*/

#ifndef __NSArchiver_h__
#define __NSArchiver_h__

#include <Foundation/NSCoder.h>

@class NSMutableDictionary;
@class NSData;
@class NSMutableData;

@interface NSArchiver : NSCoder
{
    NSMutableData*	mdata;
    NSHashTable*	objects;	// objects written so far
    NSHashTable*	conditionals;	// conditional objects
    NSMapTable*		classes;	// real classname -> class info
    NSHashTable*	pointers;	// set of pointers
    IMP			writeIMP;	// write IMP of mdata
    BOOL 		writingRoot;	// YES if encodeRootObject: was sent
    BOOL findingConditionals;		// YES if finding conditionals
}

/* Initializing an NSArchiver */
- (id)initForWritingWithMutableData:(NSMutableData*)mdata;

/* Archiving Data */
+ (NSData*)archivedDataWithRootObject:(id)rootObject;
+ (BOOL)archiveRootObject:(id)rootObject
	toFile:(NSString*)path;
- (void)encodeConditionalObject:(id)object;
- (void)encodeRootObject:(id)rootObject;

/* Getting Data from the NSArchiver */
- (NSMutableData*)archiverData;

/* Substituting One Class for Another */
- (NSString*)classNameEncodedForTrueClassName:(NSString*)trueName;
- (void)encodeClassName:(NSString*)trueName
	intoClassName:(NSString*)inArchiveName;

@end /* NSArchiver */


@interface NSUnarchiver : NSCoder
{
    NSData*	rdata;
    unsigned	cursor;
    IMP		readIMP;	// read function of encodingFormat
    NSZone*	objectZone;	// zone of allocated objects
    unsigned	archiverVersion; // archiver's version that wrote the data
    NSMapTable*	objects;	// decoded objects: key -> object
    NSMapTable*	classes;	// decoded classes: key -> class info
    NSMapTable*	pointers;	// decoded pointers: key -> pointer
    NSMapTable*	classAlias;	// archive name -> decoded name
    NSMapTable*	classVersions;	// archive name -> class info
	
}

/* Initializing an NSUnarchiver */
- (id)initForReadingWithData:(NSData*)data;

/* Decoding Objects */
+ (id)unarchiveObjectWithData:(NSData*)data;
+ (id)unarchiveObjectWithFile:(NSString*)path;
- (void)decodeArrayOfObjCType:(const char*)itemType
	count:(unsigned int)count
	at:(void*)array;

/* Managing an NSUnarchiver */
- (BOOL)isAtEnd;
- (NSZone*)objectZone;
- (void)setObjectZone:(NSZone*)zone;
- (unsigned int)systemVersion;

/* Substituting One Class for Another */
+ (NSString*)classNameDecodedForArchiveClassName:(NSString*)nameInArchive;
+ (void)decodeClassName:(NSString*)nameInArchive
	asClassName:(NSString*)trueName;
- (NSString*)classNameDecodedForArchiveClassName:(NSString*)nameInArchive;
- (void)decodeClassName:(NSString*)nameInArchive
	asClassName:(NSString*)trueName;
- (unsigned int)versionForClassName:(NSString*)className;

@end

#endif /* __NSArchiver_h__ */

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