55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
static bool
equal(void *object1, void *object2)
{
return [(id)object1 isEqual: (id)object2];
}
static const of_map_table_functions_t keyFunctions = {
.retain = copy,
.release = release,
.hash = hash,
.equal = equal
};
static const of_map_table_functions_t objectFunctions = {
.retain = retain,
.release = release,
.hash = hash,
.equal = equal
};
@implementation OFMapTableDictionary
|
|
|
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
static bool
equal(void *object1, void *object2)
{
return [(id)object1 isEqual: (id)object2];
}
static const OFMapTableFunctions keyFunctions = {
.retain = copy,
.release = release,
.hash = hash,
.equal = equal
};
static const OFMapTableFunctions objectFunctions = {
.retain = retain,
.release = release,
.hash = hash,
.equal = equal
};
@implementation OFMapTableDictionary
|
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
|
- (OFEnumerator *)objectEnumerator
{
return [[[OFMapTableEnumeratorWrapper alloc]
initWithEnumerator: [_mapTable objectEnumerator]
object: self] autorelease];
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state
objects: (id *)objects
count: (int)count
{
return [_mapTable countByEnumeratingWithState: state
objects: objects
count: count];
}
#ifdef OF_HAVE_BLOCKS
- (void)enumerateKeysAndObjectsUsingBlock:
(of_dictionary_enumeration_block_t)block
{
@try {
[_mapTable enumerateKeysAndObjectsUsingBlock:
^ (void *key, void *object, bool *stop) {
block(key, object, stop);
}];
} @catch (OFEnumerationMutationException *e) {
|
|
|
<
|
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
|
- (OFEnumerator *)objectEnumerator
{
return [[[OFMapTableEnumeratorWrapper alloc]
initWithEnumerator: [_mapTable objectEnumerator]
object: self] autorelease];
}
- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state
objects: (id *)objects
count: (int)count
{
return [_mapTable countByEnumeratingWithState: state
objects: objects
count: count];
}
#ifdef OF_HAVE_BLOCKS
- (void)enumerateKeysAndObjectsUsingBlock: (OFDictionaryEnumerationBlock)block
{
@try {
[_mapTable enumerateKeysAndObjectsUsingBlock:
^ (void *key, void *object, bool *stop) {
block(key, object, stop);
}];
} @catch (OFEnumerationMutationException *e) {
|