Definition at line 150 of file OODeepCopy.m.
◆ ooDeepCopyWithSharedObjects:
| - (id) ooDeepCopyWithSharedObjects: |
|
(NSMutableSet*) | objects |
|
|
implementation |
Definition at line 152 of file OODeepCopy.m.
152 :(NSMutableSet*)objects
153{
155 id* members = NULL;
157 BOOL tempObjects = NO;
158
159 count = [
self count];
161 return [[NSSet set] retain];
162
163 members = malloc(
sizeof *members *
count);
164 if (members == NULL) {
165 [NSException raise:NSMallocException format:@"Failed to allocate space for %zu objects in %s.", count, __PRETTY_FUNCTION__];
166 }
167
168
169 if (objects ==
nil) {
170 objects = [[NSMutableSet alloc] init];
171 tempObjects = YES;
172 }
173
174 @try {
175 i = 0;
177
178 foreach (member, self) {
179 members[i] = [member ooDeepCopyWithSharedObjects:objects];
180 i++;
181 }
182
183
184 result = [[NSSet alloc] initWithObjects:members count:count];
185 }
186 @finally {
187
188 for (i = 0; i <
count; i++) {
189 [members[i] release];
190 }
191
192 free(members);
193 if (tempObjects)
194 [objects release];
195 }
196
197
198 return result;
199}
References count, and nil.
The documentation for this category was generated from the following file: