Definition at line 110 of file OODeepCopy.m.
◆ ooDeepCopyWithSharedObjects:
- (id) ooDeepCopyWithSharedObjects: |
|
(NSMutableSet *) | objects |
|
|
implementation |
Definition at line 31 of file OODeepCopy.m.
112 :(NSMutableSet *)objects
113{
115 id *members = NULL;
116 NSArray *result =
nil;
117 BOOL tempObjects = NO;
118
119 count = [
self count];
120 if (
count == 0)
return [[NSArray array] retain];
121
122 members = calloc(
sizeof *members,
count);
123 if (members == NULL)
124 {
125 [NSException raise:NSMallocException format:@"Failed to allocate space for %lu objects in %s.", (unsigned long)count, __PRETTY_FUNCTION__];
126 }
127
128
130 {
131 objects = [[NSMutableSet alloc] init];
132 tempObjects = YES;
133 }
134
135 [self getObjects:members];
136 @try
137 {
138
139 for (i = 0; i <
count; i++)
140 {
141 members[i] = [members[i] ooDeepCopyWithSharedObjects:objects];
142 }
143
144
145 result = [[NSArray alloc] initWithObjects:members count:count];
146 }
147 @finally
148 {
149
150 for (i = 0; i <
count; i++)
151 {
152 [members[i] release];
153 }
154
155 free(members);
156 if (tempObjects) [objects release];
157 }
158
159
160 return result;
161}
The documentation for this category was generated from the following file: