Implements keyed archiving of object graphs (e.g. for storing data). More...
Public Member Functions | |
(id) | - delegate [implementation] |
(void) | - encodeBool:forKey: [implementation] |
(void) | - encodeConditionalObject:forKey: [implementation] |
(void) | - encodeDouble:forKey: [implementation] |
(void) | - encodeFloat:forKey: [implementation] |
(void) | - encodeInt:forKey: [implementation] |
(void) | - encodeNumber:forKey: [implementation] |
(void) | - encodeObject:forKey: [implementation] |
(void) | - encodePoint:forKey: [implementation] |
(void) | - encodeRect:forKey: [implementation] |
(void) | - encodeSize:forKey: [implementation] |
(void) | - finishEncoding [implementation] |
(id) | - initForWritingWithMutableData: [implementation] |
(CPPropertyListFormat) | - outputFormat [implementation] |
(void) | - setDelegate: [implementation] |
(void) | - setOutputFormat: [implementation] |
Static Public Member Functions | |
(BOOL) | + allowsKeyedCoding [implementation] |
(CPData) | + archivedDataWithRootObject: [implementation] |
(CPString) | + classNameForClass: [implementation] |
(void) | + initialize [implementation] |
(void) | + setClassName:forClass: [implementation] |
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
.
-(void)archiverWillFinish:(CPKeyedArchiver)archiver; Called when the encoding is about to finish.
archiver | the archiver that's about to finish |
-(void)archiver:(CPKeyedArchiver)archiver didEncodeObject:(id)object; Called when an object is encoded into the archiver.
archiver | the archiver that encoded the object | |
object | the object that was encoded |
-(void)archiverDidFinish:(CPKeyedArchiver)archiver; Called when the archiver finishes encoding.
archiver | the arhiver 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
.
archiver | the archiver encoding the object | |
object | the candidate object for encoding |
-(void)archiver:(CPKeyedArchiver)archiver willReplaceObject:(id)object withObject:(id)newObject; Called when an object is being replaced in the archiver.
archiver | the archiver encoding the object | |
object | the object to be replaced | |
newObject | the replacement object |
Definition at line 102 of file CPKeyedArchiver.j.
+ (BOOL) allowsKeyedCoding | [implementation] |
Definition at line 138 of file CPKeyedArchiver.j.
+ (CPData) archivedDataWithRootObject: | (id) | anObject | [implementation] |
Archives the specified object.
anObject | the object to archive |
Definition at line 148 of file CPKeyedArchiver.j.
+ (CPString) classNameForClass: | (Class) | aClass | [implementation] |
Returns the name of the substitute class used for encoding aClass
by all keyed archivers.
aClass | the class to substitute |
nil
if there is no substitute classReturns the name of the substitute class used for encoding aClass
by this keyed archiver.
aClass | the class to substitute |
nil
if there is no substitute class Definition at line 432 of file CPKeyedArchiver.j.
- (id) delegate | [implementation] |
Returns the keyed archiver's delegate
Definition at line 316 of file CPKeyedArchiver.j.
- (void) encodeBool: | (BOOL) | aBOOL | ||
forKey: | (CPString) | aKey | ||
[implementation] |
Encodes a BOOL
value
aBool | the BOOL value | |
aKey | the key to associate with the BOOL |
Definition at line 253 of file CPKeyedArchiver.j.
- (void) encodeConditionalObject: | (id) | anObject | ||
forKey: | (CPString) | aKey | ||
[implementation] |
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.
anObject | the object to to conditionally encode | |
aKey | the key to associate with the object |
Definition at line 358 of file CPKeyedArchiver.j.
- (void) encodeDouble: | (double) | aDouble | ||
forKey: | (CPString) | aKey | ||
[implementation] |
Encodes a double
value
aDouble | the double value | |
aKey | the key to associate with the double |
Definition at line 263 of file CPKeyedArchiver.j.
- (void) encodeFloat: | (float) | aFloat | ||
forKey: | (CPString) | aKey | ||
[implementation] |
Encodes a float
value
aFloat | the float value | |
aKey | the key to associate with the float |
Definition at line 273 of file CPKeyedArchiver.j.
- (void) encodeInt: | (float) | anInt | ||
forKey: | (CPString) | aKey | ||
[implementation] |
Encodes a int
value
anInt | the int value | |
aKey | the key to associate with the int |
Definition at line 283 of file CPKeyedArchiver.j.
Encodes a number
aNumber | the number to encode | |
aKey | the key to associate with the object |
Definition at line 368 of file CPKeyedArchiver.j.
- (void) encodeObject: | (id) | anObject | ||
forKey: | (CPString) | aKey | ||
[implementation] |
Encdoes an object
anObject | the object to encode | |
aKey | the key to associate with the object |
Definition at line 378 of file CPKeyedArchiver.j.
- (void) encodePoint: | (CGPoint) | aPoint | ||
forKey: | (CPString) | aKey | ||
[implementation] |
Encodes a CGPoint
aPoint | the point to encode | |
aKey | the key to associate with the point |
Definition at line 326 of file CPKeyedArchiver.j.
- (void) encodeRect: | (CGRect) | aRect | ||
forKey: | (CPString) | aKey | ||
[implementation] |
Encodes a CGRect
aRect | the rectangle to encode | |
aKey | the key to associate with the rectangle |
Definition at line 336 of file CPKeyedArchiver.j.
- (void) encodeSize: | (CGSize) | aSize | ||
forKey: | (CPString) | aKey | ||
[implementation] |
Encodes a CGSize
aSize | the size to encode | |
aKey | the key to associate with the size |
Definition at line 346 of file CPKeyedArchiver.j.
- (void) finishEncoding | [implementation] |
Finishes up writing any left over data, and notifies delegates. After calling this method, the archiver can not encode anymore objects.
Definition at line 194 of file CPKeyedArchiver.j.
- (id) initForWritingWithMutableData: | (CPMutableData) | data | [implementation] |
Initializes the keyed archiver with the specified CPMutableData
for writing.
data | the object to archive to |
Definition at line 165 of file CPKeyedArchiver.j.
+ (void) initialize | [implementation] |
Definition at line 127 of file CPKeyedArchiver.j.
- (CPPropertyListFormat) outputFormat | [implementation] |
Returns the property list format used to archive objects.
Definition at line 234 of file CPKeyedArchiver.j.
+ (void) setClassName: | (CPString) | aClassName | ||
forClass: | (Class) | aClass | ||
[implementation] |
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
.
aClassName | the substitute class name | |
aClass | the 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
.
aClassName | the substitute class name | |
aClass | the class to substitute |
Definition at line 417 of file CPKeyedArchiver.j.
- (void) setDelegate: | (id) | aDelegate | [implementation] |
Sets the keyed archiver's delegate
Definition at line 292 of file CPKeyedArchiver.j.
- (void) setOutputFormat: | (CPPropertyListFormat) | aPropertyListFormat | [implementation] |
Sets the property list format the archiver should use to archive objects.
aPropertyListFormat | the format to use |
Definition at line 243 of file CPKeyedArchiver.j.