ftp.nice.ch/Attic/openStep/implementation/gnustep/sources/objcX-0.87.tgz#/objcX-0.87/foundation/NXArchiver.h

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

/* Interface for NXArchiver and NXUnarchiver class
 *
 * Copyright (C)  1993  The Board of Trustees of  
 * The Leland Stanford Junior University.  All Rights Reserved.
 *
 * Authors: Paul Kunz
 *
 * This file is part of an Objective-C class library
 *
 * NXArchiver.h,v 1.2 1995/05/11 17:42:16 mfg Exp
 */
 
 /*
  * Based on (Preliminary Documentation) Copyright (c) 1994 by NeXT Computer,
  * Inc.  All Rights Reserved. 
  *
  * This NXCoder subclass reads and writes NeXTSTEP 3.2 compatible
  * NXTypedStreams without use of a NSCoder
  */

#ifndef __NXArchiver_include__
#define __NXArchiver_include__

#include "NXCoder.h"

#define NXACTIVE_ARCHIVER "NXActive_Archiver"

extern id	NXActive_Archiver;

@class NSData, NSMutableData, NSString;

@interface NXArchiver : NXCoder 

// Initializing an NXArchiver

// - (id)initForWritingWithMutableData:(NSMutableData *)mdata;
 /*
  * Initializes an archiver, encoding stream and version information into
  * mutable data mdata. 
  */


// Archiving data 

// + (NSData *)archivedDataWithRootObject:(id)rootObject;
 /*
  * Creates and returns a data object after initializing an archiver with
  * that object and encoding the archiver with rootObject. 
  */
  
+ (BOOL)archiveRootObject:(id)rootObject
                   toFile:(NSString *)path;
 /*
  * Archives rootObject by encoding it as a data object in an archiver and
  * writing that data object to file path.  Returns YES upon success. 
  */

// - (void)encodeArrayOfObjCType:(const char *)type
//                        count:(unsigned int)count
//			   at:(const void *)array;
 /*
  * Encodes an array of count data elements of the same   Objective C data
  * type.  
  */

// - (void)encodeConditionalObject:(id)object;
 /*
  * Encodes into the linearized data a conditional  object that points back
  * toward a root object.  If nil is specified for object, it encodes it as
  * nil unconditionally.  Raises an exception if no root object has been
  * encoded.    
  */
  
// - (void)encodeRootObject:(id)rootObject;
 /*
  * Encodes the rootObject at the start of the linearized data representing
  * the object graph.  Raises an exception if the root object has already
  * been encoded. 
  */


// Getting data from the archiver

// - (NSMutableData *)archiverData;
 /*
  * Returns the data object,  in mutable form, that is associated with the
  * receiving NXArchiver. 
  */


// Substituting One Class for Another 

// + (NSString *)classNameEncodedForTrueClassName:(NSString *)trueName;
 /*
  * Returns the string object representing the class name used to archive
  * instances of the class.  This class name might not be the original name
  * (trueName):  see encodeClassName:intoClassName. 
  */

// - (void)encodeClassName:(NSString *)trueName
// 	  intoClassName:(NSString *)inArchiveName;
 /*
  * Encodes in the archived data a substitute class name (inArchiveName) for
  * the real class name (trueName).  
  */

@end

@interface NXUnarchiver : NXCoder

// Initializing an NSUnarchiver

// - (id)initForReadingWithData:(NSData *)data;
 /*
  * Initializes an NSUnarchiver object from data object data. 
  */


// Decoding Objects

// + (id)unarchiveObjectWithData:(NSData *)data;
 /*
  * Decodes an archived object stored in data. 
  */
 
- initForReadingWithStream:(NXStream *)stream;
 /*
  * Fake NSData method with stream
  */
  
- initForReadingFromFile:(char *)filename;
 /*
  * Open a typed stream, given the filename 
  */
  
- free;
 /*
  * Closes any open stream
  */
  
+ (id)unarchiveObjectWithFile:(NSString *)path;
 /*
  * Decodes an archived object stored in the file path. 
  */
 
// - (void)decodeArrayOfObjCType:(const char *)itemType  
// 			count:(unsigned int)count
//			   at:(void *)array;
 /*
  * Decodes an array of count data elements of the same Objective C data
  * itemType. 
  */


// Managing an NSUnarchiver

// - (BOOL)isAtEnd;
 /*
  * Returns YES if the end of data is reached, NO if more data follows. 
  */
 
// - (NSZone *)objectZone;
 /*
  * Returns the allocation zone for the unarchiver object. 
  */
 
- (void)setObjectZone:(NXZone *)zone;
 /*
  * Sets the allocation zone for the unarchiver object to zone.  If zone is
  * nil, it sets it to the default zone. 
  */
 
// - (unsigned int)systemVersion;
 /*
  * Returns the system version number for the unarchived data. 
  */
 

// Substituting One Class For Another

// + (NSString *)classNameDecodedForArchiveClassName:(NSString *)inArchiveName;
 /*
  * Returns the string object representing the class name used to archive
  * instances of the class  (inArchiveName).  This  may not be the original
  * class name but another name encoded with NXArchiver's
  * encodeClassName:intoClassName. 
  */
	
// + (void)decodeClassName:(NSString *)inArchiveName	
// 	    asClassName:(NSString *)trueName;
 /*
  * Decodes from the archived data a class name (inArchiveName) substituted
  * for the real class name (trueName).  This method enables easy conversion
  * of unarchived data when there are name changes in classes. 
  */
 
// - (NSString *)classNameDecodedForArchiveClassName:(NSString *)inArchiveName;
 /*
  * Returns the string object representing the class name used to archive
  * instances of the class  (inArchiveName).  This  may not be the original
  * class name but another name encoded with NXArchiver's
  * encodeClassName:intoClassName. 
  */
	
// - (void)decodeClassName:(NSString *)inArchiveName	
// 	    asClassName:(NSString *)trueName;
 /*
  * Decodes from the archived data a class name (inArchiveName) substituted
  * for the real class name (trueName).  This method enables easy conversion
  * of unarchived data when there are name changes in classes. 
  */
  
@end

#endif	/* __NXArchiver_include__ */

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