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