API 0.9.5
CPKeyedArchiver Class Reference

Implements keyed archiving of object graphs (e.g. for storing data). More...

#import <CPKeyedArchiver.h>

Inheritance diagram for CPKeyedArchiver:

List of all members.

Instance Methods

(id) - delegate
(void) - encodeBool:forKey:
(void) - encodeConditionalObject:forKey:
(void) - encodeDouble:forKey:
(void) - encodeFloat:forKey:
(void) - encodeInt:forKey:
(void) - encodeNumber:forKey:
(void) - encodeObject:forKey:
(void) - encodePoint:forKey:
(void) - encodeRect:forKey:
(void) - encodeSize:forKey:
(void) - finishEncoding
(id) - initForWritingWithMutableData:
(CPPropertyListFormat) - outputFormat
(void) - setDelegate:
(void) - setOutputFormat:

Class Methods

(BOOL) + allowsKeyedCoding
(CPData+ archivedDataWithRootObject:
(CPString+ classNameForClass:
(void) + initialize
(void) + setClassName:forClass:

Detailed Description

Implements keyed archiving of object graphs (e.g. for storing data).

Implements keyed archiving of object graphs. Archiving means to write data out in a format that be read in again later, or possibly stored in a file. To read the data back in, use a CPKeyedUnarchiver.

Delegate Methods

-(void)archiverWillFinish:(CPKeyedArchiver)archiver; Called when the encoding is about to finish.

Parameters:
archiverthe archiver that's about to finish

-(void)archiver:(CPKeyedArchiver)archiver didEncodeObject:(id)object; Called when an object is encoded into the archiver.

Parameters:
archiverthe archiver that encoded the object
objectthe object that was encoded

-(void)archiverDidFinish:(CPKeyedArchiver)archiver; Called when the archiver finishes encoding.

Parameters:
archiverthe archiver that finished encoding

-(id)archiver:(CPKeyedArchiver)archiver willEncodeObject:(id)object; Called when an object is about to be encoded. Allows the delegate to replace the object that gets encoded with a substitute or nil.

Parameters:
archiverthe archiver encoding the object
objectthe candidate object for encoding
Returns:
the object to encode

-(void)archiver:(CPKeyedArchiver)archiver willReplaceObject:(id)object withObject:(id)newObject; Called when an object is being replaced in the archiver.

Parameters:
archiverthe archiver encoding the object
objectthe object to be replaced
newObjectthe replacement object

Definition at line 2 of file CPKeyedArchiver.h.


Method Documentation

+ (BOOL) allowsKeyedCoding

Returns a flag indicating whether the receiver supports keyed coding. The default implementation returns NO. Subclasses supporting keyed coding must override this to return YES.

Reimplemented from CPCoder.

Definition at line 131 of file CPKeyedArchiver.j.

+ (CPData) archivedDataWithRootObject: (id)  anObject

Archives the specified object.

Parameters:
anObjectthe object to archive
Returns:
the archived object

Definition at line 141 of file CPKeyedArchiver.j.

+ (CPString) classNameForClass: (Class)  aClass

Returns the name of the substitute class used for encoding aClass by all keyed archivers.

Parameters:
aClassthe class to substitute
Returns:
the name of the substitute class, or nil if there is no substitute class

Returns the name of the substitute class used for encoding aClass by this keyed archiver.

Parameters:
aClassthe class to substitute
Returns:
the name of the substitute class, or nil if there is no substitute class

Definition at line 424 of file CPKeyedArchiver.j.

- (id) delegate

Returns the keyed archiver's delegate

Definition at line 308 of file CPKeyedArchiver.j.

- (void) encodeBool: (BOOL)  aBOOL
forKey: (CPString aKey 

Encodes a BOOL value

Parameters:
aBoolthe BOOL value
aKeythe key to associate with the BOOL

Definition at line 245 of file CPKeyedArchiver.j.

- (void) encodeConditionalObject: (id)  anObject
forKey: (CPString aKey 

Encodes an conditionally. The method checks if the object has already been coded into this data stream before. If so, it will only encode a reference to that first object to save memory.

Parameters:
anObjectthe object to to conditionally encode
aKeythe key to associate with the object

Definition at line 350 of file CPKeyedArchiver.j.

- (void) encodeDouble: (double)  aDouble
forKey: (CPString aKey 

Encodes a double value

Parameters:
aDoublethe double value
aKeythe key to associate with the double

Definition at line 255 of file CPKeyedArchiver.j.

- (void) encodeFloat: (float)  aFloat
forKey: (CPString aKey 

Encodes a float value

Parameters:
aFloatthe float value
aKeythe key to associate with the float

Definition at line 265 of file CPKeyedArchiver.j.

- (void) encodeInt: (float)  anInt
forKey: (CPString aKey 

Encodes a int value

Parameters:
anIntthe int value
aKeythe key to associate with the int

Definition at line 275 of file CPKeyedArchiver.j.

- (void) encodeNumber: (CPNumber aNumber
forKey: (CPString aKey 

Encodes a number

Parameters:
aNumberthe number to encode
aKeythe key to associate with the object

Definition at line 360 of file CPKeyedArchiver.j.

- (void) encodeObject: (id)  anObject
forKey: (CPString aKey 

Encodes an object

Parameters:
anObjectthe object to encode
aKeythe key to associate with the object

Definition at line 370 of file CPKeyedArchiver.j.

- (void) encodePoint: (CGPoint)  aPoint
forKey: (CPString aKey 

Encodes a CGPoint

Parameters:
aPointthe point to encode
aKeythe key to associate with the point

Definition at line 318 of file CPKeyedArchiver.j.

- (void) encodeRect: (CGRect)  aRect
forKey: (CPString aKey 

Encodes a CGRect

Parameters:
aRectthe rectangle to encode
aKeythe key to associate with the rectangle

Definition at line 328 of file CPKeyedArchiver.j.

- (void) encodeSize: (CGSize)  aSize
forKey: (CPString aKey 

Encodes a CGSize

Parameters:
aSizethe size to encode
aKeythe key to associate with the size

Definition at line 338 of file CPKeyedArchiver.j.

- (void) finishEncoding

Finishes up writing any left over data, and notifies delegates. After calling this method, the archiver can not encode anymore objects.

Definition at line 187 of file CPKeyedArchiver.j.

- (id) initForWritingWithMutableData: (CPMutableData)  data

Initializes the keyed archiver with the specified CPMutableData for writing.

Parameters:
datathe object to archive to
Returns:
the initialized keyed archiver

Definition at line 158 of file CPKeyedArchiver.j.

+ (void) initialize

Definition at line 120 of file CPKeyedArchiver.j.

- (CPPropertyListFormat) outputFormat

Returns the property list format used to archive objects.

Definition at line 226 of file CPKeyedArchiver.j.

+ (void) setClassName: (CPString aClassName
forClass: (Class)  aClass 

Allows substitution of class types for encoding. Specifically classes of type aClass encountered by all keyed archivers will instead be archived as a class of type aClassName.

Parameters:
aClassNamethe substitute class name
aClassthe class to substitute

Allows substitution of class types for encoding. Specifically classes of type aClass encountered by this keyed archiver will instead be archived as a class of type aClassName.

Parameters:
aClassNamethe substitute class name
aClassthe class to substitute

Definition at line 409 of file CPKeyedArchiver.j.

- (void) setDelegate: (id)  aDelegate

Sets the keyed archiver's delegate

Definition at line 284 of file CPKeyedArchiver.j.

- (void) setOutputFormat: (CPPropertyListFormat)  aPropertyListFormat

Sets the property list format the archiver should use to archive objects.

Parameters:
aPropertyListFormatthe format to use

Definition at line 235 of file CPKeyedArchiver.j.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Defines