Comment: | Clean up the class hierarchy in the doxygen generated documentation. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
367bf4117b29cdda50734ba4f26c0c63 |
User & Date: | js on 2011-08-22 09:58:10 |
Other Links: | manifest | tags |
2011-08-22
| ||
10:10 | Small optimization in -[OFDictionary_hashtable initWithDictionary:]. check-in: ba9f2608cc user: js tags: trunk | |
09:58 | Clean up the class hierarchy in the doxygen generated documentation. check-in: 367bf4117b user: js tags: trunk | |
2011-08-21
| ||
21:11 | Don't install headers for implementations of abstract classes. check-in: b9191c784b user: js tags: trunk | |
Modified src/OFDictionary.h from [661b980566] to [ec216f0268].
︙ | ︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | BOOL *stop); typedef BOOL (^of_dictionary_filter_block_t)(id key, id object); typedef id (^of_dictionary_map_block_t)(id key, id object); #endif /** * \brief An abstract class for storing objects in a dictionary. * * Note: Fast enumeration on a dictionary enumerates through the keys of the * dictionary. */ @interface OFDictionary: OFObject <OFCopying, OFMutableCopying, OFCollection, OFSerialization> /** | > > | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | BOOL *stop); typedef BOOL (^of_dictionary_filter_block_t)(id key, id object); typedef id (^of_dictionary_map_block_t)(id key, id object); #endif /** * \brief An abstract class for storing objects in a dictionary. * * Keys are copied and thus must conform to the OFCopying protocol. * * Note: Fast enumeration on a dictionary enumerates through the keys of the * dictionary. */ @interface OFDictionary: OFObject <OFCopying, OFMutableCopying, OFCollection, OFSerialization> /** |
︙ | ︙ | |||
57 58 59 60 61 62 63 | * \brief Creates a new OFDictionary with the specified key and object. * * \param key The key * \param object The object * \return A new autoreleased OFDictionary */ + dictionaryWithObject: (id)object | | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | * \brief Creates a new OFDictionary with the specified key and object. * * \param key The key * \param object The object * \return A new autoreleased OFDictionary */ + dictionaryWithObject: (id)object forKey: (id)key; /** * \brief Creates a new OFDictionary with the specified keys and objects. * * \param keys An array of keys * \param objects An array of objects * \return A new autoreleased OFDictionary */ + dictionaryWithObjects: (OFArray*)objects forKeys: (OFArray*)keys; /** * \brief Creates a new OFDictionary with the specified keys objects. * * \param firstKey The first key * \return A new autoreleased OFDictionary */ + dictionaryWithKeysAndObjects: (id)firstKey, ...; /** * \brief Initializes an already allocated OFDictionary. * * \return An initialized OFDictionary */ - init; |
︙ | ︙ | |||
102 103 104 105 106 107 108 | * and object. * * \param key The key * \param object The object * \return A new initialized OFDictionary */ - initWithObject: (id)object | | | | | | 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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | * and object. * * \param key The key * \param object The object * \return A new initialized OFDictionary */ - initWithObject: (id)object forKey: (id)key; /** * \brief Initializes an already allocated OFDictionary with the specified keys * and objects. * * \param keys An array of keys * \param objects An array of objects * \return A new initialized OFDictionary */ - initWithObjects: (OFArray*)objects forKeys: (OFArray*)keys; /** * \brief Initializes an already allocated OFDictionary with the specified keys * and objects. * * \param firstKey The first key * \return A new initialized OFDictionary */ - initWithKeysAndObjects: (id)firstKey, ...; /** * \brief Initializes an already allocated OFDictionary with the specified key * and va_list. * * \param firstKey The first key * \param arguments A va_list of the other arguments * \return A new initialized OFDictionary */ - initWithKey: (id)firstKey arguments: (va_list)arguments; /** * \brief Returns the object for the given key or nil if the key was not found. * * The returned object is <i>not</i> retained and autoreleased for performance * reasons! * * \param key The key whose object should be returned * \return The object for the given key or nil if the key was not found */ - (id)objectForKey: (id)key; /** * \brief Checks whether the dictionary contains an object with the specified * address. * * \param object The object which is checked for being in the dictionary * \return A boolean whether the dictionary contains an object with the |
︙ | ︙ |
Modified src/OFDictionary.m from [cb8d68b6da] to [3cc46ccafd].
︙ | ︙ | |||
42 43 44 45 46 47 48 | - initWithDictionary: (OFDictionary*)dictionary { return (id)[[OFDictionary_hashtable alloc] initWithDictionary: dictionary]; } - initWithObject: (id)object | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | - initWithDictionary: (OFDictionary*)dictionary { return (id)[[OFDictionary_hashtable alloc] initWithDictionary: dictionary]; } - initWithObject: (id)object forKey: (id)key { return (id)[[OFDictionary_hashtable alloc] initWithObject: object forKey: key]; } - initWithObjects: (OFArray*)objects forKeys: (OFArray*)keys |
︙ | ︙ | |||
129 130 131 132 133 134 135 | + dictionaryWithDictionary: (OFDictionary*)dictionary { return [[[self alloc] initWithDictionary: dictionary] autorelease]; } + dictionaryWithObject: (id)object | | | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | + dictionaryWithDictionary: (OFDictionary*)dictionary { return [[[self alloc] initWithDictionary: dictionary] autorelease]; } + dictionaryWithObject: (id)object forKey: (id)key { return [[[self alloc] initWithObject: object forKey: key] autorelease]; } + dictionaryWithObjects: (OFArray*)objects forKeys: (OFArray*)keys { return [[[self alloc] initWithObjects: objects forKeys: keys] autorelease]; } + dictionaryWithKeysAndObjects: (id)firstKey, ... { id ret; va_list arguments; va_start(arguments, firstKey); ret = [[[self alloc] initWithKey: firstKey arguments: arguments] autorelease]; |
︙ | ︙ | |||
177 178 179 180 181 182 183 | Class c = isa; [self release]; @throw [OFNotImplementedException newWithClass: c selector: _cmd]; } - initWithObject: (id)object | | | | | | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | Class c = isa; [self release]; @throw [OFNotImplementedException newWithClass: c selector: _cmd]; } - initWithObject: (id)object forKey: (id)key { return [self initWithKeysAndObjects: key, object, nil]; } - initWithObjects: (OFArray*)objects forKeys: (OFArray*)keys { Class c = isa; [self release]; @throw [OFNotImplementedException newWithClass: c selector: _cmd]; } - initWithKeysAndObjects: (id)firstKey, ... { id ret; va_list arguments; va_start(arguments, firstKey); ret = [self initWithKey: firstKey arguments: arguments]; va_end(arguments); return ret; } - initWithKey: (id)firstKey arguments: (va_list)arguments { Class c = isa; [self release]; @throw [OFNotImplementedException newWithClass: c selector: _cmd]; } - initWithSerialization: (OFXMLElement*)element { Class c = isa; [self release]; @throw [OFNotImplementedException newWithClass: c selector: _cmd]; } - (id)objectForKey: (id)key { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } - (size_t)count { |
︙ | ︙ | |||
247 248 249 250 251 252 253 | return [[OFMutableDictionary alloc] initWithDictionary: self]; } - (BOOL)isEqual: (id)dictionary { OFAutoreleasePool *pool; OFEnumerator *enumerator; | | | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | return [[OFMutableDictionary alloc] initWithDictionary: self]; } - (BOOL)isEqual: (id)dictionary { OFAutoreleasePool *pool; OFEnumerator *enumerator; id key; if ([dictionary count] != [self count]) return NO; pool = [[OFAutoreleasePool alloc] init]; enumerator = [self keyEnumerator]; |
︙ | ︙ | |||
311 312 313 314 315 316 317 318 | } - (OFArray*)allKeys { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; id *cArray = [self allocMemoryForNItems: [self count] withSize: sizeof(id)]; OFEnumerator *enumerator; | > | < | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | } - (OFArray*)allKeys { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; id *cArray = [self allocMemoryForNItems: [self count] withSize: sizeof(id)]; OFArray *ret; OFEnumerator *enumerator; id key; size_t i = 0; pool = [[OFAutoreleasePool alloc] init]; enumerator = [self keyEnumerator]; while ((key = [enumerator nextObject]) != nil) cArray[i++] = key; |
︙ | ︙ | |||
341 342 343 344 345 346 347 348 349 | } - (OFArray*)allObjects { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; id *cArray = [self allocMemoryForNItems: [self count] withSize: sizeof(id)]; OFEnumerator *enumerator; id object; | > < | 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | } - (OFArray*)allObjects { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; id *cArray = [self allocMemoryForNItems: [self count] withSize: sizeof(id)]; OFArray *ret; OFEnumerator *enumerator; id object; size_t i = 0; pool = [[OFAutoreleasePool alloc] init]; enumerator = [self objectEnumerator]; while ((object = [enumerator nextObject]) != nil) cArray[i++] = object; |
︙ | ︙ | |||
392 393 394 395 396 397 398 | #ifdef OF_HAVE_BLOCKS - (void)enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)block { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFEnumerator *enumerator = [self keyEnumerator]; | | | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | #ifdef OF_HAVE_BLOCKS - (void)enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)block { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFEnumerator *enumerator = [self keyEnumerator]; id key; BOOL stop = NO; while (!stop && (key = [enumerator nextObject]) != nil) block(key, [self objectForKey: key], &stop); [pool release]; } |
︙ | ︙ | |||
438 439 440 441 442 443 444 | } #endif - (uint32_t)hash { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFEnumerator *enumerator = [self keyEnumerator]; | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | } #endif - (uint32_t)hash { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFEnumerator *enumerator = [self keyEnumerator]; id key; uint32_t hash = 0; while ((key = [enumerator nextObject]) != nil) { hash += [key hash]; hash += [[self objectForKey: key] hash]; } |
︙ | ︙ | |||
498 499 500 501 502 503 504 | - (OFXMLElement*)XMLElementBySerializing { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFAutoreleasePool *pool2; OFXMLElement *element; OFEnumerator *keyEnumerator, *objectEnumerator; | | | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | - (OFXMLElement*)XMLElementBySerializing { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFAutoreleasePool *pool2; OFXMLElement *element; OFEnumerator *keyEnumerator, *objectEnumerator; id key, object; if ([self isKindOfClass: [OFMutableDictionary class]]) element = [OFXMLElement elementWithName: @"OFMutableDictionary" namespace: OF_SERIALIZATION_NS]; else element = [OFXMLElement elementWithName: @"OFDictionary" namespace: OF_SERIALIZATION_NS]; |
︙ | ︙ |
Modified src/OFDictionary_hashtable.h from [bc1f7945d5] to [5e6091e296].
︙ | ︙ | |||
14 15 16 17 18 19 20 | * file. */ #import "OFDictionary.h" struct of_dictionary_hashtable_bucket { | < | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * file. */ #import "OFDictionary.h" struct of_dictionary_hashtable_bucket { id key, object; uint32_t hash; }; @interface OFDictionary_hashtable: OFDictionary { struct of_dictionary_hashtable_bucket **data; uint32_t size; |
︙ | ︙ |
Modified src/OFDictionary_hashtable.m from [2ec4537eb9] to [5217ffcc95].
︙ | ︙ | |||
125 126 127 128 129 130 131 | - initWithDictionary: (OFDictionary*)dictionary { self = [super init]; @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFEnumerator *enumerator; | | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | - initWithDictionary: (OFDictionary*)dictionary { self = [super init]; @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFEnumerator *enumerator; id key; uint32_t i, newSize; count = [dictionary count]; if (count > UINT32_MAX) @throw [OFOutOfRangeException newWithClass: isa]; |
︙ | ︙ | |||
199 200 201 202 203 204 205 | @throw e; } return self; } - initWithObject: (id)object | | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | @throw e; } return self; } - initWithObject: (id)object forKey: (id)key { self = [super init]; @try { uint32_t i; struct of_dictionary_hashtable_bucket *bucket; |
︙ | ︙ | |||
297 298 299 300 301 302 303 | break; } /* Key not in dictionary */ if (j >= last || data[j] == NULL || ![data[j]->key isEqual: keysCArray[i]]) { struct of_dictionary_hashtable_bucket *bucket; | | | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | break; } /* Key not in dictionary */ if (j >= last || data[j] == NULL || ![data[j]->key isEqual: keysCArray[i]]) { struct of_dictionary_hashtable_bucket *bucket; id key; last = size; j = hash & (size - 1); for (; j < last && data[j] != NULL; j++); /* In case the last bucket is already used */ |
︙ | ︙ | |||
361 362 363 364 365 366 367 | [self release]; @throw e; } return self; } | | | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | [self release]; @throw e; } return self; } - initWithKey: (id)firstKey arguments: (va_list)arguments { self = [super init]; @try { id key, object; uint32_t i, j, hash, newSize; |
︙ | ︙ | |||
427 428 429 430 431 432 433 | bucket->hash = hash; data[j] = bucket; for (i = 1; i < count; i++) { uint32_t last; | | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | bucket->hash = hash; data[j] = bucket; for (i = 1; i < count; i++) { uint32_t last; key = va_arg(arguments, id); object = va_arg(arguments, id); if (key == nil || object == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; |
︙ | ︙ | |||
578 579 580 581 582 583 584 | [self release]; @throw e; } return self; } | | | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | [self release]; @throw e; } return self; } - (id)objectForKey: (id)key { uint32_t i, hash, last; if (key == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; |
︙ | ︙ |
Modified src/OFEnumerator.h from [992da1f406] to [4677a6d4a2].
︙ | ︙ | |||
17 18 19 20 21 22 23 | #import "OFObject.h" @class OFEnumerator; /** * \brief A protocol for getting an enumerator for the object. */ | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #import "OFObject.h" @class OFEnumerator; /** * \brief A protocol for getting an enumerator for the object. */ @protocol OFEnumerating /** * \brief Returns an OFEnumerator to enumerate through all objects of the * collection. * * \returns An OFEnumerator to enumerate through all objects of the collection */ - (OFEnumerator*)objectEnumerator; |
︙ | ︙ |
Modified src/OFMutableDictionary.h from [0667a7eb0a] to [41532865ea].
︙ | ︙ | |||
29 30 31 32 33 34 35 | * * A key can be any object that conforms to the OFCopying protocol. * * \param key The key to set * \param object The object to set the key to */ - (void)setObject: (id)object | | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | * * A key can be any object that conforms to the OFCopying protocol. * * \param key The key to set * \param object The object to set the key to */ - (void)setObject: (id)object forKey: (id)key; /** * \brief Removes the object for the specified key from the dictionary. * * \param key The key whose object should be removed */ - (void)removeObjectForKey: (id)key; #ifdef OF_HAVE_BLOCKS /** * \brief Replaces each object with the object returned by the block. * * \param block The block which returns a new object for each object */ |
︙ | ︙ |
Modified src/OFMutableDictionary.m from [0c649f32e0] to [1646e68d29].
︙ | ︙ | |||
36 37 38 39 40 41 42 | - initWithDictionary: (OFDictionary*)dictionary { return (id)[[OFMutableDictionary_hashtable alloc] initWithDictionary: dictionary]; } - initWithObject: (id)object | | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | - initWithDictionary: (OFDictionary*)dictionary { return (id)[[OFMutableDictionary_hashtable alloc] initWithDictionary: dictionary]; } - initWithObject: (id)object forKey: (id)key { return (id)[[OFMutableDictionary_hashtable alloc] initWithObject: object forKey: key]; } - initWithObjects: (OFArray*)objects forKeys: (OFArray*)keys { return (id)[[OFMutableDictionary_hashtable alloc] initWithObjects: objects forKeys: keys]; } - initWithKeysAndObjects: (id)firstKey, ... { id ret; va_list arguments; va_start(arguments, firstKey); ret = (id)[[OFMutableDictionary_hashtable alloc] initWithKey: firstKey |
︙ | ︙ |
Modified src/OFMutableDictionary_hashtable.m from [c6660be1ea] to [ba31392df4].
︙ | ︙ | |||
185 186 187 188 189 190 191 | old = data[i]->object; data[i]->object = [object retain]; [old release]; } - (void)setObject: (id)object | | | | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | old = data[i]->object; data[i]->object = [object retain]; [old release]; } - (void)setObject: (id)object forKey: (id)key { [self _setObject: object forKey: key copyKey: YES]; } - (void)removeObjectForKey: (id)key { uint32_t i, hash, last; if (key == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; |
︙ | ︙ |
Modified src/OFObject.h from [7e695cf1f5] to [8c882f215e].
︙ | ︙ | |||
574 575 576 577 578 579 580 | */ - (void)finalize; @end /** * \brief A protocol for the creation of copies. */ | | | | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | */ - (void)finalize; @end /** * \brief A protocol for the creation of copies. */ @protocol OFCopying /** * \brief Copies the object. * * For classes which can be immutable or mutable, this returns an immutable * copy. If only a mutable version of the class exists, it creates a mutable * copy. * * \return A copy of the object */ - copy; @end /** * \brief A protocol for the creation of mutable copies. * * This protocol is implemented by objects that can be mutable and immutable * and allows returning a mutable copy. */ @protocol OFMutableCopying /** * \brief Creates a mutable copy of the object. * * \return A mutable copy of the object */ - mutableCopy; @end |
︙ | ︙ |
Modified src/OFSerialization.h from [34e6599afb] to [fbbc513813].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #define OF_SERIALIZATION_NS @"https://webkeks.org/objfw/serialization" @class OFXMLElement; /** * \brief A protocol for serializing objects. */ | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #define OF_SERIALIZATION_NS @"https://webkeks.org/objfw/serialization" @class OFXMLElement; /** * \brief A protocol for serializing objects. */ @protocol OFSerialization /** * \brief Initializes the object with the specified XML element serialization. * * \param element An OFXMLElement with the serialized object * \return An initialized object */ - initWithSerialization: (OFXMLElement*)element; |
︙ | ︙ |
Modified src/OFXMLElement+Serialization.m from [fb80388119] to [8af8aee9f9].
︙ | ︙ | |||
30 31 32 33 34 35 36 | int _OFXMLElement_Serialization_reference; @implementation OFXMLElement (Serialization) - (id)objectByDeserializing { OFAutoreleasePool *pool; Class class; | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | int _OFXMLElement_Serialization_reference; @implementation OFXMLElement (Serialization) - (id)objectByDeserializing { OFAutoreleasePool *pool; Class class; id object; pool = [[OFAutoreleasePool alloc] init]; if ((class = objc_lookUpClass([name cString])) == Nil) @throw [OFNotImplementedException newWithClass: Nil]; if (![class conformsToProtocol: @protocol(OFSerialization)]) |
︙ | ︙ |