Differences From Artifact [58ee7d242e]:
- File
src/OFDictionary.m
— part of check-in
[8ff55bf218]
at
2011-07-17 16:38:47
on branch trunk
— Remove -[containsObjectIdenticalTo:] from OFCopying.
It is still implemented by all classes implementing OFCollection so far,
but new classes are not required to implement it anymore.This is required to add OFCountedSet later, which can't support it. (user: js, size: 19689) [annotate] [blame] [check-ins using]
To Artifact [78f590ebf2]:
- File src/OFDictionary.m — part of check-in [8df328d503] at 2011-07-18 22:53:19 on branch trunk — Add OFSet and OFMutableSet. (user: js, size: 19893) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
87 88 89 90 91 92 93 | [self release]; @throw e; } return self; } | | > | > | > | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | [self release]; @throw e; } return self; } - _initWithDictionary: (OFDictionary*)dictionary copyKeys: (BOOL)copyKeys { self = [super init]; @try { uint32_t i; if (dictionary == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; data = [self allocMemoryForNItems: dictionary->size withSize: sizeof(*data)]; for (i = 0; i < dictionary->size; i++) data[i] = NULL; size = dictionary->size; count = dictionary->count; for (i = 0; i < size; i++) { id key; struct of_dictionary_bucket *bucket; if (dictionary->data[i] == NULL || dictionary->data[i] == DELETED) continue; bucket = [self allocMemoryWithSize: sizeof(*bucket)]; key = (copyKeys ? [dictionary->data[i]->key copy] : [dictionary->data[i]->key retain]); @try { [dictionary->data[i]->object retain]; } @catch (id e) { [key release]; @throw e; } |
︙ | ︙ | |||
138 139 140 141 142 143 144 145 146 147 148 149 150 151 | } @catch (id e) { [self release]; @throw e; } return self; } - initWithObject: (id)object forKey: (id <OFCopying>)key { self = [super init]; @try { | > > > > > > | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | } @catch (id e) { [self release]; @throw e; } return self; } - initWithDictionary: (OFDictionary*)dictionary { return [self _initWithDictionary: dictionary copyKeys: YES]; } - initWithObject: (id)object forKey: (id <OFCopying>)key { self = [super init]; @try { |
︙ | ︙ | |||
779 780 781 782 783 784 785 | OFMutableString *ret; OFAutoreleasePool *pool, *pool2; OFEnumerator *keyEnumerator, *objectEnumerator; id key, object; size_t i; if (count == 0) | | | 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 | OFMutableString *ret; OFAutoreleasePool *pool, *pool2; OFEnumerator *keyEnumerator, *objectEnumerator; id key, object; size_t i; if (count == 0) return @"{()}"; ret = [OFMutableString stringWithString: @"{\n"]; pool = [[OFAutoreleasePool alloc] init]; keyEnumerator = [self keyEnumerator]; objectEnumerator = [self objectEnumerator]; i = 0; |
︙ | ︙ |