Definition at line 166 of file OODeepCopy.m.
◆ ooDeepCopyWithSharedObjects:
- (id) ooDeepCopyWithSharedObjects: |
|
(NSMutableSet *) | objects |
|
|
implementation |
Definition at line 31 of file OODeepCopy.m.
168 :(NSMutableSet *)objects
169{
171 id *members = NULL;
173 BOOL tempObjects = NO;
174
175 count = [
self count];
176 if (
count == 0)
return [[NSSet set] retain];
177
178 members = malloc(
sizeof *members *
count);
179 if (members == NULL)
180 {
181 [NSException raise:NSMallocException format:@"Failed to allocate space for %lu objects in %s.", (unsigned long)count, __PRETTY_FUNCTION__];
182 }
183
184
186 {
187 objects = [[NSMutableSet alloc] init];
188 tempObjects = YES;
189 }
190
191 @try
192 {
193 i = 0;
195
196 foreach (member, self)
197 {
198 members[i] = [member ooDeepCopyWithSharedObjects:objects];
199 i++;
200 }
201
202
203 result = [[NSSet alloc] initWithObjects:members count:count];
204 }
205 @finally
206 {
207
208 for (i = 0; i <
count; i++)
209 {
210 [members[i] release];
211 }
212
213 free(members);
214 if (tempObjects) [objects release];
215 }
216
217
218 return result;
219}
The documentation for this category was generated from the following file: