ftp.nice.ch/peanuts/GeneralData/Documents/openstep/OpenStepSpec_rtf.tar.gz#/OpenStepSpec_rtf/FoundationKit/Protocols/NSCopying.rtf

This is NSCopying.rtf in view mode; [Download] [Up]

paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc.  All Rights Reserved.

s4 li100 fi0 ri1007 ql f0 b fs36 fs100 
fs36 NSCopying
pard s0 li2872 tx2872 f1 b0 fs28 fs48 
fs28 f0 b fs24 Adopted By:tab b0 fs28 f1 Various OpenStep classes
fs20 
fs28 s7 fi-2771 ri1007 ql f0 b fs24 Declared In:tab b0 fs28 f1 Foundation/NSObject.h
fs20 
fs28 pard s16 li100 fi0 ri1007 ql f0 b fs28 fs20 
fs28 Protocol Description
fs14 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 
fs28 A class whose instances provide functional copies of themselves should adopt the NSCopying protocol. The exact meaning of 'aacopy'ba can vary from class to class, but a copy must be a functionally independent object, identical to the original at the time the copy was made. Where the concept 'aaimmutable vs. mutable'ba applies to an object, this protocol produces immutable copies; see the NSMutableCopying protocol for details on making mutable copies. Property list classes (NSString, NSData, NSArray, and NSDictionary) guarantee immutable returned values.
fs16 
fs28 In most cases, to produce a copy that'27s independent of the original, a i deep copyi0  must be made. A deep copy is one in which every instance variable of the receiver is duplicated, instead of referencing the variable in the original object. If the receiver'27s instance variables themselves have instance variables, those too must be duplicated, and so on. A deep copy is thus a completely separate object from the original; changes to it don'27t affect the original, and changes to the original don'27t affect it. Further, for an immutable copy, no part at any level may be changed, making a copy a 'aasnapshot'ba of the original object.
fs16 
fs28 Making a complete deep copy isn'27t always needed. Some objects can reasonably share instance variables among themselves'd0a static string object that gets replaced but not modified, for example. In such cases your class can implement NSCopying more cheaply than it might otherwise need to.
fs16 
fs28 The typical usage of NSCopying is to create 'aapassing by value'ba value objects. 
fs16 
fs28 Contrary to most methods, the returned object is owned by the caller, who is responsible for releasing it.
fs16 
fs28 pard s16 li100 fi0 ri1007 ql f0 b fs24 
fs28 Copying Objects
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (id)b copyWithZone:b0 (NSZone *)i zonei0 tab Returns a new instance that'27s a functional copy of the receiver. Memory for the new instance is allocated from zone. For collections, creates a deep (recursive) copy. The copy returned is immutable if the consideration 'aaimmutable vs. mutable'ba applies to the receiving object; otherwise the exact nature of the copy is determined by the class. The returned object is owned by the caller, who is responsible for releasing it.
}

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