Differences From Artifact [cbf5abac37]:
- File
src/OFDictionary.m
— part of check-in
[c86b8f10f0]
at
2022-11-16 01:27:26
on branch trunk
— Add OFAssert()
This uses the same format as OFEnsure(). (user: js, size: 18498) [annotate] [blame] [check-ins using] [more...]
To Artifact [12d43fb634]:
- File
src/OFDictionary.m
— part of check-in
[6ce0093f8d]
at
2023-04-10 19:22:32
on branch trunk
— Remove OFSerialization
While the idea sounds nice that the tag name is the class, this means the
serialization includes whether something is mutable or immutable. This means
doing as much as making something immutable changes the serialization, which
can then cause issues after being deserialized. (user: js, size: 15933) [annotate] [blame] [check-ins using] [more...]
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright (c) 2008-2023 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * |
︙ | ︙ | |||
20 21 22 23 24 25 26 | #import "OFDictionary.h" #import "OFArray.h" #import "OFCharacterSet.h" #import "OFData.h" #import "OFEnumerator.h" #import "OFMapTableDictionary.h" #import "OFString.h" | < < < < < < < < | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 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 | #import "OFDictionary.h" #import "OFArray.h" #import "OFCharacterSet.h" #import "OFData.h" #import "OFEnumerator.h" #import "OFMapTableDictionary.h" #import "OFString.h" #import "OFInvalidArgumentException.h" #import "OFOutOfRangeException.h" #import "OFUndefinedKeyException.h" static struct { Class isa; } placeholder; @interface OFDictionary () - (OFString *) of_JSONRepresentationWithOptions: (OFJSONRepresentationOptions)options depth: (size_t)depth; @end @interface OFDictionaryPlaceholder: OFDictionary @end OF_DIRECT_MEMBERS @interface OFDictionaryObjectEnumerator: OFEnumerator { OFDictionary *_dictionary; OFEnumerator *_keyEnumerator; } - (instancetype)initWithDictionary: (OFDictionary *)dictionary; @end @implementation OFDictionaryPlaceholder - (instancetype)init { return (id)[[OFMapTableDictionary alloc] init]; } - (instancetype)initWithDictionary: (OFDictionary *)dictionary |
︙ | ︙ | |||
109 110 111 112 113 114 115 | - (instancetype)initWithKey: (id <OFCopying>)firstKey arguments: (va_list)arguments { return (id)[[OFMapTableDictionary alloc] initWithKey: firstKey arguments: arguments]; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | - (instancetype)initWithKey: (id <OFCopying>)firstKey arguments: (va_list)arguments { return (id)[[OFMapTableDictionary alloc] initWithKey: firstKey arguments: arguments]; } - (instancetype)retain { return self; } - (instancetype)autorelease { return self; } - (void)release { } - (void)dealloc { OF_DEALLOC_UNSUPPORTED } @end @implementation OFDictionary + (void)initialize { if (self == [OFDictionary class]) placeholder.isa = [OFDictionaryPlaceholder class]; |
︙ | ︙ | |||
326 327 328 329 330 331 332 | va_end(arguments); return ret; } - (instancetype)initWithKey: (id)firstKey arguments: (va_list)arguments { | < < < < < | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | va_end(arguments); return ret; } - (instancetype)initWithKey: (id)firstKey arguments: (va_list)arguments { OF_INVALID_INIT_METHOD } - (id)objectForKey: (id)key { OF_UNRECOGNIZED_SELECTOR } |
︙ | ︙ | |||
633 634 635 636 637 638 639 | [ret makeImmutable]; objc_autoreleasePoolPop(pool); return ret; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | [ret makeImmutable]; objc_autoreleasePoolPop(pool); return ret; } - (OFString *)JSONRepresentation { return [self of_JSONRepresentationWithOptions: 0 depth: 0]; } - (OFString *)JSONRepresentationWithOptions: (OFJSONRepresentationOptions)options |
︙ | ︙ |