237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
}
- (OFEnumerator *)objectEnumerator
{
OF_UNRECOGNIZED_SELECTOR
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count
{
OFEnumerator *enumerator;
int i;
memcpy(&enumerator, state->extra, sizeof(enumerator));
|
|
|
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
}
- (OFEnumerator *)objectEnumerator
{
OF_UNRECOGNIZED_SELECTOR
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
OFEnumerator *enumerator;
int i;
memcpy(&enumerator, state->extra, sizeof(enumerator));
|
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
|
- (OFXMLElement *)XMLElementBySerializing
{
void *pool = objc_autoreleasePoolPush();
OFXMLElement *element;
if ([self isKindOfClass: [OFMutableSet class]])
element = [OFXMLElement elementWithName: @"OFMutableSet"
namespace: OF_SERIALIZATION_NS];
else
element = [OFXMLElement elementWithName: @"OFSet"
namespace: OF_SERIALIZATION_NS];
for (id <OFSerialization> object in self) {
void *pool2 = objc_autoreleasePoolPush();
[element addChild: object.XMLElementBySerializing];
objc_autoreleasePoolPop(pool2);
}
|
|
|
|
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
|
- (OFXMLElement *)XMLElementBySerializing
{
void *pool = objc_autoreleasePoolPush();
OFXMLElement *element;
if ([self isKindOfClass: [OFMutableSet class]])
element = [OFXMLElement elementWithName: @"OFMutableSet"
namespace: OFSerializationNS];
else
element = [OFXMLElement elementWithName: @"OFSet"
namespace: OFSerializationNS];
for (id <OFSerialization> object in self) {
void *pool2 = objc_autoreleasePoolPush();
[element addChild: object.XMLElementBySerializing];
objc_autoreleasePoolPop(pool2);
}
|
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
|
void *pool = objc_autoreleasePoolPush();
id ret = [[[self objectEnumerator] nextObject] retain];
objc_autoreleasePoolPop(pool);
return [ret autorelease];
}
#ifdef OF_HAVE_BLOCKS
- (void)enumerateObjectsUsingBlock: (of_set_enumeration_block_t)block
{
bool stop = false;
for (id object in self) {
block(object, &stop);
if (stop)
break;
}
}
- (OFSet *)filteredSetUsingBlock: (of_set_filter_block_t)block
{
OFMutableSet *ret = [OFMutableSet set];
[self enumerateObjectsUsingBlock: ^ (id object, bool *stop) {
if (block(object))
[ret addObject: object];
}];
|
|
|
|
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
|
void *pool = objc_autoreleasePoolPush();
id ret = [[[self objectEnumerator] nextObject] retain];
objc_autoreleasePoolPop(pool);
return [ret autorelease];
}
#ifdef OF_HAVE_BLOCKS
- (void)enumerateObjectsUsingBlock: (OFSetEnumerationBlock)block
{
bool stop = false;
for (id object in self) {
block(object, &stop);
if (stop)
break;
}
}
- (OFSet *)filteredSetUsingBlock: (OFSetFilterBlock)block
{
OFMutableSet *ret = [OFMutableSet set];
[self enumerateObjectsUsingBlock: ^ (id object, bool *stop) {
if (block(object))
[ret addObject: object];
}];
|