Definition at line 99 of file OODeepCopy.m.
◆ ooDeepCopyWithSharedObjects:
| - (id) ooDeepCopyWithSharedObjects: |
|
(NSMutableSet*) | objects |
|
|
implementation |
Definition at line 101 of file OODeepCopy.m.
101 :(NSMutableSet*)objects
102{
104 id* members = NULL;
105 NSArray* result =
nil;
106 BOOL tempObjects = NO;
107
108 count = [
self count];
110 return [[NSArray array] retain];
111
112 members = calloc(
sizeof *members,
count);
113 if (members == NULL) {
114 [NSException raise:NSMallocException format:@"Failed to allocate space for %zu objects in %s.", count, __PRETTY_FUNCTION__];
115 }
116
117
118 if (objects ==
nil) {
119 objects = [[NSMutableSet alloc] init];
120 tempObjects = YES;
121 }
122
123 [self getObjects:members];
124 @try {
125
126 for (i = 0; i <
count; i++) {
127 members[i] = [members[i] ooDeepCopyWithSharedObjects:objects];
128 }
129
130
131 result = [[NSArray alloc] initWithObjects:members count:count];
132 }
133 @finally {
134
135 for (i = 0; i <
count; i++) {
136 [members[i] release];
137 }
138
139 free(members);
140 if (tempObjects)
141 [objects release];
142 }
143
144
145 return result;
146}
References count, and nil.
The documentation for this category was generated from the following file: