Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OODeepCopy.h
Go to the documentation of this file.
1/*
2
3OODeepCopy.h
4
5Informal protocol and utility function for making efficient deep copies of
6immutable collections.
7
8It is implemented in such a way that all objects can be deep copied. Objects
9that implement the NSCopying protocol are automatically copied, while others
10are retained. The following special cases exist:
11 * NSStrings and NSValues (including NSNumbers) are uniqued - that is, the
12 resulting collection will only include one (immutable) copy of any string
13 or number.
14 * Arrays, sets and dictionaries deep copy their contents.
15
16For objects where the mutable/immutable distinction exists, the result should
17be expected to be immutable.
18
19This self-optimizing behaviour is similar to that performed by binary plist
20export.
21
22NOTE: in accordance with Cocoa coding conventions, methods and functions with
23Copy in the name return objects owned by the receiver.
24
25
26Copyright (C) 2009-2013 Jens Ayton
27
28Permission is hereby granted, free of charge, to any person obtaining a copy
29of this software and associated documentation files (the "Software"), to deal
30in the Software without restriction, including without limitation the rights
31to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
32copies of the Software, and to permit persons to whom the Software is
33furnished to do so, subject to the following conditions:
34
35The above copyright notice and this permission notice shall be included in all
36copies or substantial portions of the Software.
37
38THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
43OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44SOFTWARE.
45
46*/
47
48#import "OOCocoa.h"
50
51
53
54
55@interface NSObject (OODeepCopy)
56
57- (id) ooDeepCopyWithSharedObjects:(NSMutableSet *)objects OO_RETURNS_RETAINED;
58
59@end
id OODeepCopy(id object) OO_RETURNS_RETAINED
Definition OODeepCopy.m:31
#define OO_RETURNS_RETAINED