Overview
Comment: | OFDictionary: Add designated initializers |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4fa963805bc23620cac44d4293ecfa4e |
User & Date: | js on 2023-08-12 17:31:08 |
Other Links: | manifest | tags |
Context
2023-08-13
| ||
22:02 | OFSet: Add designated initializers check-in: d0205355f5 user: js tags: trunk | |
2023-08-12
| ||
17:31 | OFDictionary: Add designated initializers check-in: 4fa963805b user: js tags: trunk | |
12:05 | OFArray: Add designated initializer check-in: 47860977ff user: js tags: trunk | |
Changes
Modified src/OFArray.m from [ae3e0d5879] to [0cc4510ea3].
︙ | |||
178 179 180 181 182 183 184 | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | - + - | va_start(arguments, firstObject); ret = [self initWithObject: firstObject arguments: arguments]; va_end(arguments); return ret; } |
︙ |
Modified src/OFDictionary.h from [b2fad599b6] to [947ceaf9c2].
︙ | |||
145 146 147 148 149 150 151 152 153 154 155 156 157 158 | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | + + + + + + + | * * @param firstKey The first key * @return A new autoreleased OFDictionary */ + (instancetype)dictionaryWithKeysAndObjects: (KeyType)firstKey, ... OF_SENTINEL; /** * @brief Initializes an already allocated OFDictionary to be empty. * * @return An initialized OFDictionary */ - (instancetype)init OF_DESIGNATED_INITIALIZER; /** * @brief Initializes an already allocated OFDictionary with the specified * OFDictionary. * * @param dictionary An OFDictionary * @return An initialized OFDictionary */ |
︙ | |||
187 188 189 190 191 192 193 | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | - + | * @param keys An array of keys * @param objects An array of objects * @param count The number of objects in the arrays * @return An initialized OFDictionary */ - (instancetype)initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects forKeys: (KeyType const _Nonnull *_Nonnull)keys |
︙ |
Modified src/OFDictionary.m from [8b606ffec2] to [e8124fd5c4].
︙ | |||
49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | + + + + + + | OFEnumerator *_keyEnumerator; } - (instancetype)initWithDictionary: (OFDictionary *)dictionary; @end @implementation OFPlaceholderDictionary #ifdef __clang__ /* We intentionally don't call into super, so silence the warning. */ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wunknown-pragmas" # pragma clang diagnostic ignored "-Wobjc-designated-initializers" #endif - (instancetype)init { return (id)[[OFConcreteDictionary alloc] init]; } - (instancetype)initWithDictionary: (OFDictionary *)dictionary { |
︙ | |||
100 101 102 103 104 105 106 107 108 109 110 111 112 113 | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | + + + | - (instancetype)initWithKey: (id <OFCopying>)firstKey arguments: (va_list)arguments { return (id)[[OFConcreteDictionary alloc] initWithKey: firstKey arguments: arguments]; } #ifdef __clang__ # pragma clang diagnostic pop #endif OF_SINGLETON_METHODS @end @implementation OFDictionary + (void)initialize { |
︙ | |||
184 185 186 187 188 189 190 | 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 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } return [super init]; } - (instancetype)initWithDictionary: (OFDictionary *)dictionary { void *pool = objc_autoreleasePoolPush(); id const *objects, *keys; size_t count; |
︙ |
Modified src/OFMutableDictionary.h from [368ae1527e] to [dd4009e02f].
︙ | |||
50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | + + + + + + + - + | * specified number of objects. * * @param capacity The initial capacity for the OFMutableDictionary * @return A new autoreleased OFMutableDictionary */ + (instancetype)dictionaryWithCapacity: (size_t)capacity; /** * @brief Initializes an already allocated OFMutableDictionary to be empty. * * @return An initialized OFMutableDictionary */ - (instancetype)init OF_DESIGNATED_INITIALIZER; /** * @brief Initializes an already allocated OFMutableDictionary with enough * memory to hold the specified number of objects. * * @param capacity The initial capacity for the OFMutableDictionary * @return An initialized OFMutableDictionary */ |
︙ |
Modified src/OFMutableDictionary.m from [c24bbf1afd] to [8a88d7dabe].
︙ | |||
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | 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 | + + + + + + + + + + + + + + + + + + + + + | return [super alloc]; } + (instancetype)dictionaryWithCapacity: (size_t)capacity { return [[[self alloc] initWithCapacity: capacity] autorelease]; } - (instancetype)init { return [super init]; } #ifdef __clang__ /* We intentionally don't call into super, so silence the warning. */ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wunknown-pragmas" # pragma clang diagnostic ignored "-Wobjc-designated-initializers" #endif - (instancetype)initWithObjects: (id const *)objects forKeys: (id const *)keys count: (size_t)count { OF_INVALID_INIT_METHOD } - (instancetype)initWithCapacity: (size_t)capacity { OF_INVALID_INIT_METHOD } #ifdef __clang__ # pragma clang diagnostic pop #endif - (void)setObject: (id)object forKey: (id)key { OF_UNRECOGNIZED_SELECTOR } - (void)setObject: (id)object forKeyedSubscript: (id)key |
︙ |