rfm@gnu.org
)Copyright: (C) 2004 Free Software Foundation, Inc.
- Declared in:
- Foundation/NSKeyedArchiver.h
Standards:
- MacOS-X
- NotOpenStep
- GNUstep
Implements keyed archiving of object
graphs. This archiver should be used instead of
NSArchiver
for new implementations. Classes implementing
<NSCoding>
should check the
[NSCoder -allowsKeyedCoding]
method and if the response is YES
, encode/decode their fields using the ...forKey:
NSCoder
methods, which provide for more robust
forwards and backwards compatibility.
Encodes anObject and writes the resulting data ti aPath.
Encodes anObject and returns the resulting data object.
Returns the class name with which the
NSKeyedArchiver class will encode instances
of aClass, or nil
if no name
mapping has been set using the
+setClassName:forClass:
method.
Sets the class name with which the NSKeyedArchiver
class will encode instances of aClass.
This mapping is used only if no class name mapping has
been set for the individual instance of
NSKeyedArchiver being used.
The
value of aString must be the name of an
existing class.
If the value of
aString is nil
, any mapping
for aClass is removed.
Returns any mapping for the name of
aClass which was previously set for the
receiver using the
-setClassName:forClass:
method.
Returns nil
if no such
mapping exists, even if one has been set using the
class method
+setClassName:forClass:
Returns the delegate set for the receiver, or
nil
of none is set.
Encodes aBool and associates the encoded value with aKey.
Encodes the data of the specified length and pointed to by aPointer, and associates the encoded value with aKey.
Encodes anObject and associates the encoded value with aKey, but only if anObject has already been encoded using -encodeObject:forKey:
Encodes aDouble and associates the encoded value with aKey.
Encodes aFloat and associates the encoded value with aKey.
Encodes anInteger and associates the encoded value with aKey.
Encodes anInteger and associates the encoded value with aKey.
Encodes anInteger and associates the encoded value with aKey.
Encodes anObject and associates the encoded value with aKey.
Ends the encoding process and causes the encoded
archive to be placed in the mutable data object
supplied when the receiver was initialised.
This method must be called at the end of encoding, and
nothing may be encoded after this method is called.
Initialise the receiver to encode an archive into the supplied data object.
Returns the output format of the archived data... this should default to the MacOS-X binary format, but we don't support that yet, so the -setOutputFormat: method should be used to set a supported format.
Sets the name with which instances of
aClass are encoded.
The value of
aString must be the anme of an existing
clas.
Sets the receivers delegate. The delegate should
conform to the NSObject(NSKeyedArchiverDelegate)
informal protocol.
NB. the delegate is not
retained, so you must ensure that it is not
deallocated before the archiver has finished
with it.
Specifies the output format of the archived data... this should default to the MacOS-X binary format, but we don't support that yet, so the -setOutputFormat: method should be used to set a supported format.
- Declared in:
- Foundation/NSKeyedArchiver.h
Standards:
- MacOS-X
- NotOpenStep
- GNUstep
Implements keyed unarchiving of object
graphs. The keyed archiver should be used instead of
NSArchiver
for new implementations. Classes implementing
<NSCoding>
should check the
[NSCoder -allowsKeyedCoding]
method and if the response is YES
, encode/decode their fields using the ...forKey:
NSCoder
methods, which provide for more robust
forwards and backwards compatibility.
Returns class substituted for class name specified
by aString when encountered in the archive
being decoded from, or nil
if there is
no specific translation mapping. Each instance also
maintains a translation map, which is searched
first for a match during decoding.
Sets class substituted for class name specified by
aString when encountered in the archive
being decoded from, or nil
if there is
no specific translation mapping. Each instance also
maintains a translation map, which is searched
first for a match during decoding.
Decodes from byte array in data and returns resulting root object.
Decodes from file contents at aPath and returns resulting root object.
Returns class substituted for class name specified
by aString when encountered in the archive
being decoded from, or nil
if there is
no specific translation mapping. The class as a whole
also maintains a translation map, which is searched on
decoding if no match found here.
Sets class substituted for class name specified by
aString when encountered in the archive being
decoded from, or nil
if there is no
specific translation mapping. Each instance also
maintains a translation map, which is searched
first for a match during decoding.
Returns a boolean value associated with aKey. This value must previously have been encoded using -encodeBool:forKey:
Returns a pointer to a byte array associated with
aKey.
Returns the length
of the data in aLength.
This value must
previously have been encoded using
-encodeBytes:length:forKey:
Returns a double value associated with aKey. This value must previously have been encoded using -encodeDouble:forKey: or -encodeFloat:forKey:
Returns a float value associated with
aKey. This value must previously have been
encoded using
-encodeFloat:forKey:
or
-encodeDouble:forKey:
Precision may be lost (or an exception raised
if the value will not fit in a float) if the value was
encoded using
-encodeDouble:forKey:
,
Returns a 32-bit integer value associated with
aKey. This value must previously have been
encoded using
-encodeInt:forKey:
,
-encodeInt32:forKey:
, or
-encodeInt64:forKey:
.
An exception will be raised if the value does
not fit in a 32-bit integer.
Returns a 64-bit integer value associated with aKey. This value must previously have been encoded using -encodeInt:forKey: , -encodeInt32:forKey: , or -encodeInt64:forKey: .
Returns an integer value associated with
aKey. This value must previously have been
encoded using
-encodeInt:forKey:
,
-encodeInt32:forKey:
, or
-encodeInt64:forKey:
.
An exception will be raised if the value does
not fit in an integer.
Returns an object value associated with aKey. This value must previously have been encoded using -encodeObject:forKey: or -encodeConditionalObject:forKey:
Returns the delegate of the unarchiver.
Tells receiver that you are done retrieving from archive, so the delegate should be allowed to perform close-up operations.
Prepare to read data from key archive (created by NSKeyedArchiver ). Be sure to call -finishDecoding when done.
Sets class substituted for class name specified by
aString when encountered in the archive
being decoded from, or nil
if there is
no specific translation mapping. Each instance also
maintains a translation map, which is searched
first for a match during decoding.
Sets the receivers delegate. The
delegate should conform to the
NSObject(NSKeyedUnarchiverDelegate)
informal protocol.
NB. the
delegate is not retained, so you must
ensure that it is not deallocated before the
unarchiver has finished with it.
- Declared in:
- Foundation/NSKeyedArchiver.h
Standards:
- MacOS-X
- NotOpenStep
- GNUstep
Methods for encoding/decoding points, rectangles, and sizes.
Method summary
Decodes an NSPoint
object.
Decodes an NSRect
object.
Decodes an NSSize
object.
Encodes an NSPoint
object.
Encodes an NSRect
object.
Encodes an NSSize
object.
- Declared in:
- Foundation/NSKeyedArchiver.h
Standards:
- MacOS-X
- NotOpenStep
- GNUstep
Internal methods. Do not use.
Method summary
Warning the underscore at the start of the
name of this method indicates that it is private, for
internal use only, and you should not use the
method in your code.
Internal method used to
encode an array relatively efficiently.
Some
MacOS-X library classes seem to use this.
Warning the underscore at the start of the name of this method indicates that it is private, for internal use only, and you should not use the method in your code.
- Declared in:
- Foundation/NSKeyedArchiver.h
Standards:
- MacOS-X
- NotOpenStep
- GNUstep
Internal methods. Do not use.
Method summary
Warning the underscore at the start of the
name of this method indicates that it is private, for
internal use only, and you should not use the
method in your code.
Internal method used to
decode an array relatively efficiently.
Some
MacOS-X library classes seem to use this.
Warning the underscore at the start of the name of this method indicates that it is private, for internal use only, and you should not use the method in your code.
- Declared in:
- Foundation/NSKeyedArchiver.h
Standards:
- MacOS-X
- NotOpenStep
- GNUstep
Informal protocol implemented by delegates of NSKeyedArchiver .
Method summarySent when encoding of anObject has completed except in the case of conditional encoding.
Sent when anObject is about to be encoded
(or conditionally encoded) and provides the receiver
with an opportunity to change the actual object stored
into the archive by returning a different value
(otherwise it should return anObject
).
The method is not called for encoding of
nil
or for encoding of any object for
which has already been called.
The method is
called after the
-replacementObjectForKeyedArchiver:
method.
Sent whenever object replacement occurs during encoding, either by the -replacementObjectForKeyedArchiver: method or because the delegate has returned a changed value using the -archiver:willEncodeObject: method.
Sent when the encoding process is complete.
Sent when the encoding process is about to finish.
- Declared in:
- Foundation/NSKeyedArchiver.h
Standards:
- MacOS-X
- NotOpenStep
- GNUstep
Methods by which a class may control its archiving by the NSKeyedArchiver .
Method summary
This message is sent to objects being encoded, to
allow them to choose to be encoded a different class.
If this returns nil
it is treated as if it
returned the class of the object.
After
this method is applied, any class name mapping set in
the archiver is applied to its result.
The
default implementation returns the result of the
-classForArchiver
method.
This message is sent to objects being encoded, to
allow them to choose to be encoded a different object
by returning the alternative object.
The default
implementation returns the result of calling
the
-replacementObjectForArchiver:
method with a nil
argument.
This
is called only if no mapping has been set up in the
archiver already.
- Declared in:
- Foundation/NSKeyedArchiver.h
Standards:
- MacOS-X
- NotOpenStep
- GNUstep
Informal protocol implemented by delegates of NSKeyedUnarchiver .
Method summary
Sent if the named class is not available during
decoding.
The value of aName is
the class name being decoded (after any name mapping
has been applied).
The classNames
arraay contains the original name of the class
encoded in the archive, and is followed by eqach of
its superclasses in turn.
The delegate may
either return a class object for the unarchiver to
use to continue decoding, or may return
nil
to abort the decoding process.
Sent when anObject is decoded. The receiver
may return either anObject or some other
object (including nil
). If a value
other than anObject is returned, it is
used to replace anObject.
Sent whenever object replacement occurs during decoding, eg by the -replacementObjectForKeyedArchiver: method.
Sent when unarchiving is about to complete.
Sent when unarchiving has been completed.
- Declared in:
- Foundation/NSKeyedArchiver.h
Standards:
- MacOS-X
- NotOpenStep
- GNUstep
Methods by which a class may control its unarchiving by the NSKeyedArchiver .
Method summary
Sent during unarchiving to permit classes to
substitute a different class for decoded
instances of themselves.
Default
implementation returns the receiver.
Overrides the mappings set up within the
receiver.