OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 14 matching lines...) Expand all Loading... |
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
31 #import <Foundation/Foundation.h> | 31 #import <Foundation/Foundation.h> |
32 | 32 |
33 #import "GPBRuntimeTypes.h" | 33 #import "GPBRuntimeTypes.h" |
34 | 34 |
35 // These classes are used for map fields of basic data types. They are used beca
use | 35 // Note on naming: for the classes holding numeric values, a more natural |
36 // they perform better than boxing into NSNumbers in NSDictionaries. | 36 // naming of the method might be things like "-valueForKey:", |
37 | 37 // "-setValue:forKey:"; etc. But those selectors are also defined by Key Value |
38 // Note: These are not meant to be subclassed. | 38 // Coding (KVC) as categories on NSObject. So "overloading" the selectors with |
| 39 // other meanings can cause warnings (based on compiler settings), but more |
| 40 // importantly, some of those selector get called as KVC breaks up keypaths. |
| 41 // So if those selectors are used, using KVC will compile cleanly, but could |
| 42 // crash as it invokes those selectors with the wrong types of arguments. |
39 | 43 |
40 NS_ASSUME_NONNULL_BEGIN | 44 NS_ASSUME_NONNULL_BEGIN |
41 | 45 |
42 //%PDDM-EXPAND DECLARE_DICTIONARIES() | 46 //%PDDM-EXPAND DECLARE_DICTIONARIES() |
43 // This block of code is generated, do not edit it directly. | 47 // This block of code is generated, do not edit it directly. |
44 | 48 |
45 #pragma mark - UInt32 -> UInt32 | 49 #pragma mark - UInt32 -> UInt32 |
46 | 50 |
| 51 /** |
| 52 * Class used for map fields of <uint32_t, uint32_t> |
| 53 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 54 * |
| 55 * @note This class is not meant to be subclassed. |
| 56 **/ |
47 @interface GPBUInt32UInt32Dictionary : NSObject <NSCopying> | 57 @interface GPBUInt32UInt32Dictionary : NSObject <NSCopying> |
48 | 58 |
| 59 /** Number of entries stored in this dictionary. */ |
49 @property(nonatomic, readonly) NSUInteger count; | 60 @property(nonatomic, readonly) NSUInteger count; |
50 | 61 |
| 62 /** |
| 63 * @return A newly instanced and empty dictionary. |
| 64 **/ |
51 + (instancetype)dictionary; | 65 + (instancetype)dictionary; |
52 + (instancetype)dictionaryWithValue:(uint32_t)value | 66 |
| 67 /** |
| 68 * Creates and initializes a dictionary with the single entry given. |
| 69 * |
| 70 * @param value The value to be placed in the dictionary. |
| 71 * @param key The key under which to store the value. |
| 72 * |
| 73 * @return A newly instanced dictionary with the key and value in it. |
| 74 **/ |
| 75 + (instancetype)dictionaryWithUInt32:(uint32_t)value |
| 76 forKey:(uint32_t)key; |
| 77 |
| 78 /** |
| 79 * Creates and initializes a dictionary with the entries given. |
| 80 * |
| 81 * @param values The values to be placed in the dictionary. |
| 82 * @param keys The keys under which to store the values. |
| 83 * @param count The number of entries to store in the dictionary. |
| 84 * |
| 85 * @return A newly instanced dictionary with the keys and values in it. |
| 86 **/ |
| 87 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values |
| 88 forKeys:(const uint32_t [])keys |
| 89 count:(NSUInteger)count; |
| 90 |
| 91 /** |
| 92 * Creates and initializes a dictionary with the entries from the given. |
| 93 * dictionary. |
| 94 * |
| 95 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 96 * |
| 97 * @return A newly instanced dictionary with the entries from the given |
| 98 * dictionary in it. |
| 99 **/ |
| 100 + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary
; |
| 101 |
| 102 /** |
| 103 * Creates and initializes a dictionary with the given capacity. |
| 104 * |
| 105 * @param numItems Capacity needed for the dictionary. |
| 106 * |
| 107 * @return A newly instanced dictionary with the given capacity. |
| 108 **/ |
| 109 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 110 |
| 111 /** |
| 112 * Initializes this dictionary, copying the given values and keys. |
| 113 * |
| 114 * @param values The values to be placed in this dictionary. |
| 115 * @param keys The keys under which to store the values. |
| 116 * @param count The number of elements to copy into the dictionary. |
| 117 * |
| 118 * @return A newly initialized dictionary with a copy of the values and keys. |
| 119 **/ |
| 120 - (instancetype)initWithUInt32s:(const uint32_t [])values |
| 121 forKeys:(const uint32_t [])keys |
| 122 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 123 |
| 124 /** |
| 125 * Initializes this dictionary, copying the entries from the given dictionary. |
| 126 * |
| 127 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 128 * |
| 129 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 130 **/ |
| 131 - (instancetype)initWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary; |
| 132 |
| 133 /** |
| 134 * Initializes this dictionary with the requested capacity. |
| 135 * |
| 136 * @param numItems Number of items needed for this dictionary. |
| 137 * |
| 138 * @return A newly initialized dictionary with the requested capacity. |
| 139 **/ |
| 140 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 141 |
| 142 /** |
| 143 * Gets the value for the given key. |
| 144 * |
| 145 * @param value Pointer into which the value will be set, if found. |
| 146 * @param key Key under which the value is stored, if present. |
| 147 * |
| 148 * @return YES if the key was found and the value was copied, NO otherwise. |
| 149 **/ |
| 150 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint32_t)key; |
| 151 |
| 152 /** |
| 153 * Enumerates the keys and values on this dictionary with the given block. |
| 154 * |
| 155 * @param block The block to enumerate with. |
| 156 * **key**: The key for the current entry. |
| 157 * **value**: The value for the current entry |
| 158 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 159 **/ |
| 160 - (void)enumerateKeysAndUInt32sUsingBlock: |
| 161 (void (^)(uint32_t key, uint32_t value, BOOL *stop))block; |
| 162 |
| 163 /** |
| 164 * Adds the keys and values from another dictionary. |
| 165 * |
| 166 * @param otherDictionary Dictionary containing entries to be added to this |
| 167 * dictionary. |
| 168 **/ |
| 169 - (void)addEntriesFromDictionary:(GPBUInt32UInt32Dictionary *)otherDictionary; |
| 170 |
| 171 /** |
| 172 * Sets the value for the given key. |
| 173 * |
| 174 * @param value The value to set. |
| 175 * @param key The key under which to store the value. |
| 176 **/ |
| 177 - (void)setUInt32:(uint32_t)value forKey:(uint32_t)key; |
| 178 |
| 179 /** |
| 180 * Removes the entry for the given key. |
| 181 * |
| 182 * @param aKey Key to be removed from this dictionary. |
| 183 **/ |
| 184 - (void)removeUInt32ForKey:(uint32_t)aKey; |
| 185 |
| 186 /** |
| 187 * Removes all entries in this dictionary. |
| 188 **/ |
| 189 - (void)removeAll; |
| 190 |
| 191 @end |
| 192 |
| 193 #pragma mark - UInt32 -> Int32 |
| 194 |
| 195 /** |
| 196 * Class used for map fields of <uint32_t, int32_t> |
| 197 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 198 * |
| 199 * @note This class is not meant to be subclassed. |
| 200 **/ |
| 201 @interface GPBUInt32Int32Dictionary : NSObject <NSCopying> |
| 202 |
| 203 /** Number of entries stored in this dictionary. */ |
| 204 @property(nonatomic, readonly) NSUInteger count; |
| 205 |
| 206 /** |
| 207 * @return A newly instanced and empty dictionary. |
| 208 **/ |
| 209 + (instancetype)dictionary; |
| 210 |
| 211 /** |
| 212 * Creates and initializes a dictionary with the single entry given. |
| 213 * |
| 214 * @param value The value to be placed in the dictionary. |
| 215 * @param key The key under which to store the value. |
| 216 * |
| 217 * @return A newly instanced dictionary with the key and value in it. |
| 218 **/ |
| 219 + (instancetype)dictionaryWithInt32:(int32_t)value |
53 forKey:(uint32_t)key; | 220 forKey:(uint32_t)key; |
54 + (instancetype)dictionaryWithValues:(const uint32_t [])values | 221 |
| 222 /** |
| 223 * Creates and initializes a dictionary with the entries given. |
| 224 * |
| 225 * @param values The values to be placed in the dictionary. |
| 226 * @param keys The keys under which to store the values. |
| 227 * @param count The number of entries to store in the dictionary. |
| 228 * |
| 229 * @return A newly instanced dictionary with the keys and values in it. |
| 230 **/ |
| 231 + (instancetype)dictionaryWithInt32s:(const int32_t [])values |
55 forKeys:(const uint32_t [])keys | 232 forKeys:(const uint32_t [])keys |
56 count:(NSUInteger)count; | 233 count:(NSUInteger)count; |
57 + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary
; | 234 |
| 235 /** |
| 236 * Creates and initializes a dictionary with the entries from the given. |
| 237 * dictionary. |
| 238 * |
| 239 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 240 * |
| 241 * @return A newly instanced dictionary with the entries from the given |
| 242 * dictionary in it. |
| 243 **/ |
| 244 + (instancetype)dictionaryWithDictionary:(GPBUInt32Int32Dictionary *)dictionary; |
| 245 |
| 246 /** |
| 247 * Creates and initializes a dictionary with the given capacity. |
| 248 * |
| 249 * @param numItems Capacity needed for the dictionary. |
| 250 * |
| 251 * @return A newly instanced dictionary with the given capacity. |
| 252 **/ |
58 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 253 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
59 | 254 |
60 - (instancetype)initWithValues:(const uint32_t [])values | 255 /** |
| 256 * Initializes this dictionary, copying the given values and keys. |
| 257 * |
| 258 * @param values The values to be placed in this dictionary. |
| 259 * @param keys The keys under which to store the values. |
| 260 * @param count The number of elements to copy into the dictionary. |
| 261 * |
| 262 * @return A newly initialized dictionary with a copy of the values and keys. |
| 263 **/ |
| 264 - (instancetype)initWithInt32s:(const int32_t [])values |
61 forKeys:(const uint32_t [])keys | 265 forKeys:(const uint32_t [])keys |
62 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 266 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
63 - (instancetype)initWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary; | 267 |
| 268 /** |
| 269 * Initializes this dictionary, copying the entries from the given dictionary. |
| 270 * |
| 271 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 272 * |
| 273 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 274 **/ |
| 275 - (instancetype)initWithDictionary:(GPBUInt32Int32Dictionary *)dictionary; |
| 276 |
| 277 /** |
| 278 * Initializes this dictionary with the requested capacity. |
| 279 * |
| 280 * @param numItems Number of items needed for this dictionary. |
| 281 * |
| 282 * @return A newly initialized dictionary with the requested capacity. |
| 283 **/ |
64 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 284 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
65 | 285 |
66 - (BOOL)valueForKey:(uint32_t)key value:(nullable uint32_t *)value; | 286 /** |
67 | 287 * Gets the value for the given key. |
68 - (void)enumerateKeysAndValuesUsingBlock: | 288 * |
69 (void (^)(uint32_t key, uint32_t value, BOOL *stop))block; | 289 * @param value Pointer into which the value will be set, if found. |
70 | 290 * @param key Key under which the value is stored, if present. |
71 - (void)addEntriesFromDictionary:(GPBUInt32UInt32Dictionary *)otherDictionary; | 291 * |
72 | 292 * @return YES if the key was found and the value was copied, NO otherwise. |
73 - (void)setValue:(uint32_t)value forKey:(uint32_t)key; | 293 **/ |
74 | 294 - (BOOL)getInt32:(nullable int32_t *)value forKey:(uint32_t)key; |
75 - (void)removeValueForKey:(uint32_t)aKey; | 295 |
| 296 /** |
| 297 * Enumerates the keys and values on this dictionary with the given block. |
| 298 * |
| 299 * @param block The block to enumerate with. |
| 300 * **key**: The key for the current entry. |
| 301 * **value**: The value for the current entry |
| 302 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 303 **/ |
| 304 - (void)enumerateKeysAndInt32sUsingBlock: |
| 305 (void (^)(uint32_t key, int32_t value, BOOL *stop))block; |
| 306 |
| 307 /** |
| 308 * Adds the keys and values from another dictionary. |
| 309 * |
| 310 * @param otherDictionary Dictionary containing entries to be added to this |
| 311 * dictionary. |
| 312 **/ |
| 313 - (void)addEntriesFromDictionary:(GPBUInt32Int32Dictionary *)otherDictionary; |
| 314 |
| 315 /** |
| 316 * Sets the value for the given key. |
| 317 * |
| 318 * @param value The value to set. |
| 319 * @param key The key under which to store the value. |
| 320 **/ |
| 321 - (void)setInt32:(int32_t)value forKey:(uint32_t)key; |
| 322 |
| 323 /** |
| 324 * Removes the entry for the given key. |
| 325 * |
| 326 * @param aKey Key to be removed from this dictionary. |
| 327 **/ |
| 328 - (void)removeInt32ForKey:(uint32_t)aKey; |
| 329 |
| 330 /** |
| 331 * Removes all entries in this dictionary. |
| 332 **/ |
76 - (void)removeAll; | 333 - (void)removeAll; |
77 | 334 |
78 @end | 335 @end |
79 | 336 |
80 #pragma mark - UInt32 -> Int32 | 337 #pragma mark - UInt32 -> UInt64 |
81 | 338 |
82 @interface GPBUInt32Int32Dictionary : NSObject <NSCopying> | 339 /** |
83 | 340 * Class used for map fields of <uint32_t, uint64_t> |
| 341 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 342 * |
| 343 * @note This class is not meant to be subclassed. |
| 344 **/ |
| 345 @interface GPBUInt32UInt64Dictionary : NSObject <NSCopying> |
| 346 |
| 347 /** Number of entries stored in this dictionary. */ |
84 @property(nonatomic, readonly) NSUInteger count; | 348 @property(nonatomic, readonly) NSUInteger count; |
85 | 349 |
| 350 /** |
| 351 * @return A newly instanced and empty dictionary. |
| 352 **/ |
86 + (instancetype)dictionary; | 353 + (instancetype)dictionary; |
87 + (instancetype)dictionaryWithValue:(int32_t)value | 354 |
| 355 /** |
| 356 * Creates and initializes a dictionary with the single entry given. |
| 357 * |
| 358 * @param value The value to be placed in the dictionary. |
| 359 * @param key The key under which to store the value. |
| 360 * |
| 361 * @return A newly instanced dictionary with the key and value in it. |
| 362 **/ |
| 363 + (instancetype)dictionaryWithUInt64:(uint64_t)value |
| 364 forKey:(uint32_t)key; |
| 365 |
| 366 /** |
| 367 * Creates and initializes a dictionary with the entries given. |
| 368 * |
| 369 * @param values The values to be placed in the dictionary. |
| 370 * @param keys The keys under which to store the values. |
| 371 * @param count The number of entries to store in the dictionary. |
| 372 * |
| 373 * @return A newly instanced dictionary with the keys and values in it. |
| 374 **/ |
| 375 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values |
| 376 forKeys:(const uint32_t [])keys |
| 377 count:(NSUInteger)count; |
| 378 |
| 379 /** |
| 380 * Creates and initializes a dictionary with the entries from the given. |
| 381 * dictionary. |
| 382 * |
| 383 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 384 * |
| 385 * @return A newly instanced dictionary with the entries from the given |
| 386 * dictionary in it. |
| 387 **/ |
| 388 + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary
; |
| 389 |
| 390 /** |
| 391 * Creates and initializes a dictionary with the given capacity. |
| 392 * |
| 393 * @param numItems Capacity needed for the dictionary. |
| 394 * |
| 395 * @return A newly instanced dictionary with the given capacity. |
| 396 **/ |
| 397 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 398 |
| 399 /** |
| 400 * Initializes this dictionary, copying the given values and keys. |
| 401 * |
| 402 * @param values The values to be placed in this dictionary. |
| 403 * @param keys The keys under which to store the values. |
| 404 * @param count The number of elements to copy into the dictionary. |
| 405 * |
| 406 * @return A newly initialized dictionary with a copy of the values and keys. |
| 407 **/ |
| 408 - (instancetype)initWithUInt64s:(const uint64_t [])values |
| 409 forKeys:(const uint32_t [])keys |
| 410 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 411 |
| 412 /** |
| 413 * Initializes this dictionary, copying the entries from the given dictionary. |
| 414 * |
| 415 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 416 * |
| 417 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 418 **/ |
| 419 - (instancetype)initWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary; |
| 420 |
| 421 /** |
| 422 * Initializes this dictionary with the requested capacity. |
| 423 * |
| 424 * @param numItems Number of items needed for this dictionary. |
| 425 * |
| 426 * @return A newly initialized dictionary with the requested capacity. |
| 427 **/ |
| 428 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 429 |
| 430 /** |
| 431 * Gets the value for the given key. |
| 432 * |
| 433 * @param value Pointer into which the value will be set, if found. |
| 434 * @param key Key under which the value is stored, if present. |
| 435 * |
| 436 * @return YES if the key was found and the value was copied, NO otherwise. |
| 437 **/ |
| 438 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint32_t)key; |
| 439 |
| 440 /** |
| 441 * Enumerates the keys and values on this dictionary with the given block. |
| 442 * |
| 443 * @param block The block to enumerate with. |
| 444 * **key**: The key for the current entry. |
| 445 * **value**: The value for the current entry |
| 446 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 447 **/ |
| 448 - (void)enumerateKeysAndUInt64sUsingBlock: |
| 449 (void (^)(uint32_t key, uint64_t value, BOOL *stop))block; |
| 450 |
| 451 /** |
| 452 * Adds the keys and values from another dictionary. |
| 453 * |
| 454 * @param otherDictionary Dictionary containing entries to be added to this |
| 455 * dictionary. |
| 456 **/ |
| 457 - (void)addEntriesFromDictionary:(GPBUInt32UInt64Dictionary *)otherDictionary; |
| 458 |
| 459 /** |
| 460 * Sets the value for the given key. |
| 461 * |
| 462 * @param value The value to set. |
| 463 * @param key The key under which to store the value. |
| 464 **/ |
| 465 - (void)setUInt64:(uint64_t)value forKey:(uint32_t)key; |
| 466 |
| 467 /** |
| 468 * Removes the entry for the given key. |
| 469 * |
| 470 * @param aKey Key to be removed from this dictionary. |
| 471 **/ |
| 472 - (void)removeUInt64ForKey:(uint32_t)aKey; |
| 473 |
| 474 /** |
| 475 * Removes all entries in this dictionary. |
| 476 **/ |
| 477 - (void)removeAll; |
| 478 |
| 479 @end |
| 480 |
| 481 #pragma mark - UInt32 -> Int64 |
| 482 |
| 483 /** |
| 484 * Class used for map fields of <uint32_t, int64_t> |
| 485 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 486 * |
| 487 * @note This class is not meant to be subclassed. |
| 488 **/ |
| 489 @interface GPBUInt32Int64Dictionary : NSObject <NSCopying> |
| 490 |
| 491 /** Number of entries stored in this dictionary. */ |
| 492 @property(nonatomic, readonly) NSUInteger count; |
| 493 |
| 494 /** |
| 495 * @return A newly instanced and empty dictionary. |
| 496 **/ |
| 497 + (instancetype)dictionary; |
| 498 |
| 499 /** |
| 500 * Creates and initializes a dictionary with the single entry given. |
| 501 * |
| 502 * @param value The value to be placed in the dictionary. |
| 503 * @param key The key under which to store the value. |
| 504 * |
| 505 * @return A newly instanced dictionary with the key and value in it. |
| 506 **/ |
| 507 + (instancetype)dictionaryWithInt64:(int64_t)value |
88 forKey:(uint32_t)key; | 508 forKey:(uint32_t)key; |
89 + (instancetype)dictionaryWithValues:(const int32_t [])values | 509 |
| 510 /** |
| 511 * Creates and initializes a dictionary with the entries given. |
| 512 * |
| 513 * @param values The values to be placed in the dictionary. |
| 514 * @param keys The keys under which to store the values. |
| 515 * @param count The number of entries to store in the dictionary. |
| 516 * |
| 517 * @return A newly instanced dictionary with the keys and values in it. |
| 518 **/ |
| 519 + (instancetype)dictionaryWithInt64s:(const int64_t [])values |
90 forKeys:(const uint32_t [])keys | 520 forKeys:(const uint32_t [])keys |
91 count:(NSUInteger)count; | 521 count:(NSUInteger)count; |
92 + (instancetype)dictionaryWithDictionary:(GPBUInt32Int32Dictionary *)dictionary; | 522 |
| 523 /** |
| 524 * Creates and initializes a dictionary with the entries from the given. |
| 525 * dictionary. |
| 526 * |
| 527 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 528 * |
| 529 * @return A newly instanced dictionary with the entries from the given |
| 530 * dictionary in it. |
| 531 **/ |
| 532 + (instancetype)dictionaryWithDictionary:(GPBUInt32Int64Dictionary *)dictionary; |
| 533 |
| 534 /** |
| 535 * Creates and initializes a dictionary with the given capacity. |
| 536 * |
| 537 * @param numItems Capacity needed for the dictionary. |
| 538 * |
| 539 * @return A newly instanced dictionary with the given capacity. |
| 540 **/ |
93 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 541 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
94 | 542 |
95 - (instancetype)initWithValues:(const int32_t [])values | 543 /** |
| 544 * Initializes this dictionary, copying the given values and keys. |
| 545 * |
| 546 * @param values The values to be placed in this dictionary. |
| 547 * @param keys The keys under which to store the values. |
| 548 * @param count The number of elements to copy into the dictionary. |
| 549 * |
| 550 * @return A newly initialized dictionary with a copy of the values and keys. |
| 551 **/ |
| 552 - (instancetype)initWithInt64s:(const int64_t [])values |
96 forKeys:(const uint32_t [])keys | 553 forKeys:(const uint32_t [])keys |
97 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 554 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
98 - (instancetype)initWithDictionary:(GPBUInt32Int32Dictionary *)dictionary; | 555 |
| 556 /** |
| 557 * Initializes this dictionary, copying the entries from the given dictionary. |
| 558 * |
| 559 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 560 * |
| 561 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 562 **/ |
| 563 - (instancetype)initWithDictionary:(GPBUInt32Int64Dictionary *)dictionary; |
| 564 |
| 565 /** |
| 566 * Initializes this dictionary with the requested capacity. |
| 567 * |
| 568 * @param numItems Number of items needed for this dictionary. |
| 569 * |
| 570 * @return A newly initialized dictionary with the requested capacity. |
| 571 **/ |
99 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 572 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
100 | 573 |
101 - (BOOL)valueForKey:(uint32_t)key value:(nullable int32_t *)value; | 574 /** |
102 | 575 * Gets the value for the given key. |
103 - (void)enumerateKeysAndValuesUsingBlock: | 576 * |
104 (void (^)(uint32_t key, int32_t value, BOOL *stop))block; | 577 * @param value Pointer into which the value will be set, if found. |
105 | 578 * @param key Key under which the value is stored, if present. |
106 - (void)addEntriesFromDictionary:(GPBUInt32Int32Dictionary *)otherDictionary; | 579 * |
107 | 580 * @return YES if the key was found and the value was copied, NO otherwise. |
108 - (void)setValue:(int32_t)value forKey:(uint32_t)key; | 581 **/ |
109 | 582 - (BOOL)getInt64:(nullable int64_t *)value forKey:(uint32_t)key; |
110 - (void)removeValueForKey:(uint32_t)aKey; | 583 |
| 584 /** |
| 585 * Enumerates the keys and values on this dictionary with the given block. |
| 586 * |
| 587 * @param block The block to enumerate with. |
| 588 * **key**: The key for the current entry. |
| 589 * **value**: The value for the current entry |
| 590 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 591 **/ |
| 592 - (void)enumerateKeysAndInt64sUsingBlock: |
| 593 (void (^)(uint32_t key, int64_t value, BOOL *stop))block; |
| 594 |
| 595 /** |
| 596 * Adds the keys and values from another dictionary. |
| 597 * |
| 598 * @param otherDictionary Dictionary containing entries to be added to this |
| 599 * dictionary. |
| 600 **/ |
| 601 - (void)addEntriesFromDictionary:(GPBUInt32Int64Dictionary *)otherDictionary; |
| 602 |
| 603 /** |
| 604 * Sets the value for the given key. |
| 605 * |
| 606 * @param value The value to set. |
| 607 * @param key The key under which to store the value. |
| 608 **/ |
| 609 - (void)setInt64:(int64_t)value forKey:(uint32_t)key; |
| 610 |
| 611 /** |
| 612 * Removes the entry for the given key. |
| 613 * |
| 614 * @param aKey Key to be removed from this dictionary. |
| 615 **/ |
| 616 - (void)removeInt64ForKey:(uint32_t)aKey; |
| 617 |
| 618 /** |
| 619 * Removes all entries in this dictionary. |
| 620 **/ |
111 - (void)removeAll; | 621 - (void)removeAll; |
112 | 622 |
113 @end | 623 @end |
114 | 624 |
115 #pragma mark - UInt32 -> UInt64 | 625 #pragma mark - UInt32 -> Bool |
116 | 626 |
117 @interface GPBUInt32UInt64Dictionary : NSObject <NSCopying> | 627 /** |
118 | 628 * Class used for map fields of <uint32_t, BOOL> |
| 629 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 630 * |
| 631 * @note This class is not meant to be subclassed. |
| 632 **/ |
| 633 @interface GPBUInt32BoolDictionary : NSObject <NSCopying> |
| 634 |
| 635 /** Number of entries stored in this dictionary. */ |
119 @property(nonatomic, readonly) NSUInteger count; | 636 @property(nonatomic, readonly) NSUInteger count; |
120 | 637 |
| 638 /** |
| 639 * @return A newly instanced and empty dictionary. |
| 640 **/ |
121 + (instancetype)dictionary; | 641 + (instancetype)dictionary; |
122 + (instancetype)dictionaryWithValue:(uint64_t)value | 642 |
| 643 /** |
| 644 * Creates and initializes a dictionary with the single entry given. |
| 645 * |
| 646 * @param value The value to be placed in the dictionary. |
| 647 * @param key The key under which to store the value. |
| 648 * |
| 649 * @return A newly instanced dictionary with the key and value in it. |
| 650 **/ |
| 651 + (instancetype)dictionaryWithBool:(BOOL)value |
| 652 forKey:(uint32_t)key; |
| 653 |
| 654 /** |
| 655 * Creates and initializes a dictionary with the entries given. |
| 656 * |
| 657 * @param values The values to be placed in the dictionary. |
| 658 * @param keys The keys under which to store the values. |
| 659 * @param count The number of entries to store in the dictionary. |
| 660 * |
| 661 * @return A newly instanced dictionary with the keys and values in it. |
| 662 **/ |
| 663 + (instancetype)dictionaryWithBools:(const BOOL [])values |
| 664 forKeys:(const uint32_t [])keys |
| 665 count:(NSUInteger)count; |
| 666 |
| 667 /** |
| 668 * Creates and initializes a dictionary with the entries from the given. |
| 669 * dictionary. |
| 670 * |
| 671 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 672 * |
| 673 * @return A newly instanced dictionary with the entries from the given |
| 674 * dictionary in it. |
| 675 **/ |
| 676 + (instancetype)dictionaryWithDictionary:(GPBUInt32BoolDictionary *)dictionary; |
| 677 |
| 678 /** |
| 679 * Creates and initializes a dictionary with the given capacity. |
| 680 * |
| 681 * @param numItems Capacity needed for the dictionary. |
| 682 * |
| 683 * @return A newly instanced dictionary with the given capacity. |
| 684 **/ |
| 685 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 686 |
| 687 /** |
| 688 * Initializes this dictionary, copying the given values and keys. |
| 689 * |
| 690 * @param values The values to be placed in this dictionary. |
| 691 * @param keys The keys under which to store the values. |
| 692 * @param count The number of elements to copy into the dictionary. |
| 693 * |
| 694 * @return A newly initialized dictionary with a copy of the values and keys. |
| 695 **/ |
| 696 - (instancetype)initWithBools:(const BOOL [])values |
| 697 forKeys:(const uint32_t [])keys |
| 698 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 699 |
| 700 /** |
| 701 * Initializes this dictionary, copying the entries from the given dictionary. |
| 702 * |
| 703 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 704 * |
| 705 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 706 **/ |
| 707 - (instancetype)initWithDictionary:(GPBUInt32BoolDictionary *)dictionary; |
| 708 |
| 709 /** |
| 710 * Initializes this dictionary with the requested capacity. |
| 711 * |
| 712 * @param numItems Number of items needed for this dictionary. |
| 713 * |
| 714 * @return A newly initialized dictionary with the requested capacity. |
| 715 **/ |
| 716 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 717 |
| 718 /** |
| 719 * Gets the value for the given key. |
| 720 * |
| 721 * @param value Pointer into which the value will be set, if found. |
| 722 * @param key Key under which the value is stored, if present. |
| 723 * |
| 724 * @return YES if the key was found and the value was copied, NO otherwise. |
| 725 **/ |
| 726 - (BOOL)getBool:(nullable BOOL *)value forKey:(uint32_t)key; |
| 727 |
| 728 /** |
| 729 * Enumerates the keys and values on this dictionary with the given block. |
| 730 * |
| 731 * @param block The block to enumerate with. |
| 732 * **key**: The key for the current entry. |
| 733 * **value**: The value for the current entry |
| 734 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 735 **/ |
| 736 - (void)enumerateKeysAndBoolsUsingBlock: |
| 737 (void (^)(uint32_t key, BOOL value, BOOL *stop))block; |
| 738 |
| 739 /** |
| 740 * Adds the keys and values from another dictionary. |
| 741 * |
| 742 * @param otherDictionary Dictionary containing entries to be added to this |
| 743 * dictionary. |
| 744 **/ |
| 745 - (void)addEntriesFromDictionary:(GPBUInt32BoolDictionary *)otherDictionary; |
| 746 |
| 747 /** |
| 748 * Sets the value for the given key. |
| 749 * |
| 750 * @param value The value to set. |
| 751 * @param key The key under which to store the value. |
| 752 **/ |
| 753 - (void)setBool:(BOOL)value forKey:(uint32_t)key; |
| 754 |
| 755 /** |
| 756 * Removes the entry for the given key. |
| 757 * |
| 758 * @param aKey Key to be removed from this dictionary. |
| 759 **/ |
| 760 - (void)removeBoolForKey:(uint32_t)aKey; |
| 761 |
| 762 /** |
| 763 * Removes all entries in this dictionary. |
| 764 **/ |
| 765 - (void)removeAll; |
| 766 |
| 767 @end |
| 768 |
| 769 #pragma mark - UInt32 -> Float |
| 770 |
| 771 /** |
| 772 * Class used for map fields of <uint32_t, float> |
| 773 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 774 * |
| 775 * @note This class is not meant to be subclassed. |
| 776 **/ |
| 777 @interface GPBUInt32FloatDictionary : NSObject <NSCopying> |
| 778 |
| 779 /** Number of entries stored in this dictionary. */ |
| 780 @property(nonatomic, readonly) NSUInteger count; |
| 781 |
| 782 /** |
| 783 * @return A newly instanced and empty dictionary. |
| 784 **/ |
| 785 + (instancetype)dictionary; |
| 786 |
| 787 /** |
| 788 * Creates and initializes a dictionary with the single entry given. |
| 789 * |
| 790 * @param value The value to be placed in the dictionary. |
| 791 * @param key The key under which to store the value. |
| 792 * |
| 793 * @return A newly instanced dictionary with the key and value in it. |
| 794 **/ |
| 795 + (instancetype)dictionaryWithFloat:(float)value |
123 forKey:(uint32_t)key; | 796 forKey:(uint32_t)key; |
124 + (instancetype)dictionaryWithValues:(const uint64_t [])values | 797 |
| 798 /** |
| 799 * Creates and initializes a dictionary with the entries given. |
| 800 * |
| 801 * @param values The values to be placed in the dictionary. |
| 802 * @param keys The keys under which to store the values. |
| 803 * @param count The number of entries to store in the dictionary. |
| 804 * |
| 805 * @return A newly instanced dictionary with the keys and values in it. |
| 806 **/ |
| 807 + (instancetype)dictionaryWithFloats:(const float [])values |
125 forKeys:(const uint32_t [])keys | 808 forKeys:(const uint32_t [])keys |
126 count:(NSUInteger)count; | 809 count:(NSUInteger)count; |
127 + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary
; | 810 |
| 811 /** |
| 812 * Creates and initializes a dictionary with the entries from the given. |
| 813 * dictionary. |
| 814 * |
| 815 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 816 * |
| 817 * @return A newly instanced dictionary with the entries from the given |
| 818 * dictionary in it. |
| 819 **/ |
| 820 + (instancetype)dictionaryWithDictionary:(GPBUInt32FloatDictionary *)dictionary; |
| 821 |
| 822 /** |
| 823 * Creates and initializes a dictionary with the given capacity. |
| 824 * |
| 825 * @param numItems Capacity needed for the dictionary. |
| 826 * |
| 827 * @return A newly instanced dictionary with the given capacity. |
| 828 **/ |
128 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 829 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
129 | 830 |
130 - (instancetype)initWithValues:(const uint64_t [])values | 831 /** |
| 832 * Initializes this dictionary, copying the given values and keys. |
| 833 * |
| 834 * @param values The values to be placed in this dictionary. |
| 835 * @param keys The keys under which to store the values. |
| 836 * @param count The number of elements to copy into the dictionary. |
| 837 * |
| 838 * @return A newly initialized dictionary with a copy of the values and keys. |
| 839 **/ |
| 840 - (instancetype)initWithFloats:(const float [])values |
131 forKeys:(const uint32_t [])keys | 841 forKeys:(const uint32_t [])keys |
132 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 842 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
133 - (instancetype)initWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary; | 843 |
| 844 /** |
| 845 * Initializes this dictionary, copying the entries from the given dictionary. |
| 846 * |
| 847 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 848 * |
| 849 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 850 **/ |
| 851 - (instancetype)initWithDictionary:(GPBUInt32FloatDictionary *)dictionary; |
| 852 |
| 853 /** |
| 854 * Initializes this dictionary with the requested capacity. |
| 855 * |
| 856 * @param numItems Number of items needed for this dictionary. |
| 857 * |
| 858 * @return A newly initialized dictionary with the requested capacity. |
| 859 **/ |
134 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 860 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
135 | 861 |
136 - (BOOL)valueForKey:(uint32_t)key value:(nullable uint64_t *)value; | 862 /** |
137 | 863 * Gets the value for the given key. |
138 - (void)enumerateKeysAndValuesUsingBlock: | 864 * |
139 (void (^)(uint32_t key, uint64_t value, BOOL *stop))block; | 865 * @param value Pointer into which the value will be set, if found. |
140 | 866 * @param key Key under which the value is stored, if present. |
141 - (void)addEntriesFromDictionary:(GPBUInt32UInt64Dictionary *)otherDictionary; | 867 * |
142 | 868 * @return YES if the key was found and the value was copied, NO otherwise. |
143 - (void)setValue:(uint64_t)value forKey:(uint32_t)key; | 869 **/ |
144 | 870 - (BOOL)getFloat:(nullable float *)value forKey:(uint32_t)key; |
145 - (void)removeValueForKey:(uint32_t)aKey; | 871 |
| 872 /** |
| 873 * Enumerates the keys and values on this dictionary with the given block. |
| 874 * |
| 875 * @param block The block to enumerate with. |
| 876 * **key**: The key for the current entry. |
| 877 * **value**: The value for the current entry |
| 878 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 879 **/ |
| 880 - (void)enumerateKeysAndFloatsUsingBlock: |
| 881 (void (^)(uint32_t key, float value, BOOL *stop))block; |
| 882 |
| 883 /** |
| 884 * Adds the keys and values from another dictionary. |
| 885 * |
| 886 * @param otherDictionary Dictionary containing entries to be added to this |
| 887 * dictionary. |
| 888 **/ |
| 889 - (void)addEntriesFromDictionary:(GPBUInt32FloatDictionary *)otherDictionary; |
| 890 |
| 891 /** |
| 892 * Sets the value for the given key. |
| 893 * |
| 894 * @param value The value to set. |
| 895 * @param key The key under which to store the value. |
| 896 **/ |
| 897 - (void)setFloat:(float)value forKey:(uint32_t)key; |
| 898 |
| 899 /** |
| 900 * Removes the entry for the given key. |
| 901 * |
| 902 * @param aKey Key to be removed from this dictionary. |
| 903 **/ |
| 904 - (void)removeFloatForKey:(uint32_t)aKey; |
| 905 |
| 906 /** |
| 907 * Removes all entries in this dictionary. |
| 908 **/ |
146 - (void)removeAll; | 909 - (void)removeAll; |
147 | 910 |
148 @end | 911 @end |
149 | 912 |
150 #pragma mark - UInt32 -> Int64 | 913 #pragma mark - UInt32 -> Double |
151 | 914 |
152 @interface GPBUInt32Int64Dictionary : NSObject <NSCopying> | 915 /** |
153 | 916 * Class used for map fields of <uint32_t, double> |
| 917 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 918 * |
| 919 * @note This class is not meant to be subclassed. |
| 920 **/ |
| 921 @interface GPBUInt32DoubleDictionary : NSObject <NSCopying> |
| 922 |
| 923 /** Number of entries stored in this dictionary. */ |
154 @property(nonatomic, readonly) NSUInteger count; | 924 @property(nonatomic, readonly) NSUInteger count; |
155 | 925 |
| 926 /** |
| 927 * @return A newly instanced and empty dictionary. |
| 928 **/ |
156 + (instancetype)dictionary; | 929 + (instancetype)dictionary; |
157 + (instancetype)dictionaryWithValue:(int64_t)value | 930 |
158 forKey:(uint32_t)key; | 931 /** |
159 + (instancetype)dictionaryWithValues:(const int64_t [])values | 932 * Creates and initializes a dictionary with the single entry given. |
160 forKeys:(const uint32_t [])keys | 933 * |
161 count:(NSUInteger)count; | 934 * @param value The value to be placed in the dictionary. |
162 + (instancetype)dictionaryWithDictionary:(GPBUInt32Int64Dictionary *)dictionary; | 935 * @param key The key under which to store the value. |
| 936 * |
| 937 * @return A newly instanced dictionary with the key and value in it. |
| 938 **/ |
| 939 + (instancetype)dictionaryWithDouble:(double)value |
| 940 forKey:(uint32_t)key; |
| 941 |
| 942 /** |
| 943 * Creates and initializes a dictionary with the entries given. |
| 944 * |
| 945 * @param values The values to be placed in the dictionary. |
| 946 * @param keys The keys under which to store the values. |
| 947 * @param count The number of entries to store in the dictionary. |
| 948 * |
| 949 * @return A newly instanced dictionary with the keys and values in it. |
| 950 **/ |
| 951 + (instancetype)dictionaryWithDoubles:(const double [])values |
| 952 forKeys:(const uint32_t [])keys |
| 953 count:(NSUInteger)count; |
| 954 |
| 955 /** |
| 956 * Creates and initializes a dictionary with the entries from the given. |
| 957 * dictionary. |
| 958 * |
| 959 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 960 * |
| 961 * @return A newly instanced dictionary with the entries from the given |
| 962 * dictionary in it. |
| 963 **/ |
| 964 + (instancetype)dictionaryWithDictionary:(GPBUInt32DoubleDictionary *)dictionary
; |
| 965 |
| 966 /** |
| 967 * Creates and initializes a dictionary with the given capacity. |
| 968 * |
| 969 * @param numItems Capacity needed for the dictionary. |
| 970 * |
| 971 * @return A newly instanced dictionary with the given capacity. |
| 972 **/ |
163 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 973 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
164 | 974 |
165 - (instancetype)initWithValues:(const int64_t [])values | 975 /** |
166 forKeys:(const uint32_t [])keys | 976 * Initializes this dictionary, copying the given values and keys. |
167 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 977 * |
168 - (instancetype)initWithDictionary:(GPBUInt32Int64Dictionary *)dictionary; | 978 * @param values The values to be placed in this dictionary. |
| 979 * @param keys The keys under which to store the values. |
| 980 * @param count The number of elements to copy into the dictionary. |
| 981 * |
| 982 * @return A newly initialized dictionary with a copy of the values and keys. |
| 983 **/ |
| 984 - (instancetype)initWithDoubles:(const double [])values |
| 985 forKeys:(const uint32_t [])keys |
| 986 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 987 |
| 988 /** |
| 989 * Initializes this dictionary, copying the entries from the given dictionary. |
| 990 * |
| 991 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 992 * |
| 993 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 994 **/ |
| 995 - (instancetype)initWithDictionary:(GPBUInt32DoubleDictionary *)dictionary; |
| 996 |
| 997 /** |
| 998 * Initializes this dictionary with the requested capacity. |
| 999 * |
| 1000 * @param numItems Number of items needed for this dictionary. |
| 1001 * |
| 1002 * @return A newly initialized dictionary with the requested capacity. |
| 1003 **/ |
169 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 1004 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
170 | 1005 |
171 - (BOOL)valueForKey:(uint32_t)key value:(nullable int64_t *)value; | 1006 /** |
172 | 1007 * Gets the value for the given key. |
173 - (void)enumerateKeysAndValuesUsingBlock: | 1008 * |
174 (void (^)(uint32_t key, int64_t value, BOOL *stop))block; | 1009 * @param value Pointer into which the value will be set, if found. |
175 | 1010 * @param key Key under which the value is stored, if present. |
176 - (void)addEntriesFromDictionary:(GPBUInt32Int64Dictionary *)otherDictionary; | 1011 * |
177 | 1012 * @return YES if the key was found and the value was copied, NO otherwise. |
178 - (void)setValue:(int64_t)value forKey:(uint32_t)key; | 1013 **/ |
179 | 1014 - (BOOL)getDouble:(nullable double *)value forKey:(uint32_t)key; |
180 - (void)removeValueForKey:(uint32_t)aKey; | 1015 |
| 1016 /** |
| 1017 * Enumerates the keys and values on this dictionary with the given block. |
| 1018 * |
| 1019 * @param block The block to enumerate with. |
| 1020 * **key**: The key for the current entry. |
| 1021 * **value**: The value for the current entry |
| 1022 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 1023 **/ |
| 1024 - (void)enumerateKeysAndDoublesUsingBlock: |
| 1025 (void (^)(uint32_t key, double value, BOOL *stop))block; |
| 1026 |
| 1027 /** |
| 1028 * Adds the keys and values from another dictionary. |
| 1029 * |
| 1030 * @param otherDictionary Dictionary containing entries to be added to this |
| 1031 * dictionary. |
| 1032 **/ |
| 1033 - (void)addEntriesFromDictionary:(GPBUInt32DoubleDictionary *)otherDictionary; |
| 1034 |
| 1035 /** |
| 1036 * Sets the value for the given key. |
| 1037 * |
| 1038 * @param value The value to set. |
| 1039 * @param key The key under which to store the value. |
| 1040 **/ |
| 1041 - (void)setDouble:(double)value forKey:(uint32_t)key; |
| 1042 |
| 1043 /** |
| 1044 * Removes the entry for the given key. |
| 1045 * |
| 1046 * @param aKey Key to be removed from this dictionary. |
| 1047 **/ |
| 1048 - (void)removeDoubleForKey:(uint32_t)aKey; |
| 1049 |
| 1050 /** |
| 1051 * Removes all entries in this dictionary. |
| 1052 **/ |
181 - (void)removeAll; | 1053 - (void)removeAll; |
182 | 1054 |
183 @end | 1055 @end |
184 | 1056 |
185 #pragma mark - UInt32 -> Bool | 1057 #pragma mark - UInt32 -> Enum |
186 | 1058 |
187 @interface GPBUInt32BoolDictionary : NSObject <NSCopying> | 1059 /** |
188 | 1060 * Class used for map fields of <uint32_t, int32_t> |
| 1061 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 1062 * |
| 1063 * @note This class is not meant to be subclassed. |
| 1064 **/ |
| 1065 @interface GPBUInt32EnumDictionary : NSObject <NSCopying> |
| 1066 |
| 1067 /** Number of entries stored in this dictionary. */ |
189 @property(nonatomic, readonly) NSUInteger count; | 1068 @property(nonatomic, readonly) NSUInteger count; |
190 | 1069 /** The validation function to check if the enums are valid. */ |
| 1070 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; |
| 1071 |
| 1072 /** |
| 1073 * @return A newly instanced and empty dictionary. |
| 1074 **/ |
191 + (instancetype)dictionary; | 1075 + (instancetype)dictionary; |
192 + (instancetype)dictionaryWithValue:(BOOL)value | 1076 |
193 forKey:(uint32_t)key; | 1077 /** |
194 + (instancetype)dictionaryWithValues:(const BOOL [])values | 1078 * Creates and initializes a dictionary with the given validation function. |
195 forKeys:(const uint32_t [])keys | 1079 * |
196 count:(NSUInteger)count; | 1080 * @param func The enum validation function for the dictionary. |
197 + (instancetype)dictionaryWithDictionary:(GPBUInt32BoolDictionary *)dictionary; | 1081 * |
198 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 1082 * @return A newly instanced dictionary. |
199 | 1083 **/ |
200 - (instancetype)initWithValues:(const BOOL [])values | |
201 forKeys:(const uint32_t [])keys | |
202 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
203 - (instancetype)initWithDictionary:(GPBUInt32BoolDictionary *)dictionary; | |
204 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
205 | |
206 - (BOOL)valueForKey:(uint32_t)key value:(nullable BOOL *)value; | |
207 | |
208 - (void)enumerateKeysAndValuesUsingBlock: | |
209 (void (^)(uint32_t key, BOOL value, BOOL *stop))block; | |
210 | |
211 - (void)addEntriesFromDictionary:(GPBUInt32BoolDictionary *)otherDictionary; | |
212 | |
213 - (void)setValue:(BOOL)value forKey:(uint32_t)key; | |
214 | |
215 - (void)removeValueForKey:(uint32_t)aKey; | |
216 - (void)removeAll; | |
217 | |
218 @end | |
219 | |
220 #pragma mark - UInt32 -> Float | |
221 | |
222 @interface GPBUInt32FloatDictionary : NSObject <NSCopying> | |
223 | |
224 @property(nonatomic, readonly) NSUInteger count; | |
225 | |
226 + (instancetype)dictionary; | |
227 + (instancetype)dictionaryWithValue:(float)value | |
228 forKey:(uint32_t)key; | |
229 + (instancetype)dictionaryWithValues:(const float [])values | |
230 forKeys:(const uint32_t [])keys | |
231 count:(NSUInteger)count; | |
232 + (instancetype)dictionaryWithDictionary:(GPBUInt32FloatDictionary *)dictionary; | |
233 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | |
234 | |
235 - (instancetype)initWithValues:(const float [])values | |
236 forKeys:(const uint32_t [])keys | |
237 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
238 - (instancetype)initWithDictionary:(GPBUInt32FloatDictionary *)dictionary; | |
239 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
240 | |
241 - (BOOL)valueForKey:(uint32_t)key value:(nullable float *)value; | |
242 | |
243 - (void)enumerateKeysAndValuesUsingBlock: | |
244 (void (^)(uint32_t key, float value, BOOL *stop))block; | |
245 | |
246 - (void)addEntriesFromDictionary:(GPBUInt32FloatDictionary *)otherDictionary; | |
247 | |
248 - (void)setValue:(float)value forKey:(uint32_t)key; | |
249 | |
250 - (void)removeValueForKey:(uint32_t)aKey; | |
251 - (void)removeAll; | |
252 | |
253 @end | |
254 | |
255 #pragma mark - UInt32 -> Double | |
256 | |
257 @interface GPBUInt32DoubleDictionary : NSObject <NSCopying> | |
258 | |
259 @property(nonatomic, readonly) NSUInteger count; | |
260 | |
261 + (instancetype)dictionary; | |
262 + (instancetype)dictionaryWithValue:(double)value | |
263 forKey:(uint32_t)key; | |
264 + (instancetype)dictionaryWithValues:(const double [])values | |
265 forKeys:(const uint32_t [])keys | |
266 count:(NSUInteger)count; | |
267 + (instancetype)dictionaryWithDictionary:(GPBUInt32DoubleDictionary *)dictionary
; | |
268 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | |
269 | |
270 - (instancetype)initWithValues:(const double [])values | |
271 forKeys:(const uint32_t [])keys | |
272 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
273 - (instancetype)initWithDictionary:(GPBUInt32DoubleDictionary *)dictionary; | |
274 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
275 | |
276 - (BOOL)valueForKey:(uint32_t)key value:(nullable double *)value; | |
277 | |
278 - (void)enumerateKeysAndValuesUsingBlock: | |
279 (void (^)(uint32_t key, double value, BOOL *stop))block; | |
280 | |
281 - (void)addEntriesFromDictionary:(GPBUInt32DoubleDictionary *)otherDictionary; | |
282 | |
283 - (void)setValue:(double)value forKey:(uint32_t)key; | |
284 | |
285 - (void)removeValueForKey:(uint32_t)aKey; | |
286 - (void)removeAll; | |
287 | |
288 @end | |
289 | |
290 #pragma mark - UInt32 -> Enum | |
291 | |
292 @interface GPBUInt32EnumDictionary : NSObject <NSCopying> | |
293 | |
294 @property(nonatomic, readonly) NSUInteger count; | |
295 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; | |
296 | |
297 + (instancetype)dictionary; | |
298 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func; | 1084 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func; |
| 1085 |
| 1086 /** |
| 1087 * Creates and initializes a dictionary with the single entry given. |
| 1088 * |
| 1089 * @param func The enum validation function for the dictionary. |
| 1090 * @param rawValue The raw enum value to be placed in the dictionary. |
| 1091 * @param key The key under which to store the value. |
| 1092 * |
| 1093 * @return A newly instanced dictionary with the key and value in it. |
| 1094 **/ |
299 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 1095 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
300 rawValue:(int32_t)rawValue | 1096 rawValue:(int32_t)rawValue |
301 forKey:(uint32_t)key; | 1097 forKey:(uint32_t)key; |
| 1098 |
| 1099 /** |
| 1100 * Creates and initializes a dictionary with the entries given. |
| 1101 * |
| 1102 * @param func The enum validation function for the dictionary. |
| 1103 * @param values The raw enum values values to be placed in the dictionary. |
| 1104 * @param keys The keys under which to store the values. |
| 1105 * @param count The number of entries to store in the dictionary. |
| 1106 * |
| 1107 * @return A newly instanced dictionary with the keys and values in it. |
| 1108 **/ |
302 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 1109 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
303 rawValues:(const int32_t [])values | 1110 rawValues:(const int32_t [])values |
304 forKeys:(const uint32_t [])keys | 1111 forKeys:(const uint32_t [])keys |
305 count:(NSUInteger)count; | 1112 count:(NSUInteger)count; |
| 1113 |
| 1114 /** |
| 1115 * Creates and initializes a dictionary with the entries from the given. |
| 1116 * dictionary. |
| 1117 * |
| 1118 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 1119 * |
| 1120 * @return A newly instanced dictionary with the entries from the given |
| 1121 * dictionary in it. |
| 1122 **/ |
306 + (instancetype)dictionaryWithDictionary:(GPBUInt32EnumDictionary *)dictionary; | 1123 + (instancetype)dictionaryWithDictionary:(GPBUInt32EnumDictionary *)dictionary; |
| 1124 |
| 1125 /** |
| 1126 * Creates and initializes a dictionary with the given capacity. |
| 1127 * |
| 1128 * @param func The enum validation function for the dictionary. |
| 1129 * @param numItems Capacity needed for the dictionary. |
| 1130 * |
| 1131 * @return A newly instanced dictionary with the given capacity. |
| 1132 **/ |
307 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 1133 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
308 capacity:(NSUInteger)numItems; | 1134 capacity:(NSUInteger)numItems; |
309 | 1135 |
| 1136 /** |
| 1137 * Initializes a dictionary with the given validation function. |
| 1138 * |
| 1139 * @param func The enum validation function for the dictionary. |
| 1140 * |
| 1141 * @return A newly initialized dictionary. |
| 1142 **/ |
310 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; | 1143 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; |
| 1144 |
| 1145 /** |
| 1146 * Initializes a dictionary with the entries given. |
| 1147 * |
| 1148 * @param func The enum validation function for the dictionary. |
| 1149 * @param values The raw enum values values to be placed in the dictionary. |
| 1150 * @param keys The keys under which to store the values. |
| 1151 * @param count The number of entries to store in the dictionary. |
| 1152 * |
| 1153 * @return A newly initialized dictionary with the keys and values in it. |
| 1154 **/ |
311 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func | 1155 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func |
312 rawValues:(const int32_t [])values | 1156 rawValues:(const int32_t [])values |
313 forKeys:(const uint32_t [])keys | 1157 forKeys:(const uint32_t [])keys |
314 count:(NSUInteger)count NS_DESIGNATED_INITI
ALIZER; | 1158 count:(NSUInteger)count NS_DESIGNATED_INITI
ALIZER; |
| 1159 |
| 1160 /** |
| 1161 * Initializes a dictionary with the entries from the given. |
| 1162 * dictionary. |
| 1163 * |
| 1164 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 1165 * |
| 1166 * @return A newly initialized dictionary with the entries from the given |
| 1167 * dictionary in it. |
| 1168 **/ |
315 - (instancetype)initWithDictionary:(GPBUInt32EnumDictionary *)dictionary; | 1169 - (instancetype)initWithDictionary:(GPBUInt32EnumDictionary *)dictionary; |
| 1170 |
| 1171 /** |
| 1172 * Initializes a dictionary with the given capacity. |
| 1173 * |
| 1174 * @param func The enum validation function for the dictionary. |
| 1175 * @param numItems Capacity needed for the dictionary. |
| 1176 * |
| 1177 * @return A newly initialized dictionary with the given capacity. |
| 1178 **/ |
316 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func | 1179 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func |
317 capacity:(NSUInteger)numItems; | 1180 capacity:(NSUInteger)numItems; |
318 | 1181 |
319 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key | 1182 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key |
320 // is not a valid enumerator as defined by validationFunc. If the actual value i
s | 1183 // is not a valid enumerator as defined by validationFunc. If the actual value i
s |
321 // desired, use "raw" version of the method. | 1184 // desired, use "raw" version of the method. |
322 | 1185 |
323 - (BOOL)valueForKey:(uint32_t)key value:(nullable int32_t *)value; | 1186 /** |
| 1187 * Gets the value for the given key. |
| 1188 * |
| 1189 * @param value Pointer into which the value will be set, if found. |
| 1190 * @param key Key under which the value is stored, if present. |
| 1191 * |
| 1192 * @return YES if the key was found and the value was copied, NO otherwise. |
| 1193 **/ |
| 1194 - (BOOL)getEnum:(nullable int32_t *)value forKey:(uint32_t)key; |
324 | 1195 |
325 - (void)enumerateKeysAndValuesUsingBlock: | 1196 /** |
| 1197 * Enumerates the keys and values on this dictionary with the given block. |
| 1198 * |
| 1199 * @param block The block to enumerate with. |
| 1200 * **key**: The key for the current entry. |
| 1201 * **value**: The value for the current entry |
| 1202 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 1203 **/ |
| 1204 - (void)enumerateKeysAndEnumsUsingBlock: |
326 (void (^)(uint32_t key, int32_t value, BOOL *stop))block; | 1205 (void (^)(uint32_t key, int32_t value, BOOL *stop))block; |
327 | 1206 |
328 // These methods bypass the validationFunc to provide access to values that were
not | 1207 /** |
329 // known at the time the binary was compiled. | 1208 * Gets the raw enum value for the given key. |
| 1209 * |
| 1210 * @note This method bypass the validationFunc to enable the access of values th
at |
| 1211 * were not known at the time the binary was compiled. |
| 1212 * |
| 1213 * @param rawValue Pointer into which the value will be set, if found. |
| 1214 * @param key Key under which the value is stored, if present. |
| 1215 * |
| 1216 * @return YES if the key was found and the value was copied, NO otherwise. |
| 1217 **/ |
| 1218 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint32_t)key; |
330 | 1219 |
331 - (BOOL)valueForKey:(uint32_t)key rawValue:(nullable int32_t *)rawValue; | 1220 /** |
332 | 1221 * Enumerates the keys and values on this dictionary with the given block. |
| 1222 * |
| 1223 * @note This method bypass the validationFunc to enable the access of values th
at |
| 1224 * were not known at the time the binary was compiled. |
| 1225 * |
| 1226 * @param block The block to enumerate with. |
| 1227 * **key**: The key for the current entry. |
| 1228 * **rawValue**: The value for the current entry |
| 1229 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 1230 **/ |
333 - (void)enumerateKeysAndRawValuesUsingBlock: | 1231 - (void)enumerateKeysAndRawValuesUsingBlock: |
334 (void (^)(uint32_t key, int32_t rawValue, BOOL *stop))block; | 1232 (void (^)(uint32_t key, int32_t rawValue, BOOL *stop))block; |
335 | 1233 |
| 1234 /** |
| 1235 * Adds the keys and raw enum values from another dictionary. |
| 1236 * |
| 1237 * @note This method bypass the validationFunc to enable the setting of values t
hat |
| 1238 * were not known at the time the binary was compiled. |
| 1239 * |
| 1240 * @param otherDictionary Dictionary containing entries to be added to this |
| 1241 * dictionary. |
| 1242 **/ |
336 - (void)addRawEntriesFromDictionary:(GPBUInt32EnumDictionary *)otherDictionary; | 1243 - (void)addRawEntriesFromDictionary:(GPBUInt32EnumDictionary *)otherDictionary; |
337 | 1244 |
338 // If value is not a valid enumerator as defined by validationFunc, these | 1245 // If value is not a valid enumerator as defined by validationFunc, these |
339 // methods will assert in debug, and will log in release and assign the value | 1246 // methods will assert in debug, and will log in release and assign the value |
340 // to the default value. Use the rawValue methods below to assign non enumerator | 1247 // to the default value. Use the rawValue methods below to assign non enumerator |
341 // values. | 1248 // values. |
342 | 1249 |
343 - (void)setValue:(int32_t)value forKey:(uint32_t)key; | 1250 /** |
344 | 1251 * Sets the value for the given key. |
345 // This method bypass the validationFunc to provide setting of values that were
not | 1252 * |
346 // known at the time the binary was compiled. | 1253 * @param value The value to set. |
| 1254 * @param key The key under which to store the value. |
| 1255 **/ |
| 1256 - (void)setEnum:(int32_t)value forKey:(uint32_t)key; |
| 1257 |
| 1258 /** |
| 1259 * Sets the raw enum value for the given key. |
| 1260 * |
| 1261 * @note This method bypass the validationFunc to enable the setting of values t
hat |
| 1262 * were not known at the time the binary was compiled. |
| 1263 * |
| 1264 * @param rawValue The raw enum value to set. |
| 1265 * @param key The key under which to store the raw enum value. |
| 1266 **/ |
347 - (void)setRawValue:(int32_t)rawValue forKey:(uint32_t)key; | 1267 - (void)setRawValue:(int32_t)rawValue forKey:(uint32_t)key; |
348 | 1268 |
349 // No validation applies to these methods. | 1269 /** |
350 | 1270 * Removes the entry for the given key. |
351 - (void)removeValueForKey:(uint32_t)aKey; | 1271 * |
| 1272 * @param aKey Key to be removed from this dictionary. |
| 1273 **/ |
| 1274 - (void)removeEnumForKey:(uint32_t)aKey; |
| 1275 |
| 1276 /** |
| 1277 * Removes all entries in this dictionary. |
| 1278 **/ |
352 - (void)removeAll; | 1279 - (void)removeAll; |
353 | 1280 |
354 @end | 1281 @end |
355 | 1282 |
356 #pragma mark - UInt32 -> Object | 1283 #pragma mark - UInt32 -> Object |
357 | 1284 |
| 1285 /** |
| 1286 * Class used for map fields of <uint32_t, ObjectType> |
| 1287 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 1288 * |
| 1289 * @note This class is not meant to be subclassed. |
| 1290 **/ |
358 @interface GPBUInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyi
ng> | 1291 @interface GPBUInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyi
ng> |
359 | 1292 |
| 1293 /** Number of entries stored in this dictionary. */ |
360 @property(nonatomic, readonly) NSUInteger count; | 1294 @property(nonatomic, readonly) NSUInteger count; |
361 | 1295 |
| 1296 /** |
| 1297 * @return A newly instanced and empty dictionary. |
| 1298 **/ |
362 + (instancetype)dictionary; | 1299 + (instancetype)dictionary; |
| 1300 |
| 1301 /** |
| 1302 * Creates and initializes a dictionary with the single entry given. |
| 1303 * |
| 1304 * @param object The value to be placed in the dictionary. |
| 1305 * @param key The key under which to store the value. |
| 1306 * |
| 1307 * @return A newly instanced dictionary with the key and value in it. |
| 1308 **/ |
363 + (instancetype)dictionaryWithObject:(ObjectType)object | 1309 + (instancetype)dictionaryWithObject:(ObjectType)object |
364 forKey:(uint32_t)key; | 1310 forKey:(uint32_t)key; |
| 1311 |
| 1312 /** |
| 1313 * Creates and initializes a dictionary with the entries given. |
| 1314 * |
| 1315 * @param objects The values to be placed in the dictionary. |
| 1316 * @param keys The keys under which to store the values. |
| 1317 * @param count The number of entries to store in the dictionary. |
| 1318 * |
| 1319 * @return A newly instanced dictionary with the keys and values in it. |
| 1320 **/ |
365 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED []
)objects | 1321 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED []
)objects |
366 forKeys:(const uint32_t [])keys | 1322 forKeys:(const uint32_t [])keys |
367 count:(NSUInteger)count; | 1323 count:(NSUInteger)count; |
| 1324 |
| 1325 /** |
| 1326 * Creates and initializes a dictionary with the entries from the given. |
| 1327 * dictionary. |
| 1328 * |
| 1329 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 1330 * |
| 1331 * @return A newly instanced dictionary with the entries from the given |
| 1332 * dictionary in it. |
| 1333 **/ |
368 + (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary
; | 1334 + (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary
; |
| 1335 |
| 1336 /** |
| 1337 * Creates and initializes a dictionary with the given capacity. |
| 1338 * |
| 1339 * @param numItems Capacity needed for the dictionary. |
| 1340 * |
| 1341 * @return A newly instanced dictionary with the given capacity. |
| 1342 **/ |
369 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 1343 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
370 | 1344 |
| 1345 /** |
| 1346 * Initializes this dictionary, copying the given values and keys. |
| 1347 * |
| 1348 * @param objects The values to be placed in this dictionary. |
| 1349 * @param keys The keys under which to store the values. |
| 1350 * @param count The number of elements to copy into the dictionary. |
| 1351 * |
| 1352 * @return A newly initialized dictionary with a copy of the values and keys. |
| 1353 **/ |
371 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec
ts | 1354 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec
ts |
372 forKeys:(const uint32_t [])keys | 1355 forKeys:(const uint32_t [])keys |
373 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 1356 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 1357 |
| 1358 /** |
| 1359 * Initializes this dictionary, copying the entries from the given dictionary. |
| 1360 * |
| 1361 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 1362 * |
| 1363 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 1364 **/ |
374 - (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary; | 1365 - (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary; |
| 1366 |
| 1367 /** |
| 1368 * Initializes this dictionary with the requested capacity. |
| 1369 * |
| 1370 * @param numItems Number of items needed for this dictionary. |
| 1371 * |
| 1372 * @return A newly initialized dictionary with the requested capacity. |
| 1373 **/ |
375 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 1374 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
376 | 1375 |
| 1376 /** |
| 1377 * Fetches the object stored under the given key. |
| 1378 * |
| 1379 * @param key Key under which the value is stored, if present. |
| 1380 * |
| 1381 * @return The object if found, nil otherwise. |
| 1382 **/ |
377 - (ObjectType)objectForKey:(uint32_t)key; | 1383 - (ObjectType)objectForKey:(uint32_t)key; |
378 | 1384 |
| 1385 /** |
| 1386 * Enumerates the keys and values on this dictionary with the given block. |
| 1387 * |
| 1388 * @param block The block to enumerate with. |
| 1389 * **key**: The key for the current entry. |
| 1390 * **object**: The value for the current entry |
| 1391 * **stop**: A pointer to a boolean that when set stops the enumeration
. |
| 1392 **/ |
379 - (void)enumerateKeysAndObjectsUsingBlock: | 1393 - (void)enumerateKeysAndObjectsUsingBlock: |
380 (void (^)(uint32_t key, ObjectType object, BOOL *stop))block; | 1394 (void (^)(uint32_t key, ObjectType object, BOOL *stop))block; |
381 | 1395 |
| 1396 /** |
| 1397 * Adds the keys and values from another dictionary. |
| 1398 * |
| 1399 * @param otherDictionary Dictionary containing entries to be added to this |
| 1400 * dictionary. |
| 1401 **/ |
382 - (void)addEntriesFromDictionary:(GPBUInt32ObjectDictionary *)otherDictionary; | 1402 - (void)addEntriesFromDictionary:(GPBUInt32ObjectDictionary *)otherDictionary; |
383 | 1403 |
| 1404 /** |
| 1405 * Sets the value for the given key. |
| 1406 * |
| 1407 * @param object The value to set. |
| 1408 * @param key The key under which to store the value. |
| 1409 **/ |
384 - (void)setObject:(ObjectType)object forKey:(uint32_t)key; | 1410 - (void)setObject:(ObjectType)object forKey:(uint32_t)key; |
385 | 1411 |
| 1412 /** |
| 1413 * Removes the entry for the given key. |
| 1414 * |
| 1415 * @param aKey Key to be removed from this dictionary. |
| 1416 **/ |
386 - (void)removeObjectForKey:(uint32_t)aKey; | 1417 - (void)removeObjectForKey:(uint32_t)aKey; |
| 1418 |
| 1419 /** |
| 1420 * Removes all entries in this dictionary. |
| 1421 **/ |
387 - (void)removeAll; | 1422 - (void)removeAll; |
388 | 1423 |
389 @end | 1424 @end |
390 | 1425 |
391 #pragma mark - Int32 -> UInt32 | 1426 #pragma mark - Int32 -> UInt32 |
392 | 1427 |
| 1428 /** |
| 1429 * Class used for map fields of <int32_t, uint32_t> |
| 1430 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 1431 * |
| 1432 * @note This class is not meant to be subclassed. |
| 1433 **/ |
393 @interface GPBInt32UInt32Dictionary : NSObject <NSCopying> | 1434 @interface GPBInt32UInt32Dictionary : NSObject <NSCopying> |
394 | 1435 |
| 1436 /** Number of entries stored in this dictionary. */ |
395 @property(nonatomic, readonly) NSUInteger count; | 1437 @property(nonatomic, readonly) NSUInteger count; |
396 | 1438 |
| 1439 /** |
| 1440 * @return A newly instanced and empty dictionary. |
| 1441 **/ |
397 + (instancetype)dictionary; | 1442 + (instancetype)dictionary; |
398 + (instancetype)dictionaryWithValue:(uint32_t)value | 1443 |
| 1444 /** |
| 1445 * Creates and initializes a dictionary with the single entry given. |
| 1446 * |
| 1447 * @param value The value to be placed in the dictionary. |
| 1448 * @param key The key under which to store the value. |
| 1449 * |
| 1450 * @return A newly instanced dictionary with the key and value in it. |
| 1451 **/ |
| 1452 + (instancetype)dictionaryWithUInt32:(uint32_t)value |
| 1453 forKey:(int32_t)key; |
| 1454 |
| 1455 /** |
| 1456 * Creates and initializes a dictionary with the entries given. |
| 1457 * |
| 1458 * @param values The values to be placed in the dictionary. |
| 1459 * @param keys The keys under which to store the values. |
| 1460 * @param count The number of entries to store in the dictionary. |
| 1461 * |
| 1462 * @return A newly instanced dictionary with the keys and values in it. |
| 1463 **/ |
| 1464 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values |
| 1465 forKeys:(const int32_t [])keys |
| 1466 count:(NSUInteger)count; |
| 1467 |
| 1468 /** |
| 1469 * Creates and initializes a dictionary with the entries from the given. |
| 1470 * dictionary. |
| 1471 * |
| 1472 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 1473 * |
| 1474 * @return A newly instanced dictionary with the entries from the given |
| 1475 * dictionary in it. |
| 1476 **/ |
| 1477 + (instancetype)dictionaryWithDictionary:(GPBInt32UInt32Dictionary *)dictionary; |
| 1478 |
| 1479 /** |
| 1480 * Creates and initializes a dictionary with the given capacity. |
| 1481 * |
| 1482 * @param numItems Capacity needed for the dictionary. |
| 1483 * |
| 1484 * @return A newly instanced dictionary with the given capacity. |
| 1485 **/ |
| 1486 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 1487 |
| 1488 /** |
| 1489 * Initializes this dictionary, copying the given values and keys. |
| 1490 * |
| 1491 * @param values The values to be placed in this dictionary. |
| 1492 * @param keys The keys under which to store the values. |
| 1493 * @param count The number of elements to copy into the dictionary. |
| 1494 * |
| 1495 * @return A newly initialized dictionary with a copy of the values and keys. |
| 1496 **/ |
| 1497 - (instancetype)initWithUInt32s:(const uint32_t [])values |
| 1498 forKeys:(const int32_t [])keys |
| 1499 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 1500 |
| 1501 /** |
| 1502 * Initializes this dictionary, copying the entries from the given dictionary. |
| 1503 * |
| 1504 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 1505 * |
| 1506 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 1507 **/ |
| 1508 - (instancetype)initWithDictionary:(GPBInt32UInt32Dictionary *)dictionary; |
| 1509 |
| 1510 /** |
| 1511 * Initializes this dictionary with the requested capacity. |
| 1512 * |
| 1513 * @param numItems Number of items needed for this dictionary. |
| 1514 * |
| 1515 * @return A newly initialized dictionary with the requested capacity. |
| 1516 **/ |
| 1517 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 1518 |
| 1519 /** |
| 1520 * Gets the value for the given key. |
| 1521 * |
| 1522 * @param value Pointer into which the value will be set, if found. |
| 1523 * @param key Key under which the value is stored, if present. |
| 1524 * |
| 1525 * @return YES if the key was found and the value was copied, NO otherwise. |
| 1526 **/ |
| 1527 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int32_t)key; |
| 1528 |
| 1529 /** |
| 1530 * Enumerates the keys and values on this dictionary with the given block. |
| 1531 * |
| 1532 * @param block The block to enumerate with. |
| 1533 * **key**: The key for the current entry. |
| 1534 * **value**: The value for the current entry |
| 1535 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 1536 **/ |
| 1537 - (void)enumerateKeysAndUInt32sUsingBlock: |
| 1538 (void (^)(int32_t key, uint32_t value, BOOL *stop))block; |
| 1539 |
| 1540 /** |
| 1541 * Adds the keys and values from another dictionary. |
| 1542 * |
| 1543 * @param otherDictionary Dictionary containing entries to be added to this |
| 1544 * dictionary. |
| 1545 **/ |
| 1546 - (void)addEntriesFromDictionary:(GPBInt32UInt32Dictionary *)otherDictionary; |
| 1547 |
| 1548 /** |
| 1549 * Sets the value for the given key. |
| 1550 * |
| 1551 * @param value The value to set. |
| 1552 * @param key The key under which to store the value. |
| 1553 **/ |
| 1554 - (void)setUInt32:(uint32_t)value forKey:(int32_t)key; |
| 1555 |
| 1556 /** |
| 1557 * Removes the entry for the given key. |
| 1558 * |
| 1559 * @param aKey Key to be removed from this dictionary. |
| 1560 **/ |
| 1561 - (void)removeUInt32ForKey:(int32_t)aKey; |
| 1562 |
| 1563 /** |
| 1564 * Removes all entries in this dictionary. |
| 1565 **/ |
| 1566 - (void)removeAll; |
| 1567 |
| 1568 @end |
| 1569 |
| 1570 #pragma mark - Int32 -> Int32 |
| 1571 |
| 1572 /** |
| 1573 * Class used for map fields of <int32_t, int32_t> |
| 1574 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 1575 * |
| 1576 * @note This class is not meant to be subclassed. |
| 1577 **/ |
| 1578 @interface GPBInt32Int32Dictionary : NSObject <NSCopying> |
| 1579 |
| 1580 /** Number of entries stored in this dictionary. */ |
| 1581 @property(nonatomic, readonly) NSUInteger count; |
| 1582 |
| 1583 /** |
| 1584 * @return A newly instanced and empty dictionary. |
| 1585 **/ |
| 1586 + (instancetype)dictionary; |
| 1587 |
| 1588 /** |
| 1589 * Creates and initializes a dictionary with the single entry given. |
| 1590 * |
| 1591 * @param value The value to be placed in the dictionary. |
| 1592 * @param key The key under which to store the value. |
| 1593 * |
| 1594 * @return A newly instanced dictionary with the key and value in it. |
| 1595 **/ |
| 1596 + (instancetype)dictionaryWithInt32:(int32_t)value |
399 forKey:(int32_t)key; | 1597 forKey:(int32_t)key; |
400 + (instancetype)dictionaryWithValues:(const uint32_t [])values | 1598 |
| 1599 /** |
| 1600 * Creates and initializes a dictionary with the entries given. |
| 1601 * |
| 1602 * @param values The values to be placed in the dictionary. |
| 1603 * @param keys The keys under which to store the values. |
| 1604 * @param count The number of entries to store in the dictionary. |
| 1605 * |
| 1606 * @return A newly instanced dictionary with the keys and values in it. |
| 1607 **/ |
| 1608 + (instancetype)dictionaryWithInt32s:(const int32_t [])values |
401 forKeys:(const int32_t [])keys | 1609 forKeys:(const int32_t [])keys |
402 count:(NSUInteger)count; | 1610 count:(NSUInteger)count; |
403 + (instancetype)dictionaryWithDictionary:(GPBInt32UInt32Dictionary *)dictionary; | 1611 |
| 1612 /** |
| 1613 * Creates and initializes a dictionary with the entries from the given. |
| 1614 * dictionary. |
| 1615 * |
| 1616 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 1617 * |
| 1618 * @return A newly instanced dictionary with the entries from the given |
| 1619 * dictionary in it. |
| 1620 **/ |
| 1621 + (instancetype)dictionaryWithDictionary:(GPBInt32Int32Dictionary *)dictionary; |
| 1622 |
| 1623 /** |
| 1624 * Creates and initializes a dictionary with the given capacity. |
| 1625 * |
| 1626 * @param numItems Capacity needed for the dictionary. |
| 1627 * |
| 1628 * @return A newly instanced dictionary with the given capacity. |
| 1629 **/ |
404 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 1630 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
405 | 1631 |
406 - (instancetype)initWithValues:(const uint32_t [])values | 1632 /** |
| 1633 * Initializes this dictionary, copying the given values and keys. |
| 1634 * |
| 1635 * @param values The values to be placed in this dictionary. |
| 1636 * @param keys The keys under which to store the values. |
| 1637 * @param count The number of elements to copy into the dictionary. |
| 1638 * |
| 1639 * @return A newly initialized dictionary with a copy of the values and keys. |
| 1640 **/ |
| 1641 - (instancetype)initWithInt32s:(const int32_t [])values |
407 forKeys:(const int32_t [])keys | 1642 forKeys:(const int32_t [])keys |
408 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 1643 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
409 - (instancetype)initWithDictionary:(GPBInt32UInt32Dictionary *)dictionary; | 1644 |
| 1645 /** |
| 1646 * Initializes this dictionary, copying the entries from the given dictionary. |
| 1647 * |
| 1648 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 1649 * |
| 1650 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 1651 **/ |
| 1652 - (instancetype)initWithDictionary:(GPBInt32Int32Dictionary *)dictionary; |
| 1653 |
| 1654 /** |
| 1655 * Initializes this dictionary with the requested capacity. |
| 1656 * |
| 1657 * @param numItems Number of items needed for this dictionary. |
| 1658 * |
| 1659 * @return A newly initialized dictionary with the requested capacity. |
| 1660 **/ |
410 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 1661 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
411 | 1662 |
412 - (BOOL)valueForKey:(int32_t)key value:(nullable uint32_t *)value; | 1663 /** |
413 | 1664 * Gets the value for the given key. |
414 - (void)enumerateKeysAndValuesUsingBlock: | 1665 * |
415 (void (^)(int32_t key, uint32_t value, BOOL *stop))block; | 1666 * @param value Pointer into which the value will be set, if found. |
416 | 1667 * @param key Key under which the value is stored, if present. |
417 - (void)addEntriesFromDictionary:(GPBInt32UInt32Dictionary *)otherDictionary; | 1668 * |
418 | 1669 * @return YES if the key was found and the value was copied, NO otherwise. |
419 - (void)setValue:(uint32_t)value forKey:(int32_t)key; | 1670 **/ |
420 | 1671 - (BOOL)getInt32:(nullable int32_t *)value forKey:(int32_t)key; |
421 - (void)removeValueForKey:(int32_t)aKey; | 1672 |
| 1673 /** |
| 1674 * Enumerates the keys and values on this dictionary with the given block. |
| 1675 * |
| 1676 * @param block The block to enumerate with. |
| 1677 * **key**: The key for the current entry. |
| 1678 * **value**: The value for the current entry |
| 1679 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 1680 **/ |
| 1681 - (void)enumerateKeysAndInt32sUsingBlock: |
| 1682 (void (^)(int32_t key, int32_t value, BOOL *stop))block; |
| 1683 |
| 1684 /** |
| 1685 * Adds the keys and values from another dictionary. |
| 1686 * |
| 1687 * @param otherDictionary Dictionary containing entries to be added to this |
| 1688 * dictionary. |
| 1689 **/ |
| 1690 - (void)addEntriesFromDictionary:(GPBInt32Int32Dictionary *)otherDictionary; |
| 1691 |
| 1692 /** |
| 1693 * Sets the value for the given key. |
| 1694 * |
| 1695 * @param value The value to set. |
| 1696 * @param key The key under which to store the value. |
| 1697 **/ |
| 1698 - (void)setInt32:(int32_t)value forKey:(int32_t)key; |
| 1699 |
| 1700 /** |
| 1701 * Removes the entry for the given key. |
| 1702 * |
| 1703 * @param aKey Key to be removed from this dictionary. |
| 1704 **/ |
| 1705 - (void)removeInt32ForKey:(int32_t)aKey; |
| 1706 |
| 1707 /** |
| 1708 * Removes all entries in this dictionary. |
| 1709 **/ |
422 - (void)removeAll; | 1710 - (void)removeAll; |
423 | 1711 |
424 @end | 1712 @end |
425 | 1713 |
426 #pragma mark - Int32 -> Int32 | 1714 #pragma mark - Int32 -> UInt64 |
427 | 1715 |
428 @interface GPBInt32Int32Dictionary : NSObject <NSCopying> | 1716 /** |
429 | 1717 * Class used for map fields of <int32_t, uint64_t> |
| 1718 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 1719 * |
| 1720 * @note This class is not meant to be subclassed. |
| 1721 **/ |
| 1722 @interface GPBInt32UInt64Dictionary : NSObject <NSCopying> |
| 1723 |
| 1724 /** Number of entries stored in this dictionary. */ |
430 @property(nonatomic, readonly) NSUInteger count; | 1725 @property(nonatomic, readonly) NSUInteger count; |
431 | 1726 |
| 1727 /** |
| 1728 * @return A newly instanced and empty dictionary. |
| 1729 **/ |
432 + (instancetype)dictionary; | 1730 + (instancetype)dictionary; |
433 + (instancetype)dictionaryWithValue:(int32_t)value | 1731 |
| 1732 /** |
| 1733 * Creates and initializes a dictionary with the single entry given. |
| 1734 * |
| 1735 * @param value The value to be placed in the dictionary. |
| 1736 * @param key The key under which to store the value. |
| 1737 * |
| 1738 * @return A newly instanced dictionary with the key and value in it. |
| 1739 **/ |
| 1740 + (instancetype)dictionaryWithUInt64:(uint64_t)value |
| 1741 forKey:(int32_t)key; |
| 1742 |
| 1743 /** |
| 1744 * Creates and initializes a dictionary with the entries given. |
| 1745 * |
| 1746 * @param values The values to be placed in the dictionary. |
| 1747 * @param keys The keys under which to store the values. |
| 1748 * @param count The number of entries to store in the dictionary. |
| 1749 * |
| 1750 * @return A newly instanced dictionary with the keys and values in it. |
| 1751 **/ |
| 1752 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values |
| 1753 forKeys:(const int32_t [])keys |
| 1754 count:(NSUInteger)count; |
| 1755 |
| 1756 /** |
| 1757 * Creates and initializes a dictionary with the entries from the given. |
| 1758 * dictionary. |
| 1759 * |
| 1760 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 1761 * |
| 1762 * @return A newly instanced dictionary with the entries from the given |
| 1763 * dictionary in it. |
| 1764 **/ |
| 1765 + (instancetype)dictionaryWithDictionary:(GPBInt32UInt64Dictionary *)dictionary; |
| 1766 |
| 1767 /** |
| 1768 * Creates and initializes a dictionary with the given capacity. |
| 1769 * |
| 1770 * @param numItems Capacity needed for the dictionary. |
| 1771 * |
| 1772 * @return A newly instanced dictionary with the given capacity. |
| 1773 **/ |
| 1774 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 1775 |
| 1776 /** |
| 1777 * Initializes this dictionary, copying the given values and keys. |
| 1778 * |
| 1779 * @param values The values to be placed in this dictionary. |
| 1780 * @param keys The keys under which to store the values. |
| 1781 * @param count The number of elements to copy into the dictionary. |
| 1782 * |
| 1783 * @return A newly initialized dictionary with a copy of the values and keys. |
| 1784 **/ |
| 1785 - (instancetype)initWithUInt64s:(const uint64_t [])values |
| 1786 forKeys:(const int32_t [])keys |
| 1787 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 1788 |
| 1789 /** |
| 1790 * Initializes this dictionary, copying the entries from the given dictionary. |
| 1791 * |
| 1792 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 1793 * |
| 1794 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 1795 **/ |
| 1796 - (instancetype)initWithDictionary:(GPBInt32UInt64Dictionary *)dictionary; |
| 1797 |
| 1798 /** |
| 1799 * Initializes this dictionary with the requested capacity. |
| 1800 * |
| 1801 * @param numItems Number of items needed for this dictionary. |
| 1802 * |
| 1803 * @return A newly initialized dictionary with the requested capacity. |
| 1804 **/ |
| 1805 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 1806 |
| 1807 /** |
| 1808 * Gets the value for the given key. |
| 1809 * |
| 1810 * @param value Pointer into which the value will be set, if found. |
| 1811 * @param key Key under which the value is stored, if present. |
| 1812 * |
| 1813 * @return YES if the key was found and the value was copied, NO otherwise. |
| 1814 **/ |
| 1815 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int32_t)key; |
| 1816 |
| 1817 /** |
| 1818 * Enumerates the keys and values on this dictionary with the given block. |
| 1819 * |
| 1820 * @param block The block to enumerate with. |
| 1821 * **key**: The key for the current entry. |
| 1822 * **value**: The value for the current entry |
| 1823 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 1824 **/ |
| 1825 - (void)enumerateKeysAndUInt64sUsingBlock: |
| 1826 (void (^)(int32_t key, uint64_t value, BOOL *stop))block; |
| 1827 |
| 1828 /** |
| 1829 * Adds the keys and values from another dictionary. |
| 1830 * |
| 1831 * @param otherDictionary Dictionary containing entries to be added to this |
| 1832 * dictionary. |
| 1833 **/ |
| 1834 - (void)addEntriesFromDictionary:(GPBInt32UInt64Dictionary *)otherDictionary; |
| 1835 |
| 1836 /** |
| 1837 * Sets the value for the given key. |
| 1838 * |
| 1839 * @param value The value to set. |
| 1840 * @param key The key under which to store the value. |
| 1841 **/ |
| 1842 - (void)setUInt64:(uint64_t)value forKey:(int32_t)key; |
| 1843 |
| 1844 /** |
| 1845 * Removes the entry for the given key. |
| 1846 * |
| 1847 * @param aKey Key to be removed from this dictionary. |
| 1848 **/ |
| 1849 - (void)removeUInt64ForKey:(int32_t)aKey; |
| 1850 |
| 1851 /** |
| 1852 * Removes all entries in this dictionary. |
| 1853 **/ |
| 1854 - (void)removeAll; |
| 1855 |
| 1856 @end |
| 1857 |
| 1858 #pragma mark - Int32 -> Int64 |
| 1859 |
| 1860 /** |
| 1861 * Class used for map fields of <int32_t, int64_t> |
| 1862 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 1863 * |
| 1864 * @note This class is not meant to be subclassed. |
| 1865 **/ |
| 1866 @interface GPBInt32Int64Dictionary : NSObject <NSCopying> |
| 1867 |
| 1868 /** Number of entries stored in this dictionary. */ |
| 1869 @property(nonatomic, readonly) NSUInteger count; |
| 1870 |
| 1871 /** |
| 1872 * @return A newly instanced and empty dictionary. |
| 1873 **/ |
| 1874 + (instancetype)dictionary; |
| 1875 |
| 1876 /** |
| 1877 * Creates and initializes a dictionary with the single entry given. |
| 1878 * |
| 1879 * @param value The value to be placed in the dictionary. |
| 1880 * @param key The key under which to store the value. |
| 1881 * |
| 1882 * @return A newly instanced dictionary with the key and value in it. |
| 1883 **/ |
| 1884 + (instancetype)dictionaryWithInt64:(int64_t)value |
434 forKey:(int32_t)key; | 1885 forKey:(int32_t)key; |
435 + (instancetype)dictionaryWithValues:(const int32_t [])values | 1886 |
| 1887 /** |
| 1888 * Creates and initializes a dictionary with the entries given. |
| 1889 * |
| 1890 * @param values The values to be placed in the dictionary. |
| 1891 * @param keys The keys under which to store the values. |
| 1892 * @param count The number of entries to store in the dictionary. |
| 1893 * |
| 1894 * @return A newly instanced dictionary with the keys and values in it. |
| 1895 **/ |
| 1896 + (instancetype)dictionaryWithInt64s:(const int64_t [])values |
436 forKeys:(const int32_t [])keys | 1897 forKeys:(const int32_t [])keys |
437 count:(NSUInteger)count; | 1898 count:(NSUInteger)count; |
438 + (instancetype)dictionaryWithDictionary:(GPBInt32Int32Dictionary *)dictionary; | 1899 |
| 1900 /** |
| 1901 * Creates and initializes a dictionary with the entries from the given. |
| 1902 * dictionary. |
| 1903 * |
| 1904 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 1905 * |
| 1906 * @return A newly instanced dictionary with the entries from the given |
| 1907 * dictionary in it. |
| 1908 **/ |
| 1909 + (instancetype)dictionaryWithDictionary:(GPBInt32Int64Dictionary *)dictionary; |
| 1910 |
| 1911 /** |
| 1912 * Creates and initializes a dictionary with the given capacity. |
| 1913 * |
| 1914 * @param numItems Capacity needed for the dictionary. |
| 1915 * |
| 1916 * @return A newly instanced dictionary with the given capacity. |
| 1917 **/ |
439 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 1918 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
440 | 1919 |
441 - (instancetype)initWithValues:(const int32_t [])values | 1920 /** |
| 1921 * Initializes this dictionary, copying the given values and keys. |
| 1922 * |
| 1923 * @param values The values to be placed in this dictionary. |
| 1924 * @param keys The keys under which to store the values. |
| 1925 * @param count The number of elements to copy into the dictionary. |
| 1926 * |
| 1927 * @return A newly initialized dictionary with a copy of the values and keys. |
| 1928 **/ |
| 1929 - (instancetype)initWithInt64s:(const int64_t [])values |
442 forKeys:(const int32_t [])keys | 1930 forKeys:(const int32_t [])keys |
443 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 1931 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
444 - (instancetype)initWithDictionary:(GPBInt32Int32Dictionary *)dictionary; | 1932 |
| 1933 /** |
| 1934 * Initializes this dictionary, copying the entries from the given dictionary. |
| 1935 * |
| 1936 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 1937 * |
| 1938 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 1939 **/ |
| 1940 - (instancetype)initWithDictionary:(GPBInt32Int64Dictionary *)dictionary; |
| 1941 |
| 1942 /** |
| 1943 * Initializes this dictionary with the requested capacity. |
| 1944 * |
| 1945 * @param numItems Number of items needed for this dictionary. |
| 1946 * |
| 1947 * @return A newly initialized dictionary with the requested capacity. |
| 1948 **/ |
445 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 1949 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
446 | 1950 |
447 - (BOOL)valueForKey:(int32_t)key value:(nullable int32_t *)value; | 1951 /** |
448 | 1952 * Gets the value for the given key. |
449 - (void)enumerateKeysAndValuesUsingBlock: | 1953 * |
450 (void (^)(int32_t key, int32_t value, BOOL *stop))block; | 1954 * @param value Pointer into which the value will be set, if found. |
451 | 1955 * @param key Key under which the value is stored, if present. |
452 - (void)addEntriesFromDictionary:(GPBInt32Int32Dictionary *)otherDictionary; | 1956 * |
453 | 1957 * @return YES if the key was found and the value was copied, NO otherwise. |
454 - (void)setValue:(int32_t)value forKey:(int32_t)key; | 1958 **/ |
455 | 1959 - (BOOL)getInt64:(nullable int64_t *)value forKey:(int32_t)key; |
456 - (void)removeValueForKey:(int32_t)aKey; | 1960 |
| 1961 /** |
| 1962 * Enumerates the keys and values on this dictionary with the given block. |
| 1963 * |
| 1964 * @param block The block to enumerate with. |
| 1965 * **key**: The key for the current entry. |
| 1966 * **value**: The value for the current entry |
| 1967 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 1968 **/ |
| 1969 - (void)enumerateKeysAndInt64sUsingBlock: |
| 1970 (void (^)(int32_t key, int64_t value, BOOL *stop))block; |
| 1971 |
| 1972 /** |
| 1973 * Adds the keys and values from another dictionary. |
| 1974 * |
| 1975 * @param otherDictionary Dictionary containing entries to be added to this |
| 1976 * dictionary. |
| 1977 **/ |
| 1978 - (void)addEntriesFromDictionary:(GPBInt32Int64Dictionary *)otherDictionary; |
| 1979 |
| 1980 /** |
| 1981 * Sets the value for the given key. |
| 1982 * |
| 1983 * @param value The value to set. |
| 1984 * @param key The key under which to store the value. |
| 1985 **/ |
| 1986 - (void)setInt64:(int64_t)value forKey:(int32_t)key; |
| 1987 |
| 1988 /** |
| 1989 * Removes the entry for the given key. |
| 1990 * |
| 1991 * @param aKey Key to be removed from this dictionary. |
| 1992 **/ |
| 1993 - (void)removeInt64ForKey:(int32_t)aKey; |
| 1994 |
| 1995 /** |
| 1996 * Removes all entries in this dictionary. |
| 1997 **/ |
457 - (void)removeAll; | 1998 - (void)removeAll; |
458 | 1999 |
459 @end | 2000 @end |
460 | 2001 |
461 #pragma mark - Int32 -> UInt64 | 2002 #pragma mark - Int32 -> Bool |
462 | 2003 |
463 @interface GPBInt32UInt64Dictionary : NSObject <NSCopying> | 2004 /** |
464 | 2005 * Class used for map fields of <int32_t, BOOL> |
| 2006 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 2007 * |
| 2008 * @note This class is not meant to be subclassed. |
| 2009 **/ |
| 2010 @interface GPBInt32BoolDictionary : NSObject <NSCopying> |
| 2011 |
| 2012 /** Number of entries stored in this dictionary. */ |
465 @property(nonatomic, readonly) NSUInteger count; | 2013 @property(nonatomic, readonly) NSUInteger count; |
466 | 2014 |
| 2015 /** |
| 2016 * @return A newly instanced and empty dictionary. |
| 2017 **/ |
467 + (instancetype)dictionary; | 2018 + (instancetype)dictionary; |
468 + (instancetype)dictionaryWithValue:(uint64_t)value | 2019 |
| 2020 /** |
| 2021 * Creates and initializes a dictionary with the single entry given. |
| 2022 * |
| 2023 * @param value The value to be placed in the dictionary. |
| 2024 * @param key The key under which to store the value. |
| 2025 * |
| 2026 * @return A newly instanced dictionary with the key and value in it. |
| 2027 **/ |
| 2028 + (instancetype)dictionaryWithBool:(BOOL)value |
| 2029 forKey:(int32_t)key; |
| 2030 |
| 2031 /** |
| 2032 * Creates and initializes a dictionary with the entries given. |
| 2033 * |
| 2034 * @param values The values to be placed in the dictionary. |
| 2035 * @param keys The keys under which to store the values. |
| 2036 * @param count The number of entries to store in the dictionary. |
| 2037 * |
| 2038 * @return A newly instanced dictionary with the keys and values in it. |
| 2039 **/ |
| 2040 + (instancetype)dictionaryWithBools:(const BOOL [])values |
| 2041 forKeys:(const int32_t [])keys |
| 2042 count:(NSUInteger)count; |
| 2043 |
| 2044 /** |
| 2045 * Creates and initializes a dictionary with the entries from the given. |
| 2046 * dictionary. |
| 2047 * |
| 2048 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 2049 * |
| 2050 * @return A newly instanced dictionary with the entries from the given |
| 2051 * dictionary in it. |
| 2052 **/ |
| 2053 + (instancetype)dictionaryWithDictionary:(GPBInt32BoolDictionary *)dictionary; |
| 2054 |
| 2055 /** |
| 2056 * Creates and initializes a dictionary with the given capacity. |
| 2057 * |
| 2058 * @param numItems Capacity needed for the dictionary. |
| 2059 * |
| 2060 * @return A newly instanced dictionary with the given capacity. |
| 2061 **/ |
| 2062 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 2063 |
| 2064 /** |
| 2065 * Initializes this dictionary, copying the given values and keys. |
| 2066 * |
| 2067 * @param values The values to be placed in this dictionary. |
| 2068 * @param keys The keys under which to store the values. |
| 2069 * @param count The number of elements to copy into the dictionary. |
| 2070 * |
| 2071 * @return A newly initialized dictionary with a copy of the values and keys. |
| 2072 **/ |
| 2073 - (instancetype)initWithBools:(const BOOL [])values |
| 2074 forKeys:(const int32_t [])keys |
| 2075 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 2076 |
| 2077 /** |
| 2078 * Initializes this dictionary, copying the entries from the given dictionary. |
| 2079 * |
| 2080 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 2081 * |
| 2082 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 2083 **/ |
| 2084 - (instancetype)initWithDictionary:(GPBInt32BoolDictionary *)dictionary; |
| 2085 |
| 2086 /** |
| 2087 * Initializes this dictionary with the requested capacity. |
| 2088 * |
| 2089 * @param numItems Number of items needed for this dictionary. |
| 2090 * |
| 2091 * @return A newly initialized dictionary with the requested capacity. |
| 2092 **/ |
| 2093 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 2094 |
| 2095 /** |
| 2096 * Gets the value for the given key. |
| 2097 * |
| 2098 * @param value Pointer into which the value will be set, if found. |
| 2099 * @param key Key under which the value is stored, if present. |
| 2100 * |
| 2101 * @return YES if the key was found and the value was copied, NO otherwise. |
| 2102 **/ |
| 2103 - (BOOL)getBool:(nullable BOOL *)value forKey:(int32_t)key; |
| 2104 |
| 2105 /** |
| 2106 * Enumerates the keys and values on this dictionary with the given block. |
| 2107 * |
| 2108 * @param block The block to enumerate with. |
| 2109 * **key**: The key for the current entry. |
| 2110 * **value**: The value for the current entry |
| 2111 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 2112 **/ |
| 2113 - (void)enumerateKeysAndBoolsUsingBlock: |
| 2114 (void (^)(int32_t key, BOOL value, BOOL *stop))block; |
| 2115 |
| 2116 /** |
| 2117 * Adds the keys and values from another dictionary. |
| 2118 * |
| 2119 * @param otherDictionary Dictionary containing entries to be added to this |
| 2120 * dictionary. |
| 2121 **/ |
| 2122 - (void)addEntriesFromDictionary:(GPBInt32BoolDictionary *)otherDictionary; |
| 2123 |
| 2124 /** |
| 2125 * Sets the value for the given key. |
| 2126 * |
| 2127 * @param value The value to set. |
| 2128 * @param key The key under which to store the value. |
| 2129 **/ |
| 2130 - (void)setBool:(BOOL)value forKey:(int32_t)key; |
| 2131 |
| 2132 /** |
| 2133 * Removes the entry for the given key. |
| 2134 * |
| 2135 * @param aKey Key to be removed from this dictionary. |
| 2136 **/ |
| 2137 - (void)removeBoolForKey:(int32_t)aKey; |
| 2138 |
| 2139 /** |
| 2140 * Removes all entries in this dictionary. |
| 2141 **/ |
| 2142 - (void)removeAll; |
| 2143 |
| 2144 @end |
| 2145 |
| 2146 #pragma mark - Int32 -> Float |
| 2147 |
| 2148 /** |
| 2149 * Class used for map fields of <int32_t, float> |
| 2150 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 2151 * |
| 2152 * @note This class is not meant to be subclassed. |
| 2153 **/ |
| 2154 @interface GPBInt32FloatDictionary : NSObject <NSCopying> |
| 2155 |
| 2156 /** Number of entries stored in this dictionary. */ |
| 2157 @property(nonatomic, readonly) NSUInteger count; |
| 2158 |
| 2159 /** |
| 2160 * @return A newly instanced and empty dictionary. |
| 2161 **/ |
| 2162 + (instancetype)dictionary; |
| 2163 |
| 2164 /** |
| 2165 * Creates and initializes a dictionary with the single entry given. |
| 2166 * |
| 2167 * @param value The value to be placed in the dictionary. |
| 2168 * @param key The key under which to store the value. |
| 2169 * |
| 2170 * @return A newly instanced dictionary with the key and value in it. |
| 2171 **/ |
| 2172 + (instancetype)dictionaryWithFloat:(float)value |
469 forKey:(int32_t)key; | 2173 forKey:(int32_t)key; |
470 + (instancetype)dictionaryWithValues:(const uint64_t [])values | 2174 |
| 2175 /** |
| 2176 * Creates and initializes a dictionary with the entries given. |
| 2177 * |
| 2178 * @param values The values to be placed in the dictionary. |
| 2179 * @param keys The keys under which to store the values. |
| 2180 * @param count The number of entries to store in the dictionary. |
| 2181 * |
| 2182 * @return A newly instanced dictionary with the keys and values in it. |
| 2183 **/ |
| 2184 + (instancetype)dictionaryWithFloats:(const float [])values |
471 forKeys:(const int32_t [])keys | 2185 forKeys:(const int32_t [])keys |
472 count:(NSUInteger)count; | 2186 count:(NSUInteger)count; |
473 + (instancetype)dictionaryWithDictionary:(GPBInt32UInt64Dictionary *)dictionary; | 2187 |
| 2188 /** |
| 2189 * Creates and initializes a dictionary with the entries from the given. |
| 2190 * dictionary. |
| 2191 * |
| 2192 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 2193 * |
| 2194 * @return A newly instanced dictionary with the entries from the given |
| 2195 * dictionary in it. |
| 2196 **/ |
| 2197 + (instancetype)dictionaryWithDictionary:(GPBInt32FloatDictionary *)dictionary; |
| 2198 |
| 2199 /** |
| 2200 * Creates and initializes a dictionary with the given capacity. |
| 2201 * |
| 2202 * @param numItems Capacity needed for the dictionary. |
| 2203 * |
| 2204 * @return A newly instanced dictionary with the given capacity. |
| 2205 **/ |
474 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 2206 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
475 | 2207 |
476 - (instancetype)initWithValues:(const uint64_t [])values | 2208 /** |
| 2209 * Initializes this dictionary, copying the given values and keys. |
| 2210 * |
| 2211 * @param values The values to be placed in this dictionary. |
| 2212 * @param keys The keys under which to store the values. |
| 2213 * @param count The number of elements to copy into the dictionary. |
| 2214 * |
| 2215 * @return A newly initialized dictionary with a copy of the values and keys. |
| 2216 **/ |
| 2217 - (instancetype)initWithFloats:(const float [])values |
477 forKeys:(const int32_t [])keys | 2218 forKeys:(const int32_t [])keys |
478 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 2219 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
479 - (instancetype)initWithDictionary:(GPBInt32UInt64Dictionary *)dictionary; | 2220 |
| 2221 /** |
| 2222 * Initializes this dictionary, copying the entries from the given dictionary. |
| 2223 * |
| 2224 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 2225 * |
| 2226 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 2227 **/ |
| 2228 - (instancetype)initWithDictionary:(GPBInt32FloatDictionary *)dictionary; |
| 2229 |
| 2230 /** |
| 2231 * Initializes this dictionary with the requested capacity. |
| 2232 * |
| 2233 * @param numItems Number of items needed for this dictionary. |
| 2234 * |
| 2235 * @return A newly initialized dictionary with the requested capacity. |
| 2236 **/ |
480 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 2237 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
481 | 2238 |
482 - (BOOL)valueForKey:(int32_t)key value:(nullable uint64_t *)value; | 2239 /** |
483 | 2240 * Gets the value for the given key. |
484 - (void)enumerateKeysAndValuesUsingBlock: | 2241 * |
485 (void (^)(int32_t key, uint64_t value, BOOL *stop))block; | 2242 * @param value Pointer into which the value will be set, if found. |
486 | 2243 * @param key Key under which the value is stored, if present. |
487 - (void)addEntriesFromDictionary:(GPBInt32UInt64Dictionary *)otherDictionary; | 2244 * |
488 | 2245 * @return YES if the key was found and the value was copied, NO otherwise. |
489 - (void)setValue:(uint64_t)value forKey:(int32_t)key; | 2246 **/ |
490 | 2247 - (BOOL)getFloat:(nullable float *)value forKey:(int32_t)key; |
491 - (void)removeValueForKey:(int32_t)aKey; | 2248 |
| 2249 /** |
| 2250 * Enumerates the keys and values on this dictionary with the given block. |
| 2251 * |
| 2252 * @param block The block to enumerate with. |
| 2253 * **key**: The key for the current entry. |
| 2254 * **value**: The value for the current entry |
| 2255 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 2256 **/ |
| 2257 - (void)enumerateKeysAndFloatsUsingBlock: |
| 2258 (void (^)(int32_t key, float value, BOOL *stop))block; |
| 2259 |
| 2260 /** |
| 2261 * Adds the keys and values from another dictionary. |
| 2262 * |
| 2263 * @param otherDictionary Dictionary containing entries to be added to this |
| 2264 * dictionary. |
| 2265 **/ |
| 2266 - (void)addEntriesFromDictionary:(GPBInt32FloatDictionary *)otherDictionary; |
| 2267 |
| 2268 /** |
| 2269 * Sets the value for the given key. |
| 2270 * |
| 2271 * @param value The value to set. |
| 2272 * @param key The key under which to store the value. |
| 2273 **/ |
| 2274 - (void)setFloat:(float)value forKey:(int32_t)key; |
| 2275 |
| 2276 /** |
| 2277 * Removes the entry for the given key. |
| 2278 * |
| 2279 * @param aKey Key to be removed from this dictionary. |
| 2280 **/ |
| 2281 - (void)removeFloatForKey:(int32_t)aKey; |
| 2282 |
| 2283 /** |
| 2284 * Removes all entries in this dictionary. |
| 2285 **/ |
492 - (void)removeAll; | 2286 - (void)removeAll; |
493 | 2287 |
494 @end | 2288 @end |
495 | 2289 |
496 #pragma mark - Int32 -> Int64 | 2290 #pragma mark - Int32 -> Double |
497 | 2291 |
498 @interface GPBInt32Int64Dictionary : NSObject <NSCopying> | 2292 /** |
499 | 2293 * Class used for map fields of <int32_t, double> |
| 2294 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 2295 * |
| 2296 * @note This class is not meant to be subclassed. |
| 2297 **/ |
| 2298 @interface GPBInt32DoubleDictionary : NSObject <NSCopying> |
| 2299 |
| 2300 /** Number of entries stored in this dictionary. */ |
500 @property(nonatomic, readonly) NSUInteger count; | 2301 @property(nonatomic, readonly) NSUInteger count; |
501 | 2302 |
| 2303 /** |
| 2304 * @return A newly instanced and empty dictionary. |
| 2305 **/ |
502 + (instancetype)dictionary; | 2306 + (instancetype)dictionary; |
503 + (instancetype)dictionaryWithValue:(int64_t)value | 2307 |
504 forKey:(int32_t)key; | 2308 /** |
505 + (instancetype)dictionaryWithValues:(const int64_t [])values | 2309 * Creates and initializes a dictionary with the single entry given. |
506 forKeys:(const int32_t [])keys | 2310 * |
507 count:(NSUInteger)count; | 2311 * @param value The value to be placed in the dictionary. |
508 + (instancetype)dictionaryWithDictionary:(GPBInt32Int64Dictionary *)dictionary; | 2312 * @param key The key under which to store the value. |
| 2313 * |
| 2314 * @return A newly instanced dictionary with the key and value in it. |
| 2315 **/ |
| 2316 + (instancetype)dictionaryWithDouble:(double)value |
| 2317 forKey:(int32_t)key; |
| 2318 |
| 2319 /** |
| 2320 * Creates and initializes a dictionary with the entries given. |
| 2321 * |
| 2322 * @param values The values to be placed in the dictionary. |
| 2323 * @param keys The keys under which to store the values. |
| 2324 * @param count The number of entries to store in the dictionary. |
| 2325 * |
| 2326 * @return A newly instanced dictionary with the keys and values in it. |
| 2327 **/ |
| 2328 + (instancetype)dictionaryWithDoubles:(const double [])values |
| 2329 forKeys:(const int32_t [])keys |
| 2330 count:(NSUInteger)count; |
| 2331 |
| 2332 /** |
| 2333 * Creates and initializes a dictionary with the entries from the given. |
| 2334 * dictionary. |
| 2335 * |
| 2336 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 2337 * |
| 2338 * @return A newly instanced dictionary with the entries from the given |
| 2339 * dictionary in it. |
| 2340 **/ |
| 2341 + (instancetype)dictionaryWithDictionary:(GPBInt32DoubleDictionary *)dictionary; |
| 2342 |
| 2343 /** |
| 2344 * Creates and initializes a dictionary with the given capacity. |
| 2345 * |
| 2346 * @param numItems Capacity needed for the dictionary. |
| 2347 * |
| 2348 * @return A newly instanced dictionary with the given capacity. |
| 2349 **/ |
509 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 2350 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
510 | 2351 |
511 - (instancetype)initWithValues:(const int64_t [])values | 2352 /** |
512 forKeys:(const int32_t [])keys | 2353 * Initializes this dictionary, copying the given values and keys. |
513 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 2354 * |
514 - (instancetype)initWithDictionary:(GPBInt32Int64Dictionary *)dictionary; | 2355 * @param values The values to be placed in this dictionary. |
| 2356 * @param keys The keys under which to store the values. |
| 2357 * @param count The number of elements to copy into the dictionary. |
| 2358 * |
| 2359 * @return A newly initialized dictionary with a copy of the values and keys. |
| 2360 **/ |
| 2361 - (instancetype)initWithDoubles:(const double [])values |
| 2362 forKeys:(const int32_t [])keys |
| 2363 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 2364 |
| 2365 /** |
| 2366 * Initializes this dictionary, copying the entries from the given dictionary. |
| 2367 * |
| 2368 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 2369 * |
| 2370 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 2371 **/ |
| 2372 - (instancetype)initWithDictionary:(GPBInt32DoubleDictionary *)dictionary; |
| 2373 |
| 2374 /** |
| 2375 * Initializes this dictionary with the requested capacity. |
| 2376 * |
| 2377 * @param numItems Number of items needed for this dictionary. |
| 2378 * |
| 2379 * @return A newly initialized dictionary with the requested capacity. |
| 2380 **/ |
515 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 2381 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
516 | 2382 |
517 - (BOOL)valueForKey:(int32_t)key value:(nullable int64_t *)value; | 2383 /** |
518 | 2384 * Gets the value for the given key. |
519 - (void)enumerateKeysAndValuesUsingBlock: | 2385 * |
520 (void (^)(int32_t key, int64_t value, BOOL *stop))block; | 2386 * @param value Pointer into which the value will be set, if found. |
521 | 2387 * @param key Key under which the value is stored, if present. |
522 - (void)addEntriesFromDictionary:(GPBInt32Int64Dictionary *)otherDictionary; | 2388 * |
523 | 2389 * @return YES if the key was found and the value was copied, NO otherwise. |
524 - (void)setValue:(int64_t)value forKey:(int32_t)key; | 2390 **/ |
525 | 2391 - (BOOL)getDouble:(nullable double *)value forKey:(int32_t)key; |
526 - (void)removeValueForKey:(int32_t)aKey; | 2392 |
| 2393 /** |
| 2394 * Enumerates the keys and values on this dictionary with the given block. |
| 2395 * |
| 2396 * @param block The block to enumerate with. |
| 2397 * **key**: The key for the current entry. |
| 2398 * **value**: The value for the current entry |
| 2399 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 2400 **/ |
| 2401 - (void)enumerateKeysAndDoublesUsingBlock: |
| 2402 (void (^)(int32_t key, double value, BOOL *stop))block; |
| 2403 |
| 2404 /** |
| 2405 * Adds the keys and values from another dictionary. |
| 2406 * |
| 2407 * @param otherDictionary Dictionary containing entries to be added to this |
| 2408 * dictionary. |
| 2409 **/ |
| 2410 - (void)addEntriesFromDictionary:(GPBInt32DoubleDictionary *)otherDictionary; |
| 2411 |
| 2412 /** |
| 2413 * Sets the value for the given key. |
| 2414 * |
| 2415 * @param value The value to set. |
| 2416 * @param key The key under which to store the value. |
| 2417 **/ |
| 2418 - (void)setDouble:(double)value forKey:(int32_t)key; |
| 2419 |
| 2420 /** |
| 2421 * Removes the entry for the given key. |
| 2422 * |
| 2423 * @param aKey Key to be removed from this dictionary. |
| 2424 **/ |
| 2425 - (void)removeDoubleForKey:(int32_t)aKey; |
| 2426 |
| 2427 /** |
| 2428 * Removes all entries in this dictionary. |
| 2429 **/ |
527 - (void)removeAll; | 2430 - (void)removeAll; |
528 | 2431 |
529 @end | 2432 @end |
530 | 2433 |
531 #pragma mark - Int32 -> Bool | 2434 #pragma mark - Int32 -> Enum |
532 | 2435 |
533 @interface GPBInt32BoolDictionary : NSObject <NSCopying> | 2436 /** |
534 | 2437 * Class used for map fields of <int32_t, int32_t> |
| 2438 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 2439 * |
| 2440 * @note This class is not meant to be subclassed. |
| 2441 **/ |
| 2442 @interface GPBInt32EnumDictionary : NSObject <NSCopying> |
| 2443 |
| 2444 /** Number of entries stored in this dictionary. */ |
535 @property(nonatomic, readonly) NSUInteger count; | 2445 @property(nonatomic, readonly) NSUInteger count; |
536 | 2446 /** The validation function to check if the enums are valid. */ |
| 2447 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; |
| 2448 |
| 2449 /** |
| 2450 * @return A newly instanced and empty dictionary. |
| 2451 **/ |
537 + (instancetype)dictionary; | 2452 + (instancetype)dictionary; |
538 + (instancetype)dictionaryWithValue:(BOOL)value | 2453 |
539 forKey:(int32_t)key; | 2454 /** |
540 + (instancetype)dictionaryWithValues:(const BOOL [])values | 2455 * Creates and initializes a dictionary with the given validation function. |
541 forKeys:(const int32_t [])keys | 2456 * |
542 count:(NSUInteger)count; | 2457 * @param func The enum validation function for the dictionary. |
543 + (instancetype)dictionaryWithDictionary:(GPBInt32BoolDictionary *)dictionary; | 2458 * |
544 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 2459 * @return A newly instanced dictionary. |
545 | 2460 **/ |
546 - (instancetype)initWithValues:(const BOOL [])values | |
547 forKeys:(const int32_t [])keys | |
548 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
549 - (instancetype)initWithDictionary:(GPBInt32BoolDictionary *)dictionary; | |
550 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
551 | |
552 - (BOOL)valueForKey:(int32_t)key value:(nullable BOOL *)value; | |
553 | |
554 - (void)enumerateKeysAndValuesUsingBlock: | |
555 (void (^)(int32_t key, BOOL value, BOOL *stop))block; | |
556 | |
557 - (void)addEntriesFromDictionary:(GPBInt32BoolDictionary *)otherDictionary; | |
558 | |
559 - (void)setValue:(BOOL)value forKey:(int32_t)key; | |
560 | |
561 - (void)removeValueForKey:(int32_t)aKey; | |
562 - (void)removeAll; | |
563 | |
564 @end | |
565 | |
566 #pragma mark - Int32 -> Float | |
567 | |
568 @interface GPBInt32FloatDictionary : NSObject <NSCopying> | |
569 | |
570 @property(nonatomic, readonly) NSUInteger count; | |
571 | |
572 + (instancetype)dictionary; | |
573 + (instancetype)dictionaryWithValue:(float)value | |
574 forKey:(int32_t)key; | |
575 + (instancetype)dictionaryWithValues:(const float [])values | |
576 forKeys:(const int32_t [])keys | |
577 count:(NSUInteger)count; | |
578 + (instancetype)dictionaryWithDictionary:(GPBInt32FloatDictionary *)dictionary; | |
579 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | |
580 | |
581 - (instancetype)initWithValues:(const float [])values | |
582 forKeys:(const int32_t [])keys | |
583 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
584 - (instancetype)initWithDictionary:(GPBInt32FloatDictionary *)dictionary; | |
585 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
586 | |
587 - (BOOL)valueForKey:(int32_t)key value:(nullable float *)value; | |
588 | |
589 - (void)enumerateKeysAndValuesUsingBlock: | |
590 (void (^)(int32_t key, float value, BOOL *stop))block; | |
591 | |
592 - (void)addEntriesFromDictionary:(GPBInt32FloatDictionary *)otherDictionary; | |
593 | |
594 - (void)setValue:(float)value forKey:(int32_t)key; | |
595 | |
596 - (void)removeValueForKey:(int32_t)aKey; | |
597 - (void)removeAll; | |
598 | |
599 @end | |
600 | |
601 #pragma mark - Int32 -> Double | |
602 | |
603 @interface GPBInt32DoubleDictionary : NSObject <NSCopying> | |
604 | |
605 @property(nonatomic, readonly) NSUInteger count; | |
606 | |
607 + (instancetype)dictionary; | |
608 + (instancetype)dictionaryWithValue:(double)value | |
609 forKey:(int32_t)key; | |
610 + (instancetype)dictionaryWithValues:(const double [])values | |
611 forKeys:(const int32_t [])keys | |
612 count:(NSUInteger)count; | |
613 + (instancetype)dictionaryWithDictionary:(GPBInt32DoubleDictionary *)dictionary; | |
614 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | |
615 | |
616 - (instancetype)initWithValues:(const double [])values | |
617 forKeys:(const int32_t [])keys | |
618 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
619 - (instancetype)initWithDictionary:(GPBInt32DoubleDictionary *)dictionary; | |
620 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
621 | |
622 - (BOOL)valueForKey:(int32_t)key value:(nullable double *)value; | |
623 | |
624 - (void)enumerateKeysAndValuesUsingBlock: | |
625 (void (^)(int32_t key, double value, BOOL *stop))block; | |
626 | |
627 - (void)addEntriesFromDictionary:(GPBInt32DoubleDictionary *)otherDictionary; | |
628 | |
629 - (void)setValue:(double)value forKey:(int32_t)key; | |
630 | |
631 - (void)removeValueForKey:(int32_t)aKey; | |
632 - (void)removeAll; | |
633 | |
634 @end | |
635 | |
636 #pragma mark - Int32 -> Enum | |
637 | |
638 @interface GPBInt32EnumDictionary : NSObject <NSCopying> | |
639 | |
640 @property(nonatomic, readonly) NSUInteger count; | |
641 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; | |
642 | |
643 + (instancetype)dictionary; | |
644 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func; | 2461 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func; |
| 2462 |
| 2463 /** |
| 2464 * Creates and initializes a dictionary with the single entry given. |
| 2465 * |
| 2466 * @param func The enum validation function for the dictionary. |
| 2467 * @param rawValue The raw enum value to be placed in the dictionary. |
| 2468 * @param key The key under which to store the value. |
| 2469 * |
| 2470 * @return A newly instanced dictionary with the key and value in it. |
| 2471 **/ |
645 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 2472 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
646 rawValue:(int32_t)rawValue | 2473 rawValue:(int32_t)rawValue |
647 forKey:(int32_t)key; | 2474 forKey:(int32_t)key; |
| 2475 |
| 2476 /** |
| 2477 * Creates and initializes a dictionary with the entries given. |
| 2478 * |
| 2479 * @param func The enum validation function for the dictionary. |
| 2480 * @param values The raw enum values values to be placed in the dictionary. |
| 2481 * @param keys The keys under which to store the values. |
| 2482 * @param count The number of entries to store in the dictionary. |
| 2483 * |
| 2484 * @return A newly instanced dictionary with the keys and values in it. |
| 2485 **/ |
648 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 2486 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
649 rawValues:(const int32_t [])values | 2487 rawValues:(const int32_t [])values |
650 forKeys:(const int32_t [])keys | 2488 forKeys:(const int32_t [])keys |
651 count:(NSUInteger)count; | 2489 count:(NSUInteger)count; |
| 2490 |
| 2491 /** |
| 2492 * Creates and initializes a dictionary with the entries from the given. |
| 2493 * dictionary. |
| 2494 * |
| 2495 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 2496 * |
| 2497 * @return A newly instanced dictionary with the entries from the given |
| 2498 * dictionary in it. |
| 2499 **/ |
652 + (instancetype)dictionaryWithDictionary:(GPBInt32EnumDictionary *)dictionary; | 2500 + (instancetype)dictionaryWithDictionary:(GPBInt32EnumDictionary *)dictionary; |
| 2501 |
| 2502 /** |
| 2503 * Creates and initializes a dictionary with the given capacity. |
| 2504 * |
| 2505 * @param func The enum validation function for the dictionary. |
| 2506 * @param numItems Capacity needed for the dictionary. |
| 2507 * |
| 2508 * @return A newly instanced dictionary with the given capacity. |
| 2509 **/ |
653 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 2510 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
654 capacity:(NSUInteger)numItems; | 2511 capacity:(NSUInteger)numItems; |
655 | 2512 |
| 2513 /** |
| 2514 * Initializes a dictionary with the given validation function. |
| 2515 * |
| 2516 * @param func The enum validation function for the dictionary. |
| 2517 * |
| 2518 * @return A newly initialized dictionary. |
| 2519 **/ |
656 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; | 2520 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; |
| 2521 |
| 2522 /** |
| 2523 * Initializes a dictionary with the entries given. |
| 2524 * |
| 2525 * @param func The enum validation function for the dictionary. |
| 2526 * @param values The raw enum values values to be placed in the dictionary. |
| 2527 * @param keys The keys under which to store the values. |
| 2528 * @param count The number of entries to store in the dictionary. |
| 2529 * |
| 2530 * @return A newly initialized dictionary with the keys and values in it. |
| 2531 **/ |
657 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func | 2532 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func |
658 rawValues:(const int32_t [])values | 2533 rawValues:(const int32_t [])values |
659 forKeys:(const int32_t [])keys | 2534 forKeys:(const int32_t [])keys |
660 count:(NSUInteger)count NS_DESIGNATED_INITI
ALIZER; | 2535 count:(NSUInteger)count NS_DESIGNATED_INITI
ALIZER; |
| 2536 |
| 2537 /** |
| 2538 * Initializes a dictionary with the entries from the given. |
| 2539 * dictionary. |
| 2540 * |
| 2541 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 2542 * |
| 2543 * @return A newly initialized dictionary with the entries from the given |
| 2544 * dictionary in it. |
| 2545 **/ |
661 - (instancetype)initWithDictionary:(GPBInt32EnumDictionary *)dictionary; | 2546 - (instancetype)initWithDictionary:(GPBInt32EnumDictionary *)dictionary; |
| 2547 |
| 2548 /** |
| 2549 * Initializes a dictionary with the given capacity. |
| 2550 * |
| 2551 * @param func The enum validation function for the dictionary. |
| 2552 * @param numItems Capacity needed for the dictionary. |
| 2553 * |
| 2554 * @return A newly initialized dictionary with the given capacity. |
| 2555 **/ |
662 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func | 2556 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func |
663 capacity:(NSUInteger)numItems; | 2557 capacity:(NSUInteger)numItems; |
664 | 2558 |
665 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key | 2559 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key |
666 // is not a valid enumerator as defined by validationFunc. If the actual value i
s | 2560 // is not a valid enumerator as defined by validationFunc. If the actual value i
s |
667 // desired, use "raw" version of the method. | 2561 // desired, use "raw" version of the method. |
668 | 2562 |
669 - (BOOL)valueForKey:(int32_t)key value:(nullable int32_t *)value; | 2563 /** |
| 2564 * Gets the value for the given key. |
| 2565 * |
| 2566 * @param value Pointer into which the value will be set, if found. |
| 2567 * @param key Key under which the value is stored, if present. |
| 2568 * |
| 2569 * @return YES if the key was found and the value was copied, NO otherwise. |
| 2570 **/ |
| 2571 - (BOOL)getEnum:(nullable int32_t *)value forKey:(int32_t)key; |
670 | 2572 |
671 - (void)enumerateKeysAndValuesUsingBlock: | 2573 /** |
| 2574 * Enumerates the keys and values on this dictionary with the given block. |
| 2575 * |
| 2576 * @param block The block to enumerate with. |
| 2577 * **key**: The key for the current entry. |
| 2578 * **value**: The value for the current entry |
| 2579 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 2580 **/ |
| 2581 - (void)enumerateKeysAndEnumsUsingBlock: |
672 (void (^)(int32_t key, int32_t value, BOOL *stop))block; | 2582 (void (^)(int32_t key, int32_t value, BOOL *stop))block; |
673 | 2583 |
674 // These methods bypass the validationFunc to provide access to values that were
not | 2584 /** |
675 // known at the time the binary was compiled. | 2585 * Gets the raw enum value for the given key. |
| 2586 * |
| 2587 * @note This method bypass the validationFunc to enable the access of values th
at |
| 2588 * were not known at the time the binary was compiled. |
| 2589 * |
| 2590 * @param rawValue Pointer into which the value will be set, if found. |
| 2591 * @param key Key under which the value is stored, if present. |
| 2592 * |
| 2593 * @return YES if the key was found and the value was copied, NO otherwise. |
| 2594 **/ |
| 2595 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int32_t)key; |
676 | 2596 |
677 - (BOOL)valueForKey:(int32_t)key rawValue:(nullable int32_t *)rawValue; | 2597 /** |
678 | 2598 * Enumerates the keys and values on this dictionary with the given block. |
| 2599 * |
| 2600 * @note This method bypass the validationFunc to enable the access of values th
at |
| 2601 * were not known at the time the binary was compiled. |
| 2602 * |
| 2603 * @param block The block to enumerate with. |
| 2604 * **key**: The key for the current entry. |
| 2605 * **rawValue**: The value for the current entry |
| 2606 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 2607 **/ |
679 - (void)enumerateKeysAndRawValuesUsingBlock: | 2608 - (void)enumerateKeysAndRawValuesUsingBlock: |
680 (void (^)(int32_t key, int32_t rawValue, BOOL *stop))block; | 2609 (void (^)(int32_t key, int32_t rawValue, BOOL *stop))block; |
681 | 2610 |
| 2611 /** |
| 2612 * Adds the keys and raw enum values from another dictionary. |
| 2613 * |
| 2614 * @note This method bypass the validationFunc to enable the setting of values t
hat |
| 2615 * were not known at the time the binary was compiled. |
| 2616 * |
| 2617 * @param otherDictionary Dictionary containing entries to be added to this |
| 2618 * dictionary. |
| 2619 **/ |
682 - (void)addRawEntriesFromDictionary:(GPBInt32EnumDictionary *)otherDictionary; | 2620 - (void)addRawEntriesFromDictionary:(GPBInt32EnumDictionary *)otherDictionary; |
683 | 2621 |
684 // If value is not a valid enumerator as defined by validationFunc, these | 2622 // If value is not a valid enumerator as defined by validationFunc, these |
685 // methods will assert in debug, and will log in release and assign the value | 2623 // methods will assert in debug, and will log in release and assign the value |
686 // to the default value. Use the rawValue methods below to assign non enumerator | 2624 // to the default value. Use the rawValue methods below to assign non enumerator |
687 // values. | 2625 // values. |
688 | 2626 |
689 - (void)setValue:(int32_t)value forKey:(int32_t)key; | 2627 /** |
690 | 2628 * Sets the value for the given key. |
691 // This method bypass the validationFunc to provide setting of values that were
not | 2629 * |
692 // known at the time the binary was compiled. | 2630 * @param value The value to set. |
| 2631 * @param key The key under which to store the value. |
| 2632 **/ |
| 2633 - (void)setEnum:(int32_t)value forKey:(int32_t)key; |
| 2634 |
| 2635 /** |
| 2636 * Sets the raw enum value for the given key. |
| 2637 * |
| 2638 * @note This method bypass the validationFunc to enable the setting of values t
hat |
| 2639 * were not known at the time the binary was compiled. |
| 2640 * |
| 2641 * @param rawValue The raw enum value to set. |
| 2642 * @param key The key under which to store the raw enum value. |
| 2643 **/ |
693 - (void)setRawValue:(int32_t)rawValue forKey:(int32_t)key; | 2644 - (void)setRawValue:(int32_t)rawValue forKey:(int32_t)key; |
694 | 2645 |
695 // No validation applies to these methods. | 2646 /** |
696 | 2647 * Removes the entry for the given key. |
697 - (void)removeValueForKey:(int32_t)aKey; | 2648 * |
| 2649 * @param aKey Key to be removed from this dictionary. |
| 2650 **/ |
| 2651 - (void)removeEnumForKey:(int32_t)aKey; |
| 2652 |
| 2653 /** |
| 2654 * Removes all entries in this dictionary. |
| 2655 **/ |
698 - (void)removeAll; | 2656 - (void)removeAll; |
699 | 2657 |
700 @end | 2658 @end |
701 | 2659 |
702 #pragma mark - Int32 -> Object | 2660 #pragma mark - Int32 -> Object |
703 | 2661 |
| 2662 /** |
| 2663 * Class used for map fields of <int32_t, ObjectType> |
| 2664 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 2665 * |
| 2666 * @note This class is not meant to be subclassed. |
| 2667 **/ |
704 @interface GPBInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyin
g> | 2668 @interface GPBInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyin
g> |
705 | 2669 |
| 2670 /** Number of entries stored in this dictionary. */ |
706 @property(nonatomic, readonly) NSUInteger count; | 2671 @property(nonatomic, readonly) NSUInteger count; |
707 | 2672 |
| 2673 /** |
| 2674 * @return A newly instanced and empty dictionary. |
| 2675 **/ |
708 + (instancetype)dictionary; | 2676 + (instancetype)dictionary; |
| 2677 |
| 2678 /** |
| 2679 * Creates and initializes a dictionary with the single entry given. |
| 2680 * |
| 2681 * @param object The value to be placed in the dictionary. |
| 2682 * @param key The key under which to store the value. |
| 2683 * |
| 2684 * @return A newly instanced dictionary with the key and value in it. |
| 2685 **/ |
709 + (instancetype)dictionaryWithObject:(ObjectType)object | 2686 + (instancetype)dictionaryWithObject:(ObjectType)object |
710 forKey:(int32_t)key; | 2687 forKey:(int32_t)key; |
| 2688 |
| 2689 /** |
| 2690 * Creates and initializes a dictionary with the entries given. |
| 2691 * |
| 2692 * @param objects The values to be placed in the dictionary. |
| 2693 * @param keys The keys under which to store the values. |
| 2694 * @param count The number of entries to store in the dictionary. |
| 2695 * |
| 2696 * @return A newly instanced dictionary with the keys and values in it. |
| 2697 **/ |
711 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED []
)objects | 2698 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED []
)objects |
712 forKeys:(const int32_t [])keys | 2699 forKeys:(const int32_t [])keys |
713 count:(NSUInteger)count; | 2700 count:(NSUInteger)count; |
| 2701 |
| 2702 /** |
| 2703 * Creates and initializes a dictionary with the entries from the given. |
| 2704 * dictionary. |
| 2705 * |
| 2706 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 2707 * |
| 2708 * @return A newly instanced dictionary with the entries from the given |
| 2709 * dictionary in it. |
| 2710 **/ |
714 + (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary; | 2711 + (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary; |
| 2712 |
| 2713 /** |
| 2714 * Creates and initializes a dictionary with the given capacity. |
| 2715 * |
| 2716 * @param numItems Capacity needed for the dictionary. |
| 2717 * |
| 2718 * @return A newly instanced dictionary with the given capacity. |
| 2719 **/ |
715 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 2720 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
716 | 2721 |
| 2722 /** |
| 2723 * Initializes this dictionary, copying the given values and keys. |
| 2724 * |
| 2725 * @param objects The values to be placed in this dictionary. |
| 2726 * @param keys The keys under which to store the values. |
| 2727 * @param count The number of elements to copy into the dictionary. |
| 2728 * |
| 2729 * @return A newly initialized dictionary with a copy of the values and keys. |
| 2730 **/ |
717 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec
ts | 2731 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec
ts |
718 forKeys:(const int32_t [])keys | 2732 forKeys:(const int32_t [])keys |
719 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 2733 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 2734 |
| 2735 /** |
| 2736 * Initializes this dictionary, copying the entries from the given dictionary. |
| 2737 * |
| 2738 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 2739 * |
| 2740 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 2741 **/ |
720 - (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary; | 2742 - (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary; |
| 2743 |
| 2744 /** |
| 2745 * Initializes this dictionary with the requested capacity. |
| 2746 * |
| 2747 * @param numItems Number of items needed for this dictionary. |
| 2748 * |
| 2749 * @return A newly initialized dictionary with the requested capacity. |
| 2750 **/ |
721 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 2751 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
722 | 2752 |
| 2753 /** |
| 2754 * Fetches the object stored under the given key. |
| 2755 * |
| 2756 * @param key Key under which the value is stored, if present. |
| 2757 * |
| 2758 * @return The object if found, nil otherwise. |
| 2759 **/ |
723 - (ObjectType)objectForKey:(int32_t)key; | 2760 - (ObjectType)objectForKey:(int32_t)key; |
724 | 2761 |
| 2762 /** |
| 2763 * Enumerates the keys and values on this dictionary with the given block. |
| 2764 * |
| 2765 * @param block The block to enumerate with. |
| 2766 * **key**: The key for the current entry. |
| 2767 * **object**: The value for the current entry |
| 2768 * **stop**: A pointer to a boolean that when set stops the enumeration
. |
| 2769 **/ |
725 - (void)enumerateKeysAndObjectsUsingBlock: | 2770 - (void)enumerateKeysAndObjectsUsingBlock: |
726 (void (^)(int32_t key, ObjectType object, BOOL *stop))block; | 2771 (void (^)(int32_t key, ObjectType object, BOOL *stop))block; |
727 | 2772 |
| 2773 /** |
| 2774 * Adds the keys and values from another dictionary. |
| 2775 * |
| 2776 * @param otherDictionary Dictionary containing entries to be added to this |
| 2777 * dictionary. |
| 2778 **/ |
728 - (void)addEntriesFromDictionary:(GPBInt32ObjectDictionary *)otherDictionary; | 2779 - (void)addEntriesFromDictionary:(GPBInt32ObjectDictionary *)otherDictionary; |
729 | 2780 |
| 2781 /** |
| 2782 * Sets the value for the given key. |
| 2783 * |
| 2784 * @param object The value to set. |
| 2785 * @param key The key under which to store the value. |
| 2786 **/ |
730 - (void)setObject:(ObjectType)object forKey:(int32_t)key; | 2787 - (void)setObject:(ObjectType)object forKey:(int32_t)key; |
731 | 2788 |
| 2789 /** |
| 2790 * Removes the entry for the given key. |
| 2791 * |
| 2792 * @param aKey Key to be removed from this dictionary. |
| 2793 **/ |
732 - (void)removeObjectForKey:(int32_t)aKey; | 2794 - (void)removeObjectForKey:(int32_t)aKey; |
| 2795 |
| 2796 /** |
| 2797 * Removes all entries in this dictionary. |
| 2798 **/ |
733 - (void)removeAll; | 2799 - (void)removeAll; |
734 | 2800 |
735 @end | 2801 @end |
736 | 2802 |
737 #pragma mark - UInt64 -> UInt32 | 2803 #pragma mark - UInt64 -> UInt32 |
738 | 2804 |
| 2805 /** |
| 2806 * Class used for map fields of <uint64_t, uint32_t> |
| 2807 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 2808 * |
| 2809 * @note This class is not meant to be subclassed. |
| 2810 **/ |
739 @interface GPBUInt64UInt32Dictionary : NSObject <NSCopying> | 2811 @interface GPBUInt64UInt32Dictionary : NSObject <NSCopying> |
740 | 2812 |
| 2813 /** Number of entries stored in this dictionary. */ |
741 @property(nonatomic, readonly) NSUInteger count; | 2814 @property(nonatomic, readonly) NSUInteger count; |
742 | 2815 |
| 2816 /** |
| 2817 * @return A newly instanced and empty dictionary. |
| 2818 **/ |
743 + (instancetype)dictionary; | 2819 + (instancetype)dictionary; |
744 + (instancetype)dictionaryWithValue:(uint32_t)value | 2820 |
| 2821 /** |
| 2822 * Creates and initializes a dictionary with the single entry given. |
| 2823 * |
| 2824 * @param value The value to be placed in the dictionary. |
| 2825 * @param key The key under which to store the value. |
| 2826 * |
| 2827 * @return A newly instanced dictionary with the key and value in it. |
| 2828 **/ |
| 2829 + (instancetype)dictionaryWithUInt32:(uint32_t)value |
| 2830 forKey:(uint64_t)key; |
| 2831 |
| 2832 /** |
| 2833 * Creates and initializes a dictionary with the entries given. |
| 2834 * |
| 2835 * @param values The values to be placed in the dictionary. |
| 2836 * @param keys The keys under which to store the values. |
| 2837 * @param count The number of entries to store in the dictionary. |
| 2838 * |
| 2839 * @return A newly instanced dictionary with the keys and values in it. |
| 2840 **/ |
| 2841 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values |
| 2842 forKeys:(const uint64_t [])keys |
| 2843 count:(NSUInteger)count; |
| 2844 |
| 2845 /** |
| 2846 * Creates and initializes a dictionary with the entries from the given. |
| 2847 * dictionary. |
| 2848 * |
| 2849 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 2850 * |
| 2851 * @return A newly instanced dictionary with the entries from the given |
| 2852 * dictionary in it. |
| 2853 **/ |
| 2854 + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary
; |
| 2855 |
| 2856 /** |
| 2857 * Creates and initializes a dictionary with the given capacity. |
| 2858 * |
| 2859 * @param numItems Capacity needed for the dictionary. |
| 2860 * |
| 2861 * @return A newly instanced dictionary with the given capacity. |
| 2862 **/ |
| 2863 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 2864 |
| 2865 /** |
| 2866 * Initializes this dictionary, copying the given values and keys. |
| 2867 * |
| 2868 * @param values The values to be placed in this dictionary. |
| 2869 * @param keys The keys under which to store the values. |
| 2870 * @param count The number of elements to copy into the dictionary. |
| 2871 * |
| 2872 * @return A newly initialized dictionary with a copy of the values and keys. |
| 2873 **/ |
| 2874 - (instancetype)initWithUInt32s:(const uint32_t [])values |
| 2875 forKeys:(const uint64_t [])keys |
| 2876 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 2877 |
| 2878 /** |
| 2879 * Initializes this dictionary, copying the entries from the given dictionary. |
| 2880 * |
| 2881 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 2882 * |
| 2883 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 2884 **/ |
| 2885 - (instancetype)initWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary; |
| 2886 |
| 2887 /** |
| 2888 * Initializes this dictionary with the requested capacity. |
| 2889 * |
| 2890 * @param numItems Number of items needed for this dictionary. |
| 2891 * |
| 2892 * @return A newly initialized dictionary with the requested capacity. |
| 2893 **/ |
| 2894 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 2895 |
| 2896 /** |
| 2897 * Gets the value for the given key. |
| 2898 * |
| 2899 * @param value Pointer into which the value will be set, if found. |
| 2900 * @param key Key under which the value is stored, if present. |
| 2901 * |
| 2902 * @return YES if the key was found and the value was copied, NO otherwise. |
| 2903 **/ |
| 2904 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint64_t)key; |
| 2905 |
| 2906 /** |
| 2907 * Enumerates the keys and values on this dictionary with the given block. |
| 2908 * |
| 2909 * @param block The block to enumerate with. |
| 2910 * **key**: The key for the current entry. |
| 2911 * **value**: The value for the current entry |
| 2912 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 2913 **/ |
| 2914 - (void)enumerateKeysAndUInt32sUsingBlock: |
| 2915 (void (^)(uint64_t key, uint32_t value, BOOL *stop))block; |
| 2916 |
| 2917 /** |
| 2918 * Adds the keys and values from another dictionary. |
| 2919 * |
| 2920 * @param otherDictionary Dictionary containing entries to be added to this |
| 2921 * dictionary. |
| 2922 **/ |
| 2923 - (void)addEntriesFromDictionary:(GPBUInt64UInt32Dictionary *)otherDictionary; |
| 2924 |
| 2925 /** |
| 2926 * Sets the value for the given key. |
| 2927 * |
| 2928 * @param value The value to set. |
| 2929 * @param key The key under which to store the value. |
| 2930 **/ |
| 2931 - (void)setUInt32:(uint32_t)value forKey:(uint64_t)key; |
| 2932 |
| 2933 /** |
| 2934 * Removes the entry for the given key. |
| 2935 * |
| 2936 * @param aKey Key to be removed from this dictionary. |
| 2937 **/ |
| 2938 - (void)removeUInt32ForKey:(uint64_t)aKey; |
| 2939 |
| 2940 /** |
| 2941 * Removes all entries in this dictionary. |
| 2942 **/ |
| 2943 - (void)removeAll; |
| 2944 |
| 2945 @end |
| 2946 |
| 2947 #pragma mark - UInt64 -> Int32 |
| 2948 |
| 2949 /** |
| 2950 * Class used for map fields of <uint64_t, int32_t> |
| 2951 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 2952 * |
| 2953 * @note This class is not meant to be subclassed. |
| 2954 **/ |
| 2955 @interface GPBUInt64Int32Dictionary : NSObject <NSCopying> |
| 2956 |
| 2957 /** Number of entries stored in this dictionary. */ |
| 2958 @property(nonatomic, readonly) NSUInteger count; |
| 2959 |
| 2960 /** |
| 2961 * @return A newly instanced and empty dictionary. |
| 2962 **/ |
| 2963 + (instancetype)dictionary; |
| 2964 |
| 2965 /** |
| 2966 * Creates and initializes a dictionary with the single entry given. |
| 2967 * |
| 2968 * @param value The value to be placed in the dictionary. |
| 2969 * @param key The key under which to store the value. |
| 2970 * |
| 2971 * @return A newly instanced dictionary with the key and value in it. |
| 2972 **/ |
| 2973 + (instancetype)dictionaryWithInt32:(int32_t)value |
745 forKey:(uint64_t)key; | 2974 forKey:(uint64_t)key; |
746 + (instancetype)dictionaryWithValues:(const uint32_t [])values | 2975 |
| 2976 /** |
| 2977 * Creates and initializes a dictionary with the entries given. |
| 2978 * |
| 2979 * @param values The values to be placed in the dictionary. |
| 2980 * @param keys The keys under which to store the values. |
| 2981 * @param count The number of entries to store in the dictionary. |
| 2982 * |
| 2983 * @return A newly instanced dictionary with the keys and values in it. |
| 2984 **/ |
| 2985 + (instancetype)dictionaryWithInt32s:(const int32_t [])values |
747 forKeys:(const uint64_t [])keys | 2986 forKeys:(const uint64_t [])keys |
748 count:(NSUInteger)count; | 2987 count:(NSUInteger)count; |
749 + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary
; | 2988 |
| 2989 /** |
| 2990 * Creates and initializes a dictionary with the entries from the given. |
| 2991 * dictionary. |
| 2992 * |
| 2993 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 2994 * |
| 2995 * @return A newly instanced dictionary with the entries from the given |
| 2996 * dictionary in it. |
| 2997 **/ |
| 2998 + (instancetype)dictionaryWithDictionary:(GPBUInt64Int32Dictionary *)dictionary; |
| 2999 |
| 3000 /** |
| 3001 * Creates and initializes a dictionary with the given capacity. |
| 3002 * |
| 3003 * @param numItems Capacity needed for the dictionary. |
| 3004 * |
| 3005 * @return A newly instanced dictionary with the given capacity. |
| 3006 **/ |
750 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 3007 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
751 | 3008 |
752 - (instancetype)initWithValues:(const uint32_t [])values | 3009 /** |
| 3010 * Initializes this dictionary, copying the given values and keys. |
| 3011 * |
| 3012 * @param values The values to be placed in this dictionary. |
| 3013 * @param keys The keys under which to store the values. |
| 3014 * @param count The number of elements to copy into the dictionary. |
| 3015 * |
| 3016 * @return A newly initialized dictionary with a copy of the values and keys. |
| 3017 **/ |
| 3018 - (instancetype)initWithInt32s:(const int32_t [])values |
753 forKeys:(const uint64_t [])keys | 3019 forKeys:(const uint64_t [])keys |
754 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 3020 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
755 - (instancetype)initWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary; | 3021 |
| 3022 /** |
| 3023 * Initializes this dictionary, copying the entries from the given dictionary. |
| 3024 * |
| 3025 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 3026 * |
| 3027 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 3028 **/ |
| 3029 - (instancetype)initWithDictionary:(GPBUInt64Int32Dictionary *)dictionary; |
| 3030 |
| 3031 /** |
| 3032 * Initializes this dictionary with the requested capacity. |
| 3033 * |
| 3034 * @param numItems Number of items needed for this dictionary. |
| 3035 * |
| 3036 * @return A newly initialized dictionary with the requested capacity. |
| 3037 **/ |
756 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 3038 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
757 | 3039 |
758 - (BOOL)valueForKey:(uint64_t)key value:(nullable uint32_t *)value; | 3040 /** |
759 | 3041 * Gets the value for the given key. |
760 - (void)enumerateKeysAndValuesUsingBlock: | 3042 * |
761 (void (^)(uint64_t key, uint32_t value, BOOL *stop))block; | 3043 * @param value Pointer into which the value will be set, if found. |
762 | 3044 * @param key Key under which the value is stored, if present. |
763 - (void)addEntriesFromDictionary:(GPBUInt64UInt32Dictionary *)otherDictionary; | 3045 * |
764 | 3046 * @return YES if the key was found and the value was copied, NO otherwise. |
765 - (void)setValue:(uint32_t)value forKey:(uint64_t)key; | 3047 **/ |
766 | 3048 - (BOOL)getInt32:(nullable int32_t *)value forKey:(uint64_t)key; |
767 - (void)removeValueForKey:(uint64_t)aKey; | 3049 |
| 3050 /** |
| 3051 * Enumerates the keys and values on this dictionary with the given block. |
| 3052 * |
| 3053 * @param block The block to enumerate with. |
| 3054 * **key**: The key for the current entry. |
| 3055 * **value**: The value for the current entry |
| 3056 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 3057 **/ |
| 3058 - (void)enumerateKeysAndInt32sUsingBlock: |
| 3059 (void (^)(uint64_t key, int32_t value, BOOL *stop))block; |
| 3060 |
| 3061 /** |
| 3062 * Adds the keys and values from another dictionary. |
| 3063 * |
| 3064 * @param otherDictionary Dictionary containing entries to be added to this |
| 3065 * dictionary. |
| 3066 **/ |
| 3067 - (void)addEntriesFromDictionary:(GPBUInt64Int32Dictionary *)otherDictionary; |
| 3068 |
| 3069 /** |
| 3070 * Sets the value for the given key. |
| 3071 * |
| 3072 * @param value The value to set. |
| 3073 * @param key The key under which to store the value. |
| 3074 **/ |
| 3075 - (void)setInt32:(int32_t)value forKey:(uint64_t)key; |
| 3076 |
| 3077 /** |
| 3078 * Removes the entry for the given key. |
| 3079 * |
| 3080 * @param aKey Key to be removed from this dictionary. |
| 3081 **/ |
| 3082 - (void)removeInt32ForKey:(uint64_t)aKey; |
| 3083 |
| 3084 /** |
| 3085 * Removes all entries in this dictionary. |
| 3086 **/ |
768 - (void)removeAll; | 3087 - (void)removeAll; |
769 | 3088 |
770 @end | 3089 @end |
771 | 3090 |
772 #pragma mark - UInt64 -> Int32 | 3091 #pragma mark - UInt64 -> UInt64 |
773 | 3092 |
774 @interface GPBUInt64Int32Dictionary : NSObject <NSCopying> | 3093 /** |
775 | 3094 * Class used for map fields of <uint64_t, uint64_t> |
| 3095 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 3096 * |
| 3097 * @note This class is not meant to be subclassed. |
| 3098 **/ |
| 3099 @interface GPBUInt64UInt64Dictionary : NSObject <NSCopying> |
| 3100 |
| 3101 /** Number of entries stored in this dictionary. */ |
776 @property(nonatomic, readonly) NSUInteger count; | 3102 @property(nonatomic, readonly) NSUInteger count; |
777 | 3103 |
| 3104 /** |
| 3105 * @return A newly instanced and empty dictionary. |
| 3106 **/ |
778 + (instancetype)dictionary; | 3107 + (instancetype)dictionary; |
779 + (instancetype)dictionaryWithValue:(int32_t)value | 3108 |
| 3109 /** |
| 3110 * Creates and initializes a dictionary with the single entry given. |
| 3111 * |
| 3112 * @param value The value to be placed in the dictionary. |
| 3113 * @param key The key under which to store the value. |
| 3114 * |
| 3115 * @return A newly instanced dictionary with the key and value in it. |
| 3116 **/ |
| 3117 + (instancetype)dictionaryWithUInt64:(uint64_t)value |
| 3118 forKey:(uint64_t)key; |
| 3119 |
| 3120 /** |
| 3121 * Creates and initializes a dictionary with the entries given. |
| 3122 * |
| 3123 * @param values The values to be placed in the dictionary. |
| 3124 * @param keys The keys under which to store the values. |
| 3125 * @param count The number of entries to store in the dictionary. |
| 3126 * |
| 3127 * @return A newly instanced dictionary with the keys and values in it. |
| 3128 **/ |
| 3129 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values |
| 3130 forKeys:(const uint64_t [])keys |
| 3131 count:(NSUInteger)count; |
| 3132 |
| 3133 /** |
| 3134 * Creates and initializes a dictionary with the entries from the given. |
| 3135 * dictionary. |
| 3136 * |
| 3137 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 3138 * |
| 3139 * @return A newly instanced dictionary with the entries from the given |
| 3140 * dictionary in it. |
| 3141 **/ |
| 3142 + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary
; |
| 3143 |
| 3144 /** |
| 3145 * Creates and initializes a dictionary with the given capacity. |
| 3146 * |
| 3147 * @param numItems Capacity needed for the dictionary. |
| 3148 * |
| 3149 * @return A newly instanced dictionary with the given capacity. |
| 3150 **/ |
| 3151 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 3152 |
| 3153 /** |
| 3154 * Initializes this dictionary, copying the given values and keys. |
| 3155 * |
| 3156 * @param values The values to be placed in this dictionary. |
| 3157 * @param keys The keys under which to store the values. |
| 3158 * @param count The number of elements to copy into the dictionary. |
| 3159 * |
| 3160 * @return A newly initialized dictionary with a copy of the values and keys. |
| 3161 **/ |
| 3162 - (instancetype)initWithUInt64s:(const uint64_t [])values |
| 3163 forKeys:(const uint64_t [])keys |
| 3164 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 3165 |
| 3166 /** |
| 3167 * Initializes this dictionary, copying the entries from the given dictionary. |
| 3168 * |
| 3169 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 3170 * |
| 3171 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 3172 **/ |
| 3173 - (instancetype)initWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary; |
| 3174 |
| 3175 /** |
| 3176 * Initializes this dictionary with the requested capacity. |
| 3177 * |
| 3178 * @param numItems Number of items needed for this dictionary. |
| 3179 * |
| 3180 * @return A newly initialized dictionary with the requested capacity. |
| 3181 **/ |
| 3182 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 3183 |
| 3184 /** |
| 3185 * Gets the value for the given key. |
| 3186 * |
| 3187 * @param value Pointer into which the value will be set, if found. |
| 3188 * @param key Key under which the value is stored, if present. |
| 3189 * |
| 3190 * @return YES if the key was found and the value was copied, NO otherwise. |
| 3191 **/ |
| 3192 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint64_t)key; |
| 3193 |
| 3194 /** |
| 3195 * Enumerates the keys and values on this dictionary with the given block. |
| 3196 * |
| 3197 * @param block The block to enumerate with. |
| 3198 * **key**: The key for the current entry. |
| 3199 * **value**: The value for the current entry |
| 3200 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 3201 **/ |
| 3202 - (void)enumerateKeysAndUInt64sUsingBlock: |
| 3203 (void (^)(uint64_t key, uint64_t value, BOOL *stop))block; |
| 3204 |
| 3205 /** |
| 3206 * Adds the keys and values from another dictionary. |
| 3207 * |
| 3208 * @param otherDictionary Dictionary containing entries to be added to this |
| 3209 * dictionary. |
| 3210 **/ |
| 3211 - (void)addEntriesFromDictionary:(GPBUInt64UInt64Dictionary *)otherDictionary; |
| 3212 |
| 3213 /** |
| 3214 * Sets the value for the given key. |
| 3215 * |
| 3216 * @param value The value to set. |
| 3217 * @param key The key under which to store the value. |
| 3218 **/ |
| 3219 - (void)setUInt64:(uint64_t)value forKey:(uint64_t)key; |
| 3220 |
| 3221 /** |
| 3222 * Removes the entry for the given key. |
| 3223 * |
| 3224 * @param aKey Key to be removed from this dictionary. |
| 3225 **/ |
| 3226 - (void)removeUInt64ForKey:(uint64_t)aKey; |
| 3227 |
| 3228 /** |
| 3229 * Removes all entries in this dictionary. |
| 3230 **/ |
| 3231 - (void)removeAll; |
| 3232 |
| 3233 @end |
| 3234 |
| 3235 #pragma mark - UInt64 -> Int64 |
| 3236 |
| 3237 /** |
| 3238 * Class used for map fields of <uint64_t, int64_t> |
| 3239 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 3240 * |
| 3241 * @note This class is not meant to be subclassed. |
| 3242 **/ |
| 3243 @interface GPBUInt64Int64Dictionary : NSObject <NSCopying> |
| 3244 |
| 3245 /** Number of entries stored in this dictionary. */ |
| 3246 @property(nonatomic, readonly) NSUInteger count; |
| 3247 |
| 3248 /** |
| 3249 * @return A newly instanced and empty dictionary. |
| 3250 **/ |
| 3251 + (instancetype)dictionary; |
| 3252 |
| 3253 /** |
| 3254 * Creates and initializes a dictionary with the single entry given. |
| 3255 * |
| 3256 * @param value The value to be placed in the dictionary. |
| 3257 * @param key The key under which to store the value. |
| 3258 * |
| 3259 * @return A newly instanced dictionary with the key and value in it. |
| 3260 **/ |
| 3261 + (instancetype)dictionaryWithInt64:(int64_t)value |
780 forKey:(uint64_t)key; | 3262 forKey:(uint64_t)key; |
781 + (instancetype)dictionaryWithValues:(const int32_t [])values | 3263 |
| 3264 /** |
| 3265 * Creates and initializes a dictionary with the entries given. |
| 3266 * |
| 3267 * @param values The values to be placed in the dictionary. |
| 3268 * @param keys The keys under which to store the values. |
| 3269 * @param count The number of entries to store in the dictionary. |
| 3270 * |
| 3271 * @return A newly instanced dictionary with the keys and values in it. |
| 3272 **/ |
| 3273 + (instancetype)dictionaryWithInt64s:(const int64_t [])values |
782 forKeys:(const uint64_t [])keys | 3274 forKeys:(const uint64_t [])keys |
783 count:(NSUInteger)count; | 3275 count:(NSUInteger)count; |
784 + (instancetype)dictionaryWithDictionary:(GPBUInt64Int32Dictionary *)dictionary; | 3276 |
| 3277 /** |
| 3278 * Creates and initializes a dictionary with the entries from the given. |
| 3279 * dictionary. |
| 3280 * |
| 3281 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 3282 * |
| 3283 * @return A newly instanced dictionary with the entries from the given |
| 3284 * dictionary in it. |
| 3285 **/ |
| 3286 + (instancetype)dictionaryWithDictionary:(GPBUInt64Int64Dictionary *)dictionary; |
| 3287 |
| 3288 /** |
| 3289 * Creates and initializes a dictionary with the given capacity. |
| 3290 * |
| 3291 * @param numItems Capacity needed for the dictionary. |
| 3292 * |
| 3293 * @return A newly instanced dictionary with the given capacity. |
| 3294 **/ |
785 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 3295 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
786 | 3296 |
787 - (instancetype)initWithValues:(const int32_t [])values | 3297 /** |
| 3298 * Initializes this dictionary, copying the given values and keys. |
| 3299 * |
| 3300 * @param values The values to be placed in this dictionary. |
| 3301 * @param keys The keys under which to store the values. |
| 3302 * @param count The number of elements to copy into the dictionary. |
| 3303 * |
| 3304 * @return A newly initialized dictionary with a copy of the values and keys. |
| 3305 **/ |
| 3306 - (instancetype)initWithInt64s:(const int64_t [])values |
788 forKeys:(const uint64_t [])keys | 3307 forKeys:(const uint64_t [])keys |
789 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 3308 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
790 - (instancetype)initWithDictionary:(GPBUInt64Int32Dictionary *)dictionary; | 3309 |
| 3310 /** |
| 3311 * Initializes this dictionary, copying the entries from the given dictionary. |
| 3312 * |
| 3313 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 3314 * |
| 3315 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 3316 **/ |
| 3317 - (instancetype)initWithDictionary:(GPBUInt64Int64Dictionary *)dictionary; |
| 3318 |
| 3319 /** |
| 3320 * Initializes this dictionary with the requested capacity. |
| 3321 * |
| 3322 * @param numItems Number of items needed for this dictionary. |
| 3323 * |
| 3324 * @return A newly initialized dictionary with the requested capacity. |
| 3325 **/ |
791 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 3326 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
792 | 3327 |
793 - (BOOL)valueForKey:(uint64_t)key value:(nullable int32_t *)value; | 3328 /** |
794 | 3329 * Gets the value for the given key. |
795 - (void)enumerateKeysAndValuesUsingBlock: | 3330 * |
796 (void (^)(uint64_t key, int32_t value, BOOL *stop))block; | 3331 * @param value Pointer into which the value will be set, if found. |
797 | 3332 * @param key Key under which the value is stored, if present. |
798 - (void)addEntriesFromDictionary:(GPBUInt64Int32Dictionary *)otherDictionary; | 3333 * |
799 | 3334 * @return YES if the key was found and the value was copied, NO otherwise. |
800 - (void)setValue:(int32_t)value forKey:(uint64_t)key; | 3335 **/ |
801 | 3336 - (BOOL)getInt64:(nullable int64_t *)value forKey:(uint64_t)key; |
802 - (void)removeValueForKey:(uint64_t)aKey; | 3337 |
| 3338 /** |
| 3339 * Enumerates the keys and values on this dictionary with the given block. |
| 3340 * |
| 3341 * @param block The block to enumerate with. |
| 3342 * **key**: The key for the current entry. |
| 3343 * **value**: The value for the current entry |
| 3344 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 3345 **/ |
| 3346 - (void)enumerateKeysAndInt64sUsingBlock: |
| 3347 (void (^)(uint64_t key, int64_t value, BOOL *stop))block; |
| 3348 |
| 3349 /** |
| 3350 * Adds the keys and values from another dictionary. |
| 3351 * |
| 3352 * @param otherDictionary Dictionary containing entries to be added to this |
| 3353 * dictionary. |
| 3354 **/ |
| 3355 - (void)addEntriesFromDictionary:(GPBUInt64Int64Dictionary *)otherDictionary; |
| 3356 |
| 3357 /** |
| 3358 * Sets the value for the given key. |
| 3359 * |
| 3360 * @param value The value to set. |
| 3361 * @param key The key under which to store the value. |
| 3362 **/ |
| 3363 - (void)setInt64:(int64_t)value forKey:(uint64_t)key; |
| 3364 |
| 3365 /** |
| 3366 * Removes the entry for the given key. |
| 3367 * |
| 3368 * @param aKey Key to be removed from this dictionary. |
| 3369 **/ |
| 3370 - (void)removeInt64ForKey:(uint64_t)aKey; |
| 3371 |
| 3372 /** |
| 3373 * Removes all entries in this dictionary. |
| 3374 **/ |
803 - (void)removeAll; | 3375 - (void)removeAll; |
804 | 3376 |
805 @end | 3377 @end |
806 | 3378 |
807 #pragma mark - UInt64 -> UInt64 | 3379 #pragma mark - UInt64 -> Bool |
808 | 3380 |
809 @interface GPBUInt64UInt64Dictionary : NSObject <NSCopying> | 3381 /** |
810 | 3382 * Class used for map fields of <uint64_t, BOOL> |
| 3383 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 3384 * |
| 3385 * @note This class is not meant to be subclassed. |
| 3386 **/ |
| 3387 @interface GPBUInt64BoolDictionary : NSObject <NSCopying> |
| 3388 |
| 3389 /** Number of entries stored in this dictionary. */ |
811 @property(nonatomic, readonly) NSUInteger count; | 3390 @property(nonatomic, readonly) NSUInteger count; |
812 | 3391 |
| 3392 /** |
| 3393 * @return A newly instanced and empty dictionary. |
| 3394 **/ |
813 + (instancetype)dictionary; | 3395 + (instancetype)dictionary; |
814 + (instancetype)dictionaryWithValue:(uint64_t)value | 3396 |
| 3397 /** |
| 3398 * Creates and initializes a dictionary with the single entry given. |
| 3399 * |
| 3400 * @param value The value to be placed in the dictionary. |
| 3401 * @param key The key under which to store the value. |
| 3402 * |
| 3403 * @return A newly instanced dictionary with the key and value in it. |
| 3404 **/ |
| 3405 + (instancetype)dictionaryWithBool:(BOOL)value |
| 3406 forKey:(uint64_t)key; |
| 3407 |
| 3408 /** |
| 3409 * Creates and initializes a dictionary with the entries given. |
| 3410 * |
| 3411 * @param values The values to be placed in the dictionary. |
| 3412 * @param keys The keys under which to store the values. |
| 3413 * @param count The number of entries to store in the dictionary. |
| 3414 * |
| 3415 * @return A newly instanced dictionary with the keys and values in it. |
| 3416 **/ |
| 3417 + (instancetype)dictionaryWithBools:(const BOOL [])values |
| 3418 forKeys:(const uint64_t [])keys |
| 3419 count:(NSUInteger)count; |
| 3420 |
| 3421 /** |
| 3422 * Creates and initializes a dictionary with the entries from the given. |
| 3423 * dictionary. |
| 3424 * |
| 3425 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 3426 * |
| 3427 * @return A newly instanced dictionary with the entries from the given |
| 3428 * dictionary in it. |
| 3429 **/ |
| 3430 + (instancetype)dictionaryWithDictionary:(GPBUInt64BoolDictionary *)dictionary; |
| 3431 |
| 3432 /** |
| 3433 * Creates and initializes a dictionary with the given capacity. |
| 3434 * |
| 3435 * @param numItems Capacity needed for the dictionary. |
| 3436 * |
| 3437 * @return A newly instanced dictionary with the given capacity. |
| 3438 **/ |
| 3439 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 3440 |
| 3441 /** |
| 3442 * Initializes this dictionary, copying the given values and keys. |
| 3443 * |
| 3444 * @param values The values to be placed in this dictionary. |
| 3445 * @param keys The keys under which to store the values. |
| 3446 * @param count The number of elements to copy into the dictionary. |
| 3447 * |
| 3448 * @return A newly initialized dictionary with a copy of the values and keys. |
| 3449 **/ |
| 3450 - (instancetype)initWithBools:(const BOOL [])values |
| 3451 forKeys:(const uint64_t [])keys |
| 3452 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 3453 |
| 3454 /** |
| 3455 * Initializes this dictionary, copying the entries from the given dictionary. |
| 3456 * |
| 3457 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 3458 * |
| 3459 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 3460 **/ |
| 3461 - (instancetype)initWithDictionary:(GPBUInt64BoolDictionary *)dictionary; |
| 3462 |
| 3463 /** |
| 3464 * Initializes this dictionary with the requested capacity. |
| 3465 * |
| 3466 * @param numItems Number of items needed for this dictionary. |
| 3467 * |
| 3468 * @return A newly initialized dictionary with the requested capacity. |
| 3469 **/ |
| 3470 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 3471 |
| 3472 /** |
| 3473 * Gets the value for the given key. |
| 3474 * |
| 3475 * @param value Pointer into which the value will be set, if found. |
| 3476 * @param key Key under which the value is stored, if present. |
| 3477 * |
| 3478 * @return YES if the key was found and the value was copied, NO otherwise. |
| 3479 **/ |
| 3480 - (BOOL)getBool:(nullable BOOL *)value forKey:(uint64_t)key; |
| 3481 |
| 3482 /** |
| 3483 * Enumerates the keys and values on this dictionary with the given block. |
| 3484 * |
| 3485 * @param block The block to enumerate with. |
| 3486 * **key**: The key for the current entry. |
| 3487 * **value**: The value for the current entry |
| 3488 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 3489 **/ |
| 3490 - (void)enumerateKeysAndBoolsUsingBlock: |
| 3491 (void (^)(uint64_t key, BOOL value, BOOL *stop))block; |
| 3492 |
| 3493 /** |
| 3494 * Adds the keys and values from another dictionary. |
| 3495 * |
| 3496 * @param otherDictionary Dictionary containing entries to be added to this |
| 3497 * dictionary. |
| 3498 **/ |
| 3499 - (void)addEntriesFromDictionary:(GPBUInt64BoolDictionary *)otherDictionary; |
| 3500 |
| 3501 /** |
| 3502 * Sets the value for the given key. |
| 3503 * |
| 3504 * @param value The value to set. |
| 3505 * @param key The key under which to store the value. |
| 3506 **/ |
| 3507 - (void)setBool:(BOOL)value forKey:(uint64_t)key; |
| 3508 |
| 3509 /** |
| 3510 * Removes the entry for the given key. |
| 3511 * |
| 3512 * @param aKey Key to be removed from this dictionary. |
| 3513 **/ |
| 3514 - (void)removeBoolForKey:(uint64_t)aKey; |
| 3515 |
| 3516 /** |
| 3517 * Removes all entries in this dictionary. |
| 3518 **/ |
| 3519 - (void)removeAll; |
| 3520 |
| 3521 @end |
| 3522 |
| 3523 #pragma mark - UInt64 -> Float |
| 3524 |
| 3525 /** |
| 3526 * Class used for map fields of <uint64_t, float> |
| 3527 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 3528 * |
| 3529 * @note This class is not meant to be subclassed. |
| 3530 **/ |
| 3531 @interface GPBUInt64FloatDictionary : NSObject <NSCopying> |
| 3532 |
| 3533 /** Number of entries stored in this dictionary. */ |
| 3534 @property(nonatomic, readonly) NSUInteger count; |
| 3535 |
| 3536 /** |
| 3537 * @return A newly instanced and empty dictionary. |
| 3538 **/ |
| 3539 + (instancetype)dictionary; |
| 3540 |
| 3541 /** |
| 3542 * Creates and initializes a dictionary with the single entry given. |
| 3543 * |
| 3544 * @param value The value to be placed in the dictionary. |
| 3545 * @param key The key under which to store the value. |
| 3546 * |
| 3547 * @return A newly instanced dictionary with the key and value in it. |
| 3548 **/ |
| 3549 + (instancetype)dictionaryWithFloat:(float)value |
815 forKey:(uint64_t)key; | 3550 forKey:(uint64_t)key; |
816 + (instancetype)dictionaryWithValues:(const uint64_t [])values | 3551 |
| 3552 /** |
| 3553 * Creates and initializes a dictionary with the entries given. |
| 3554 * |
| 3555 * @param values The values to be placed in the dictionary. |
| 3556 * @param keys The keys under which to store the values. |
| 3557 * @param count The number of entries to store in the dictionary. |
| 3558 * |
| 3559 * @return A newly instanced dictionary with the keys and values in it. |
| 3560 **/ |
| 3561 + (instancetype)dictionaryWithFloats:(const float [])values |
817 forKeys:(const uint64_t [])keys | 3562 forKeys:(const uint64_t [])keys |
818 count:(NSUInteger)count; | 3563 count:(NSUInteger)count; |
819 + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary
; | 3564 |
| 3565 /** |
| 3566 * Creates and initializes a dictionary with the entries from the given. |
| 3567 * dictionary. |
| 3568 * |
| 3569 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 3570 * |
| 3571 * @return A newly instanced dictionary with the entries from the given |
| 3572 * dictionary in it. |
| 3573 **/ |
| 3574 + (instancetype)dictionaryWithDictionary:(GPBUInt64FloatDictionary *)dictionary; |
| 3575 |
| 3576 /** |
| 3577 * Creates and initializes a dictionary with the given capacity. |
| 3578 * |
| 3579 * @param numItems Capacity needed for the dictionary. |
| 3580 * |
| 3581 * @return A newly instanced dictionary with the given capacity. |
| 3582 **/ |
820 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 3583 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
821 | 3584 |
822 - (instancetype)initWithValues:(const uint64_t [])values | 3585 /** |
| 3586 * Initializes this dictionary, copying the given values and keys. |
| 3587 * |
| 3588 * @param values The values to be placed in this dictionary. |
| 3589 * @param keys The keys under which to store the values. |
| 3590 * @param count The number of elements to copy into the dictionary. |
| 3591 * |
| 3592 * @return A newly initialized dictionary with a copy of the values and keys. |
| 3593 **/ |
| 3594 - (instancetype)initWithFloats:(const float [])values |
823 forKeys:(const uint64_t [])keys | 3595 forKeys:(const uint64_t [])keys |
824 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 3596 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
825 - (instancetype)initWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary; | 3597 |
| 3598 /** |
| 3599 * Initializes this dictionary, copying the entries from the given dictionary. |
| 3600 * |
| 3601 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 3602 * |
| 3603 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 3604 **/ |
| 3605 - (instancetype)initWithDictionary:(GPBUInt64FloatDictionary *)dictionary; |
| 3606 |
| 3607 /** |
| 3608 * Initializes this dictionary with the requested capacity. |
| 3609 * |
| 3610 * @param numItems Number of items needed for this dictionary. |
| 3611 * |
| 3612 * @return A newly initialized dictionary with the requested capacity. |
| 3613 **/ |
826 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 3614 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
827 | 3615 |
828 - (BOOL)valueForKey:(uint64_t)key value:(nullable uint64_t *)value; | 3616 /** |
829 | 3617 * Gets the value for the given key. |
830 - (void)enumerateKeysAndValuesUsingBlock: | 3618 * |
831 (void (^)(uint64_t key, uint64_t value, BOOL *stop))block; | 3619 * @param value Pointer into which the value will be set, if found. |
832 | 3620 * @param key Key under which the value is stored, if present. |
833 - (void)addEntriesFromDictionary:(GPBUInt64UInt64Dictionary *)otherDictionary; | 3621 * |
834 | 3622 * @return YES if the key was found and the value was copied, NO otherwise. |
835 - (void)setValue:(uint64_t)value forKey:(uint64_t)key; | 3623 **/ |
836 | 3624 - (BOOL)getFloat:(nullable float *)value forKey:(uint64_t)key; |
837 - (void)removeValueForKey:(uint64_t)aKey; | 3625 |
| 3626 /** |
| 3627 * Enumerates the keys and values on this dictionary with the given block. |
| 3628 * |
| 3629 * @param block The block to enumerate with. |
| 3630 * **key**: The key for the current entry. |
| 3631 * **value**: The value for the current entry |
| 3632 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 3633 **/ |
| 3634 - (void)enumerateKeysAndFloatsUsingBlock: |
| 3635 (void (^)(uint64_t key, float value, BOOL *stop))block; |
| 3636 |
| 3637 /** |
| 3638 * Adds the keys and values from another dictionary. |
| 3639 * |
| 3640 * @param otherDictionary Dictionary containing entries to be added to this |
| 3641 * dictionary. |
| 3642 **/ |
| 3643 - (void)addEntriesFromDictionary:(GPBUInt64FloatDictionary *)otherDictionary; |
| 3644 |
| 3645 /** |
| 3646 * Sets the value for the given key. |
| 3647 * |
| 3648 * @param value The value to set. |
| 3649 * @param key The key under which to store the value. |
| 3650 **/ |
| 3651 - (void)setFloat:(float)value forKey:(uint64_t)key; |
| 3652 |
| 3653 /** |
| 3654 * Removes the entry for the given key. |
| 3655 * |
| 3656 * @param aKey Key to be removed from this dictionary. |
| 3657 **/ |
| 3658 - (void)removeFloatForKey:(uint64_t)aKey; |
| 3659 |
| 3660 /** |
| 3661 * Removes all entries in this dictionary. |
| 3662 **/ |
838 - (void)removeAll; | 3663 - (void)removeAll; |
839 | 3664 |
840 @end | 3665 @end |
841 | 3666 |
842 #pragma mark - UInt64 -> Int64 | 3667 #pragma mark - UInt64 -> Double |
843 | 3668 |
844 @interface GPBUInt64Int64Dictionary : NSObject <NSCopying> | 3669 /** |
845 | 3670 * Class used for map fields of <uint64_t, double> |
| 3671 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 3672 * |
| 3673 * @note This class is not meant to be subclassed. |
| 3674 **/ |
| 3675 @interface GPBUInt64DoubleDictionary : NSObject <NSCopying> |
| 3676 |
| 3677 /** Number of entries stored in this dictionary. */ |
846 @property(nonatomic, readonly) NSUInteger count; | 3678 @property(nonatomic, readonly) NSUInteger count; |
847 | 3679 |
| 3680 /** |
| 3681 * @return A newly instanced and empty dictionary. |
| 3682 **/ |
848 + (instancetype)dictionary; | 3683 + (instancetype)dictionary; |
849 + (instancetype)dictionaryWithValue:(int64_t)value | 3684 |
850 forKey:(uint64_t)key; | 3685 /** |
851 + (instancetype)dictionaryWithValues:(const int64_t [])values | 3686 * Creates and initializes a dictionary with the single entry given. |
852 forKeys:(const uint64_t [])keys | 3687 * |
853 count:(NSUInteger)count; | 3688 * @param value The value to be placed in the dictionary. |
854 + (instancetype)dictionaryWithDictionary:(GPBUInt64Int64Dictionary *)dictionary; | 3689 * @param key The key under which to store the value. |
| 3690 * |
| 3691 * @return A newly instanced dictionary with the key and value in it. |
| 3692 **/ |
| 3693 + (instancetype)dictionaryWithDouble:(double)value |
| 3694 forKey:(uint64_t)key; |
| 3695 |
| 3696 /** |
| 3697 * Creates and initializes a dictionary with the entries given. |
| 3698 * |
| 3699 * @param values The values to be placed in the dictionary. |
| 3700 * @param keys The keys under which to store the values. |
| 3701 * @param count The number of entries to store in the dictionary. |
| 3702 * |
| 3703 * @return A newly instanced dictionary with the keys and values in it. |
| 3704 **/ |
| 3705 + (instancetype)dictionaryWithDoubles:(const double [])values |
| 3706 forKeys:(const uint64_t [])keys |
| 3707 count:(NSUInteger)count; |
| 3708 |
| 3709 /** |
| 3710 * Creates and initializes a dictionary with the entries from the given. |
| 3711 * dictionary. |
| 3712 * |
| 3713 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 3714 * |
| 3715 * @return A newly instanced dictionary with the entries from the given |
| 3716 * dictionary in it. |
| 3717 **/ |
| 3718 + (instancetype)dictionaryWithDictionary:(GPBUInt64DoubleDictionary *)dictionary
; |
| 3719 |
| 3720 /** |
| 3721 * Creates and initializes a dictionary with the given capacity. |
| 3722 * |
| 3723 * @param numItems Capacity needed for the dictionary. |
| 3724 * |
| 3725 * @return A newly instanced dictionary with the given capacity. |
| 3726 **/ |
855 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 3727 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
856 | 3728 |
857 - (instancetype)initWithValues:(const int64_t [])values | 3729 /** |
858 forKeys:(const uint64_t [])keys | 3730 * Initializes this dictionary, copying the given values and keys. |
859 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 3731 * |
860 - (instancetype)initWithDictionary:(GPBUInt64Int64Dictionary *)dictionary; | 3732 * @param values The values to be placed in this dictionary. |
| 3733 * @param keys The keys under which to store the values. |
| 3734 * @param count The number of elements to copy into the dictionary. |
| 3735 * |
| 3736 * @return A newly initialized dictionary with a copy of the values and keys. |
| 3737 **/ |
| 3738 - (instancetype)initWithDoubles:(const double [])values |
| 3739 forKeys:(const uint64_t [])keys |
| 3740 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 3741 |
| 3742 /** |
| 3743 * Initializes this dictionary, copying the entries from the given dictionary. |
| 3744 * |
| 3745 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 3746 * |
| 3747 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 3748 **/ |
| 3749 - (instancetype)initWithDictionary:(GPBUInt64DoubleDictionary *)dictionary; |
| 3750 |
| 3751 /** |
| 3752 * Initializes this dictionary with the requested capacity. |
| 3753 * |
| 3754 * @param numItems Number of items needed for this dictionary. |
| 3755 * |
| 3756 * @return A newly initialized dictionary with the requested capacity. |
| 3757 **/ |
861 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 3758 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
862 | 3759 |
863 - (BOOL)valueForKey:(uint64_t)key value:(nullable int64_t *)value; | 3760 /** |
864 | 3761 * Gets the value for the given key. |
865 - (void)enumerateKeysAndValuesUsingBlock: | 3762 * |
866 (void (^)(uint64_t key, int64_t value, BOOL *stop))block; | 3763 * @param value Pointer into which the value will be set, if found. |
867 | 3764 * @param key Key under which the value is stored, if present. |
868 - (void)addEntriesFromDictionary:(GPBUInt64Int64Dictionary *)otherDictionary; | 3765 * |
869 | 3766 * @return YES if the key was found and the value was copied, NO otherwise. |
870 - (void)setValue:(int64_t)value forKey:(uint64_t)key; | 3767 **/ |
871 | 3768 - (BOOL)getDouble:(nullable double *)value forKey:(uint64_t)key; |
872 - (void)removeValueForKey:(uint64_t)aKey; | 3769 |
| 3770 /** |
| 3771 * Enumerates the keys and values on this dictionary with the given block. |
| 3772 * |
| 3773 * @param block The block to enumerate with. |
| 3774 * **key**: The key for the current entry. |
| 3775 * **value**: The value for the current entry |
| 3776 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 3777 **/ |
| 3778 - (void)enumerateKeysAndDoublesUsingBlock: |
| 3779 (void (^)(uint64_t key, double value, BOOL *stop))block; |
| 3780 |
| 3781 /** |
| 3782 * Adds the keys and values from another dictionary. |
| 3783 * |
| 3784 * @param otherDictionary Dictionary containing entries to be added to this |
| 3785 * dictionary. |
| 3786 **/ |
| 3787 - (void)addEntriesFromDictionary:(GPBUInt64DoubleDictionary *)otherDictionary; |
| 3788 |
| 3789 /** |
| 3790 * Sets the value for the given key. |
| 3791 * |
| 3792 * @param value The value to set. |
| 3793 * @param key The key under which to store the value. |
| 3794 **/ |
| 3795 - (void)setDouble:(double)value forKey:(uint64_t)key; |
| 3796 |
| 3797 /** |
| 3798 * Removes the entry for the given key. |
| 3799 * |
| 3800 * @param aKey Key to be removed from this dictionary. |
| 3801 **/ |
| 3802 - (void)removeDoubleForKey:(uint64_t)aKey; |
| 3803 |
| 3804 /** |
| 3805 * Removes all entries in this dictionary. |
| 3806 **/ |
873 - (void)removeAll; | 3807 - (void)removeAll; |
874 | 3808 |
875 @end | 3809 @end |
876 | 3810 |
877 #pragma mark - UInt64 -> Bool | 3811 #pragma mark - UInt64 -> Enum |
878 | 3812 |
879 @interface GPBUInt64BoolDictionary : NSObject <NSCopying> | 3813 /** |
880 | 3814 * Class used for map fields of <uint64_t, int32_t> |
| 3815 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 3816 * |
| 3817 * @note This class is not meant to be subclassed. |
| 3818 **/ |
| 3819 @interface GPBUInt64EnumDictionary : NSObject <NSCopying> |
| 3820 |
| 3821 /** Number of entries stored in this dictionary. */ |
881 @property(nonatomic, readonly) NSUInteger count; | 3822 @property(nonatomic, readonly) NSUInteger count; |
882 | 3823 /** The validation function to check if the enums are valid. */ |
| 3824 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; |
| 3825 |
| 3826 /** |
| 3827 * @return A newly instanced and empty dictionary. |
| 3828 **/ |
883 + (instancetype)dictionary; | 3829 + (instancetype)dictionary; |
884 + (instancetype)dictionaryWithValue:(BOOL)value | 3830 |
885 forKey:(uint64_t)key; | 3831 /** |
886 + (instancetype)dictionaryWithValues:(const BOOL [])values | 3832 * Creates and initializes a dictionary with the given validation function. |
887 forKeys:(const uint64_t [])keys | 3833 * |
888 count:(NSUInteger)count; | 3834 * @param func The enum validation function for the dictionary. |
889 + (instancetype)dictionaryWithDictionary:(GPBUInt64BoolDictionary *)dictionary; | 3835 * |
890 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 3836 * @return A newly instanced dictionary. |
891 | 3837 **/ |
892 - (instancetype)initWithValues:(const BOOL [])values | |
893 forKeys:(const uint64_t [])keys | |
894 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
895 - (instancetype)initWithDictionary:(GPBUInt64BoolDictionary *)dictionary; | |
896 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
897 | |
898 - (BOOL)valueForKey:(uint64_t)key value:(nullable BOOL *)value; | |
899 | |
900 - (void)enumerateKeysAndValuesUsingBlock: | |
901 (void (^)(uint64_t key, BOOL value, BOOL *stop))block; | |
902 | |
903 - (void)addEntriesFromDictionary:(GPBUInt64BoolDictionary *)otherDictionary; | |
904 | |
905 - (void)setValue:(BOOL)value forKey:(uint64_t)key; | |
906 | |
907 - (void)removeValueForKey:(uint64_t)aKey; | |
908 - (void)removeAll; | |
909 | |
910 @end | |
911 | |
912 #pragma mark - UInt64 -> Float | |
913 | |
914 @interface GPBUInt64FloatDictionary : NSObject <NSCopying> | |
915 | |
916 @property(nonatomic, readonly) NSUInteger count; | |
917 | |
918 + (instancetype)dictionary; | |
919 + (instancetype)dictionaryWithValue:(float)value | |
920 forKey:(uint64_t)key; | |
921 + (instancetype)dictionaryWithValues:(const float [])values | |
922 forKeys:(const uint64_t [])keys | |
923 count:(NSUInteger)count; | |
924 + (instancetype)dictionaryWithDictionary:(GPBUInt64FloatDictionary *)dictionary; | |
925 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | |
926 | |
927 - (instancetype)initWithValues:(const float [])values | |
928 forKeys:(const uint64_t [])keys | |
929 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
930 - (instancetype)initWithDictionary:(GPBUInt64FloatDictionary *)dictionary; | |
931 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
932 | |
933 - (BOOL)valueForKey:(uint64_t)key value:(nullable float *)value; | |
934 | |
935 - (void)enumerateKeysAndValuesUsingBlock: | |
936 (void (^)(uint64_t key, float value, BOOL *stop))block; | |
937 | |
938 - (void)addEntriesFromDictionary:(GPBUInt64FloatDictionary *)otherDictionary; | |
939 | |
940 - (void)setValue:(float)value forKey:(uint64_t)key; | |
941 | |
942 - (void)removeValueForKey:(uint64_t)aKey; | |
943 - (void)removeAll; | |
944 | |
945 @end | |
946 | |
947 #pragma mark - UInt64 -> Double | |
948 | |
949 @interface GPBUInt64DoubleDictionary : NSObject <NSCopying> | |
950 | |
951 @property(nonatomic, readonly) NSUInteger count; | |
952 | |
953 + (instancetype)dictionary; | |
954 + (instancetype)dictionaryWithValue:(double)value | |
955 forKey:(uint64_t)key; | |
956 + (instancetype)dictionaryWithValues:(const double [])values | |
957 forKeys:(const uint64_t [])keys | |
958 count:(NSUInteger)count; | |
959 + (instancetype)dictionaryWithDictionary:(GPBUInt64DoubleDictionary *)dictionary
; | |
960 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | |
961 | |
962 - (instancetype)initWithValues:(const double [])values | |
963 forKeys:(const uint64_t [])keys | |
964 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
965 - (instancetype)initWithDictionary:(GPBUInt64DoubleDictionary *)dictionary; | |
966 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
967 | |
968 - (BOOL)valueForKey:(uint64_t)key value:(nullable double *)value; | |
969 | |
970 - (void)enumerateKeysAndValuesUsingBlock: | |
971 (void (^)(uint64_t key, double value, BOOL *stop))block; | |
972 | |
973 - (void)addEntriesFromDictionary:(GPBUInt64DoubleDictionary *)otherDictionary; | |
974 | |
975 - (void)setValue:(double)value forKey:(uint64_t)key; | |
976 | |
977 - (void)removeValueForKey:(uint64_t)aKey; | |
978 - (void)removeAll; | |
979 | |
980 @end | |
981 | |
982 #pragma mark - UInt64 -> Enum | |
983 | |
984 @interface GPBUInt64EnumDictionary : NSObject <NSCopying> | |
985 | |
986 @property(nonatomic, readonly) NSUInteger count; | |
987 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; | |
988 | |
989 + (instancetype)dictionary; | |
990 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func; | 3838 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func; |
| 3839 |
| 3840 /** |
| 3841 * Creates and initializes a dictionary with the single entry given. |
| 3842 * |
| 3843 * @param func The enum validation function for the dictionary. |
| 3844 * @param rawValue The raw enum value to be placed in the dictionary. |
| 3845 * @param key The key under which to store the value. |
| 3846 * |
| 3847 * @return A newly instanced dictionary with the key and value in it. |
| 3848 **/ |
991 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 3849 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
992 rawValue:(int32_t)rawValue | 3850 rawValue:(int32_t)rawValue |
993 forKey:(uint64_t)key; | 3851 forKey:(uint64_t)key; |
| 3852 |
| 3853 /** |
| 3854 * Creates and initializes a dictionary with the entries given. |
| 3855 * |
| 3856 * @param func The enum validation function for the dictionary. |
| 3857 * @param values The raw enum values values to be placed in the dictionary. |
| 3858 * @param keys The keys under which to store the values. |
| 3859 * @param count The number of entries to store in the dictionary. |
| 3860 * |
| 3861 * @return A newly instanced dictionary with the keys and values in it. |
| 3862 **/ |
994 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 3863 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
995 rawValues:(const int32_t [])values | 3864 rawValues:(const int32_t [])values |
996 forKeys:(const uint64_t [])keys | 3865 forKeys:(const uint64_t [])keys |
997 count:(NSUInteger)count; | 3866 count:(NSUInteger)count; |
| 3867 |
| 3868 /** |
| 3869 * Creates and initializes a dictionary with the entries from the given. |
| 3870 * dictionary. |
| 3871 * |
| 3872 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 3873 * |
| 3874 * @return A newly instanced dictionary with the entries from the given |
| 3875 * dictionary in it. |
| 3876 **/ |
998 + (instancetype)dictionaryWithDictionary:(GPBUInt64EnumDictionary *)dictionary; | 3877 + (instancetype)dictionaryWithDictionary:(GPBUInt64EnumDictionary *)dictionary; |
| 3878 |
| 3879 /** |
| 3880 * Creates and initializes a dictionary with the given capacity. |
| 3881 * |
| 3882 * @param func The enum validation function for the dictionary. |
| 3883 * @param numItems Capacity needed for the dictionary. |
| 3884 * |
| 3885 * @return A newly instanced dictionary with the given capacity. |
| 3886 **/ |
999 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 3887 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
1000 capacity:(NSUInteger)numItems; | 3888 capacity:(NSUInteger)numItems; |
1001 | 3889 |
| 3890 /** |
| 3891 * Initializes a dictionary with the given validation function. |
| 3892 * |
| 3893 * @param func The enum validation function for the dictionary. |
| 3894 * |
| 3895 * @return A newly initialized dictionary. |
| 3896 **/ |
1002 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; | 3897 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; |
| 3898 |
| 3899 /** |
| 3900 * Initializes a dictionary with the entries given. |
| 3901 * |
| 3902 * @param func The enum validation function for the dictionary. |
| 3903 * @param values The raw enum values values to be placed in the dictionary. |
| 3904 * @param keys The keys under which to store the values. |
| 3905 * @param count The number of entries to store in the dictionary. |
| 3906 * |
| 3907 * @return A newly initialized dictionary with the keys and values in it. |
| 3908 **/ |
1003 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func | 3909 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func |
1004 rawValues:(const int32_t [])values | 3910 rawValues:(const int32_t [])values |
1005 forKeys:(const uint64_t [])keys | 3911 forKeys:(const uint64_t [])keys |
1006 count:(NSUInteger)count NS_DESIGNATED_INITI
ALIZER; | 3912 count:(NSUInteger)count NS_DESIGNATED_INITI
ALIZER; |
| 3913 |
| 3914 /** |
| 3915 * Initializes a dictionary with the entries from the given. |
| 3916 * dictionary. |
| 3917 * |
| 3918 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 3919 * |
| 3920 * @return A newly initialized dictionary with the entries from the given |
| 3921 * dictionary in it. |
| 3922 **/ |
1007 - (instancetype)initWithDictionary:(GPBUInt64EnumDictionary *)dictionary; | 3923 - (instancetype)initWithDictionary:(GPBUInt64EnumDictionary *)dictionary; |
| 3924 |
| 3925 /** |
| 3926 * Initializes a dictionary with the given capacity. |
| 3927 * |
| 3928 * @param func The enum validation function for the dictionary. |
| 3929 * @param numItems Capacity needed for the dictionary. |
| 3930 * |
| 3931 * @return A newly initialized dictionary with the given capacity. |
| 3932 **/ |
1008 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func | 3933 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func |
1009 capacity:(NSUInteger)numItems; | 3934 capacity:(NSUInteger)numItems; |
1010 | 3935 |
1011 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key | 3936 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key |
1012 // is not a valid enumerator as defined by validationFunc. If the actual value i
s | 3937 // is not a valid enumerator as defined by validationFunc. If the actual value i
s |
1013 // desired, use "raw" version of the method. | 3938 // desired, use "raw" version of the method. |
1014 | 3939 |
1015 - (BOOL)valueForKey:(uint64_t)key value:(nullable int32_t *)value; | 3940 /** |
| 3941 * Gets the value for the given key. |
| 3942 * |
| 3943 * @param value Pointer into which the value will be set, if found. |
| 3944 * @param key Key under which the value is stored, if present. |
| 3945 * |
| 3946 * @return YES if the key was found and the value was copied, NO otherwise. |
| 3947 **/ |
| 3948 - (BOOL)getEnum:(nullable int32_t *)value forKey:(uint64_t)key; |
1016 | 3949 |
1017 - (void)enumerateKeysAndValuesUsingBlock: | 3950 /** |
| 3951 * Enumerates the keys and values on this dictionary with the given block. |
| 3952 * |
| 3953 * @param block The block to enumerate with. |
| 3954 * **key**: The key for the current entry. |
| 3955 * **value**: The value for the current entry |
| 3956 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 3957 **/ |
| 3958 - (void)enumerateKeysAndEnumsUsingBlock: |
1018 (void (^)(uint64_t key, int32_t value, BOOL *stop))block; | 3959 (void (^)(uint64_t key, int32_t value, BOOL *stop))block; |
1019 | 3960 |
1020 // These methods bypass the validationFunc to provide access to values that were
not | 3961 /** |
1021 // known at the time the binary was compiled. | 3962 * Gets the raw enum value for the given key. |
| 3963 * |
| 3964 * @note This method bypass the validationFunc to enable the access of values th
at |
| 3965 * were not known at the time the binary was compiled. |
| 3966 * |
| 3967 * @param rawValue Pointer into which the value will be set, if found. |
| 3968 * @param key Key under which the value is stored, if present. |
| 3969 * |
| 3970 * @return YES if the key was found and the value was copied, NO otherwise. |
| 3971 **/ |
| 3972 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint64_t)key; |
1022 | 3973 |
1023 - (BOOL)valueForKey:(uint64_t)key rawValue:(nullable int32_t *)rawValue; | 3974 /** |
1024 | 3975 * Enumerates the keys and values on this dictionary with the given block. |
| 3976 * |
| 3977 * @note This method bypass the validationFunc to enable the access of values th
at |
| 3978 * were not known at the time the binary was compiled. |
| 3979 * |
| 3980 * @param block The block to enumerate with. |
| 3981 * **key**: The key for the current entry. |
| 3982 * **rawValue**: The value for the current entry |
| 3983 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 3984 **/ |
1025 - (void)enumerateKeysAndRawValuesUsingBlock: | 3985 - (void)enumerateKeysAndRawValuesUsingBlock: |
1026 (void (^)(uint64_t key, int32_t rawValue, BOOL *stop))block; | 3986 (void (^)(uint64_t key, int32_t rawValue, BOOL *stop))block; |
1027 | 3987 |
| 3988 /** |
| 3989 * Adds the keys and raw enum values from another dictionary. |
| 3990 * |
| 3991 * @note This method bypass the validationFunc to enable the setting of values t
hat |
| 3992 * were not known at the time the binary was compiled. |
| 3993 * |
| 3994 * @param otherDictionary Dictionary containing entries to be added to this |
| 3995 * dictionary. |
| 3996 **/ |
1028 - (void)addRawEntriesFromDictionary:(GPBUInt64EnumDictionary *)otherDictionary; | 3997 - (void)addRawEntriesFromDictionary:(GPBUInt64EnumDictionary *)otherDictionary; |
1029 | 3998 |
1030 // If value is not a valid enumerator as defined by validationFunc, these | 3999 // If value is not a valid enumerator as defined by validationFunc, these |
1031 // methods will assert in debug, and will log in release and assign the value | 4000 // methods will assert in debug, and will log in release and assign the value |
1032 // to the default value. Use the rawValue methods below to assign non enumerator | 4001 // to the default value. Use the rawValue methods below to assign non enumerator |
1033 // values. | 4002 // values. |
1034 | 4003 |
1035 - (void)setValue:(int32_t)value forKey:(uint64_t)key; | 4004 /** |
1036 | 4005 * Sets the value for the given key. |
1037 // This method bypass the validationFunc to provide setting of values that were
not | 4006 * |
1038 // known at the time the binary was compiled. | 4007 * @param value The value to set. |
| 4008 * @param key The key under which to store the value. |
| 4009 **/ |
| 4010 - (void)setEnum:(int32_t)value forKey:(uint64_t)key; |
| 4011 |
| 4012 /** |
| 4013 * Sets the raw enum value for the given key. |
| 4014 * |
| 4015 * @note This method bypass the validationFunc to enable the setting of values t
hat |
| 4016 * were not known at the time the binary was compiled. |
| 4017 * |
| 4018 * @param rawValue The raw enum value to set. |
| 4019 * @param key The key under which to store the raw enum value. |
| 4020 **/ |
1039 - (void)setRawValue:(int32_t)rawValue forKey:(uint64_t)key; | 4021 - (void)setRawValue:(int32_t)rawValue forKey:(uint64_t)key; |
1040 | 4022 |
1041 // No validation applies to these methods. | 4023 /** |
1042 | 4024 * Removes the entry for the given key. |
1043 - (void)removeValueForKey:(uint64_t)aKey; | 4025 * |
| 4026 * @param aKey Key to be removed from this dictionary. |
| 4027 **/ |
| 4028 - (void)removeEnumForKey:(uint64_t)aKey; |
| 4029 |
| 4030 /** |
| 4031 * Removes all entries in this dictionary. |
| 4032 **/ |
1044 - (void)removeAll; | 4033 - (void)removeAll; |
1045 | 4034 |
1046 @end | 4035 @end |
1047 | 4036 |
1048 #pragma mark - UInt64 -> Object | 4037 #pragma mark - UInt64 -> Object |
1049 | 4038 |
| 4039 /** |
| 4040 * Class used for map fields of <uint64_t, ObjectType> |
| 4041 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 4042 * |
| 4043 * @note This class is not meant to be subclassed. |
| 4044 **/ |
1050 @interface GPBUInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyi
ng> | 4045 @interface GPBUInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyi
ng> |
1051 | 4046 |
| 4047 /** Number of entries stored in this dictionary. */ |
1052 @property(nonatomic, readonly) NSUInteger count; | 4048 @property(nonatomic, readonly) NSUInteger count; |
1053 | 4049 |
| 4050 /** |
| 4051 * @return A newly instanced and empty dictionary. |
| 4052 **/ |
1054 + (instancetype)dictionary; | 4053 + (instancetype)dictionary; |
| 4054 |
| 4055 /** |
| 4056 * Creates and initializes a dictionary with the single entry given. |
| 4057 * |
| 4058 * @param object The value to be placed in the dictionary. |
| 4059 * @param key The key under which to store the value. |
| 4060 * |
| 4061 * @return A newly instanced dictionary with the key and value in it. |
| 4062 **/ |
1055 + (instancetype)dictionaryWithObject:(ObjectType)object | 4063 + (instancetype)dictionaryWithObject:(ObjectType)object |
1056 forKey:(uint64_t)key; | 4064 forKey:(uint64_t)key; |
| 4065 |
| 4066 /** |
| 4067 * Creates and initializes a dictionary with the entries given. |
| 4068 * |
| 4069 * @param objects The values to be placed in the dictionary. |
| 4070 * @param keys The keys under which to store the values. |
| 4071 * @param count The number of entries to store in the dictionary. |
| 4072 * |
| 4073 * @return A newly instanced dictionary with the keys and values in it. |
| 4074 **/ |
1057 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED []
)objects | 4075 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED []
)objects |
1058 forKeys:(const uint64_t [])keys | 4076 forKeys:(const uint64_t [])keys |
1059 count:(NSUInteger)count; | 4077 count:(NSUInteger)count; |
| 4078 |
| 4079 /** |
| 4080 * Creates and initializes a dictionary with the entries from the given. |
| 4081 * dictionary. |
| 4082 * |
| 4083 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 4084 * |
| 4085 * @return A newly instanced dictionary with the entries from the given |
| 4086 * dictionary in it. |
| 4087 **/ |
1060 + (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary
; | 4088 + (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary
; |
| 4089 |
| 4090 /** |
| 4091 * Creates and initializes a dictionary with the given capacity. |
| 4092 * |
| 4093 * @param numItems Capacity needed for the dictionary. |
| 4094 * |
| 4095 * @return A newly instanced dictionary with the given capacity. |
| 4096 **/ |
1061 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 4097 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1062 | 4098 |
| 4099 /** |
| 4100 * Initializes this dictionary, copying the given values and keys. |
| 4101 * |
| 4102 * @param objects The values to be placed in this dictionary. |
| 4103 * @param keys The keys under which to store the values. |
| 4104 * @param count The number of elements to copy into the dictionary. |
| 4105 * |
| 4106 * @return A newly initialized dictionary with a copy of the values and keys. |
| 4107 **/ |
1063 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec
ts | 4108 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec
ts |
1064 forKeys:(const uint64_t [])keys | 4109 forKeys:(const uint64_t [])keys |
1065 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 4110 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 4111 |
| 4112 /** |
| 4113 * Initializes this dictionary, copying the entries from the given dictionary. |
| 4114 * |
| 4115 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 4116 * |
| 4117 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 4118 **/ |
1066 - (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary; | 4119 - (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary; |
| 4120 |
| 4121 /** |
| 4122 * Initializes this dictionary with the requested capacity. |
| 4123 * |
| 4124 * @param numItems Number of items needed for this dictionary. |
| 4125 * |
| 4126 * @return A newly initialized dictionary with the requested capacity. |
| 4127 **/ |
1067 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 4128 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1068 | 4129 |
| 4130 /** |
| 4131 * Fetches the object stored under the given key. |
| 4132 * |
| 4133 * @param key Key under which the value is stored, if present. |
| 4134 * |
| 4135 * @return The object if found, nil otherwise. |
| 4136 **/ |
1069 - (ObjectType)objectForKey:(uint64_t)key; | 4137 - (ObjectType)objectForKey:(uint64_t)key; |
1070 | 4138 |
| 4139 /** |
| 4140 * Enumerates the keys and values on this dictionary with the given block. |
| 4141 * |
| 4142 * @param block The block to enumerate with. |
| 4143 * **key**: The key for the current entry. |
| 4144 * **object**: The value for the current entry |
| 4145 * **stop**: A pointer to a boolean that when set stops the enumeration
. |
| 4146 **/ |
1071 - (void)enumerateKeysAndObjectsUsingBlock: | 4147 - (void)enumerateKeysAndObjectsUsingBlock: |
1072 (void (^)(uint64_t key, ObjectType object, BOOL *stop))block; | 4148 (void (^)(uint64_t key, ObjectType object, BOOL *stop))block; |
1073 | 4149 |
| 4150 /** |
| 4151 * Adds the keys and values from another dictionary. |
| 4152 * |
| 4153 * @param otherDictionary Dictionary containing entries to be added to this |
| 4154 * dictionary. |
| 4155 **/ |
1074 - (void)addEntriesFromDictionary:(GPBUInt64ObjectDictionary *)otherDictionary; | 4156 - (void)addEntriesFromDictionary:(GPBUInt64ObjectDictionary *)otherDictionary; |
1075 | 4157 |
| 4158 /** |
| 4159 * Sets the value for the given key. |
| 4160 * |
| 4161 * @param object The value to set. |
| 4162 * @param key The key under which to store the value. |
| 4163 **/ |
1076 - (void)setObject:(ObjectType)object forKey:(uint64_t)key; | 4164 - (void)setObject:(ObjectType)object forKey:(uint64_t)key; |
1077 | 4165 |
| 4166 /** |
| 4167 * Removes the entry for the given key. |
| 4168 * |
| 4169 * @param aKey Key to be removed from this dictionary. |
| 4170 **/ |
1078 - (void)removeObjectForKey:(uint64_t)aKey; | 4171 - (void)removeObjectForKey:(uint64_t)aKey; |
| 4172 |
| 4173 /** |
| 4174 * Removes all entries in this dictionary. |
| 4175 **/ |
1079 - (void)removeAll; | 4176 - (void)removeAll; |
1080 | 4177 |
1081 @end | 4178 @end |
1082 | 4179 |
1083 #pragma mark - Int64 -> UInt32 | 4180 #pragma mark - Int64 -> UInt32 |
1084 | 4181 |
| 4182 /** |
| 4183 * Class used for map fields of <int64_t, uint32_t> |
| 4184 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 4185 * |
| 4186 * @note This class is not meant to be subclassed. |
| 4187 **/ |
1085 @interface GPBInt64UInt32Dictionary : NSObject <NSCopying> | 4188 @interface GPBInt64UInt32Dictionary : NSObject <NSCopying> |
1086 | 4189 |
| 4190 /** Number of entries stored in this dictionary. */ |
1087 @property(nonatomic, readonly) NSUInteger count; | 4191 @property(nonatomic, readonly) NSUInteger count; |
1088 | 4192 |
| 4193 /** |
| 4194 * @return A newly instanced and empty dictionary. |
| 4195 **/ |
1089 + (instancetype)dictionary; | 4196 + (instancetype)dictionary; |
1090 + (instancetype)dictionaryWithValue:(uint32_t)value | 4197 |
| 4198 /** |
| 4199 * Creates and initializes a dictionary with the single entry given. |
| 4200 * |
| 4201 * @param value The value to be placed in the dictionary. |
| 4202 * @param key The key under which to store the value. |
| 4203 * |
| 4204 * @return A newly instanced dictionary with the key and value in it. |
| 4205 **/ |
| 4206 + (instancetype)dictionaryWithUInt32:(uint32_t)value |
| 4207 forKey:(int64_t)key; |
| 4208 |
| 4209 /** |
| 4210 * Creates and initializes a dictionary with the entries given. |
| 4211 * |
| 4212 * @param values The values to be placed in the dictionary. |
| 4213 * @param keys The keys under which to store the values. |
| 4214 * @param count The number of entries to store in the dictionary. |
| 4215 * |
| 4216 * @return A newly instanced dictionary with the keys and values in it. |
| 4217 **/ |
| 4218 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values |
| 4219 forKeys:(const int64_t [])keys |
| 4220 count:(NSUInteger)count; |
| 4221 |
| 4222 /** |
| 4223 * Creates and initializes a dictionary with the entries from the given. |
| 4224 * dictionary. |
| 4225 * |
| 4226 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 4227 * |
| 4228 * @return A newly instanced dictionary with the entries from the given |
| 4229 * dictionary in it. |
| 4230 **/ |
| 4231 + (instancetype)dictionaryWithDictionary:(GPBInt64UInt32Dictionary *)dictionary; |
| 4232 |
| 4233 /** |
| 4234 * Creates and initializes a dictionary with the given capacity. |
| 4235 * |
| 4236 * @param numItems Capacity needed for the dictionary. |
| 4237 * |
| 4238 * @return A newly instanced dictionary with the given capacity. |
| 4239 **/ |
| 4240 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 4241 |
| 4242 /** |
| 4243 * Initializes this dictionary, copying the given values and keys. |
| 4244 * |
| 4245 * @param values The values to be placed in this dictionary. |
| 4246 * @param keys The keys under which to store the values. |
| 4247 * @param count The number of elements to copy into the dictionary. |
| 4248 * |
| 4249 * @return A newly initialized dictionary with a copy of the values and keys. |
| 4250 **/ |
| 4251 - (instancetype)initWithUInt32s:(const uint32_t [])values |
| 4252 forKeys:(const int64_t [])keys |
| 4253 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 4254 |
| 4255 /** |
| 4256 * Initializes this dictionary, copying the entries from the given dictionary. |
| 4257 * |
| 4258 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 4259 * |
| 4260 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 4261 **/ |
| 4262 - (instancetype)initWithDictionary:(GPBInt64UInt32Dictionary *)dictionary; |
| 4263 |
| 4264 /** |
| 4265 * Initializes this dictionary with the requested capacity. |
| 4266 * |
| 4267 * @param numItems Number of items needed for this dictionary. |
| 4268 * |
| 4269 * @return A newly initialized dictionary with the requested capacity. |
| 4270 **/ |
| 4271 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 4272 |
| 4273 /** |
| 4274 * Gets the value for the given key. |
| 4275 * |
| 4276 * @param value Pointer into which the value will be set, if found. |
| 4277 * @param key Key under which the value is stored, if present. |
| 4278 * |
| 4279 * @return YES if the key was found and the value was copied, NO otherwise. |
| 4280 **/ |
| 4281 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int64_t)key; |
| 4282 |
| 4283 /** |
| 4284 * Enumerates the keys and values on this dictionary with the given block. |
| 4285 * |
| 4286 * @param block The block to enumerate with. |
| 4287 * **key**: The key for the current entry. |
| 4288 * **value**: The value for the current entry |
| 4289 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 4290 **/ |
| 4291 - (void)enumerateKeysAndUInt32sUsingBlock: |
| 4292 (void (^)(int64_t key, uint32_t value, BOOL *stop))block; |
| 4293 |
| 4294 /** |
| 4295 * Adds the keys and values from another dictionary. |
| 4296 * |
| 4297 * @param otherDictionary Dictionary containing entries to be added to this |
| 4298 * dictionary. |
| 4299 **/ |
| 4300 - (void)addEntriesFromDictionary:(GPBInt64UInt32Dictionary *)otherDictionary; |
| 4301 |
| 4302 /** |
| 4303 * Sets the value for the given key. |
| 4304 * |
| 4305 * @param value The value to set. |
| 4306 * @param key The key under which to store the value. |
| 4307 **/ |
| 4308 - (void)setUInt32:(uint32_t)value forKey:(int64_t)key; |
| 4309 |
| 4310 /** |
| 4311 * Removes the entry for the given key. |
| 4312 * |
| 4313 * @param aKey Key to be removed from this dictionary. |
| 4314 **/ |
| 4315 - (void)removeUInt32ForKey:(int64_t)aKey; |
| 4316 |
| 4317 /** |
| 4318 * Removes all entries in this dictionary. |
| 4319 **/ |
| 4320 - (void)removeAll; |
| 4321 |
| 4322 @end |
| 4323 |
| 4324 #pragma mark - Int64 -> Int32 |
| 4325 |
| 4326 /** |
| 4327 * Class used for map fields of <int64_t, int32_t> |
| 4328 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 4329 * |
| 4330 * @note This class is not meant to be subclassed. |
| 4331 **/ |
| 4332 @interface GPBInt64Int32Dictionary : NSObject <NSCopying> |
| 4333 |
| 4334 /** Number of entries stored in this dictionary. */ |
| 4335 @property(nonatomic, readonly) NSUInteger count; |
| 4336 |
| 4337 /** |
| 4338 * @return A newly instanced and empty dictionary. |
| 4339 **/ |
| 4340 + (instancetype)dictionary; |
| 4341 |
| 4342 /** |
| 4343 * Creates and initializes a dictionary with the single entry given. |
| 4344 * |
| 4345 * @param value The value to be placed in the dictionary. |
| 4346 * @param key The key under which to store the value. |
| 4347 * |
| 4348 * @return A newly instanced dictionary with the key and value in it. |
| 4349 **/ |
| 4350 + (instancetype)dictionaryWithInt32:(int32_t)value |
1091 forKey:(int64_t)key; | 4351 forKey:(int64_t)key; |
1092 + (instancetype)dictionaryWithValues:(const uint32_t [])values | 4352 |
| 4353 /** |
| 4354 * Creates and initializes a dictionary with the entries given. |
| 4355 * |
| 4356 * @param values The values to be placed in the dictionary. |
| 4357 * @param keys The keys under which to store the values. |
| 4358 * @param count The number of entries to store in the dictionary. |
| 4359 * |
| 4360 * @return A newly instanced dictionary with the keys and values in it. |
| 4361 **/ |
| 4362 + (instancetype)dictionaryWithInt32s:(const int32_t [])values |
1093 forKeys:(const int64_t [])keys | 4363 forKeys:(const int64_t [])keys |
1094 count:(NSUInteger)count; | 4364 count:(NSUInteger)count; |
1095 + (instancetype)dictionaryWithDictionary:(GPBInt64UInt32Dictionary *)dictionary; | 4365 |
| 4366 /** |
| 4367 * Creates and initializes a dictionary with the entries from the given. |
| 4368 * dictionary. |
| 4369 * |
| 4370 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 4371 * |
| 4372 * @return A newly instanced dictionary with the entries from the given |
| 4373 * dictionary in it. |
| 4374 **/ |
| 4375 + (instancetype)dictionaryWithDictionary:(GPBInt64Int32Dictionary *)dictionary; |
| 4376 |
| 4377 /** |
| 4378 * Creates and initializes a dictionary with the given capacity. |
| 4379 * |
| 4380 * @param numItems Capacity needed for the dictionary. |
| 4381 * |
| 4382 * @return A newly instanced dictionary with the given capacity. |
| 4383 **/ |
1096 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 4384 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1097 | 4385 |
1098 - (instancetype)initWithValues:(const uint32_t [])values | 4386 /** |
| 4387 * Initializes this dictionary, copying the given values and keys. |
| 4388 * |
| 4389 * @param values The values to be placed in this dictionary. |
| 4390 * @param keys The keys under which to store the values. |
| 4391 * @param count The number of elements to copy into the dictionary. |
| 4392 * |
| 4393 * @return A newly initialized dictionary with a copy of the values and keys. |
| 4394 **/ |
| 4395 - (instancetype)initWithInt32s:(const int32_t [])values |
1099 forKeys:(const int64_t [])keys | 4396 forKeys:(const int64_t [])keys |
1100 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 4397 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
1101 - (instancetype)initWithDictionary:(GPBInt64UInt32Dictionary *)dictionary; | 4398 |
| 4399 /** |
| 4400 * Initializes this dictionary, copying the entries from the given dictionary. |
| 4401 * |
| 4402 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 4403 * |
| 4404 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 4405 **/ |
| 4406 - (instancetype)initWithDictionary:(GPBInt64Int32Dictionary *)dictionary; |
| 4407 |
| 4408 /** |
| 4409 * Initializes this dictionary with the requested capacity. |
| 4410 * |
| 4411 * @param numItems Number of items needed for this dictionary. |
| 4412 * |
| 4413 * @return A newly initialized dictionary with the requested capacity. |
| 4414 **/ |
1102 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 4415 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1103 | 4416 |
1104 - (BOOL)valueForKey:(int64_t)key value:(nullable uint32_t *)value; | 4417 /** |
1105 | 4418 * Gets the value for the given key. |
1106 - (void)enumerateKeysAndValuesUsingBlock: | 4419 * |
1107 (void (^)(int64_t key, uint32_t value, BOOL *stop))block; | 4420 * @param value Pointer into which the value will be set, if found. |
1108 | 4421 * @param key Key under which the value is stored, if present. |
1109 - (void)addEntriesFromDictionary:(GPBInt64UInt32Dictionary *)otherDictionary; | 4422 * |
1110 | 4423 * @return YES if the key was found and the value was copied, NO otherwise. |
1111 - (void)setValue:(uint32_t)value forKey:(int64_t)key; | 4424 **/ |
1112 | 4425 - (BOOL)getInt32:(nullable int32_t *)value forKey:(int64_t)key; |
1113 - (void)removeValueForKey:(int64_t)aKey; | 4426 |
| 4427 /** |
| 4428 * Enumerates the keys and values on this dictionary with the given block. |
| 4429 * |
| 4430 * @param block The block to enumerate with. |
| 4431 * **key**: The key for the current entry. |
| 4432 * **value**: The value for the current entry |
| 4433 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 4434 **/ |
| 4435 - (void)enumerateKeysAndInt32sUsingBlock: |
| 4436 (void (^)(int64_t key, int32_t value, BOOL *stop))block; |
| 4437 |
| 4438 /** |
| 4439 * Adds the keys and values from another dictionary. |
| 4440 * |
| 4441 * @param otherDictionary Dictionary containing entries to be added to this |
| 4442 * dictionary. |
| 4443 **/ |
| 4444 - (void)addEntriesFromDictionary:(GPBInt64Int32Dictionary *)otherDictionary; |
| 4445 |
| 4446 /** |
| 4447 * Sets the value for the given key. |
| 4448 * |
| 4449 * @param value The value to set. |
| 4450 * @param key The key under which to store the value. |
| 4451 **/ |
| 4452 - (void)setInt32:(int32_t)value forKey:(int64_t)key; |
| 4453 |
| 4454 /** |
| 4455 * Removes the entry for the given key. |
| 4456 * |
| 4457 * @param aKey Key to be removed from this dictionary. |
| 4458 **/ |
| 4459 - (void)removeInt32ForKey:(int64_t)aKey; |
| 4460 |
| 4461 /** |
| 4462 * Removes all entries in this dictionary. |
| 4463 **/ |
1114 - (void)removeAll; | 4464 - (void)removeAll; |
1115 | 4465 |
1116 @end | 4466 @end |
1117 | 4467 |
1118 #pragma mark - Int64 -> Int32 | 4468 #pragma mark - Int64 -> UInt64 |
1119 | 4469 |
1120 @interface GPBInt64Int32Dictionary : NSObject <NSCopying> | 4470 /** |
1121 | 4471 * Class used for map fields of <int64_t, uint64_t> |
| 4472 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 4473 * |
| 4474 * @note This class is not meant to be subclassed. |
| 4475 **/ |
| 4476 @interface GPBInt64UInt64Dictionary : NSObject <NSCopying> |
| 4477 |
| 4478 /** Number of entries stored in this dictionary. */ |
1122 @property(nonatomic, readonly) NSUInteger count; | 4479 @property(nonatomic, readonly) NSUInteger count; |
1123 | 4480 |
| 4481 /** |
| 4482 * @return A newly instanced and empty dictionary. |
| 4483 **/ |
1124 + (instancetype)dictionary; | 4484 + (instancetype)dictionary; |
1125 + (instancetype)dictionaryWithValue:(int32_t)value | 4485 |
| 4486 /** |
| 4487 * Creates and initializes a dictionary with the single entry given. |
| 4488 * |
| 4489 * @param value The value to be placed in the dictionary. |
| 4490 * @param key The key under which to store the value. |
| 4491 * |
| 4492 * @return A newly instanced dictionary with the key and value in it. |
| 4493 **/ |
| 4494 + (instancetype)dictionaryWithUInt64:(uint64_t)value |
| 4495 forKey:(int64_t)key; |
| 4496 |
| 4497 /** |
| 4498 * Creates and initializes a dictionary with the entries given. |
| 4499 * |
| 4500 * @param values The values to be placed in the dictionary. |
| 4501 * @param keys The keys under which to store the values. |
| 4502 * @param count The number of entries to store in the dictionary. |
| 4503 * |
| 4504 * @return A newly instanced dictionary with the keys and values in it. |
| 4505 **/ |
| 4506 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values |
| 4507 forKeys:(const int64_t [])keys |
| 4508 count:(NSUInteger)count; |
| 4509 |
| 4510 /** |
| 4511 * Creates and initializes a dictionary with the entries from the given. |
| 4512 * dictionary. |
| 4513 * |
| 4514 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 4515 * |
| 4516 * @return A newly instanced dictionary with the entries from the given |
| 4517 * dictionary in it. |
| 4518 **/ |
| 4519 + (instancetype)dictionaryWithDictionary:(GPBInt64UInt64Dictionary *)dictionary; |
| 4520 |
| 4521 /** |
| 4522 * Creates and initializes a dictionary with the given capacity. |
| 4523 * |
| 4524 * @param numItems Capacity needed for the dictionary. |
| 4525 * |
| 4526 * @return A newly instanced dictionary with the given capacity. |
| 4527 **/ |
| 4528 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 4529 |
| 4530 /** |
| 4531 * Initializes this dictionary, copying the given values and keys. |
| 4532 * |
| 4533 * @param values The values to be placed in this dictionary. |
| 4534 * @param keys The keys under which to store the values. |
| 4535 * @param count The number of elements to copy into the dictionary. |
| 4536 * |
| 4537 * @return A newly initialized dictionary with a copy of the values and keys. |
| 4538 **/ |
| 4539 - (instancetype)initWithUInt64s:(const uint64_t [])values |
| 4540 forKeys:(const int64_t [])keys |
| 4541 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 4542 |
| 4543 /** |
| 4544 * Initializes this dictionary, copying the entries from the given dictionary. |
| 4545 * |
| 4546 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 4547 * |
| 4548 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 4549 **/ |
| 4550 - (instancetype)initWithDictionary:(GPBInt64UInt64Dictionary *)dictionary; |
| 4551 |
| 4552 /** |
| 4553 * Initializes this dictionary with the requested capacity. |
| 4554 * |
| 4555 * @param numItems Number of items needed for this dictionary. |
| 4556 * |
| 4557 * @return A newly initialized dictionary with the requested capacity. |
| 4558 **/ |
| 4559 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 4560 |
| 4561 /** |
| 4562 * Gets the value for the given key. |
| 4563 * |
| 4564 * @param value Pointer into which the value will be set, if found. |
| 4565 * @param key Key under which the value is stored, if present. |
| 4566 * |
| 4567 * @return YES if the key was found and the value was copied, NO otherwise. |
| 4568 **/ |
| 4569 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int64_t)key; |
| 4570 |
| 4571 /** |
| 4572 * Enumerates the keys and values on this dictionary with the given block. |
| 4573 * |
| 4574 * @param block The block to enumerate with. |
| 4575 * **key**: The key for the current entry. |
| 4576 * **value**: The value for the current entry |
| 4577 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 4578 **/ |
| 4579 - (void)enumerateKeysAndUInt64sUsingBlock: |
| 4580 (void (^)(int64_t key, uint64_t value, BOOL *stop))block; |
| 4581 |
| 4582 /** |
| 4583 * Adds the keys and values from another dictionary. |
| 4584 * |
| 4585 * @param otherDictionary Dictionary containing entries to be added to this |
| 4586 * dictionary. |
| 4587 **/ |
| 4588 - (void)addEntriesFromDictionary:(GPBInt64UInt64Dictionary *)otherDictionary; |
| 4589 |
| 4590 /** |
| 4591 * Sets the value for the given key. |
| 4592 * |
| 4593 * @param value The value to set. |
| 4594 * @param key The key under which to store the value. |
| 4595 **/ |
| 4596 - (void)setUInt64:(uint64_t)value forKey:(int64_t)key; |
| 4597 |
| 4598 /** |
| 4599 * Removes the entry for the given key. |
| 4600 * |
| 4601 * @param aKey Key to be removed from this dictionary. |
| 4602 **/ |
| 4603 - (void)removeUInt64ForKey:(int64_t)aKey; |
| 4604 |
| 4605 /** |
| 4606 * Removes all entries in this dictionary. |
| 4607 **/ |
| 4608 - (void)removeAll; |
| 4609 |
| 4610 @end |
| 4611 |
| 4612 #pragma mark - Int64 -> Int64 |
| 4613 |
| 4614 /** |
| 4615 * Class used for map fields of <int64_t, int64_t> |
| 4616 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 4617 * |
| 4618 * @note This class is not meant to be subclassed. |
| 4619 **/ |
| 4620 @interface GPBInt64Int64Dictionary : NSObject <NSCopying> |
| 4621 |
| 4622 /** Number of entries stored in this dictionary. */ |
| 4623 @property(nonatomic, readonly) NSUInteger count; |
| 4624 |
| 4625 /** |
| 4626 * @return A newly instanced and empty dictionary. |
| 4627 **/ |
| 4628 + (instancetype)dictionary; |
| 4629 |
| 4630 /** |
| 4631 * Creates and initializes a dictionary with the single entry given. |
| 4632 * |
| 4633 * @param value The value to be placed in the dictionary. |
| 4634 * @param key The key under which to store the value. |
| 4635 * |
| 4636 * @return A newly instanced dictionary with the key and value in it. |
| 4637 **/ |
| 4638 + (instancetype)dictionaryWithInt64:(int64_t)value |
1126 forKey:(int64_t)key; | 4639 forKey:(int64_t)key; |
1127 + (instancetype)dictionaryWithValues:(const int32_t [])values | 4640 |
| 4641 /** |
| 4642 * Creates and initializes a dictionary with the entries given. |
| 4643 * |
| 4644 * @param values The values to be placed in the dictionary. |
| 4645 * @param keys The keys under which to store the values. |
| 4646 * @param count The number of entries to store in the dictionary. |
| 4647 * |
| 4648 * @return A newly instanced dictionary with the keys and values in it. |
| 4649 **/ |
| 4650 + (instancetype)dictionaryWithInt64s:(const int64_t [])values |
1128 forKeys:(const int64_t [])keys | 4651 forKeys:(const int64_t [])keys |
1129 count:(NSUInteger)count; | 4652 count:(NSUInteger)count; |
1130 + (instancetype)dictionaryWithDictionary:(GPBInt64Int32Dictionary *)dictionary; | 4653 |
| 4654 /** |
| 4655 * Creates and initializes a dictionary with the entries from the given. |
| 4656 * dictionary. |
| 4657 * |
| 4658 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 4659 * |
| 4660 * @return A newly instanced dictionary with the entries from the given |
| 4661 * dictionary in it. |
| 4662 **/ |
| 4663 + (instancetype)dictionaryWithDictionary:(GPBInt64Int64Dictionary *)dictionary; |
| 4664 |
| 4665 /** |
| 4666 * Creates and initializes a dictionary with the given capacity. |
| 4667 * |
| 4668 * @param numItems Capacity needed for the dictionary. |
| 4669 * |
| 4670 * @return A newly instanced dictionary with the given capacity. |
| 4671 **/ |
1131 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 4672 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1132 | 4673 |
1133 - (instancetype)initWithValues:(const int32_t [])values | 4674 /** |
| 4675 * Initializes this dictionary, copying the given values and keys. |
| 4676 * |
| 4677 * @param values The values to be placed in this dictionary. |
| 4678 * @param keys The keys under which to store the values. |
| 4679 * @param count The number of elements to copy into the dictionary. |
| 4680 * |
| 4681 * @return A newly initialized dictionary with a copy of the values and keys. |
| 4682 **/ |
| 4683 - (instancetype)initWithInt64s:(const int64_t [])values |
1134 forKeys:(const int64_t [])keys | 4684 forKeys:(const int64_t [])keys |
1135 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 4685 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
1136 - (instancetype)initWithDictionary:(GPBInt64Int32Dictionary *)dictionary; | 4686 |
| 4687 /** |
| 4688 * Initializes this dictionary, copying the entries from the given dictionary. |
| 4689 * |
| 4690 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 4691 * |
| 4692 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 4693 **/ |
| 4694 - (instancetype)initWithDictionary:(GPBInt64Int64Dictionary *)dictionary; |
| 4695 |
| 4696 /** |
| 4697 * Initializes this dictionary with the requested capacity. |
| 4698 * |
| 4699 * @param numItems Number of items needed for this dictionary. |
| 4700 * |
| 4701 * @return A newly initialized dictionary with the requested capacity. |
| 4702 **/ |
1137 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 4703 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1138 | 4704 |
1139 - (BOOL)valueForKey:(int64_t)key value:(nullable int32_t *)value; | 4705 /** |
1140 | 4706 * Gets the value for the given key. |
1141 - (void)enumerateKeysAndValuesUsingBlock: | 4707 * |
1142 (void (^)(int64_t key, int32_t value, BOOL *stop))block; | 4708 * @param value Pointer into which the value will be set, if found. |
1143 | 4709 * @param key Key under which the value is stored, if present. |
1144 - (void)addEntriesFromDictionary:(GPBInt64Int32Dictionary *)otherDictionary; | 4710 * |
1145 | 4711 * @return YES if the key was found and the value was copied, NO otherwise. |
1146 - (void)setValue:(int32_t)value forKey:(int64_t)key; | 4712 **/ |
1147 | 4713 - (BOOL)getInt64:(nullable int64_t *)value forKey:(int64_t)key; |
1148 - (void)removeValueForKey:(int64_t)aKey; | 4714 |
| 4715 /** |
| 4716 * Enumerates the keys and values on this dictionary with the given block. |
| 4717 * |
| 4718 * @param block The block to enumerate with. |
| 4719 * **key**: The key for the current entry. |
| 4720 * **value**: The value for the current entry |
| 4721 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 4722 **/ |
| 4723 - (void)enumerateKeysAndInt64sUsingBlock: |
| 4724 (void (^)(int64_t key, int64_t value, BOOL *stop))block; |
| 4725 |
| 4726 /** |
| 4727 * Adds the keys and values from another dictionary. |
| 4728 * |
| 4729 * @param otherDictionary Dictionary containing entries to be added to this |
| 4730 * dictionary. |
| 4731 **/ |
| 4732 - (void)addEntriesFromDictionary:(GPBInt64Int64Dictionary *)otherDictionary; |
| 4733 |
| 4734 /** |
| 4735 * Sets the value for the given key. |
| 4736 * |
| 4737 * @param value The value to set. |
| 4738 * @param key The key under which to store the value. |
| 4739 **/ |
| 4740 - (void)setInt64:(int64_t)value forKey:(int64_t)key; |
| 4741 |
| 4742 /** |
| 4743 * Removes the entry for the given key. |
| 4744 * |
| 4745 * @param aKey Key to be removed from this dictionary. |
| 4746 **/ |
| 4747 - (void)removeInt64ForKey:(int64_t)aKey; |
| 4748 |
| 4749 /** |
| 4750 * Removes all entries in this dictionary. |
| 4751 **/ |
1149 - (void)removeAll; | 4752 - (void)removeAll; |
1150 | 4753 |
1151 @end | 4754 @end |
1152 | 4755 |
1153 #pragma mark - Int64 -> UInt64 | 4756 #pragma mark - Int64 -> Bool |
1154 | 4757 |
1155 @interface GPBInt64UInt64Dictionary : NSObject <NSCopying> | 4758 /** |
1156 | 4759 * Class used for map fields of <int64_t, BOOL> |
| 4760 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 4761 * |
| 4762 * @note This class is not meant to be subclassed. |
| 4763 **/ |
| 4764 @interface GPBInt64BoolDictionary : NSObject <NSCopying> |
| 4765 |
| 4766 /** Number of entries stored in this dictionary. */ |
1157 @property(nonatomic, readonly) NSUInteger count; | 4767 @property(nonatomic, readonly) NSUInteger count; |
1158 | 4768 |
| 4769 /** |
| 4770 * @return A newly instanced and empty dictionary. |
| 4771 **/ |
1159 + (instancetype)dictionary; | 4772 + (instancetype)dictionary; |
1160 + (instancetype)dictionaryWithValue:(uint64_t)value | 4773 |
| 4774 /** |
| 4775 * Creates and initializes a dictionary with the single entry given. |
| 4776 * |
| 4777 * @param value The value to be placed in the dictionary. |
| 4778 * @param key The key under which to store the value. |
| 4779 * |
| 4780 * @return A newly instanced dictionary with the key and value in it. |
| 4781 **/ |
| 4782 + (instancetype)dictionaryWithBool:(BOOL)value |
| 4783 forKey:(int64_t)key; |
| 4784 |
| 4785 /** |
| 4786 * Creates and initializes a dictionary with the entries given. |
| 4787 * |
| 4788 * @param values The values to be placed in the dictionary. |
| 4789 * @param keys The keys under which to store the values. |
| 4790 * @param count The number of entries to store in the dictionary. |
| 4791 * |
| 4792 * @return A newly instanced dictionary with the keys and values in it. |
| 4793 **/ |
| 4794 + (instancetype)dictionaryWithBools:(const BOOL [])values |
| 4795 forKeys:(const int64_t [])keys |
| 4796 count:(NSUInteger)count; |
| 4797 |
| 4798 /** |
| 4799 * Creates and initializes a dictionary with the entries from the given. |
| 4800 * dictionary. |
| 4801 * |
| 4802 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 4803 * |
| 4804 * @return A newly instanced dictionary with the entries from the given |
| 4805 * dictionary in it. |
| 4806 **/ |
| 4807 + (instancetype)dictionaryWithDictionary:(GPBInt64BoolDictionary *)dictionary; |
| 4808 |
| 4809 /** |
| 4810 * Creates and initializes a dictionary with the given capacity. |
| 4811 * |
| 4812 * @param numItems Capacity needed for the dictionary. |
| 4813 * |
| 4814 * @return A newly instanced dictionary with the given capacity. |
| 4815 **/ |
| 4816 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 4817 |
| 4818 /** |
| 4819 * Initializes this dictionary, copying the given values and keys. |
| 4820 * |
| 4821 * @param values The values to be placed in this dictionary. |
| 4822 * @param keys The keys under which to store the values. |
| 4823 * @param count The number of elements to copy into the dictionary. |
| 4824 * |
| 4825 * @return A newly initialized dictionary with a copy of the values and keys. |
| 4826 **/ |
| 4827 - (instancetype)initWithBools:(const BOOL [])values |
| 4828 forKeys:(const int64_t [])keys |
| 4829 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 4830 |
| 4831 /** |
| 4832 * Initializes this dictionary, copying the entries from the given dictionary. |
| 4833 * |
| 4834 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 4835 * |
| 4836 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 4837 **/ |
| 4838 - (instancetype)initWithDictionary:(GPBInt64BoolDictionary *)dictionary; |
| 4839 |
| 4840 /** |
| 4841 * Initializes this dictionary with the requested capacity. |
| 4842 * |
| 4843 * @param numItems Number of items needed for this dictionary. |
| 4844 * |
| 4845 * @return A newly initialized dictionary with the requested capacity. |
| 4846 **/ |
| 4847 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 4848 |
| 4849 /** |
| 4850 * Gets the value for the given key. |
| 4851 * |
| 4852 * @param value Pointer into which the value will be set, if found. |
| 4853 * @param key Key under which the value is stored, if present. |
| 4854 * |
| 4855 * @return YES if the key was found and the value was copied, NO otherwise. |
| 4856 **/ |
| 4857 - (BOOL)getBool:(nullable BOOL *)value forKey:(int64_t)key; |
| 4858 |
| 4859 /** |
| 4860 * Enumerates the keys and values on this dictionary with the given block. |
| 4861 * |
| 4862 * @param block The block to enumerate with. |
| 4863 * **key**: The key for the current entry. |
| 4864 * **value**: The value for the current entry |
| 4865 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 4866 **/ |
| 4867 - (void)enumerateKeysAndBoolsUsingBlock: |
| 4868 (void (^)(int64_t key, BOOL value, BOOL *stop))block; |
| 4869 |
| 4870 /** |
| 4871 * Adds the keys and values from another dictionary. |
| 4872 * |
| 4873 * @param otherDictionary Dictionary containing entries to be added to this |
| 4874 * dictionary. |
| 4875 **/ |
| 4876 - (void)addEntriesFromDictionary:(GPBInt64BoolDictionary *)otherDictionary; |
| 4877 |
| 4878 /** |
| 4879 * Sets the value for the given key. |
| 4880 * |
| 4881 * @param value The value to set. |
| 4882 * @param key The key under which to store the value. |
| 4883 **/ |
| 4884 - (void)setBool:(BOOL)value forKey:(int64_t)key; |
| 4885 |
| 4886 /** |
| 4887 * Removes the entry for the given key. |
| 4888 * |
| 4889 * @param aKey Key to be removed from this dictionary. |
| 4890 **/ |
| 4891 - (void)removeBoolForKey:(int64_t)aKey; |
| 4892 |
| 4893 /** |
| 4894 * Removes all entries in this dictionary. |
| 4895 **/ |
| 4896 - (void)removeAll; |
| 4897 |
| 4898 @end |
| 4899 |
| 4900 #pragma mark - Int64 -> Float |
| 4901 |
| 4902 /** |
| 4903 * Class used for map fields of <int64_t, float> |
| 4904 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 4905 * |
| 4906 * @note This class is not meant to be subclassed. |
| 4907 **/ |
| 4908 @interface GPBInt64FloatDictionary : NSObject <NSCopying> |
| 4909 |
| 4910 /** Number of entries stored in this dictionary. */ |
| 4911 @property(nonatomic, readonly) NSUInteger count; |
| 4912 |
| 4913 /** |
| 4914 * @return A newly instanced and empty dictionary. |
| 4915 **/ |
| 4916 + (instancetype)dictionary; |
| 4917 |
| 4918 /** |
| 4919 * Creates and initializes a dictionary with the single entry given. |
| 4920 * |
| 4921 * @param value The value to be placed in the dictionary. |
| 4922 * @param key The key under which to store the value. |
| 4923 * |
| 4924 * @return A newly instanced dictionary with the key and value in it. |
| 4925 **/ |
| 4926 + (instancetype)dictionaryWithFloat:(float)value |
1161 forKey:(int64_t)key; | 4927 forKey:(int64_t)key; |
1162 + (instancetype)dictionaryWithValues:(const uint64_t [])values | 4928 |
| 4929 /** |
| 4930 * Creates and initializes a dictionary with the entries given. |
| 4931 * |
| 4932 * @param values The values to be placed in the dictionary. |
| 4933 * @param keys The keys under which to store the values. |
| 4934 * @param count The number of entries to store in the dictionary. |
| 4935 * |
| 4936 * @return A newly instanced dictionary with the keys and values in it. |
| 4937 **/ |
| 4938 + (instancetype)dictionaryWithFloats:(const float [])values |
1163 forKeys:(const int64_t [])keys | 4939 forKeys:(const int64_t [])keys |
1164 count:(NSUInteger)count; | 4940 count:(NSUInteger)count; |
1165 + (instancetype)dictionaryWithDictionary:(GPBInt64UInt64Dictionary *)dictionary; | 4941 |
| 4942 /** |
| 4943 * Creates and initializes a dictionary with the entries from the given. |
| 4944 * dictionary. |
| 4945 * |
| 4946 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 4947 * |
| 4948 * @return A newly instanced dictionary with the entries from the given |
| 4949 * dictionary in it. |
| 4950 **/ |
| 4951 + (instancetype)dictionaryWithDictionary:(GPBInt64FloatDictionary *)dictionary; |
| 4952 |
| 4953 /** |
| 4954 * Creates and initializes a dictionary with the given capacity. |
| 4955 * |
| 4956 * @param numItems Capacity needed for the dictionary. |
| 4957 * |
| 4958 * @return A newly instanced dictionary with the given capacity. |
| 4959 **/ |
1166 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 4960 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1167 | 4961 |
1168 - (instancetype)initWithValues:(const uint64_t [])values | 4962 /** |
| 4963 * Initializes this dictionary, copying the given values and keys. |
| 4964 * |
| 4965 * @param values The values to be placed in this dictionary. |
| 4966 * @param keys The keys under which to store the values. |
| 4967 * @param count The number of elements to copy into the dictionary. |
| 4968 * |
| 4969 * @return A newly initialized dictionary with a copy of the values and keys. |
| 4970 **/ |
| 4971 - (instancetype)initWithFloats:(const float [])values |
1169 forKeys:(const int64_t [])keys | 4972 forKeys:(const int64_t [])keys |
1170 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 4973 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
1171 - (instancetype)initWithDictionary:(GPBInt64UInt64Dictionary *)dictionary; | 4974 |
| 4975 /** |
| 4976 * Initializes this dictionary, copying the entries from the given dictionary. |
| 4977 * |
| 4978 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 4979 * |
| 4980 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 4981 **/ |
| 4982 - (instancetype)initWithDictionary:(GPBInt64FloatDictionary *)dictionary; |
| 4983 |
| 4984 /** |
| 4985 * Initializes this dictionary with the requested capacity. |
| 4986 * |
| 4987 * @param numItems Number of items needed for this dictionary. |
| 4988 * |
| 4989 * @return A newly initialized dictionary with the requested capacity. |
| 4990 **/ |
1172 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 4991 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1173 | 4992 |
1174 - (BOOL)valueForKey:(int64_t)key value:(nullable uint64_t *)value; | 4993 /** |
1175 | 4994 * Gets the value for the given key. |
1176 - (void)enumerateKeysAndValuesUsingBlock: | 4995 * |
1177 (void (^)(int64_t key, uint64_t value, BOOL *stop))block; | 4996 * @param value Pointer into which the value will be set, if found. |
1178 | 4997 * @param key Key under which the value is stored, if present. |
1179 - (void)addEntriesFromDictionary:(GPBInt64UInt64Dictionary *)otherDictionary; | 4998 * |
1180 | 4999 * @return YES if the key was found and the value was copied, NO otherwise. |
1181 - (void)setValue:(uint64_t)value forKey:(int64_t)key; | 5000 **/ |
1182 | 5001 - (BOOL)getFloat:(nullable float *)value forKey:(int64_t)key; |
1183 - (void)removeValueForKey:(int64_t)aKey; | 5002 |
| 5003 /** |
| 5004 * Enumerates the keys and values on this dictionary with the given block. |
| 5005 * |
| 5006 * @param block The block to enumerate with. |
| 5007 * **key**: The key for the current entry. |
| 5008 * **value**: The value for the current entry |
| 5009 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 5010 **/ |
| 5011 - (void)enumerateKeysAndFloatsUsingBlock: |
| 5012 (void (^)(int64_t key, float value, BOOL *stop))block; |
| 5013 |
| 5014 /** |
| 5015 * Adds the keys and values from another dictionary. |
| 5016 * |
| 5017 * @param otherDictionary Dictionary containing entries to be added to this |
| 5018 * dictionary. |
| 5019 **/ |
| 5020 - (void)addEntriesFromDictionary:(GPBInt64FloatDictionary *)otherDictionary; |
| 5021 |
| 5022 /** |
| 5023 * Sets the value for the given key. |
| 5024 * |
| 5025 * @param value The value to set. |
| 5026 * @param key The key under which to store the value. |
| 5027 **/ |
| 5028 - (void)setFloat:(float)value forKey:(int64_t)key; |
| 5029 |
| 5030 /** |
| 5031 * Removes the entry for the given key. |
| 5032 * |
| 5033 * @param aKey Key to be removed from this dictionary. |
| 5034 **/ |
| 5035 - (void)removeFloatForKey:(int64_t)aKey; |
| 5036 |
| 5037 /** |
| 5038 * Removes all entries in this dictionary. |
| 5039 **/ |
1184 - (void)removeAll; | 5040 - (void)removeAll; |
1185 | 5041 |
1186 @end | 5042 @end |
1187 | 5043 |
1188 #pragma mark - Int64 -> Int64 | 5044 #pragma mark - Int64 -> Double |
1189 | 5045 |
1190 @interface GPBInt64Int64Dictionary : NSObject <NSCopying> | 5046 /** |
1191 | 5047 * Class used for map fields of <int64_t, double> |
| 5048 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 5049 * |
| 5050 * @note This class is not meant to be subclassed. |
| 5051 **/ |
| 5052 @interface GPBInt64DoubleDictionary : NSObject <NSCopying> |
| 5053 |
| 5054 /** Number of entries stored in this dictionary. */ |
1192 @property(nonatomic, readonly) NSUInteger count; | 5055 @property(nonatomic, readonly) NSUInteger count; |
1193 | 5056 |
| 5057 /** |
| 5058 * @return A newly instanced and empty dictionary. |
| 5059 **/ |
1194 + (instancetype)dictionary; | 5060 + (instancetype)dictionary; |
1195 + (instancetype)dictionaryWithValue:(int64_t)value | 5061 |
1196 forKey:(int64_t)key; | 5062 /** |
1197 + (instancetype)dictionaryWithValues:(const int64_t [])values | 5063 * Creates and initializes a dictionary with the single entry given. |
1198 forKeys:(const int64_t [])keys | 5064 * |
1199 count:(NSUInteger)count; | 5065 * @param value The value to be placed in the dictionary. |
1200 + (instancetype)dictionaryWithDictionary:(GPBInt64Int64Dictionary *)dictionary; | 5066 * @param key The key under which to store the value. |
| 5067 * |
| 5068 * @return A newly instanced dictionary with the key and value in it. |
| 5069 **/ |
| 5070 + (instancetype)dictionaryWithDouble:(double)value |
| 5071 forKey:(int64_t)key; |
| 5072 |
| 5073 /** |
| 5074 * Creates and initializes a dictionary with the entries given. |
| 5075 * |
| 5076 * @param values The values to be placed in the dictionary. |
| 5077 * @param keys The keys under which to store the values. |
| 5078 * @param count The number of entries to store in the dictionary. |
| 5079 * |
| 5080 * @return A newly instanced dictionary with the keys and values in it. |
| 5081 **/ |
| 5082 + (instancetype)dictionaryWithDoubles:(const double [])values |
| 5083 forKeys:(const int64_t [])keys |
| 5084 count:(NSUInteger)count; |
| 5085 |
| 5086 /** |
| 5087 * Creates and initializes a dictionary with the entries from the given. |
| 5088 * dictionary. |
| 5089 * |
| 5090 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 5091 * |
| 5092 * @return A newly instanced dictionary with the entries from the given |
| 5093 * dictionary in it. |
| 5094 **/ |
| 5095 + (instancetype)dictionaryWithDictionary:(GPBInt64DoubleDictionary *)dictionary; |
| 5096 |
| 5097 /** |
| 5098 * Creates and initializes a dictionary with the given capacity. |
| 5099 * |
| 5100 * @param numItems Capacity needed for the dictionary. |
| 5101 * |
| 5102 * @return A newly instanced dictionary with the given capacity. |
| 5103 **/ |
1201 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 5104 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1202 | 5105 |
1203 - (instancetype)initWithValues:(const int64_t [])values | 5106 /** |
1204 forKeys:(const int64_t [])keys | 5107 * Initializes this dictionary, copying the given values and keys. |
1205 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 5108 * |
1206 - (instancetype)initWithDictionary:(GPBInt64Int64Dictionary *)dictionary; | 5109 * @param values The values to be placed in this dictionary. |
| 5110 * @param keys The keys under which to store the values. |
| 5111 * @param count The number of elements to copy into the dictionary. |
| 5112 * |
| 5113 * @return A newly initialized dictionary with a copy of the values and keys. |
| 5114 **/ |
| 5115 - (instancetype)initWithDoubles:(const double [])values |
| 5116 forKeys:(const int64_t [])keys |
| 5117 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 5118 |
| 5119 /** |
| 5120 * Initializes this dictionary, copying the entries from the given dictionary. |
| 5121 * |
| 5122 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 5123 * |
| 5124 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 5125 **/ |
| 5126 - (instancetype)initWithDictionary:(GPBInt64DoubleDictionary *)dictionary; |
| 5127 |
| 5128 /** |
| 5129 * Initializes this dictionary with the requested capacity. |
| 5130 * |
| 5131 * @param numItems Number of items needed for this dictionary. |
| 5132 * |
| 5133 * @return A newly initialized dictionary with the requested capacity. |
| 5134 **/ |
1207 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 5135 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1208 | 5136 |
1209 - (BOOL)valueForKey:(int64_t)key value:(nullable int64_t *)value; | 5137 /** |
1210 | 5138 * Gets the value for the given key. |
1211 - (void)enumerateKeysAndValuesUsingBlock: | 5139 * |
1212 (void (^)(int64_t key, int64_t value, BOOL *stop))block; | 5140 * @param value Pointer into which the value will be set, if found. |
1213 | 5141 * @param key Key under which the value is stored, if present. |
1214 - (void)addEntriesFromDictionary:(GPBInt64Int64Dictionary *)otherDictionary; | 5142 * |
1215 | 5143 * @return YES if the key was found and the value was copied, NO otherwise. |
1216 - (void)setValue:(int64_t)value forKey:(int64_t)key; | 5144 **/ |
1217 | 5145 - (BOOL)getDouble:(nullable double *)value forKey:(int64_t)key; |
1218 - (void)removeValueForKey:(int64_t)aKey; | 5146 |
| 5147 /** |
| 5148 * Enumerates the keys and values on this dictionary with the given block. |
| 5149 * |
| 5150 * @param block The block to enumerate with. |
| 5151 * **key**: The key for the current entry. |
| 5152 * **value**: The value for the current entry |
| 5153 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 5154 **/ |
| 5155 - (void)enumerateKeysAndDoublesUsingBlock: |
| 5156 (void (^)(int64_t key, double value, BOOL *stop))block; |
| 5157 |
| 5158 /** |
| 5159 * Adds the keys and values from another dictionary. |
| 5160 * |
| 5161 * @param otherDictionary Dictionary containing entries to be added to this |
| 5162 * dictionary. |
| 5163 **/ |
| 5164 - (void)addEntriesFromDictionary:(GPBInt64DoubleDictionary *)otherDictionary; |
| 5165 |
| 5166 /** |
| 5167 * Sets the value for the given key. |
| 5168 * |
| 5169 * @param value The value to set. |
| 5170 * @param key The key under which to store the value. |
| 5171 **/ |
| 5172 - (void)setDouble:(double)value forKey:(int64_t)key; |
| 5173 |
| 5174 /** |
| 5175 * Removes the entry for the given key. |
| 5176 * |
| 5177 * @param aKey Key to be removed from this dictionary. |
| 5178 **/ |
| 5179 - (void)removeDoubleForKey:(int64_t)aKey; |
| 5180 |
| 5181 /** |
| 5182 * Removes all entries in this dictionary. |
| 5183 **/ |
1219 - (void)removeAll; | 5184 - (void)removeAll; |
1220 | 5185 |
1221 @end | 5186 @end |
1222 | 5187 |
1223 #pragma mark - Int64 -> Bool | 5188 #pragma mark - Int64 -> Enum |
1224 | 5189 |
1225 @interface GPBInt64BoolDictionary : NSObject <NSCopying> | 5190 /** |
1226 | 5191 * Class used for map fields of <int64_t, int32_t> |
| 5192 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 5193 * |
| 5194 * @note This class is not meant to be subclassed. |
| 5195 **/ |
| 5196 @interface GPBInt64EnumDictionary : NSObject <NSCopying> |
| 5197 |
| 5198 /** Number of entries stored in this dictionary. */ |
1227 @property(nonatomic, readonly) NSUInteger count; | 5199 @property(nonatomic, readonly) NSUInteger count; |
1228 | 5200 /** The validation function to check if the enums are valid. */ |
| 5201 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; |
| 5202 |
| 5203 /** |
| 5204 * @return A newly instanced and empty dictionary. |
| 5205 **/ |
1229 + (instancetype)dictionary; | 5206 + (instancetype)dictionary; |
1230 + (instancetype)dictionaryWithValue:(BOOL)value | 5207 |
1231 forKey:(int64_t)key; | 5208 /** |
1232 + (instancetype)dictionaryWithValues:(const BOOL [])values | 5209 * Creates and initializes a dictionary with the given validation function. |
1233 forKeys:(const int64_t [])keys | 5210 * |
1234 count:(NSUInteger)count; | 5211 * @param func The enum validation function for the dictionary. |
1235 + (instancetype)dictionaryWithDictionary:(GPBInt64BoolDictionary *)dictionary; | 5212 * |
1236 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 5213 * @return A newly instanced dictionary. |
1237 | 5214 **/ |
1238 - (instancetype)initWithValues:(const BOOL [])values | |
1239 forKeys:(const int64_t [])keys | |
1240 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
1241 - (instancetype)initWithDictionary:(GPBInt64BoolDictionary *)dictionary; | |
1242 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
1243 | |
1244 - (BOOL)valueForKey:(int64_t)key value:(nullable BOOL *)value; | |
1245 | |
1246 - (void)enumerateKeysAndValuesUsingBlock: | |
1247 (void (^)(int64_t key, BOOL value, BOOL *stop))block; | |
1248 | |
1249 - (void)addEntriesFromDictionary:(GPBInt64BoolDictionary *)otherDictionary; | |
1250 | |
1251 - (void)setValue:(BOOL)value forKey:(int64_t)key; | |
1252 | |
1253 - (void)removeValueForKey:(int64_t)aKey; | |
1254 - (void)removeAll; | |
1255 | |
1256 @end | |
1257 | |
1258 #pragma mark - Int64 -> Float | |
1259 | |
1260 @interface GPBInt64FloatDictionary : NSObject <NSCopying> | |
1261 | |
1262 @property(nonatomic, readonly) NSUInteger count; | |
1263 | |
1264 + (instancetype)dictionary; | |
1265 + (instancetype)dictionaryWithValue:(float)value | |
1266 forKey:(int64_t)key; | |
1267 + (instancetype)dictionaryWithValues:(const float [])values | |
1268 forKeys:(const int64_t [])keys | |
1269 count:(NSUInteger)count; | |
1270 + (instancetype)dictionaryWithDictionary:(GPBInt64FloatDictionary *)dictionary; | |
1271 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | |
1272 | |
1273 - (instancetype)initWithValues:(const float [])values | |
1274 forKeys:(const int64_t [])keys | |
1275 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
1276 - (instancetype)initWithDictionary:(GPBInt64FloatDictionary *)dictionary; | |
1277 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
1278 | |
1279 - (BOOL)valueForKey:(int64_t)key value:(nullable float *)value; | |
1280 | |
1281 - (void)enumerateKeysAndValuesUsingBlock: | |
1282 (void (^)(int64_t key, float value, BOOL *stop))block; | |
1283 | |
1284 - (void)addEntriesFromDictionary:(GPBInt64FloatDictionary *)otherDictionary; | |
1285 | |
1286 - (void)setValue:(float)value forKey:(int64_t)key; | |
1287 | |
1288 - (void)removeValueForKey:(int64_t)aKey; | |
1289 - (void)removeAll; | |
1290 | |
1291 @end | |
1292 | |
1293 #pragma mark - Int64 -> Double | |
1294 | |
1295 @interface GPBInt64DoubleDictionary : NSObject <NSCopying> | |
1296 | |
1297 @property(nonatomic, readonly) NSUInteger count; | |
1298 | |
1299 + (instancetype)dictionary; | |
1300 + (instancetype)dictionaryWithValue:(double)value | |
1301 forKey:(int64_t)key; | |
1302 + (instancetype)dictionaryWithValues:(const double [])values | |
1303 forKeys:(const int64_t [])keys | |
1304 count:(NSUInteger)count; | |
1305 + (instancetype)dictionaryWithDictionary:(GPBInt64DoubleDictionary *)dictionary; | |
1306 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | |
1307 | |
1308 - (instancetype)initWithValues:(const double [])values | |
1309 forKeys:(const int64_t [])keys | |
1310 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
1311 - (instancetype)initWithDictionary:(GPBInt64DoubleDictionary *)dictionary; | |
1312 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
1313 | |
1314 - (BOOL)valueForKey:(int64_t)key value:(nullable double *)value; | |
1315 | |
1316 - (void)enumerateKeysAndValuesUsingBlock: | |
1317 (void (^)(int64_t key, double value, BOOL *stop))block; | |
1318 | |
1319 - (void)addEntriesFromDictionary:(GPBInt64DoubleDictionary *)otherDictionary; | |
1320 | |
1321 - (void)setValue:(double)value forKey:(int64_t)key; | |
1322 | |
1323 - (void)removeValueForKey:(int64_t)aKey; | |
1324 - (void)removeAll; | |
1325 | |
1326 @end | |
1327 | |
1328 #pragma mark - Int64 -> Enum | |
1329 | |
1330 @interface GPBInt64EnumDictionary : NSObject <NSCopying> | |
1331 | |
1332 @property(nonatomic, readonly) NSUInteger count; | |
1333 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; | |
1334 | |
1335 + (instancetype)dictionary; | |
1336 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func; | 5215 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func; |
| 5216 |
| 5217 /** |
| 5218 * Creates and initializes a dictionary with the single entry given. |
| 5219 * |
| 5220 * @param func The enum validation function for the dictionary. |
| 5221 * @param rawValue The raw enum value to be placed in the dictionary. |
| 5222 * @param key The key under which to store the value. |
| 5223 * |
| 5224 * @return A newly instanced dictionary with the key and value in it. |
| 5225 **/ |
1337 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 5226 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
1338 rawValue:(int32_t)rawValue | 5227 rawValue:(int32_t)rawValue |
1339 forKey:(int64_t)key; | 5228 forKey:(int64_t)key; |
| 5229 |
| 5230 /** |
| 5231 * Creates and initializes a dictionary with the entries given. |
| 5232 * |
| 5233 * @param func The enum validation function for the dictionary. |
| 5234 * @param values The raw enum values values to be placed in the dictionary. |
| 5235 * @param keys The keys under which to store the values. |
| 5236 * @param count The number of entries to store in the dictionary. |
| 5237 * |
| 5238 * @return A newly instanced dictionary with the keys and values in it. |
| 5239 **/ |
1340 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 5240 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
1341 rawValues:(const int32_t [])values | 5241 rawValues:(const int32_t [])values |
1342 forKeys:(const int64_t [])keys | 5242 forKeys:(const int64_t [])keys |
1343 count:(NSUInteger)count; | 5243 count:(NSUInteger)count; |
| 5244 |
| 5245 /** |
| 5246 * Creates and initializes a dictionary with the entries from the given. |
| 5247 * dictionary. |
| 5248 * |
| 5249 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 5250 * |
| 5251 * @return A newly instanced dictionary with the entries from the given |
| 5252 * dictionary in it. |
| 5253 **/ |
1344 + (instancetype)dictionaryWithDictionary:(GPBInt64EnumDictionary *)dictionary; | 5254 + (instancetype)dictionaryWithDictionary:(GPBInt64EnumDictionary *)dictionary; |
| 5255 |
| 5256 /** |
| 5257 * Creates and initializes a dictionary with the given capacity. |
| 5258 * |
| 5259 * @param func The enum validation function for the dictionary. |
| 5260 * @param numItems Capacity needed for the dictionary. |
| 5261 * |
| 5262 * @return A newly instanced dictionary with the given capacity. |
| 5263 **/ |
1345 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 5264 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
1346 capacity:(NSUInteger)numItems; | 5265 capacity:(NSUInteger)numItems; |
1347 | 5266 |
| 5267 /** |
| 5268 * Initializes a dictionary with the given validation function. |
| 5269 * |
| 5270 * @param func The enum validation function for the dictionary. |
| 5271 * |
| 5272 * @return A newly initialized dictionary. |
| 5273 **/ |
1348 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; | 5274 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; |
| 5275 |
| 5276 /** |
| 5277 * Initializes a dictionary with the entries given. |
| 5278 * |
| 5279 * @param func The enum validation function for the dictionary. |
| 5280 * @param values The raw enum values values to be placed in the dictionary. |
| 5281 * @param keys The keys under which to store the values. |
| 5282 * @param count The number of entries to store in the dictionary. |
| 5283 * |
| 5284 * @return A newly initialized dictionary with the keys and values in it. |
| 5285 **/ |
1349 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func | 5286 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func |
1350 rawValues:(const int32_t [])values | 5287 rawValues:(const int32_t [])values |
1351 forKeys:(const int64_t [])keys | 5288 forKeys:(const int64_t [])keys |
1352 count:(NSUInteger)count NS_DESIGNATED_INITI
ALIZER; | 5289 count:(NSUInteger)count NS_DESIGNATED_INITI
ALIZER; |
| 5290 |
| 5291 /** |
| 5292 * Initializes a dictionary with the entries from the given. |
| 5293 * dictionary. |
| 5294 * |
| 5295 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 5296 * |
| 5297 * @return A newly initialized dictionary with the entries from the given |
| 5298 * dictionary in it. |
| 5299 **/ |
1353 - (instancetype)initWithDictionary:(GPBInt64EnumDictionary *)dictionary; | 5300 - (instancetype)initWithDictionary:(GPBInt64EnumDictionary *)dictionary; |
| 5301 |
| 5302 /** |
| 5303 * Initializes a dictionary with the given capacity. |
| 5304 * |
| 5305 * @param func The enum validation function for the dictionary. |
| 5306 * @param numItems Capacity needed for the dictionary. |
| 5307 * |
| 5308 * @return A newly initialized dictionary with the given capacity. |
| 5309 **/ |
1354 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func | 5310 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func |
1355 capacity:(NSUInteger)numItems; | 5311 capacity:(NSUInteger)numItems; |
1356 | 5312 |
1357 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key | 5313 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key |
1358 // is not a valid enumerator as defined by validationFunc. If the actual value i
s | 5314 // is not a valid enumerator as defined by validationFunc. If the actual value i
s |
1359 // desired, use "raw" version of the method. | 5315 // desired, use "raw" version of the method. |
1360 | 5316 |
1361 - (BOOL)valueForKey:(int64_t)key value:(nullable int32_t *)value; | 5317 /** |
| 5318 * Gets the value for the given key. |
| 5319 * |
| 5320 * @param value Pointer into which the value will be set, if found. |
| 5321 * @param key Key under which the value is stored, if present. |
| 5322 * |
| 5323 * @return YES if the key was found and the value was copied, NO otherwise. |
| 5324 **/ |
| 5325 - (BOOL)getEnum:(nullable int32_t *)value forKey:(int64_t)key; |
1362 | 5326 |
1363 - (void)enumerateKeysAndValuesUsingBlock: | 5327 /** |
| 5328 * Enumerates the keys and values on this dictionary with the given block. |
| 5329 * |
| 5330 * @param block The block to enumerate with. |
| 5331 * **key**: The key for the current entry. |
| 5332 * **value**: The value for the current entry |
| 5333 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 5334 **/ |
| 5335 - (void)enumerateKeysAndEnumsUsingBlock: |
1364 (void (^)(int64_t key, int32_t value, BOOL *stop))block; | 5336 (void (^)(int64_t key, int32_t value, BOOL *stop))block; |
1365 | 5337 |
1366 // These methods bypass the validationFunc to provide access to values that were
not | 5338 /** |
1367 // known at the time the binary was compiled. | 5339 * Gets the raw enum value for the given key. |
| 5340 * |
| 5341 * @note This method bypass the validationFunc to enable the access of values th
at |
| 5342 * were not known at the time the binary was compiled. |
| 5343 * |
| 5344 * @param rawValue Pointer into which the value will be set, if found. |
| 5345 * @param key Key under which the value is stored, if present. |
| 5346 * |
| 5347 * @return YES if the key was found and the value was copied, NO otherwise. |
| 5348 **/ |
| 5349 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int64_t)key; |
1368 | 5350 |
1369 - (BOOL)valueForKey:(int64_t)key rawValue:(nullable int32_t *)rawValue; | 5351 /** |
1370 | 5352 * Enumerates the keys and values on this dictionary with the given block. |
| 5353 * |
| 5354 * @note This method bypass the validationFunc to enable the access of values th
at |
| 5355 * were not known at the time the binary was compiled. |
| 5356 * |
| 5357 * @param block The block to enumerate with. |
| 5358 * **key**: The key for the current entry. |
| 5359 * **rawValue**: The value for the current entry |
| 5360 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 5361 **/ |
1371 - (void)enumerateKeysAndRawValuesUsingBlock: | 5362 - (void)enumerateKeysAndRawValuesUsingBlock: |
1372 (void (^)(int64_t key, int32_t rawValue, BOOL *stop))block; | 5363 (void (^)(int64_t key, int32_t rawValue, BOOL *stop))block; |
1373 | 5364 |
| 5365 /** |
| 5366 * Adds the keys and raw enum values from another dictionary. |
| 5367 * |
| 5368 * @note This method bypass the validationFunc to enable the setting of values t
hat |
| 5369 * were not known at the time the binary was compiled. |
| 5370 * |
| 5371 * @param otherDictionary Dictionary containing entries to be added to this |
| 5372 * dictionary. |
| 5373 **/ |
1374 - (void)addRawEntriesFromDictionary:(GPBInt64EnumDictionary *)otherDictionary; | 5374 - (void)addRawEntriesFromDictionary:(GPBInt64EnumDictionary *)otherDictionary; |
1375 | 5375 |
1376 // If value is not a valid enumerator as defined by validationFunc, these | 5376 // If value is not a valid enumerator as defined by validationFunc, these |
1377 // methods will assert in debug, and will log in release and assign the value | 5377 // methods will assert in debug, and will log in release and assign the value |
1378 // to the default value. Use the rawValue methods below to assign non enumerator | 5378 // to the default value. Use the rawValue methods below to assign non enumerator |
1379 // values. | 5379 // values. |
1380 | 5380 |
1381 - (void)setValue:(int32_t)value forKey:(int64_t)key; | 5381 /** |
1382 | 5382 * Sets the value for the given key. |
1383 // This method bypass the validationFunc to provide setting of values that were
not | 5383 * |
1384 // known at the time the binary was compiled. | 5384 * @param value The value to set. |
| 5385 * @param key The key under which to store the value. |
| 5386 **/ |
| 5387 - (void)setEnum:(int32_t)value forKey:(int64_t)key; |
| 5388 |
| 5389 /** |
| 5390 * Sets the raw enum value for the given key. |
| 5391 * |
| 5392 * @note This method bypass the validationFunc to enable the setting of values t
hat |
| 5393 * were not known at the time the binary was compiled. |
| 5394 * |
| 5395 * @param rawValue The raw enum value to set. |
| 5396 * @param key The key under which to store the raw enum value. |
| 5397 **/ |
1385 - (void)setRawValue:(int32_t)rawValue forKey:(int64_t)key; | 5398 - (void)setRawValue:(int32_t)rawValue forKey:(int64_t)key; |
1386 | 5399 |
1387 // No validation applies to these methods. | 5400 /** |
1388 | 5401 * Removes the entry for the given key. |
1389 - (void)removeValueForKey:(int64_t)aKey; | 5402 * |
| 5403 * @param aKey Key to be removed from this dictionary. |
| 5404 **/ |
| 5405 - (void)removeEnumForKey:(int64_t)aKey; |
| 5406 |
| 5407 /** |
| 5408 * Removes all entries in this dictionary. |
| 5409 **/ |
1390 - (void)removeAll; | 5410 - (void)removeAll; |
1391 | 5411 |
1392 @end | 5412 @end |
1393 | 5413 |
1394 #pragma mark - Int64 -> Object | 5414 #pragma mark - Int64 -> Object |
1395 | 5415 |
| 5416 /** |
| 5417 * Class used for map fields of <int64_t, ObjectType> |
| 5418 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 5419 * |
| 5420 * @note This class is not meant to be subclassed. |
| 5421 **/ |
1396 @interface GPBInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyin
g> | 5422 @interface GPBInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyin
g> |
1397 | 5423 |
| 5424 /** Number of entries stored in this dictionary. */ |
1398 @property(nonatomic, readonly) NSUInteger count; | 5425 @property(nonatomic, readonly) NSUInteger count; |
1399 | 5426 |
| 5427 /** |
| 5428 * @return A newly instanced and empty dictionary. |
| 5429 **/ |
1400 + (instancetype)dictionary; | 5430 + (instancetype)dictionary; |
| 5431 |
| 5432 /** |
| 5433 * Creates and initializes a dictionary with the single entry given. |
| 5434 * |
| 5435 * @param object The value to be placed in the dictionary. |
| 5436 * @param key The key under which to store the value. |
| 5437 * |
| 5438 * @return A newly instanced dictionary with the key and value in it. |
| 5439 **/ |
1401 + (instancetype)dictionaryWithObject:(ObjectType)object | 5440 + (instancetype)dictionaryWithObject:(ObjectType)object |
1402 forKey:(int64_t)key; | 5441 forKey:(int64_t)key; |
| 5442 |
| 5443 /** |
| 5444 * Creates and initializes a dictionary with the entries given. |
| 5445 * |
| 5446 * @param objects The values to be placed in the dictionary. |
| 5447 * @param keys The keys under which to store the values. |
| 5448 * @param count The number of entries to store in the dictionary. |
| 5449 * |
| 5450 * @return A newly instanced dictionary with the keys and values in it. |
| 5451 **/ |
1403 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED []
)objects | 5452 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED []
)objects |
1404 forKeys:(const int64_t [])keys | 5453 forKeys:(const int64_t [])keys |
1405 count:(NSUInteger)count; | 5454 count:(NSUInteger)count; |
| 5455 |
| 5456 /** |
| 5457 * Creates and initializes a dictionary with the entries from the given. |
| 5458 * dictionary. |
| 5459 * |
| 5460 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 5461 * |
| 5462 * @return A newly instanced dictionary with the entries from the given |
| 5463 * dictionary in it. |
| 5464 **/ |
1406 + (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary; | 5465 + (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary; |
| 5466 |
| 5467 /** |
| 5468 * Creates and initializes a dictionary with the given capacity. |
| 5469 * |
| 5470 * @param numItems Capacity needed for the dictionary. |
| 5471 * |
| 5472 * @return A newly instanced dictionary with the given capacity. |
| 5473 **/ |
1407 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 5474 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1408 | 5475 |
| 5476 /** |
| 5477 * Initializes this dictionary, copying the given values and keys. |
| 5478 * |
| 5479 * @param objects The values to be placed in this dictionary. |
| 5480 * @param keys The keys under which to store the values. |
| 5481 * @param count The number of elements to copy into the dictionary. |
| 5482 * |
| 5483 * @return A newly initialized dictionary with a copy of the values and keys. |
| 5484 **/ |
1409 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec
ts | 5485 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec
ts |
1410 forKeys:(const int64_t [])keys | 5486 forKeys:(const int64_t [])keys |
1411 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 5487 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 5488 |
| 5489 /** |
| 5490 * Initializes this dictionary, copying the entries from the given dictionary. |
| 5491 * |
| 5492 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 5493 * |
| 5494 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 5495 **/ |
1412 - (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary; | 5496 - (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary; |
| 5497 |
| 5498 /** |
| 5499 * Initializes this dictionary with the requested capacity. |
| 5500 * |
| 5501 * @param numItems Number of items needed for this dictionary. |
| 5502 * |
| 5503 * @return A newly initialized dictionary with the requested capacity. |
| 5504 **/ |
1413 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 5505 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1414 | 5506 |
| 5507 /** |
| 5508 * Fetches the object stored under the given key. |
| 5509 * |
| 5510 * @param key Key under which the value is stored, if present. |
| 5511 * |
| 5512 * @return The object if found, nil otherwise. |
| 5513 **/ |
1415 - (ObjectType)objectForKey:(int64_t)key; | 5514 - (ObjectType)objectForKey:(int64_t)key; |
1416 | 5515 |
| 5516 /** |
| 5517 * Enumerates the keys and values on this dictionary with the given block. |
| 5518 * |
| 5519 * @param block The block to enumerate with. |
| 5520 * **key**: The key for the current entry. |
| 5521 * **object**: The value for the current entry |
| 5522 * **stop**: A pointer to a boolean that when set stops the enumeration
. |
| 5523 **/ |
1417 - (void)enumerateKeysAndObjectsUsingBlock: | 5524 - (void)enumerateKeysAndObjectsUsingBlock: |
1418 (void (^)(int64_t key, ObjectType object, BOOL *stop))block; | 5525 (void (^)(int64_t key, ObjectType object, BOOL *stop))block; |
1419 | 5526 |
| 5527 /** |
| 5528 * Adds the keys and values from another dictionary. |
| 5529 * |
| 5530 * @param otherDictionary Dictionary containing entries to be added to this |
| 5531 * dictionary. |
| 5532 **/ |
1420 - (void)addEntriesFromDictionary:(GPBInt64ObjectDictionary *)otherDictionary; | 5533 - (void)addEntriesFromDictionary:(GPBInt64ObjectDictionary *)otherDictionary; |
1421 | 5534 |
| 5535 /** |
| 5536 * Sets the value for the given key. |
| 5537 * |
| 5538 * @param object The value to set. |
| 5539 * @param key The key under which to store the value. |
| 5540 **/ |
1422 - (void)setObject:(ObjectType)object forKey:(int64_t)key; | 5541 - (void)setObject:(ObjectType)object forKey:(int64_t)key; |
1423 | 5542 |
| 5543 /** |
| 5544 * Removes the entry for the given key. |
| 5545 * |
| 5546 * @param aKey Key to be removed from this dictionary. |
| 5547 **/ |
1424 - (void)removeObjectForKey:(int64_t)aKey; | 5548 - (void)removeObjectForKey:(int64_t)aKey; |
| 5549 |
| 5550 /** |
| 5551 * Removes all entries in this dictionary. |
| 5552 **/ |
1425 - (void)removeAll; | 5553 - (void)removeAll; |
1426 | 5554 |
1427 @end | 5555 @end |
1428 | 5556 |
1429 #pragma mark - Bool -> UInt32 | 5557 #pragma mark - Bool -> UInt32 |
1430 | 5558 |
| 5559 /** |
| 5560 * Class used for map fields of <BOOL, uint32_t> |
| 5561 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 5562 * |
| 5563 * @note This class is not meant to be subclassed. |
| 5564 **/ |
1431 @interface GPBBoolUInt32Dictionary : NSObject <NSCopying> | 5565 @interface GPBBoolUInt32Dictionary : NSObject <NSCopying> |
1432 | 5566 |
| 5567 /** Number of entries stored in this dictionary. */ |
1433 @property(nonatomic, readonly) NSUInteger count; | 5568 @property(nonatomic, readonly) NSUInteger count; |
1434 | 5569 |
| 5570 /** |
| 5571 * @return A newly instanced and empty dictionary. |
| 5572 **/ |
1435 + (instancetype)dictionary; | 5573 + (instancetype)dictionary; |
1436 + (instancetype)dictionaryWithValue:(uint32_t)value | 5574 |
| 5575 /** |
| 5576 * Creates and initializes a dictionary with the single entry given. |
| 5577 * |
| 5578 * @param value The value to be placed in the dictionary. |
| 5579 * @param key The key under which to store the value. |
| 5580 * |
| 5581 * @return A newly instanced dictionary with the key and value in it. |
| 5582 **/ |
| 5583 + (instancetype)dictionaryWithUInt32:(uint32_t)value |
| 5584 forKey:(BOOL)key; |
| 5585 |
| 5586 /** |
| 5587 * Creates and initializes a dictionary with the entries given. |
| 5588 * |
| 5589 * @param values The values to be placed in the dictionary. |
| 5590 * @param keys The keys under which to store the values. |
| 5591 * @param count The number of entries to store in the dictionary. |
| 5592 * |
| 5593 * @return A newly instanced dictionary with the keys and values in it. |
| 5594 **/ |
| 5595 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values |
| 5596 forKeys:(const BOOL [])keys |
| 5597 count:(NSUInteger)count; |
| 5598 |
| 5599 /** |
| 5600 * Creates and initializes a dictionary with the entries from the given. |
| 5601 * dictionary. |
| 5602 * |
| 5603 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 5604 * |
| 5605 * @return A newly instanced dictionary with the entries from the given |
| 5606 * dictionary in it. |
| 5607 **/ |
| 5608 + (instancetype)dictionaryWithDictionary:(GPBBoolUInt32Dictionary *)dictionary; |
| 5609 |
| 5610 /** |
| 5611 * Creates and initializes a dictionary with the given capacity. |
| 5612 * |
| 5613 * @param numItems Capacity needed for the dictionary. |
| 5614 * |
| 5615 * @return A newly instanced dictionary with the given capacity. |
| 5616 **/ |
| 5617 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 5618 |
| 5619 /** |
| 5620 * Initializes this dictionary, copying the given values and keys. |
| 5621 * |
| 5622 * @param values The values to be placed in this dictionary. |
| 5623 * @param keys The keys under which to store the values. |
| 5624 * @param count The number of elements to copy into the dictionary. |
| 5625 * |
| 5626 * @return A newly initialized dictionary with a copy of the values and keys. |
| 5627 **/ |
| 5628 - (instancetype)initWithUInt32s:(const uint32_t [])values |
| 5629 forKeys:(const BOOL [])keys |
| 5630 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 5631 |
| 5632 /** |
| 5633 * Initializes this dictionary, copying the entries from the given dictionary. |
| 5634 * |
| 5635 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 5636 * |
| 5637 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 5638 **/ |
| 5639 - (instancetype)initWithDictionary:(GPBBoolUInt32Dictionary *)dictionary; |
| 5640 |
| 5641 /** |
| 5642 * Initializes this dictionary with the requested capacity. |
| 5643 * |
| 5644 * @param numItems Number of items needed for this dictionary. |
| 5645 * |
| 5646 * @return A newly initialized dictionary with the requested capacity. |
| 5647 **/ |
| 5648 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 5649 |
| 5650 /** |
| 5651 * Gets the value for the given key. |
| 5652 * |
| 5653 * @param value Pointer into which the value will be set, if found. |
| 5654 * @param key Key under which the value is stored, if present. |
| 5655 * |
| 5656 * @return YES if the key was found and the value was copied, NO otherwise. |
| 5657 **/ |
| 5658 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(BOOL)key; |
| 5659 |
| 5660 /** |
| 5661 * Enumerates the keys and values on this dictionary with the given block. |
| 5662 * |
| 5663 * @param block The block to enumerate with. |
| 5664 * **key**: The key for the current entry. |
| 5665 * **value**: The value for the current entry |
| 5666 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 5667 **/ |
| 5668 - (void)enumerateKeysAndUInt32sUsingBlock: |
| 5669 (void (^)(BOOL key, uint32_t value, BOOL *stop))block; |
| 5670 |
| 5671 /** |
| 5672 * Adds the keys and values from another dictionary. |
| 5673 * |
| 5674 * @param otherDictionary Dictionary containing entries to be added to this |
| 5675 * dictionary. |
| 5676 **/ |
| 5677 - (void)addEntriesFromDictionary:(GPBBoolUInt32Dictionary *)otherDictionary; |
| 5678 |
| 5679 /** |
| 5680 * Sets the value for the given key. |
| 5681 * |
| 5682 * @param value The value to set. |
| 5683 * @param key The key under which to store the value. |
| 5684 **/ |
| 5685 - (void)setUInt32:(uint32_t)value forKey:(BOOL)key; |
| 5686 |
| 5687 /** |
| 5688 * Removes the entry for the given key. |
| 5689 * |
| 5690 * @param aKey Key to be removed from this dictionary. |
| 5691 **/ |
| 5692 - (void)removeUInt32ForKey:(BOOL)aKey; |
| 5693 |
| 5694 /** |
| 5695 * Removes all entries in this dictionary. |
| 5696 **/ |
| 5697 - (void)removeAll; |
| 5698 |
| 5699 @end |
| 5700 |
| 5701 #pragma mark - Bool -> Int32 |
| 5702 |
| 5703 /** |
| 5704 * Class used for map fields of <BOOL, int32_t> |
| 5705 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 5706 * |
| 5707 * @note This class is not meant to be subclassed. |
| 5708 **/ |
| 5709 @interface GPBBoolInt32Dictionary : NSObject <NSCopying> |
| 5710 |
| 5711 /** Number of entries stored in this dictionary. */ |
| 5712 @property(nonatomic, readonly) NSUInteger count; |
| 5713 |
| 5714 /** |
| 5715 * @return A newly instanced and empty dictionary. |
| 5716 **/ |
| 5717 + (instancetype)dictionary; |
| 5718 |
| 5719 /** |
| 5720 * Creates and initializes a dictionary with the single entry given. |
| 5721 * |
| 5722 * @param value The value to be placed in the dictionary. |
| 5723 * @param key The key under which to store the value. |
| 5724 * |
| 5725 * @return A newly instanced dictionary with the key and value in it. |
| 5726 **/ |
| 5727 + (instancetype)dictionaryWithInt32:(int32_t)value |
1437 forKey:(BOOL)key; | 5728 forKey:(BOOL)key; |
1438 + (instancetype)dictionaryWithValues:(const uint32_t [])values | 5729 |
| 5730 /** |
| 5731 * Creates and initializes a dictionary with the entries given. |
| 5732 * |
| 5733 * @param values The values to be placed in the dictionary. |
| 5734 * @param keys The keys under which to store the values. |
| 5735 * @param count The number of entries to store in the dictionary. |
| 5736 * |
| 5737 * @return A newly instanced dictionary with the keys and values in it. |
| 5738 **/ |
| 5739 + (instancetype)dictionaryWithInt32s:(const int32_t [])values |
1439 forKeys:(const BOOL [])keys | 5740 forKeys:(const BOOL [])keys |
1440 count:(NSUInteger)count; | 5741 count:(NSUInteger)count; |
1441 + (instancetype)dictionaryWithDictionary:(GPBBoolUInt32Dictionary *)dictionary; | 5742 |
| 5743 /** |
| 5744 * Creates and initializes a dictionary with the entries from the given. |
| 5745 * dictionary. |
| 5746 * |
| 5747 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 5748 * |
| 5749 * @return A newly instanced dictionary with the entries from the given |
| 5750 * dictionary in it. |
| 5751 **/ |
| 5752 + (instancetype)dictionaryWithDictionary:(GPBBoolInt32Dictionary *)dictionary; |
| 5753 |
| 5754 /** |
| 5755 * Creates and initializes a dictionary with the given capacity. |
| 5756 * |
| 5757 * @param numItems Capacity needed for the dictionary. |
| 5758 * |
| 5759 * @return A newly instanced dictionary with the given capacity. |
| 5760 **/ |
1442 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 5761 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1443 | 5762 |
1444 - (instancetype)initWithValues:(const uint32_t [])values | 5763 /** |
| 5764 * Initializes this dictionary, copying the given values and keys. |
| 5765 * |
| 5766 * @param values The values to be placed in this dictionary. |
| 5767 * @param keys The keys under which to store the values. |
| 5768 * @param count The number of elements to copy into the dictionary. |
| 5769 * |
| 5770 * @return A newly initialized dictionary with a copy of the values and keys. |
| 5771 **/ |
| 5772 - (instancetype)initWithInt32s:(const int32_t [])values |
1445 forKeys:(const BOOL [])keys | 5773 forKeys:(const BOOL [])keys |
1446 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 5774 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
1447 - (instancetype)initWithDictionary:(GPBBoolUInt32Dictionary *)dictionary; | 5775 |
| 5776 /** |
| 5777 * Initializes this dictionary, copying the entries from the given dictionary. |
| 5778 * |
| 5779 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 5780 * |
| 5781 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 5782 **/ |
| 5783 - (instancetype)initWithDictionary:(GPBBoolInt32Dictionary *)dictionary; |
| 5784 |
| 5785 /** |
| 5786 * Initializes this dictionary with the requested capacity. |
| 5787 * |
| 5788 * @param numItems Number of items needed for this dictionary. |
| 5789 * |
| 5790 * @return A newly initialized dictionary with the requested capacity. |
| 5791 **/ |
1448 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 5792 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1449 | 5793 |
1450 - (BOOL)valueForKey:(BOOL)key value:(nullable uint32_t *)value; | 5794 /** |
1451 | 5795 * Gets the value for the given key. |
1452 - (void)enumerateKeysAndValuesUsingBlock: | 5796 * |
1453 (void (^)(BOOL key, uint32_t value, BOOL *stop))block; | 5797 * @param value Pointer into which the value will be set, if found. |
1454 | 5798 * @param key Key under which the value is stored, if present. |
1455 - (void)addEntriesFromDictionary:(GPBBoolUInt32Dictionary *)otherDictionary; | 5799 * |
1456 | 5800 * @return YES if the key was found and the value was copied, NO otherwise. |
1457 - (void)setValue:(uint32_t)value forKey:(BOOL)key; | 5801 **/ |
1458 | 5802 - (BOOL)getInt32:(nullable int32_t *)value forKey:(BOOL)key; |
1459 - (void)removeValueForKey:(BOOL)aKey; | 5803 |
| 5804 /** |
| 5805 * Enumerates the keys and values on this dictionary with the given block. |
| 5806 * |
| 5807 * @param block The block to enumerate with. |
| 5808 * **key**: The key for the current entry. |
| 5809 * **value**: The value for the current entry |
| 5810 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 5811 **/ |
| 5812 - (void)enumerateKeysAndInt32sUsingBlock: |
| 5813 (void (^)(BOOL key, int32_t value, BOOL *stop))block; |
| 5814 |
| 5815 /** |
| 5816 * Adds the keys and values from another dictionary. |
| 5817 * |
| 5818 * @param otherDictionary Dictionary containing entries to be added to this |
| 5819 * dictionary. |
| 5820 **/ |
| 5821 - (void)addEntriesFromDictionary:(GPBBoolInt32Dictionary *)otherDictionary; |
| 5822 |
| 5823 /** |
| 5824 * Sets the value for the given key. |
| 5825 * |
| 5826 * @param value The value to set. |
| 5827 * @param key The key under which to store the value. |
| 5828 **/ |
| 5829 - (void)setInt32:(int32_t)value forKey:(BOOL)key; |
| 5830 |
| 5831 /** |
| 5832 * Removes the entry for the given key. |
| 5833 * |
| 5834 * @param aKey Key to be removed from this dictionary. |
| 5835 **/ |
| 5836 - (void)removeInt32ForKey:(BOOL)aKey; |
| 5837 |
| 5838 /** |
| 5839 * Removes all entries in this dictionary. |
| 5840 **/ |
1460 - (void)removeAll; | 5841 - (void)removeAll; |
1461 | 5842 |
1462 @end | 5843 @end |
1463 | 5844 |
1464 #pragma mark - Bool -> Int32 | 5845 #pragma mark - Bool -> UInt64 |
1465 | 5846 |
1466 @interface GPBBoolInt32Dictionary : NSObject <NSCopying> | 5847 /** |
1467 | 5848 * Class used for map fields of <BOOL, uint64_t> |
| 5849 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 5850 * |
| 5851 * @note This class is not meant to be subclassed. |
| 5852 **/ |
| 5853 @interface GPBBoolUInt64Dictionary : NSObject <NSCopying> |
| 5854 |
| 5855 /** Number of entries stored in this dictionary. */ |
1468 @property(nonatomic, readonly) NSUInteger count; | 5856 @property(nonatomic, readonly) NSUInteger count; |
1469 | 5857 |
| 5858 /** |
| 5859 * @return A newly instanced and empty dictionary. |
| 5860 **/ |
1470 + (instancetype)dictionary; | 5861 + (instancetype)dictionary; |
1471 + (instancetype)dictionaryWithValue:(int32_t)value | 5862 |
| 5863 /** |
| 5864 * Creates and initializes a dictionary with the single entry given. |
| 5865 * |
| 5866 * @param value The value to be placed in the dictionary. |
| 5867 * @param key The key under which to store the value. |
| 5868 * |
| 5869 * @return A newly instanced dictionary with the key and value in it. |
| 5870 **/ |
| 5871 + (instancetype)dictionaryWithUInt64:(uint64_t)value |
| 5872 forKey:(BOOL)key; |
| 5873 |
| 5874 /** |
| 5875 * Creates and initializes a dictionary with the entries given. |
| 5876 * |
| 5877 * @param values The values to be placed in the dictionary. |
| 5878 * @param keys The keys under which to store the values. |
| 5879 * @param count The number of entries to store in the dictionary. |
| 5880 * |
| 5881 * @return A newly instanced dictionary with the keys and values in it. |
| 5882 **/ |
| 5883 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values |
| 5884 forKeys:(const BOOL [])keys |
| 5885 count:(NSUInteger)count; |
| 5886 |
| 5887 /** |
| 5888 * Creates and initializes a dictionary with the entries from the given. |
| 5889 * dictionary. |
| 5890 * |
| 5891 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 5892 * |
| 5893 * @return A newly instanced dictionary with the entries from the given |
| 5894 * dictionary in it. |
| 5895 **/ |
| 5896 + (instancetype)dictionaryWithDictionary:(GPBBoolUInt64Dictionary *)dictionary; |
| 5897 |
| 5898 /** |
| 5899 * Creates and initializes a dictionary with the given capacity. |
| 5900 * |
| 5901 * @param numItems Capacity needed for the dictionary. |
| 5902 * |
| 5903 * @return A newly instanced dictionary with the given capacity. |
| 5904 **/ |
| 5905 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 5906 |
| 5907 /** |
| 5908 * Initializes this dictionary, copying the given values and keys. |
| 5909 * |
| 5910 * @param values The values to be placed in this dictionary. |
| 5911 * @param keys The keys under which to store the values. |
| 5912 * @param count The number of elements to copy into the dictionary. |
| 5913 * |
| 5914 * @return A newly initialized dictionary with a copy of the values and keys. |
| 5915 **/ |
| 5916 - (instancetype)initWithUInt64s:(const uint64_t [])values |
| 5917 forKeys:(const BOOL [])keys |
| 5918 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 5919 |
| 5920 /** |
| 5921 * Initializes this dictionary, copying the entries from the given dictionary. |
| 5922 * |
| 5923 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 5924 * |
| 5925 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 5926 **/ |
| 5927 - (instancetype)initWithDictionary:(GPBBoolUInt64Dictionary *)dictionary; |
| 5928 |
| 5929 /** |
| 5930 * Initializes this dictionary with the requested capacity. |
| 5931 * |
| 5932 * @param numItems Number of items needed for this dictionary. |
| 5933 * |
| 5934 * @return A newly initialized dictionary with the requested capacity. |
| 5935 **/ |
| 5936 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 5937 |
| 5938 /** |
| 5939 * Gets the value for the given key. |
| 5940 * |
| 5941 * @param value Pointer into which the value will be set, if found. |
| 5942 * @param key Key under which the value is stored, if present. |
| 5943 * |
| 5944 * @return YES if the key was found and the value was copied, NO otherwise. |
| 5945 **/ |
| 5946 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(BOOL)key; |
| 5947 |
| 5948 /** |
| 5949 * Enumerates the keys and values on this dictionary with the given block. |
| 5950 * |
| 5951 * @param block The block to enumerate with. |
| 5952 * **key**: The key for the current entry. |
| 5953 * **value**: The value for the current entry |
| 5954 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 5955 **/ |
| 5956 - (void)enumerateKeysAndUInt64sUsingBlock: |
| 5957 (void (^)(BOOL key, uint64_t value, BOOL *stop))block; |
| 5958 |
| 5959 /** |
| 5960 * Adds the keys and values from another dictionary. |
| 5961 * |
| 5962 * @param otherDictionary Dictionary containing entries to be added to this |
| 5963 * dictionary. |
| 5964 **/ |
| 5965 - (void)addEntriesFromDictionary:(GPBBoolUInt64Dictionary *)otherDictionary; |
| 5966 |
| 5967 /** |
| 5968 * Sets the value for the given key. |
| 5969 * |
| 5970 * @param value The value to set. |
| 5971 * @param key The key under which to store the value. |
| 5972 **/ |
| 5973 - (void)setUInt64:(uint64_t)value forKey:(BOOL)key; |
| 5974 |
| 5975 /** |
| 5976 * Removes the entry for the given key. |
| 5977 * |
| 5978 * @param aKey Key to be removed from this dictionary. |
| 5979 **/ |
| 5980 - (void)removeUInt64ForKey:(BOOL)aKey; |
| 5981 |
| 5982 /** |
| 5983 * Removes all entries in this dictionary. |
| 5984 **/ |
| 5985 - (void)removeAll; |
| 5986 |
| 5987 @end |
| 5988 |
| 5989 #pragma mark - Bool -> Int64 |
| 5990 |
| 5991 /** |
| 5992 * Class used for map fields of <BOOL, int64_t> |
| 5993 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 5994 * |
| 5995 * @note This class is not meant to be subclassed. |
| 5996 **/ |
| 5997 @interface GPBBoolInt64Dictionary : NSObject <NSCopying> |
| 5998 |
| 5999 /** Number of entries stored in this dictionary. */ |
| 6000 @property(nonatomic, readonly) NSUInteger count; |
| 6001 |
| 6002 /** |
| 6003 * @return A newly instanced and empty dictionary. |
| 6004 **/ |
| 6005 + (instancetype)dictionary; |
| 6006 |
| 6007 /** |
| 6008 * Creates and initializes a dictionary with the single entry given. |
| 6009 * |
| 6010 * @param value The value to be placed in the dictionary. |
| 6011 * @param key The key under which to store the value. |
| 6012 * |
| 6013 * @return A newly instanced dictionary with the key and value in it. |
| 6014 **/ |
| 6015 + (instancetype)dictionaryWithInt64:(int64_t)value |
1472 forKey:(BOOL)key; | 6016 forKey:(BOOL)key; |
1473 + (instancetype)dictionaryWithValues:(const int32_t [])values | 6017 |
| 6018 /** |
| 6019 * Creates and initializes a dictionary with the entries given. |
| 6020 * |
| 6021 * @param values The values to be placed in the dictionary. |
| 6022 * @param keys The keys under which to store the values. |
| 6023 * @param count The number of entries to store in the dictionary. |
| 6024 * |
| 6025 * @return A newly instanced dictionary with the keys and values in it. |
| 6026 **/ |
| 6027 + (instancetype)dictionaryWithInt64s:(const int64_t [])values |
1474 forKeys:(const BOOL [])keys | 6028 forKeys:(const BOOL [])keys |
1475 count:(NSUInteger)count; | 6029 count:(NSUInteger)count; |
1476 + (instancetype)dictionaryWithDictionary:(GPBBoolInt32Dictionary *)dictionary; | 6030 |
| 6031 /** |
| 6032 * Creates and initializes a dictionary with the entries from the given. |
| 6033 * dictionary. |
| 6034 * |
| 6035 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 6036 * |
| 6037 * @return A newly instanced dictionary with the entries from the given |
| 6038 * dictionary in it. |
| 6039 **/ |
| 6040 + (instancetype)dictionaryWithDictionary:(GPBBoolInt64Dictionary *)dictionary; |
| 6041 |
| 6042 /** |
| 6043 * Creates and initializes a dictionary with the given capacity. |
| 6044 * |
| 6045 * @param numItems Capacity needed for the dictionary. |
| 6046 * |
| 6047 * @return A newly instanced dictionary with the given capacity. |
| 6048 **/ |
1477 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 6049 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1478 | 6050 |
1479 - (instancetype)initWithValues:(const int32_t [])values | 6051 /** |
| 6052 * Initializes this dictionary, copying the given values and keys. |
| 6053 * |
| 6054 * @param values The values to be placed in this dictionary. |
| 6055 * @param keys The keys under which to store the values. |
| 6056 * @param count The number of elements to copy into the dictionary. |
| 6057 * |
| 6058 * @return A newly initialized dictionary with a copy of the values and keys. |
| 6059 **/ |
| 6060 - (instancetype)initWithInt64s:(const int64_t [])values |
1480 forKeys:(const BOOL [])keys | 6061 forKeys:(const BOOL [])keys |
1481 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 6062 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
1482 - (instancetype)initWithDictionary:(GPBBoolInt32Dictionary *)dictionary; | 6063 |
| 6064 /** |
| 6065 * Initializes this dictionary, copying the entries from the given dictionary. |
| 6066 * |
| 6067 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 6068 * |
| 6069 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 6070 **/ |
| 6071 - (instancetype)initWithDictionary:(GPBBoolInt64Dictionary *)dictionary; |
| 6072 |
| 6073 /** |
| 6074 * Initializes this dictionary with the requested capacity. |
| 6075 * |
| 6076 * @param numItems Number of items needed for this dictionary. |
| 6077 * |
| 6078 * @return A newly initialized dictionary with the requested capacity. |
| 6079 **/ |
1483 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 6080 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1484 | 6081 |
1485 - (BOOL)valueForKey:(BOOL)key value:(nullable int32_t *)value; | 6082 /** |
1486 | 6083 * Gets the value for the given key. |
1487 - (void)enumerateKeysAndValuesUsingBlock: | 6084 * |
1488 (void (^)(BOOL key, int32_t value, BOOL *stop))block; | 6085 * @param value Pointer into which the value will be set, if found. |
1489 | 6086 * @param key Key under which the value is stored, if present. |
1490 - (void)addEntriesFromDictionary:(GPBBoolInt32Dictionary *)otherDictionary; | 6087 * |
1491 | 6088 * @return YES if the key was found and the value was copied, NO otherwise. |
1492 - (void)setValue:(int32_t)value forKey:(BOOL)key; | 6089 **/ |
1493 | 6090 - (BOOL)getInt64:(nullable int64_t *)value forKey:(BOOL)key; |
1494 - (void)removeValueForKey:(BOOL)aKey; | 6091 |
| 6092 /** |
| 6093 * Enumerates the keys and values on this dictionary with the given block. |
| 6094 * |
| 6095 * @param block The block to enumerate with. |
| 6096 * **key**: The key for the current entry. |
| 6097 * **value**: The value for the current entry |
| 6098 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 6099 **/ |
| 6100 - (void)enumerateKeysAndInt64sUsingBlock: |
| 6101 (void (^)(BOOL key, int64_t value, BOOL *stop))block; |
| 6102 |
| 6103 /** |
| 6104 * Adds the keys and values from another dictionary. |
| 6105 * |
| 6106 * @param otherDictionary Dictionary containing entries to be added to this |
| 6107 * dictionary. |
| 6108 **/ |
| 6109 - (void)addEntriesFromDictionary:(GPBBoolInt64Dictionary *)otherDictionary; |
| 6110 |
| 6111 /** |
| 6112 * Sets the value for the given key. |
| 6113 * |
| 6114 * @param value The value to set. |
| 6115 * @param key The key under which to store the value. |
| 6116 **/ |
| 6117 - (void)setInt64:(int64_t)value forKey:(BOOL)key; |
| 6118 |
| 6119 /** |
| 6120 * Removes the entry for the given key. |
| 6121 * |
| 6122 * @param aKey Key to be removed from this dictionary. |
| 6123 **/ |
| 6124 - (void)removeInt64ForKey:(BOOL)aKey; |
| 6125 |
| 6126 /** |
| 6127 * Removes all entries in this dictionary. |
| 6128 **/ |
1495 - (void)removeAll; | 6129 - (void)removeAll; |
1496 | 6130 |
1497 @end | 6131 @end |
1498 | 6132 |
1499 #pragma mark - Bool -> UInt64 | 6133 #pragma mark - Bool -> Bool |
1500 | 6134 |
1501 @interface GPBBoolUInt64Dictionary : NSObject <NSCopying> | 6135 /** |
1502 | 6136 * Class used for map fields of <BOOL, BOOL> |
| 6137 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 6138 * |
| 6139 * @note This class is not meant to be subclassed. |
| 6140 **/ |
| 6141 @interface GPBBoolBoolDictionary : NSObject <NSCopying> |
| 6142 |
| 6143 /** Number of entries stored in this dictionary. */ |
1503 @property(nonatomic, readonly) NSUInteger count; | 6144 @property(nonatomic, readonly) NSUInteger count; |
1504 | 6145 |
| 6146 /** |
| 6147 * @return A newly instanced and empty dictionary. |
| 6148 **/ |
1505 + (instancetype)dictionary; | 6149 + (instancetype)dictionary; |
1506 + (instancetype)dictionaryWithValue:(uint64_t)value | 6150 |
| 6151 /** |
| 6152 * Creates and initializes a dictionary with the single entry given. |
| 6153 * |
| 6154 * @param value The value to be placed in the dictionary. |
| 6155 * @param key The key under which to store the value. |
| 6156 * |
| 6157 * @return A newly instanced dictionary with the key and value in it. |
| 6158 **/ |
| 6159 + (instancetype)dictionaryWithBool:(BOOL)value |
| 6160 forKey:(BOOL)key; |
| 6161 |
| 6162 /** |
| 6163 * Creates and initializes a dictionary with the entries given. |
| 6164 * |
| 6165 * @param values The values to be placed in the dictionary. |
| 6166 * @param keys The keys under which to store the values. |
| 6167 * @param count The number of entries to store in the dictionary. |
| 6168 * |
| 6169 * @return A newly instanced dictionary with the keys and values in it. |
| 6170 **/ |
| 6171 + (instancetype)dictionaryWithBools:(const BOOL [])values |
| 6172 forKeys:(const BOOL [])keys |
| 6173 count:(NSUInteger)count; |
| 6174 |
| 6175 /** |
| 6176 * Creates and initializes a dictionary with the entries from the given. |
| 6177 * dictionary. |
| 6178 * |
| 6179 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 6180 * |
| 6181 * @return A newly instanced dictionary with the entries from the given |
| 6182 * dictionary in it. |
| 6183 **/ |
| 6184 + (instancetype)dictionaryWithDictionary:(GPBBoolBoolDictionary *)dictionary; |
| 6185 |
| 6186 /** |
| 6187 * Creates and initializes a dictionary with the given capacity. |
| 6188 * |
| 6189 * @param numItems Capacity needed for the dictionary. |
| 6190 * |
| 6191 * @return A newly instanced dictionary with the given capacity. |
| 6192 **/ |
| 6193 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 6194 |
| 6195 /** |
| 6196 * Initializes this dictionary, copying the given values and keys. |
| 6197 * |
| 6198 * @param values The values to be placed in this dictionary. |
| 6199 * @param keys The keys under which to store the values. |
| 6200 * @param count The number of elements to copy into the dictionary. |
| 6201 * |
| 6202 * @return A newly initialized dictionary with a copy of the values and keys. |
| 6203 **/ |
| 6204 - (instancetype)initWithBools:(const BOOL [])values |
| 6205 forKeys:(const BOOL [])keys |
| 6206 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 6207 |
| 6208 /** |
| 6209 * Initializes this dictionary, copying the entries from the given dictionary. |
| 6210 * |
| 6211 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 6212 * |
| 6213 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 6214 **/ |
| 6215 - (instancetype)initWithDictionary:(GPBBoolBoolDictionary *)dictionary; |
| 6216 |
| 6217 /** |
| 6218 * Initializes this dictionary with the requested capacity. |
| 6219 * |
| 6220 * @param numItems Number of items needed for this dictionary. |
| 6221 * |
| 6222 * @return A newly initialized dictionary with the requested capacity. |
| 6223 **/ |
| 6224 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 6225 |
| 6226 /** |
| 6227 * Gets the value for the given key. |
| 6228 * |
| 6229 * @param value Pointer into which the value will be set, if found. |
| 6230 * @param key Key under which the value is stored, if present. |
| 6231 * |
| 6232 * @return YES if the key was found and the value was copied, NO otherwise. |
| 6233 **/ |
| 6234 - (BOOL)getBool:(nullable BOOL *)value forKey:(BOOL)key; |
| 6235 |
| 6236 /** |
| 6237 * Enumerates the keys and values on this dictionary with the given block. |
| 6238 * |
| 6239 * @param block The block to enumerate with. |
| 6240 * **key**: The key for the current entry. |
| 6241 * **value**: The value for the current entry |
| 6242 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 6243 **/ |
| 6244 - (void)enumerateKeysAndBoolsUsingBlock: |
| 6245 (void (^)(BOOL key, BOOL value, BOOL *stop))block; |
| 6246 |
| 6247 /** |
| 6248 * Adds the keys and values from another dictionary. |
| 6249 * |
| 6250 * @param otherDictionary Dictionary containing entries to be added to this |
| 6251 * dictionary. |
| 6252 **/ |
| 6253 - (void)addEntriesFromDictionary:(GPBBoolBoolDictionary *)otherDictionary; |
| 6254 |
| 6255 /** |
| 6256 * Sets the value for the given key. |
| 6257 * |
| 6258 * @param value The value to set. |
| 6259 * @param key The key under which to store the value. |
| 6260 **/ |
| 6261 - (void)setBool:(BOOL)value forKey:(BOOL)key; |
| 6262 |
| 6263 /** |
| 6264 * Removes the entry for the given key. |
| 6265 * |
| 6266 * @param aKey Key to be removed from this dictionary. |
| 6267 **/ |
| 6268 - (void)removeBoolForKey:(BOOL)aKey; |
| 6269 |
| 6270 /** |
| 6271 * Removes all entries in this dictionary. |
| 6272 **/ |
| 6273 - (void)removeAll; |
| 6274 |
| 6275 @end |
| 6276 |
| 6277 #pragma mark - Bool -> Float |
| 6278 |
| 6279 /** |
| 6280 * Class used for map fields of <BOOL, float> |
| 6281 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 6282 * |
| 6283 * @note This class is not meant to be subclassed. |
| 6284 **/ |
| 6285 @interface GPBBoolFloatDictionary : NSObject <NSCopying> |
| 6286 |
| 6287 /** Number of entries stored in this dictionary. */ |
| 6288 @property(nonatomic, readonly) NSUInteger count; |
| 6289 |
| 6290 /** |
| 6291 * @return A newly instanced and empty dictionary. |
| 6292 **/ |
| 6293 + (instancetype)dictionary; |
| 6294 |
| 6295 /** |
| 6296 * Creates and initializes a dictionary with the single entry given. |
| 6297 * |
| 6298 * @param value The value to be placed in the dictionary. |
| 6299 * @param key The key under which to store the value. |
| 6300 * |
| 6301 * @return A newly instanced dictionary with the key and value in it. |
| 6302 **/ |
| 6303 + (instancetype)dictionaryWithFloat:(float)value |
1507 forKey:(BOOL)key; | 6304 forKey:(BOOL)key; |
1508 + (instancetype)dictionaryWithValues:(const uint64_t [])values | 6305 |
| 6306 /** |
| 6307 * Creates and initializes a dictionary with the entries given. |
| 6308 * |
| 6309 * @param values The values to be placed in the dictionary. |
| 6310 * @param keys The keys under which to store the values. |
| 6311 * @param count The number of entries to store in the dictionary. |
| 6312 * |
| 6313 * @return A newly instanced dictionary with the keys and values in it. |
| 6314 **/ |
| 6315 + (instancetype)dictionaryWithFloats:(const float [])values |
1509 forKeys:(const BOOL [])keys | 6316 forKeys:(const BOOL [])keys |
1510 count:(NSUInteger)count; | 6317 count:(NSUInteger)count; |
1511 + (instancetype)dictionaryWithDictionary:(GPBBoolUInt64Dictionary *)dictionary; | 6318 |
| 6319 /** |
| 6320 * Creates and initializes a dictionary with the entries from the given. |
| 6321 * dictionary. |
| 6322 * |
| 6323 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 6324 * |
| 6325 * @return A newly instanced dictionary with the entries from the given |
| 6326 * dictionary in it. |
| 6327 **/ |
| 6328 + (instancetype)dictionaryWithDictionary:(GPBBoolFloatDictionary *)dictionary; |
| 6329 |
| 6330 /** |
| 6331 * Creates and initializes a dictionary with the given capacity. |
| 6332 * |
| 6333 * @param numItems Capacity needed for the dictionary. |
| 6334 * |
| 6335 * @return A newly instanced dictionary with the given capacity. |
| 6336 **/ |
1512 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 6337 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1513 | 6338 |
1514 - (instancetype)initWithValues:(const uint64_t [])values | 6339 /** |
| 6340 * Initializes this dictionary, copying the given values and keys. |
| 6341 * |
| 6342 * @param values The values to be placed in this dictionary. |
| 6343 * @param keys The keys under which to store the values. |
| 6344 * @param count The number of elements to copy into the dictionary. |
| 6345 * |
| 6346 * @return A newly initialized dictionary with a copy of the values and keys. |
| 6347 **/ |
| 6348 - (instancetype)initWithFloats:(const float [])values |
1515 forKeys:(const BOOL [])keys | 6349 forKeys:(const BOOL [])keys |
1516 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 6350 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
1517 - (instancetype)initWithDictionary:(GPBBoolUInt64Dictionary *)dictionary; | 6351 |
| 6352 /** |
| 6353 * Initializes this dictionary, copying the entries from the given dictionary. |
| 6354 * |
| 6355 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 6356 * |
| 6357 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 6358 **/ |
| 6359 - (instancetype)initWithDictionary:(GPBBoolFloatDictionary *)dictionary; |
| 6360 |
| 6361 /** |
| 6362 * Initializes this dictionary with the requested capacity. |
| 6363 * |
| 6364 * @param numItems Number of items needed for this dictionary. |
| 6365 * |
| 6366 * @return A newly initialized dictionary with the requested capacity. |
| 6367 **/ |
1518 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 6368 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1519 | 6369 |
1520 - (BOOL)valueForKey:(BOOL)key value:(nullable uint64_t *)value; | 6370 /** |
1521 | 6371 * Gets the value for the given key. |
1522 - (void)enumerateKeysAndValuesUsingBlock: | 6372 * |
1523 (void (^)(BOOL key, uint64_t value, BOOL *stop))block; | 6373 * @param value Pointer into which the value will be set, if found. |
1524 | 6374 * @param key Key under which the value is stored, if present. |
1525 - (void)addEntriesFromDictionary:(GPBBoolUInt64Dictionary *)otherDictionary; | 6375 * |
1526 | 6376 * @return YES if the key was found and the value was copied, NO otherwise. |
1527 - (void)setValue:(uint64_t)value forKey:(BOOL)key; | 6377 **/ |
1528 | 6378 - (BOOL)getFloat:(nullable float *)value forKey:(BOOL)key; |
1529 - (void)removeValueForKey:(BOOL)aKey; | 6379 |
| 6380 /** |
| 6381 * Enumerates the keys and values on this dictionary with the given block. |
| 6382 * |
| 6383 * @param block The block to enumerate with. |
| 6384 * **key**: The key for the current entry. |
| 6385 * **value**: The value for the current entry |
| 6386 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 6387 **/ |
| 6388 - (void)enumerateKeysAndFloatsUsingBlock: |
| 6389 (void (^)(BOOL key, float value, BOOL *stop))block; |
| 6390 |
| 6391 /** |
| 6392 * Adds the keys and values from another dictionary. |
| 6393 * |
| 6394 * @param otherDictionary Dictionary containing entries to be added to this |
| 6395 * dictionary. |
| 6396 **/ |
| 6397 - (void)addEntriesFromDictionary:(GPBBoolFloatDictionary *)otherDictionary; |
| 6398 |
| 6399 /** |
| 6400 * Sets the value for the given key. |
| 6401 * |
| 6402 * @param value The value to set. |
| 6403 * @param key The key under which to store the value. |
| 6404 **/ |
| 6405 - (void)setFloat:(float)value forKey:(BOOL)key; |
| 6406 |
| 6407 /** |
| 6408 * Removes the entry for the given key. |
| 6409 * |
| 6410 * @param aKey Key to be removed from this dictionary. |
| 6411 **/ |
| 6412 - (void)removeFloatForKey:(BOOL)aKey; |
| 6413 |
| 6414 /** |
| 6415 * Removes all entries in this dictionary. |
| 6416 **/ |
1530 - (void)removeAll; | 6417 - (void)removeAll; |
1531 | 6418 |
1532 @end | 6419 @end |
1533 | 6420 |
1534 #pragma mark - Bool -> Int64 | 6421 #pragma mark - Bool -> Double |
1535 | 6422 |
1536 @interface GPBBoolInt64Dictionary : NSObject <NSCopying> | 6423 /** |
1537 | 6424 * Class used for map fields of <BOOL, double> |
| 6425 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 6426 * |
| 6427 * @note This class is not meant to be subclassed. |
| 6428 **/ |
| 6429 @interface GPBBoolDoubleDictionary : NSObject <NSCopying> |
| 6430 |
| 6431 /** Number of entries stored in this dictionary. */ |
1538 @property(nonatomic, readonly) NSUInteger count; | 6432 @property(nonatomic, readonly) NSUInteger count; |
1539 | 6433 |
| 6434 /** |
| 6435 * @return A newly instanced and empty dictionary. |
| 6436 **/ |
1540 + (instancetype)dictionary; | 6437 + (instancetype)dictionary; |
1541 + (instancetype)dictionaryWithValue:(int64_t)value | 6438 |
1542 forKey:(BOOL)key; | 6439 /** |
1543 + (instancetype)dictionaryWithValues:(const int64_t [])values | 6440 * Creates and initializes a dictionary with the single entry given. |
1544 forKeys:(const BOOL [])keys | 6441 * |
1545 count:(NSUInteger)count; | 6442 * @param value The value to be placed in the dictionary. |
1546 + (instancetype)dictionaryWithDictionary:(GPBBoolInt64Dictionary *)dictionary; | 6443 * @param key The key under which to store the value. |
| 6444 * |
| 6445 * @return A newly instanced dictionary with the key and value in it. |
| 6446 **/ |
| 6447 + (instancetype)dictionaryWithDouble:(double)value |
| 6448 forKey:(BOOL)key; |
| 6449 |
| 6450 /** |
| 6451 * Creates and initializes a dictionary with the entries given. |
| 6452 * |
| 6453 * @param values The values to be placed in the dictionary. |
| 6454 * @param keys The keys under which to store the values. |
| 6455 * @param count The number of entries to store in the dictionary. |
| 6456 * |
| 6457 * @return A newly instanced dictionary with the keys and values in it. |
| 6458 **/ |
| 6459 + (instancetype)dictionaryWithDoubles:(const double [])values |
| 6460 forKeys:(const BOOL [])keys |
| 6461 count:(NSUInteger)count; |
| 6462 |
| 6463 /** |
| 6464 * Creates and initializes a dictionary with the entries from the given. |
| 6465 * dictionary. |
| 6466 * |
| 6467 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 6468 * |
| 6469 * @return A newly instanced dictionary with the entries from the given |
| 6470 * dictionary in it. |
| 6471 **/ |
| 6472 + (instancetype)dictionaryWithDictionary:(GPBBoolDoubleDictionary *)dictionary; |
| 6473 |
| 6474 /** |
| 6475 * Creates and initializes a dictionary with the given capacity. |
| 6476 * |
| 6477 * @param numItems Capacity needed for the dictionary. |
| 6478 * |
| 6479 * @return A newly instanced dictionary with the given capacity. |
| 6480 **/ |
1547 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 6481 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1548 | 6482 |
1549 - (instancetype)initWithValues:(const int64_t [])values | 6483 /** |
1550 forKeys:(const BOOL [])keys | 6484 * Initializes this dictionary, copying the given values and keys. |
1551 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 6485 * |
1552 - (instancetype)initWithDictionary:(GPBBoolInt64Dictionary *)dictionary; | 6486 * @param values The values to be placed in this dictionary. |
| 6487 * @param keys The keys under which to store the values. |
| 6488 * @param count The number of elements to copy into the dictionary. |
| 6489 * |
| 6490 * @return A newly initialized dictionary with a copy of the values and keys. |
| 6491 **/ |
| 6492 - (instancetype)initWithDoubles:(const double [])values |
| 6493 forKeys:(const BOOL [])keys |
| 6494 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 6495 |
| 6496 /** |
| 6497 * Initializes this dictionary, copying the entries from the given dictionary. |
| 6498 * |
| 6499 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 6500 * |
| 6501 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 6502 **/ |
| 6503 - (instancetype)initWithDictionary:(GPBBoolDoubleDictionary *)dictionary; |
| 6504 |
| 6505 /** |
| 6506 * Initializes this dictionary with the requested capacity. |
| 6507 * |
| 6508 * @param numItems Number of items needed for this dictionary. |
| 6509 * |
| 6510 * @return A newly initialized dictionary with the requested capacity. |
| 6511 **/ |
1553 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 6512 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1554 | 6513 |
1555 - (BOOL)valueForKey:(BOOL)key value:(nullable int64_t *)value; | 6514 /** |
1556 | 6515 * Gets the value for the given key. |
1557 - (void)enumerateKeysAndValuesUsingBlock: | 6516 * |
1558 (void (^)(BOOL key, int64_t value, BOOL *stop))block; | 6517 * @param value Pointer into which the value will be set, if found. |
1559 | 6518 * @param key Key under which the value is stored, if present. |
1560 - (void)addEntriesFromDictionary:(GPBBoolInt64Dictionary *)otherDictionary; | 6519 * |
1561 | 6520 * @return YES if the key was found and the value was copied, NO otherwise. |
1562 - (void)setValue:(int64_t)value forKey:(BOOL)key; | 6521 **/ |
1563 | 6522 - (BOOL)getDouble:(nullable double *)value forKey:(BOOL)key; |
1564 - (void)removeValueForKey:(BOOL)aKey; | 6523 |
| 6524 /** |
| 6525 * Enumerates the keys and values on this dictionary with the given block. |
| 6526 * |
| 6527 * @param block The block to enumerate with. |
| 6528 * **key**: The key for the current entry. |
| 6529 * **value**: The value for the current entry |
| 6530 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 6531 **/ |
| 6532 - (void)enumerateKeysAndDoublesUsingBlock: |
| 6533 (void (^)(BOOL key, double value, BOOL *stop))block; |
| 6534 |
| 6535 /** |
| 6536 * Adds the keys and values from another dictionary. |
| 6537 * |
| 6538 * @param otherDictionary Dictionary containing entries to be added to this |
| 6539 * dictionary. |
| 6540 **/ |
| 6541 - (void)addEntriesFromDictionary:(GPBBoolDoubleDictionary *)otherDictionary; |
| 6542 |
| 6543 /** |
| 6544 * Sets the value for the given key. |
| 6545 * |
| 6546 * @param value The value to set. |
| 6547 * @param key The key under which to store the value. |
| 6548 **/ |
| 6549 - (void)setDouble:(double)value forKey:(BOOL)key; |
| 6550 |
| 6551 /** |
| 6552 * Removes the entry for the given key. |
| 6553 * |
| 6554 * @param aKey Key to be removed from this dictionary. |
| 6555 **/ |
| 6556 - (void)removeDoubleForKey:(BOOL)aKey; |
| 6557 |
| 6558 /** |
| 6559 * Removes all entries in this dictionary. |
| 6560 **/ |
1565 - (void)removeAll; | 6561 - (void)removeAll; |
1566 | 6562 |
1567 @end | 6563 @end |
1568 | 6564 |
1569 #pragma mark - Bool -> Bool | 6565 #pragma mark - Bool -> Enum |
1570 | 6566 |
1571 @interface GPBBoolBoolDictionary : NSObject <NSCopying> | 6567 /** |
1572 | 6568 * Class used for map fields of <BOOL, int32_t> |
| 6569 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 6570 * |
| 6571 * @note This class is not meant to be subclassed. |
| 6572 **/ |
| 6573 @interface GPBBoolEnumDictionary : NSObject <NSCopying> |
| 6574 |
| 6575 /** Number of entries stored in this dictionary. */ |
1573 @property(nonatomic, readonly) NSUInteger count; | 6576 @property(nonatomic, readonly) NSUInteger count; |
1574 | 6577 /** The validation function to check if the enums are valid. */ |
| 6578 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; |
| 6579 |
| 6580 /** |
| 6581 * @return A newly instanced and empty dictionary. |
| 6582 **/ |
1575 + (instancetype)dictionary; | 6583 + (instancetype)dictionary; |
1576 + (instancetype)dictionaryWithValue:(BOOL)value | 6584 |
1577 forKey:(BOOL)key; | 6585 /** |
1578 + (instancetype)dictionaryWithValues:(const BOOL [])values | 6586 * Creates and initializes a dictionary with the given validation function. |
1579 forKeys:(const BOOL [])keys | 6587 * |
1580 count:(NSUInteger)count; | 6588 * @param func The enum validation function for the dictionary. |
1581 + (instancetype)dictionaryWithDictionary:(GPBBoolBoolDictionary *)dictionary; | 6589 * |
1582 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 6590 * @return A newly instanced dictionary. |
1583 | 6591 **/ |
1584 - (instancetype)initWithValues:(const BOOL [])values | |
1585 forKeys:(const BOOL [])keys | |
1586 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
1587 - (instancetype)initWithDictionary:(GPBBoolBoolDictionary *)dictionary; | |
1588 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
1589 | |
1590 - (BOOL)valueForKey:(BOOL)key value:(nullable BOOL *)value; | |
1591 | |
1592 - (void)enumerateKeysAndValuesUsingBlock: | |
1593 (void (^)(BOOL key, BOOL value, BOOL *stop))block; | |
1594 | |
1595 - (void)addEntriesFromDictionary:(GPBBoolBoolDictionary *)otherDictionary; | |
1596 | |
1597 - (void)setValue:(BOOL)value forKey:(BOOL)key; | |
1598 | |
1599 - (void)removeValueForKey:(BOOL)aKey; | |
1600 - (void)removeAll; | |
1601 | |
1602 @end | |
1603 | |
1604 #pragma mark - Bool -> Float | |
1605 | |
1606 @interface GPBBoolFloatDictionary : NSObject <NSCopying> | |
1607 | |
1608 @property(nonatomic, readonly) NSUInteger count; | |
1609 | |
1610 + (instancetype)dictionary; | |
1611 + (instancetype)dictionaryWithValue:(float)value | |
1612 forKey:(BOOL)key; | |
1613 + (instancetype)dictionaryWithValues:(const float [])values | |
1614 forKeys:(const BOOL [])keys | |
1615 count:(NSUInteger)count; | |
1616 + (instancetype)dictionaryWithDictionary:(GPBBoolFloatDictionary *)dictionary; | |
1617 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | |
1618 | |
1619 - (instancetype)initWithValues:(const float [])values | |
1620 forKeys:(const BOOL [])keys | |
1621 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
1622 - (instancetype)initWithDictionary:(GPBBoolFloatDictionary *)dictionary; | |
1623 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
1624 | |
1625 - (BOOL)valueForKey:(BOOL)key value:(nullable float *)value; | |
1626 | |
1627 - (void)enumerateKeysAndValuesUsingBlock: | |
1628 (void (^)(BOOL key, float value, BOOL *stop))block; | |
1629 | |
1630 - (void)addEntriesFromDictionary:(GPBBoolFloatDictionary *)otherDictionary; | |
1631 | |
1632 - (void)setValue:(float)value forKey:(BOOL)key; | |
1633 | |
1634 - (void)removeValueForKey:(BOOL)aKey; | |
1635 - (void)removeAll; | |
1636 | |
1637 @end | |
1638 | |
1639 #pragma mark - Bool -> Double | |
1640 | |
1641 @interface GPBBoolDoubleDictionary : NSObject <NSCopying> | |
1642 | |
1643 @property(nonatomic, readonly) NSUInteger count; | |
1644 | |
1645 + (instancetype)dictionary; | |
1646 + (instancetype)dictionaryWithValue:(double)value | |
1647 forKey:(BOOL)key; | |
1648 + (instancetype)dictionaryWithValues:(const double [])values | |
1649 forKeys:(const BOOL [])keys | |
1650 count:(NSUInteger)count; | |
1651 + (instancetype)dictionaryWithDictionary:(GPBBoolDoubleDictionary *)dictionary; | |
1652 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | |
1653 | |
1654 - (instancetype)initWithValues:(const double [])values | |
1655 forKeys:(const BOOL [])keys | |
1656 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
1657 - (instancetype)initWithDictionary:(GPBBoolDoubleDictionary *)dictionary; | |
1658 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
1659 | |
1660 - (BOOL)valueForKey:(BOOL)key value:(nullable double *)value; | |
1661 | |
1662 - (void)enumerateKeysAndValuesUsingBlock: | |
1663 (void (^)(BOOL key, double value, BOOL *stop))block; | |
1664 | |
1665 - (void)addEntriesFromDictionary:(GPBBoolDoubleDictionary *)otherDictionary; | |
1666 | |
1667 - (void)setValue:(double)value forKey:(BOOL)key; | |
1668 | |
1669 - (void)removeValueForKey:(BOOL)aKey; | |
1670 - (void)removeAll; | |
1671 | |
1672 @end | |
1673 | |
1674 #pragma mark - Bool -> Enum | |
1675 | |
1676 @interface GPBBoolEnumDictionary : NSObject <NSCopying> | |
1677 | |
1678 @property(nonatomic, readonly) NSUInteger count; | |
1679 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; | |
1680 | |
1681 + (instancetype)dictionary; | |
1682 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func; | 6592 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func; |
| 6593 |
| 6594 /** |
| 6595 * Creates and initializes a dictionary with the single entry given. |
| 6596 * |
| 6597 * @param func The enum validation function for the dictionary. |
| 6598 * @param rawValue The raw enum value to be placed in the dictionary. |
| 6599 * @param key The key under which to store the value. |
| 6600 * |
| 6601 * @return A newly instanced dictionary with the key and value in it. |
| 6602 **/ |
1683 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 6603 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
1684 rawValue:(int32_t)rawValue | 6604 rawValue:(int32_t)rawValue |
1685 forKey:(BOOL)key; | 6605 forKey:(BOOL)key; |
| 6606 |
| 6607 /** |
| 6608 * Creates and initializes a dictionary with the entries given. |
| 6609 * |
| 6610 * @param func The enum validation function for the dictionary. |
| 6611 * @param values The raw enum values values to be placed in the dictionary. |
| 6612 * @param keys The keys under which to store the values. |
| 6613 * @param count The number of entries to store in the dictionary. |
| 6614 * |
| 6615 * @return A newly instanced dictionary with the keys and values in it. |
| 6616 **/ |
1686 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 6617 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
1687 rawValues:(const int32_t [])values | 6618 rawValues:(const int32_t [])values |
1688 forKeys:(const BOOL [])keys | 6619 forKeys:(const BOOL [])keys |
1689 count:(NSUInteger)count; | 6620 count:(NSUInteger)count; |
| 6621 |
| 6622 /** |
| 6623 * Creates and initializes a dictionary with the entries from the given. |
| 6624 * dictionary. |
| 6625 * |
| 6626 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 6627 * |
| 6628 * @return A newly instanced dictionary with the entries from the given |
| 6629 * dictionary in it. |
| 6630 **/ |
1690 + (instancetype)dictionaryWithDictionary:(GPBBoolEnumDictionary *)dictionary; | 6631 + (instancetype)dictionaryWithDictionary:(GPBBoolEnumDictionary *)dictionary; |
| 6632 |
| 6633 /** |
| 6634 * Creates and initializes a dictionary with the given capacity. |
| 6635 * |
| 6636 * @param func The enum validation function for the dictionary. |
| 6637 * @param numItems Capacity needed for the dictionary. |
| 6638 * |
| 6639 * @return A newly instanced dictionary with the given capacity. |
| 6640 **/ |
1691 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 6641 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
1692 capacity:(NSUInteger)numItems; | 6642 capacity:(NSUInteger)numItems; |
1693 | 6643 |
| 6644 /** |
| 6645 * Initializes a dictionary with the given validation function. |
| 6646 * |
| 6647 * @param func The enum validation function for the dictionary. |
| 6648 * |
| 6649 * @return A newly initialized dictionary. |
| 6650 **/ |
1694 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; | 6651 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; |
| 6652 |
| 6653 /** |
| 6654 * Initializes a dictionary with the entries given. |
| 6655 * |
| 6656 * @param func The enum validation function for the dictionary. |
| 6657 * @param values The raw enum values values to be placed in the dictionary. |
| 6658 * @param keys The keys under which to store the values. |
| 6659 * @param count The number of entries to store in the dictionary. |
| 6660 * |
| 6661 * @return A newly initialized dictionary with the keys and values in it. |
| 6662 **/ |
1695 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func | 6663 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func |
1696 rawValues:(const int32_t [])values | 6664 rawValues:(const int32_t [])values |
1697 forKeys:(const BOOL [])keys | 6665 forKeys:(const BOOL [])keys |
1698 count:(NSUInteger)count NS_DESIGNATED_INITI
ALIZER; | 6666 count:(NSUInteger)count NS_DESIGNATED_INITI
ALIZER; |
| 6667 |
| 6668 /** |
| 6669 * Initializes a dictionary with the entries from the given. |
| 6670 * dictionary. |
| 6671 * |
| 6672 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 6673 * |
| 6674 * @return A newly initialized dictionary with the entries from the given |
| 6675 * dictionary in it. |
| 6676 **/ |
1699 - (instancetype)initWithDictionary:(GPBBoolEnumDictionary *)dictionary; | 6677 - (instancetype)initWithDictionary:(GPBBoolEnumDictionary *)dictionary; |
| 6678 |
| 6679 /** |
| 6680 * Initializes a dictionary with the given capacity. |
| 6681 * |
| 6682 * @param func The enum validation function for the dictionary. |
| 6683 * @param numItems Capacity needed for the dictionary. |
| 6684 * |
| 6685 * @return A newly initialized dictionary with the given capacity. |
| 6686 **/ |
1700 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func | 6687 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func |
1701 capacity:(NSUInteger)numItems; | 6688 capacity:(NSUInteger)numItems; |
1702 | 6689 |
1703 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key | 6690 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key |
1704 // is not a valid enumerator as defined by validationFunc. If the actual value i
s | 6691 // is not a valid enumerator as defined by validationFunc. If the actual value i
s |
1705 // desired, use "raw" version of the method. | 6692 // desired, use "raw" version of the method. |
1706 | 6693 |
1707 - (BOOL)valueForKey:(BOOL)key value:(nullable int32_t *)value; | 6694 /** |
| 6695 * Gets the value for the given key. |
| 6696 * |
| 6697 * @param value Pointer into which the value will be set, if found. |
| 6698 * @param key Key under which the value is stored, if present. |
| 6699 * |
| 6700 * @return YES if the key was found and the value was copied, NO otherwise. |
| 6701 **/ |
| 6702 - (BOOL)getEnum:(nullable int32_t *)value forKey:(BOOL)key; |
1708 | 6703 |
1709 - (void)enumerateKeysAndValuesUsingBlock: | 6704 /** |
| 6705 * Enumerates the keys and values on this dictionary with the given block. |
| 6706 * |
| 6707 * @param block The block to enumerate with. |
| 6708 * **key**: The key for the current entry. |
| 6709 * **value**: The value for the current entry |
| 6710 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 6711 **/ |
| 6712 - (void)enumerateKeysAndEnumsUsingBlock: |
1710 (void (^)(BOOL key, int32_t value, BOOL *stop))block; | 6713 (void (^)(BOOL key, int32_t value, BOOL *stop))block; |
1711 | 6714 |
1712 // These methods bypass the validationFunc to provide access to values that were
not | 6715 /** |
1713 // known at the time the binary was compiled. | 6716 * Gets the raw enum value for the given key. |
| 6717 * |
| 6718 * @note This method bypass the validationFunc to enable the access of values th
at |
| 6719 * were not known at the time the binary was compiled. |
| 6720 * |
| 6721 * @param rawValue Pointer into which the value will be set, if found. |
| 6722 * @param key Key under which the value is stored, if present. |
| 6723 * |
| 6724 * @return YES if the key was found and the value was copied, NO otherwise. |
| 6725 **/ |
| 6726 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(BOOL)key; |
1714 | 6727 |
1715 - (BOOL)valueForKey:(BOOL)key rawValue:(nullable int32_t *)rawValue; | 6728 /** |
1716 | 6729 * Enumerates the keys and values on this dictionary with the given block. |
| 6730 * |
| 6731 * @note This method bypass the validationFunc to enable the access of values th
at |
| 6732 * were not known at the time the binary was compiled. |
| 6733 * |
| 6734 * @param block The block to enumerate with. |
| 6735 * **key**: The key for the current entry. |
| 6736 * **rawValue**: The value for the current entry |
| 6737 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 6738 **/ |
1717 - (void)enumerateKeysAndRawValuesUsingBlock: | 6739 - (void)enumerateKeysAndRawValuesUsingBlock: |
1718 (void (^)(BOOL key, int32_t rawValue, BOOL *stop))block; | 6740 (void (^)(BOOL key, int32_t rawValue, BOOL *stop))block; |
1719 | 6741 |
| 6742 /** |
| 6743 * Adds the keys and raw enum values from another dictionary. |
| 6744 * |
| 6745 * @note This method bypass the validationFunc to enable the setting of values t
hat |
| 6746 * were not known at the time the binary was compiled. |
| 6747 * |
| 6748 * @param otherDictionary Dictionary containing entries to be added to this |
| 6749 * dictionary. |
| 6750 **/ |
1720 - (void)addRawEntriesFromDictionary:(GPBBoolEnumDictionary *)otherDictionary; | 6751 - (void)addRawEntriesFromDictionary:(GPBBoolEnumDictionary *)otherDictionary; |
1721 | 6752 |
1722 // If value is not a valid enumerator as defined by validationFunc, these | 6753 // If value is not a valid enumerator as defined by validationFunc, these |
1723 // methods will assert in debug, and will log in release and assign the value | 6754 // methods will assert in debug, and will log in release and assign the value |
1724 // to the default value. Use the rawValue methods below to assign non enumerator | 6755 // to the default value. Use the rawValue methods below to assign non enumerator |
1725 // values. | 6756 // values. |
1726 | 6757 |
1727 - (void)setValue:(int32_t)value forKey:(BOOL)key; | 6758 /** |
1728 | 6759 * Sets the value for the given key. |
1729 // This method bypass the validationFunc to provide setting of values that were
not | 6760 * |
1730 // known at the time the binary was compiled. | 6761 * @param value The value to set. |
| 6762 * @param key The key under which to store the value. |
| 6763 **/ |
| 6764 - (void)setEnum:(int32_t)value forKey:(BOOL)key; |
| 6765 |
| 6766 /** |
| 6767 * Sets the raw enum value for the given key. |
| 6768 * |
| 6769 * @note This method bypass the validationFunc to enable the setting of values t
hat |
| 6770 * were not known at the time the binary was compiled. |
| 6771 * |
| 6772 * @param rawValue The raw enum value to set. |
| 6773 * @param key The key under which to store the raw enum value. |
| 6774 **/ |
1731 - (void)setRawValue:(int32_t)rawValue forKey:(BOOL)key; | 6775 - (void)setRawValue:(int32_t)rawValue forKey:(BOOL)key; |
1732 | 6776 |
1733 // No validation applies to these methods. | 6777 /** |
1734 | 6778 * Removes the entry for the given key. |
1735 - (void)removeValueForKey:(BOOL)aKey; | 6779 * |
| 6780 * @param aKey Key to be removed from this dictionary. |
| 6781 **/ |
| 6782 - (void)removeEnumForKey:(BOOL)aKey; |
| 6783 |
| 6784 /** |
| 6785 * Removes all entries in this dictionary. |
| 6786 **/ |
1736 - (void)removeAll; | 6787 - (void)removeAll; |
1737 | 6788 |
1738 @end | 6789 @end |
1739 | 6790 |
1740 #pragma mark - Bool -> Object | 6791 #pragma mark - Bool -> Object |
1741 | 6792 |
| 6793 /** |
| 6794 * Class used for map fields of <BOOL, ObjectType> |
| 6795 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 6796 * |
| 6797 * @note This class is not meant to be subclassed. |
| 6798 **/ |
1742 @interface GPBBoolObjectDictionary<__covariant ObjectType> : NSObject <NSCopying
> | 6799 @interface GPBBoolObjectDictionary<__covariant ObjectType> : NSObject <NSCopying
> |
1743 | 6800 |
| 6801 /** Number of entries stored in this dictionary. */ |
1744 @property(nonatomic, readonly) NSUInteger count; | 6802 @property(nonatomic, readonly) NSUInteger count; |
1745 | 6803 |
| 6804 /** |
| 6805 * @return A newly instanced and empty dictionary. |
| 6806 **/ |
1746 + (instancetype)dictionary; | 6807 + (instancetype)dictionary; |
| 6808 |
| 6809 /** |
| 6810 * Creates and initializes a dictionary with the single entry given. |
| 6811 * |
| 6812 * @param object The value to be placed in the dictionary. |
| 6813 * @param key The key under which to store the value. |
| 6814 * |
| 6815 * @return A newly instanced dictionary with the key and value in it. |
| 6816 **/ |
1747 + (instancetype)dictionaryWithObject:(ObjectType)object | 6817 + (instancetype)dictionaryWithObject:(ObjectType)object |
1748 forKey:(BOOL)key; | 6818 forKey:(BOOL)key; |
| 6819 |
| 6820 /** |
| 6821 * Creates and initializes a dictionary with the entries given. |
| 6822 * |
| 6823 * @param objects The values to be placed in the dictionary. |
| 6824 * @param keys The keys under which to store the values. |
| 6825 * @param count The number of entries to store in the dictionary. |
| 6826 * |
| 6827 * @return A newly instanced dictionary with the keys and values in it. |
| 6828 **/ |
1749 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED []
)objects | 6829 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED []
)objects |
1750 forKeys:(const BOOL [])keys | 6830 forKeys:(const BOOL [])keys |
1751 count:(NSUInteger)count; | 6831 count:(NSUInteger)count; |
| 6832 |
| 6833 /** |
| 6834 * Creates and initializes a dictionary with the entries from the given. |
| 6835 * dictionary. |
| 6836 * |
| 6837 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 6838 * |
| 6839 * @return A newly instanced dictionary with the entries from the given |
| 6840 * dictionary in it. |
| 6841 **/ |
1752 + (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary; | 6842 + (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary; |
| 6843 |
| 6844 /** |
| 6845 * Creates and initializes a dictionary with the given capacity. |
| 6846 * |
| 6847 * @param numItems Capacity needed for the dictionary. |
| 6848 * |
| 6849 * @return A newly instanced dictionary with the given capacity. |
| 6850 **/ |
1753 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 6851 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1754 | 6852 |
| 6853 /** |
| 6854 * Initializes this dictionary, copying the given values and keys. |
| 6855 * |
| 6856 * @param objects The values to be placed in this dictionary. |
| 6857 * @param keys The keys under which to store the values. |
| 6858 * @param count The number of elements to copy into the dictionary. |
| 6859 * |
| 6860 * @return A newly initialized dictionary with a copy of the values and keys. |
| 6861 **/ |
1755 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec
ts | 6862 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec
ts |
1756 forKeys:(const BOOL [])keys | 6863 forKeys:(const BOOL [])keys |
1757 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 6864 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 6865 |
| 6866 /** |
| 6867 * Initializes this dictionary, copying the entries from the given dictionary. |
| 6868 * |
| 6869 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 6870 * |
| 6871 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 6872 **/ |
1758 - (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary; | 6873 - (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary; |
| 6874 |
| 6875 /** |
| 6876 * Initializes this dictionary with the requested capacity. |
| 6877 * |
| 6878 * @param numItems Number of items needed for this dictionary. |
| 6879 * |
| 6880 * @return A newly initialized dictionary with the requested capacity. |
| 6881 **/ |
1759 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 6882 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1760 | 6883 |
| 6884 /** |
| 6885 * Fetches the object stored under the given key. |
| 6886 * |
| 6887 * @param key Key under which the value is stored, if present. |
| 6888 * |
| 6889 * @return The object if found, nil otherwise. |
| 6890 **/ |
1761 - (ObjectType)objectForKey:(BOOL)key; | 6891 - (ObjectType)objectForKey:(BOOL)key; |
1762 | 6892 |
| 6893 /** |
| 6894 * Enumerates the keys and values on this dictionary with the given block. |
| 6895 * |
| 6896 * @param block The block to enumerate with. |
| 6897 * **key**: The key for the current entry. |
| 6898 * **object**: The value for the current entry |
| 6899 * **stop**: A pointer to a boolean that when set stops the enumeration
. |
| 6900 **/ |
1763 - (void)enumerateKeysAndObjectsUsingBlock: | 6901 - (void)enumerateKeysAndObjectsUsingBlock: |
1764 (void (^)(BOOL key, ObjectType object, BOOL *stop))block; | 6902 (void (^)(BOOL key, ObjectType object, BOOL *stop))block; |
1765 | 6903 |
| 6904 /** |
| 6905 * Adds the keys and values from another dictionary. |
| 6906 * |
| 6907 * @param otherDictionary Dictionary containing entries to be added to this |
| 6908 * dictionary. |
| 6909 **/ |
1766 - (void)addEntriesFromDictionary:(GPBBoolObjectDictionary *)otherDictionary; | 6910 - (void)addEntriesFromDictionary:(GPBBoolObjectDictionary *)otherDictionary; |
1767 | 6911 |
| 6912 /** |
| 6913 * Sets the value for the given key. |
| 6914 * |
| 6915 * @param object The value to set. |
| 6916 * @param key The key under which to store the value. |
| 6917 **/ |
1768 - (void)setObject:(ObjectType)object forKey:(BOOL)key; | 6918 - (void)setObject:(ObjectType)object forKey:(BOOL)key; |
1769 | 6919 |
| 6920 /** |
| 6921 * Removes the entry for the given key. |
| 6922 * |
| 6923 * @param aKey Key to be removed from this dictionary. |
| 6924 **/ |
1770 - (void)removeObjectForKey:(BOOL)aKey; | 6925 - (void)removeObjectForKey:(BOOL)aKey; |
| 6926 |
| 6927 /** |
| 6928 * Removes all entries in this dictionary. |
| 6929 **/ |
1771 - (void)removeAll; | 6930 - (void)removeAll; |
1772 | 6931 |
1773 @end | 6932 @end |
1774 | 6933 |
1775 #pragma mark - String -> UInt32 | 6934 #pragma mark - String -> UInt32 |
1776 | 6935 |
| 6936 /** |
| 6937 * Class used for map fields of <NSString, uint32_t> |
| 6938 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 6939 * |
| 6940 * @note This class is not meant to be subclassed. |
| 6941 **/ |
1777 @interface GPBStringUInt32Dictionary : NSObject <NSCopying> | 6942 @interface GPBStringUInt32Dictionary : NSObject <NSCopying> |
1778 | 6943 |
| 6944 /** Number of entries stored in this dictionary. */ |
1779 @property(nonatomic, readonly) NSUInteger count; | 6945 @property(nonatomic, readonly) NSUInteger count; |
1780 | 6946 |
| 6947 /** |
| 6948 * @return A newly instanced and empty dictionary. |
| 6949 **/ |
1781 + (instancetype)dictionary; | 6950 + (instancetype)dictionary; |
1782 + (instancetype)dictionaryWithValue:(uint32_t)value | 6951 |
| 6952 /** |
| 6953 * Creates and initializes a dictionary with the single entry given. |
| 6954 * |
| 6955 * @param value The value to be placed in the dictionary. |
| 6956 * @param key The key under which to store the value. |
| 6957 * |
| 6958 * @return A newly instanced dictionary with the key and value in it. |
| 6959 **/ |
| 6960 + (instancetype)dictionaryWithUInt32:(uint32_t)value |
| 6961 forKey:(NSString *)key; |
| 6962 |
| 6963 /** |
| 6964 * Creates and initializes a dictionary with the entries given. |
| 6965 * |
| 6966 * @param values The values to be placed in the dictionary. |
| 6967 * @param keys The keys under which to store the values. |
| 6968 * @param count The number of entries to store in the dictionary. |
| 6969 * |
| 6970 * @return A newly instanced dictionary with the keys and values in it. |
| 6971 **/ |
| 6972 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values |
| 6973 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED []
)keys |
| 6974 count:(NSUInteger)count; |
| 6975 |
| 6976 /** |
| 6977 * Creates and initializes a dictionary with the entries from the given. |
| 6978 * dictionary. |
| 6979 * |
| 6980 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 6981 * |
| 6982 * @return A newly instanced dictionary with the entries from the given |
| 6983 * dictionary in it. |
| 6984 **/ |
| 6985 + (instancetype)dictionaryWithDictionary:(GPBStringUInt32Dictionary *)dictionary
; |
| 6986 |
| 6987 /** |
| 6988 * Creates and initializes a dictionary with the given capacity. |
| 6989 * |
| 6990 * @param numItems Capacity needed for the dictionary. |
| 6991 * |
| 6992 * @return A newly instanced dictionary with the given capacity. |
| 6993 **/ |
| 6994 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 6995 |
| 6996 /** |
| 6997 * Initializes this dictionary, copying the given values and keys. |
| 6998 * |
| 6999 * @param values The values to be placed in this dictionary. |
| 7000 * @param keys The keys under which to store the values. |
| 7001 * @param count The number of elements to copy into the dictionary. |
| 7002 * |
| 7003 * @return A newly initialized dictionary with a copy of the values and keys. |
| 7004 **/ |
| 7005 - (instancetype)initWithUInt32s:(const uint32_t [])values |
| 7006 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys |
| 7007 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 7008 |
| 7009 /** |
| 7010 * Initializes this dictionary, copying the entries from the given dictionary. |
| 7011 * |
| 7012 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 7013 * |
| 7014 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 7015 **/ |
| 7016 - (instancetype)initWithDictionary:(GPBStringUInt32Dictionary *)dictionary; |
| 7017 |
| 7018 /** |
| 7019 * Initializes this dictionary with the requested capacity. |
| 7020 * |
| 7021 * @param numItems Number of items needed for this dictionary. |
| 7022 * |
| 7023 * @return A newly initialized dictionary with the requested capacity. |
| 7024 **/ |
| 7025 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 7026 |
| 7027 /** |
| 7028 * Gets the value for the given key. |
| 7029 * |
| 7030 * @param value Pointer into which the value will be set, if found. |
| 7031 * @param key Key under which the value is stored, if present. |
| 7032 * |
| 7033 * @return YES if the key was found and the value was copied, NO otherwise. |
| 7034 **/ |
| 7035 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(NSString *)key; |
| 7036 |
| 7037 /** |
| 7038 * Enumerates the keys and values on this dictionary with the given block. |
| 7039 * |
| 7040 * @param block The block to enumerate with. |
| 7041 * **key**: The key for the current entry. |
| 7042 * **value**: The value for the current entry |
| 7043 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 7044 **/ |
| 7045 - (void)enumerateKeysAndUInt32sUsingBlock: |
| 7046 (void (^)(NSString *key, uint32_t value, BOOL *stop))block; |
| 7047 |
| 7048 /** |
| 7049 * Adds the keys and values from another dictionary. |
| 7050 * |
| 7051 * @param otherDictionary Dictionary containing entries to be added to this |
| 7052 * dictionary. |
| 7053 **/ |
| 7054 - (void)addEntriesFromDictionary:(GPBStringUInt32Dictionary *)otherDictionary; |
| 7055 |
| 7056 /** |
| 7057 * Sets the value for the given key. |
| 7058 * |
| 7059 * @param value The value to set. |
| 7060 * @param key The key under which to store the value. |
| 7061 **/ |
| 7062 - (void)setUInt32:(uint32_t)value forKey:(NSString *)key; |
| 7063 |
| 7064 /** |
| 7065 * Removes the entry for the given key. |
| 7066 * |
| 7067 * @param aKey Key to be removed from this dictionary. |
| 7068 **/ |
| 7069 - (void)removeUInt32ForKey:(NSString *)aKey; |
| 7070 |
| 7071 /** |
| 7072 * Removes all entries in this dictionary. |
| 7073 **/ |
| 7074 - (void)removeAll; |
| 7075 |
| 7076 @end |
| 7077 |
| 7078 #pragma mark - String -> Int32 |
| 7079 |
| 7080 /** |
| 7081 * Class used for map fields of <NSString, int32_t> |
| 7082 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 7083 * |
| 7084 * @note This class is not meant to be subclassed. |
| 7085 **/ |
| 7086 @interface GPBStringInt32Dictionary : NSObject <NSCopying> |
| 7087 |
| 7088 /** Number of entries stored in this dictionary. */ |
| 7089 @property(nonatomic, readonly) NSUInteger count; |
| 7090 |
| 7091 /** |
| 7092 * @return A newly instanced and empty dictionary. |
| 7093 **/ |
| 7094 + (instancetype)dictionary; |
| 7095 |
| 7096 /** |
| 7097 * Creates and initializes a dictionary with the single entry given. |
| 7098 * |
| 7099 * @param value The value to be placed in the dictionary. |
| 7100 * @param key The key under which to store the value. |
| 7101 * |
| 7102 * @return A newly instanced dictionary with the key and value in it. |
| 7103 **/ |
| 7104 + (instancetype)dictionaryWithInt32:(int32_t)value |
1783 forKey:(NSString *)key; | 7105 forKey:(NSString *)key; |
1784 + (instancetype)dictionaryWithValues:(const uint32_t [])values | 7106 |
| 7107 /** |
| 7108 * Creates and initializes a dictionary with the entries given. |
| 7109 * |
| 7110 * @param values The values to be placed in the dictionary. |
| 7111 * @param keys The keys under which to store the values. |
| 7112 * @param count The number of entries to store in the dictionary. |
| 7113 * |
| 7114 * @return A newly instanced dictionary with the keys and values in it. |
| 7115 **/ |
| 7116 + (instancetype)dictionaryWithInt32s:(const int32_t [])values |
1785 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])
keys | 7117 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])
keys |
1786 count:(NSUInteger)count; | 7118 count:(NSUInteger)count; |
1787 + (instancetype)dictionaryWithDictionary:(GPBStringUInt32Dictionary *)dictionary
; | 7119 |
| 7120 /** |
| 7121 * Creates and initializes a dictionary with the entries from the given. |
| 7122 * dictionary. |
| 7123 * |
| 7124 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 7125 * |
| 7126 * @return A newly instanced dictionary with the entries from the given |
| 7127 * dictionary in it. |
| 7128 **/ |
| 7129 + (instancetype)dictionaryWithDictionary:(GPBStringInt32Dictionary *)dictionary; |
| 7130 |
| 7131 /** |
| 7132 * Creates and initializes a dictionary with the given capacity. |
| 7133 * |
| 7134 * @param numItems Capacity needed for the dictionary. |
| 7135 * |
| 7136 * @return A newly instanced dictionary with the given capacity. |
| 7137 **/ |
1788 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 7138 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1789 | 7139 |
1790 - (instancetype)initWithValues:(const uint32_t [])values | 7140 /** |
| 7141 * Initializes this dictionary, copying the given values and keys. |
| 7142 * |
| 7143 * @param values The values to be placed in this dictionary. |
| 7144 * @param keys The keys under which to store the values. |
| 7145 * @param count The number of elements to copy into the dictionary. |
| 7146 * |
| 7147 * @return A newly initialized dictionary with a copy of the values and keys. |
| 7148 **/ |
| 7149 - (instancetype)initWithInt32s:(const int32_t [])values |
1791 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys | 7150 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys |
1792 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 7151 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
1793 - (instancetype)initWithDictionary:(GPBStringUInt32Dictionary *)dictionary; | 7152 |
| 7153 /** |
| 7154 * Initializes this dictionary, copying the entries from the given dictionary. |
| 7155 * |
| 7156 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 7157 * |
| 7158 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 7159 **/ |
| 7160 - (instancetype)initWithDictionary:(GPBStringInt32Dictionary *)dictionary; |
| 7161 |
| 7162 /** |
| 7163 * Initializes this dictionary with the requested capacity. |
| 7164 * |
| 7165 * @param numItems Number of items needed for this dictionary. |
| 7166 * |
| 7167 * @return A newly initialized dictionary with the requested capacity. |
| 7168 **/ |
1794 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 7169 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1795 | 7170 |
1796 - (BOOL)valueForKey:(NSString *)key value:(nullable uint32_t *)value; | 7171 /** |
1797 | 7172 * Gets the value for the given key. |
1798 - (void)enumerateKeysAndValuesUsingBlock: | 7173 * |
1799 (void (^)(NSString *key, uint32_t value, BOOL *stop))block; | 7174 * @param value Pointer into which the value will be set, if found. |
1800 | 7175 * @param key Key under which the value is stored, if present. |
1801 - (void)addEntriesFromDictionary:(GPBStringUInt32Dictionary *)otherDictionary; | 7176 * |
1802 | 7177 * @return YES if the key was found and the value was copied, NO otherwise. |
1803 - (void)setValue:(uint32_t)value forKey:(NSString *)key; | 7178 **/ |
1804 | 7179 - (BOOL)getInt32:(nullable int32_t *)value forKey:(NSString *)key; |
1805 - (void)removeValueForKey:(NSString *)aKey; | 7180 |
| 7181 /** |
| 7182 * Enumerates the keys and values on this dictionary with the given block. |
| 7183 * |
| 7184 * @param block The block to enumerate with. |
| 7185 * **key**: The key for the current entry. |
| 7186 * **value**: The value for the current entry |
| 7187 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 7188 **/ |
| 7189 - (void)enumerateKeysAndInt32sUsingBlock: |
| 7190 (void (^)(NSString *key, int32_t value, BOOL *stop))block; |
| 7191 |
| 7192 /** |
| 7193 * Adds the keys and values from another dictionary. |
| 7194 * |
| 7195 * @param otherDictionary Dictionary containing entries to be added to this |
| 7196 * dictionary. |
| 7197 **/ |
| 7198 - (void)addEntriesFromDictionary:(GPBStringInt32Dictionary *)otherDictionary; |
| 7199 |
| 7200 /** |
| 7201 * Sets the value for the given key. |
| 7202 * |
| 7203 * @param value The value to set. |
| 7204 * @param key The key under which to store the value. |
| 7205 **/ |
| 7206 - (void)setInt32:(int32_t)value forKey:(NSString *)key; |
| 7207 |
| 7208 /** |
| 7209 * Removes the entry for the given key. |
| 7210 * |
| 7211 * @param aKey Key to be removed from this dictionary. |
| 7212 **/ |
| 7213 - (void)removeInt32ForKey:(NSString *)aKey; |
| 7214 |
| 7215 /** |
| 7216 * Removes all entries in this dictionary. |
| 7217 **/ |
1806 - (void)removeAll; | 7218 - (void)removeAll; |
1807 | 7219 |
1808 @end | 7220 @end |
1809 | 7221 |
1810 #pragma mark - String -> Int32 | 7222 #pragma mark - String -> UInt64 |
1811 | 7223 |
1812 @interface GPBStringInt32Dictionary : NSObject <NSCopying> | 7224 /** |
1813 | 7225 * Class used for map fields of <NSString, uint64_t> |
| 7226 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 7227 * |
| 7228 * @note This class is not meant to be subclassed. |
| 7229 **/ |
| 7230 @interface GPBStringUInt64Dictionary : NSObject <NSCopying> |
| 7231 |
| 7232 /** Number of entries stored in this dictionary. */ |
1814 @property(nonatomic, readonly) NSUInteger count; | 7233 @property(nonatomic, readonly) NSUInteger count; |
1815 | 7234 |
| 7235 /** |
| 7236 * @return A newly instanced and empty dictionary. |
| 7237 **/ |
1816 + (instancetype)dictionary; | 7238 + (instancetype)dictionary; |
1817 + (instancetype)dictionaryWithValue:(int32_t)value | 7239 |
| 7240 /** |
| 7241 * Creates and initializes a dictionary with the single entry given. |
| 7242 * |
| 7243 * @param value The value to be placed in the dictionary. |
| 7244 * @param key The key under which to store the value. |
| 7245 * |
| 7246 * @return A newly instanced dictionary with the key and value in it. |
| 7247 **/ |
| 7248 + (instancetype)dictionaryWithUInt64:(uint64_t)value |
| 7249 forKey:(NSString *)key; |
| 7250 |
| 7251 /** |
| 7252 * Creates and initializes a dictionary with the entries given. |
| 7253 * |
| 7254 * @param values The values to be placed in the dictionary. |
| 7255 * @param keys The keys under which to store the values. |
| 7256 * @param count The number of entries to store in the dictionary. |
| 7257 * |
| 7258 * @return A newly instanced dictionary with the keys and values in it. |
| 7259 **/ |
| 7260 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values |
| 7261 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED []
)keys |
| 7262 count:(NSUInteger)count; |
| 7263 |
| 7264 /** |
| 7265 * Creates and initializes a dictionary with the entries from the given. |
| 7266 * dictionary. |
| 7267 * |
| 7268 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 7269 * |
| 7270 * @return A newly instanced dictionary with the entries from the given |
| 7271 * dictionary in it. |
| 7272 **/ |
| 7273 + (instancetype)dictionaryWithDictionary:(GPBStringUInt64Dictionary *)dictionary
; |
| 7274 |
| 7275 /** |
| 7276 * Creates and initializes a dictionary with the given capacity. |
| 7277 * |
| 7278 * @param numItems Capacity needed for the dictionary. |
| 7279 * |
| 7280 * @return A newly instanced dictionary with the given capacity. |
| 7281 **/ |
| 7282 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 7283 |
| 7284 /** |
| 7285 * Initializes this dictionary, copying the given values and keys. |
| 7286 * |
| 7287 * @param values The values to be placed in this dictionary. |
| 7288 * @param keys The keys under which to store the values. |
| 7289 * @param count The number of elements to copy into the dictionary. |
| 7290 * |
| 7291 * @return A newly initialized dictionary with a copy of the values and keys. |
| 7292 **/ |
| 7293 - (instancetype)initWithUInt64s:(const uint64_t [])values |
| 7294 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys |
| 7295 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 7296 |
| 7297 /** |
| 7298 * Initializes this dictionary, copying the entries from the given dictionary. |
| 7299 * |
| 7300 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 7301 * |
| 7302 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 7303 **/ |
| 7304 - (instancetype)initWithDictionary:(GPBStringUInt64Dictionary *)dictionary; |
| 7305 |
| 7306 /** |
| 7307 * Initializes this dictionary with the requested capacity. |
| 7308 * |
| 7309 * @param numItems Number of items needed for this dictionary. |
| 7310 * |
| 7311 * @return A newly initialized dictionary with the requested capacity. |
| 7312 **/ |
| 7313 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 7314 |
| 7315 /** |
| 7316 * Gets the value for the given key. |
| 7317 * |
| 7318 * @param value Pointer into which the value will be set, if found. |
| 7319 * @param key Key under which the value is stored, if present. |
| 7320 * |
| 7321 * @return YES if the key was found and the value was copied, NO otherwise. |
| 7322 **/ |
| 7323 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(NSString *)key; |
| 7324 |
| 7325 /** |
| 7326 * Enumerates the keys and values on this dictionary with the given block. |
| 7327 * |
| 7328 * @param block The block to enumerate with. |
| 7329 * **key**: The key for the current entry. |
| 7330 * **value**: The value for the current entry |
| 7331 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 7332 **/ |
| 7333 - (void)enumerateKeysAndUInt64sUsingBlock: |
| 7334 (void (^)(NSString *key, uint64_t value, BOOL *stop))block; |
| 7335 |
| 7336 /** |
| 7337 * Adds the keys and values from another dictionary. |
| 7338 * |
| 7339 * @param otherDictionary Dictionary containing entries to be added to this |
| 7340 * dictionary. |
| 7341 **/ |
| 7342 - (void)addEntriesFromDictionary:(GPBStringUInt64Dictionary *)otherDictionary; |
| 7343 |
| 7344 /** |
| 7345 * Sets the value for the given key. |
| 7346 * |
| 7347 * @param value The value to set. |
| 7348 * @param key The key under which to store the value. |
| 7349 **/ |
| 7350 - (void)setUInt64:(uint64_t)value forKey:(NSString *)key; |
| 7351 |
| 7352 /** |
| 7353 * Removes the entry for the given key. |
| 7354 * |
| 7355 * @param aKey Key to be removed from this dictionary. |
| 7356 **/ |
| 7357 - (void)removeUInt64ForKey:(NSString *)aKey; |
| 7358 |
| 7359 /** |
| 7360 * Removes all entries in this dictionary. |
| 7361 **/ |
| 7362 - (void)removeAll; |
| 7363 |
| 7364 @end |
| 7365 |
| 7366 #pragma mark - String -> Int64 |
| 7367 |
| 7368 /** |
| 7369 * Class used for map fields of <NSString, int64_t> |
| 7370 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 7371 * |
| 7372 * @note This class is not meant to be subclassed. |
| 7373 **/ |
| 7374 @interface GPBStringInt64Dictionary : NSObject <NSCopying> |
| 7375 |
| 7376 /** Number of entries stored in this dictionary. */ |
| 7377 @property(nonatomic, readonly) NSUInteger count; |
| 7378 |
| 7379 /** |
| 7380 * @return A newly instanced and empty dictionary. |
| 7381 **/ |
| 7382 + (instancetype)dictionary; |
| 7383 |
| 7384 /** |
| 7385 * Creates and initializes a dictionary with the single entry given. |
| 7386 * |
| 7387 * @param value The value to be placed in the dictionary. |
| 7388 * @param key The key under which to store the value. |
| 7389 * |
| 7390 * @return A newly instanced dictionary with the key and value in it. |
| 7391 **/ |
| 7392 + (instancetype)dictionaryWithInt64:(int64_t)value |
1818 forKey:(NSString *)key; | 7393 forKey:(NSString *)key; |
1819 + (instancetype)dictionaryWithValues:(const int32_t [])values | 7394 |
| 7395 /** |
| 7396 * Creates and initializes a dictionary with the entries given. |
| 7397 * |
| 7398 * @param values The values to be placed in the dictionary. |
| 7399 * @param keys The keys under which to store the values. |
| 7400 * @param count The number of entries to store in the dictionary. |
| 7401 * |
| 7402 * @return A newly instanced dictionary with the keys and values in it. |
| 7403 **/ |
| 7404 + (instancetype)dictionaryWithInt64s:(const int64_t [])values |
1820 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])
keys | 7405 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])
keys |
1821 count:(NSUInteger)count; | 7406 count:(NSUInteger)count; |
1822 + (instancetype)dictionaryWithDictionary:(GPBStringInt32Dictionary *)dictionary; | 7407 |
| 7408 /** |
| 7409 * Creates and initializes a dictionary with the entries from the given. |
| 7410 * dictionary. |
| 7411 * |
| 7412 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 7413 * |
| 7414 * @return A newly instanced dictionary with the entries from the given |
| 7415 * dictionary in it. |
| 7416 **/ |
| 7417 + (instancetype)dictionaryWithDictionary:(GPBStringInt64Dictionary *)dictionary; |
| 7418 |
| 7419 /** |
| 7420 * Creates and initializes a dictionary with the given capacity. |
| 7421 * |
| 7422 * @param numItems Capacity needed for the dictionary. |
| 7423 * |
| 7424 * @return A newly instanced dictionary with the given capacity. |
| 7425 **/ |
1823 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 7426 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1824 | 7427 |
1825 - (instancetype)initWithValues:(const int32_t [])values | 7428 /** |
| 7429 * Initializes this dictionary, copying the given values and keys. |
| 7430 * |
| 7431 * @param values The values to be placed in this dictionary. |
| 7432 * @param keys The keys under which to store the values. |
| 7433 * @param count The number of elements to copy into the dictionary. |
| 7434 * |
| 7435 * @return A newly initialized dictionary with a copy of the values and keys. |
| 7436 **/ |
| 7437 - (instancetype)initWithInt64s:(const int64_t [])values |
1826 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys | 7438 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys |
1827 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 7439 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
1828 - (instancetype)initWithDictionary:(GPBStringInt32Dictionary *)dictionary; | 7440 |
| 7441 /** |
| 7442 * Initializes this dictionary, copying the entries from the given dictionary. |
| 7443 * |
| 7444 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 7445 * |
| 7446 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 7447 **/ |
| 7448 - (instancetype)initWithDictionary:(GPBStringInt64Dictionary *)dictionary; |
| 7449 |
| 7450 /** |
| 7451 * Initializes this dictionary with the requested capacity. |
| 7452 * |
| 7453 * @param numItems Number of items needed for this dictionary. |
| 7454 * |
| 7455 * @return A newly initialized dictionary with the requested capacity. |
| 7456 **/ |
1829 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 7457 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1830 | 7458 |
1831 - (BOOL)valueForKey:(NSString *)key value:(nullable int32_t *)value; | 7459 /** |
1832 | 7460 * Gets the value for the given key. |
1833 - (void)enumerateKeysAndValuesUsingBlock: | 7461 * |
1834 (void (^)(NSString *key, int32_t value, BOOL *stop))block; | 7462 * @param value Pointer into which the value will be set, if found. |
1835 | 7463 * @param key Key under which the value is stored, if present. |
1836 - (void)addEntriesFromDictionary:(GPBStringInt32Dictionary *)otherDictionary; | 7464 * |
1837 | 7465 * @return YES if the key was found and the value was copied, NO otherwise. |
1838 - (void)setValue:(int32_t)value forKey:(NSString *)key; | 7466 **/ |
1839 | 7467 - (BOOL)getInt64:(nullable int64_t *)value forKey:(NSString *)key; |
1840 - (void)removeValueForKey:(NSString *)aKey; | 7468 |
| 7469 /** |
| 7470 * Enumerates the keys and values on this dictionary with the given block. |
| 7471 * |
| 7472 * @param block The block to enumerate with. |
| 7473 * **key**: The key for the current entry. |
| 7474 * **value**: The value for the current entry |
| 7475 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 7476 **/ |
| 7477 - (void)enumerateKeysAndInt64sUsingBlock: |
| 7478 (void (^)(NSString *key, int64_t value, BOOL *stop))block; |
| 7479 |
| 7480 /** |
| 7481 * Adds the keys and values from another dictionary. |
| 7482 * |
| 7483 * @param otherDictionary Dictionary containing entries to be added to this |
| 7484 * dictionary. |
| 7485 **/ |
| 7486 - (void)addEntriesFromDictionary:(GPBStringInt64Dictionary *)otherDictionary; |
| 7487 |
| 7488 /** |
| 7489 * Sets the value for the given key. |
| 7490 * |
| 7491 * @param value The value to set. |
| 7492 * @param key The key under which to store the value. |
| 7493 **/ |
| 7494 - (void)setInt64:(int64_t)value forKey:(NSString *)key; |
| 7495 |
| 7496 /** |
| 7497 * Removes the entry for the given key. |
| 7498 * |
| 7499 * @param aKey Key to be removed from this dictionary. |
| 7500 **/ |
| 7501 - (void)removeInt64ForKey:(NSString *)aKey; |
| 7502 |
| 7503 /** |
| 7504 * Removes all entries in this dictionary. |
| 7505 **/ |
1841 - (void)removeAll; | 7506 - (void)removeAll; |
1842 | 7507 |
1843 @end | 7508 @end |
1844 | 7509 |
1845 #pragma mark - String -> UInt64 | 7510 #pragma mark - String -> Bool |
1846 | 7511 |
1847 @interface GPBStringUInt64Dictionary : NSObject <NSCopying> | 7512 /** |
1848 | 7513 * Class used for map fields of <NSString, BOOL> |
| 7514 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 7515 * |
| 7516 * @note This class is not meant to be subclassed. |
| 7517 **/ |
| 7518 @interface GPBStringBoolDictionary : NSObject <NSCopying> |
| 7519 |
| 7520 /** Number of entries stored in this dictionary. */ |
1849 @property(nonatomic, readonly) NSUInteger count; | 7521 @property(nonatomic, readonly) NSUInteger count; |
1850 | 7522 |
| 7523 /** |
| 7524 * @return A newly instanced and empty dictionary. |
| 7525 **/ |
1851 + (instancetype)dictionary; | 7526 + (instancetype)dictionary; |
1852 + (instancetype)dictionaryWithValue:(uint64_t)value | 7527 |
| 7528 /** |
| 7529 * Creates and initializes a dictionary with the single entry given. |
| 7530 * |
| 7531 * @param value The value to be placed in the dictionary. |
| 7532 * @param key The key under which to store the value. |
| 7533 * |
| 7534 * @return A newly instanced dictionary with the key and value in it. |
| 7535 **/ |
| 7536 + (instancetype)dictionaryWithBool:(BOOL)value |
| 7537 forKey:(NSString *)key; |
| 7538 |
| 7539 /** |
| 7540 * Creates and initializes a dictionary with the entries given. |
| 7541 * |
| 7542 * @param values The values to be placed in the dictionary. |
| 7543 * @param keys The keys under which to store the values. |
| 7544 * @param count The number of entries to store in the dictionary. |
| 7545 * |
| 7546 * @return A newly instanced dictionary with the keys and values in it. |
| 7547 **/ |
| 7548 + (instancetype)dictionaryWithBools:(const BOOL [])values |
| 7549 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])k
eys |
| 7550 count:(NSUInteger)count; |
| 7551 |
| 7552 /** |
| 7553 * Creates and initializes a dictionary with the entries from the given. |
| 7554 * dictionary. |
| 7555 * |
| 7556 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 7557 * |
| 7558 * @return A newly instanced dictionary with the entries from the given |
| 7559 * dictionary in it. |
| 7560 **/ |
| 7561 + (instancetype)dictionaryWithDictionary:(GPBStringBoolDictionary *)dictionary; |
| 7562 |
| 7563 /** |
| 7564 * Creates and initializes a dictionary with the given capacity. |
| 7565 * |
| 7566 * @param numItems Capacity needed for the dictionary. |
| 7567 * |
| 7568 * @return A newly instanced dictionary with the given capacity. |
| 7569 **/ |
| 7570 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
| 7571 |
| 7572 /** |
| 7573 * Initializes this dictionary, copying the given values and keys. |
| 7574 * |
| 7575 * @param values The values to be placed in this dictionary. |
| 7576 * @param keys The keys under which to store the values. |
| 7577 * @param count The number of elements to copy into the dictionary. |
| 7578 * |
| 7579 * @return A newly initialized dictionary with a copy of the values and keys. |
| 7580 **/ |
| 7581 - (instancetype)initWithBools:(const BOOL [])values |
| 7582 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys |
| 7583 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 7584 |
| 7585 /** |
| 7586 * Initializes this dictionary, copying the entries from the given dictionary. |
| 7587 * |
| 7588 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 7589 * |
| 7590 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 7591 **/ |
| 7592 - (instancetype)initWithDictionary:(GPBStringBoolDictionary *)dictionary; |
| 7593 |
| 7594 /** |
| 7595 * Initializes this dictionary with the requested capacity. |
| 7596 * |
| 7597 * @param numItems Number of items needed for this dictionary. |
| 7598 * |
| 7599 * @return A newly initialized dictionary with the requested capacity. |
| 7600 **/ |
| 7601 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
| 7602 |
| 7603 /** |
| 7604 * Gets the value for the given key. |
| 7605 * |
| 7606 * @param value Pointer into which the value will be set, if found. |
| 7607 * @param key Key under which the value is stored, if present. |
| 7608 * |
| 7609 * @return YES if the key was found and the value was copied, NO otherwise. |
| 7610 **/ |
| 7611 - (BOOL)getBool:(nullable BOOL *)value forKey:(NSString *)key; |
| 7612 |
| 7613 /** |
| 7614 * Enumerates the keys and values on this dictionary with the given block. |
| 7615 * |
| 7616 * @param block The block to enumerate with. |
| 7617 * **key**: The key for the current entry. |
| 7618 * **value**: The value for the current entry |
| 7619 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 7620 **/ |
| 7621 - (void)enumerateKeysAndBoolsUsingBlock: |
| 7622 (void (^)(NSString *key, BOOL value, BOOL *stop))block; |
| 7623 |
| 7624 /** |
| 7625 * Adds the keys and values from another dictionary. |
| 7626 * |
| 7627 * @param otherDictionary Dictionary containing entries to be added to this |
| 7628 * dictionary. |
| 7629 **/ |
| 7630 - (void)addEntriesFromDictionary:(GPBStringBoolDictionary *)otherDictionary; |
| 7631 |
| 7632 /** |
| 7633 * Sets the value for the given key. |
| 7634 * |
| 7635 * @param value The value to set. |
| 7636 * @param key The key under which to store the value. |
| 7637 **/ |
| 7638 - (void)setBool:(BOOL)value forKey:(NSString *)key; |
| 7639 |
| 7640 /** |
| 7641 * Removes the entry for the given key. |
| 7642 * |
| 7643 * @param aKey Key to be removed from this dictionary. |
| 7644 **/ |
| 7645 - (void)removeBoolForKey:(NSString *)aKey; |
| 7646 |
| 7647 /** |
| 7648 * Removes all entries in this dictionary. |
| 7649 **/ |
| 7650 - (void)removeAll; |
| 7651 |
| 7652 @end |
| 7653 |
| 7654 #pragma mark - String -> Float |
| 7655 |
| 7656 /** |
| 7657 * Class used for map fields of <NSString, float> |
| 7658 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 7659 * |
| 7660 * @note This class is not meant to be subclassed. |
| 7661 **/ |
| 7662 @interface GPBStringFloatDictionary : NSObject <NSCopying> |
| 7663 |
| 7664 /** Number of entries stored in this dictionary. */ |
| 7665 @property(nonatomic, readonly) NSUInteger count; |
| 7666 |
| 7667 /** |
| 7668 * @return A newly instanced and empty dictionary. |
| 7669 **/ |
| 7670 + (instancetype)dictionary; |
| 7671 |
| 7672 /** |
| 7673 * Creates and initializes a dictionary with the single entry given. |
| 7674 * |
| 7675 * @param value The value to be placed in the dictionary. |
| 7676 * @param key The key under which to store the value. |
| 7677 * |
| 7678 * @return A newly instanced dictionary with the key and value in it. |
| 7679 **/ |
| 7680 + (instancetype)dictionaryWithFloat:(float)value |
1853 forKey:(NSString *)key; | 7681 forKey:(NSString *)key; |
1854 + (instancetype)dictionaryWithValues:(const uint64_t [])values | 7682 |
| 7683 /** |
| 7684 * Creates and initializes a dictionary with the entries given. |
| 7685 * |
| 7686 * @param values The values to be placed in the dictionary. |
| 7687 * @param keys The keys under which to store the values. |
| 7688 * @param count The number of entries to store in the dictionary. |
| 7689 * |
| 7690 * @return A newly instanced dictionary with the keys and values in it. |
| 7691 **/ |
| 7692 + (instancetype)dictionaryWithFloats:(const float [])values |
1855 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])
keys | 7693 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])
keys |
1856 count:(NSUInteger)count; | 7694 count:(NSUInteger)count; |
1857 + (instancetype)dictionaryWithDictionary:(GPBStringUInt64Dictionary *)dictionary
; | 7695 |
| 7696 /** |
| 7697 * Creates and initializes a dictionary with the entries from the given. |
| 7698 * dictionary. |
| 7699 * |
| 7700 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 7701 * |
| 7702 * @return A newly instanced dictionary with the entries from the given |
| 7703 * dictionary in it. |
| 7704 **/ |
| 7705 + (instancetype)dictionaryWithDictionary:(GPBStringFloatDictionary *)dictionary; |
| 7706 |
| 7707 /** |
| 7708 * Creates and initializes a dictionary with the given capacity. |
| 7709 * |
| 7710 * @param numItems Capacity needed for the dictionary. |
| 7711 * |
| 7712 * @return A newly instanced dictionary with the given capacity. |
| 7713 **/ |
1858 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 7714 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1859 | 7715 |
1860 - (instancetype)initWithValues:(const uint64_t [])values | 7716 /** |
| 7717 * Initializes this dictionary, copying the given values and keys. |
| 7718 * |
| 7719 * @param values The values to be placed in this dictionary. |
| 7720 * @param keys The keys under which to store the values. |
| 7721 * @param count The number of elements to copy into the dictionary. |
| 7722 * |
| 7723 * @return A newly initialized dictionary with a copy of the values and keys. |
| 7724 **/ |
| 7725 - (instancetype)initWithFloats:(const float [])values |
1861 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys | 7726 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys |
1862 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 7727 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
1863 - (instancetype)initWithDictionary:(GPBStringUInt64Dictionary *)dictionary; | 7728 |
| 7729 /** |
| 7730 * Initializes this dictionary, copying the entries from the given dictionary. |
| 7731 * |
| 7732 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 7733 * |
| 7734 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 7735 **/ |
| 7736 - (instancetype)initWithDictionary:(GPBStringFloatDictionary *)dictionary; |
| 7737 |
| 7738 /** |
| 7739 * Initializes this dictionary with the requested capacity. |
| 7740 * |
| 7741 * @param numItems Number of items needed for this dictionary. |
| 7742 * |
| 7743 * @return A newly initialized dictionary with the requested capacity. |
| 7744 **/ |
1864 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 7745 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1865 | 7746 |
1866 - (BOOL)valueForKey:(NSString *)key value:(nullable uint64_t *)value; | 7747 /** |
1867 | 7748 * Gets the value for the given key. |
1868 - (void)enumerateKeysAndValuesUsingBlock: | 7749 * |
1869 (void (^)(NSString *key, uint64_t value, BOOL *stop))block; | 7750 * @param value Pointer into which the value will be set, if found. |
1870 | 7751 * @param key Key under which the value is stored, if present. |
1871 - (void)addEntriesFromDictionary:(GPBStringUInt64Dictionary *)otherDictionary; | 7752 * |
1872 | 7753 * @return YES if the key was found and the value was copied, NO otherwise. |
1873 - (void)setValue:(uint64_t)value forKey:(NSString *)key; | 7754 **/ |
1874 | 7755 - (BOOL)getFloat:(nullable float *)value forKey:(NSString *)key; |
1875 - (void)removeValueForKey:(NSString *)aKey; | 7756 |
| 7757 /** |
| 7758 * Enumerates the keys and values on this dictionary with the given block. |
| 7759 * |
| 7760 * @param block The block to enumerate with. |
| 7761 * **key**: The key for the current entry. |
| 7762 * **value**: The value for the current entry |
| 7763 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 7764 **/ |
| 7765 - (void)enumerateKeysAndFloatsUsingBlock: |
| 7766 (void (^)(NSString *key, float value, BOOL *stop))block; |
| 7767 |
| 7768 /** |
| 7769 * Adds the keys and values from another dictionary. |
| 7770 * |
| 7771 * @param otherDictionary Dictionary containing entries to be added to this |
| 7772 * dictionary. |
| 7773 **/ |
| 7774 - (void)addEntriesFromDictionary:(GPBStringFloatDictionary *)otherDictionary; |
| 7775 |
| 7776 /** |
| 7777 * Sets the value for the given key. |
| 7778 * |
| 7779 * @param value The value to set. |
| 7780 * @param key The key under which to store the value. |
| 7781 **/ |
| 7782 - (void)setFloat:(float)value forKey:(NSString *)key; |
| 7783 |
| 7784 /** |
| 7785 * Removes the entry for the given key. |
| 7786 * |
| 7787 * @param aKey Key to be removed from this dictionary. |
| 7788 **/ |
| 7789 - (void)removeFloatForKey:(NSString *)aKey; |
| 7790 |
| 7791 /** |
| 7792 * Removes all entries in this dictionary. |
| 7793 **/ |
1876 - (void)removeAll; | 7794 - (void)removeAll; |
1877 | 7795 |
1878 @end | 7796 @end |
1879 | 7797 |
1880 #pragma mark - String -> Int64 | 7798 #pragma mark - String -> Double |
1881 | 7799 |
1882 @interface GPBStringInt64Dictionary : NSObject <NSCopying> | 7800 /** |
1883 | 7801 * Class used for map fields of <NSString, double> |
| 7802 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 7803 * |
| 7804 * @note This class is not meant to be subclassed. |
| 7805 **/ |
| 7806 @interface GPBStringDoubleDictionary : NSObject <NSCopying> |
| 7807 |
| 7808 /** Number of entries stored in this dictionary. */ |
1884 @property(nonatomic, readonly) NSUInteger count; | 7809 @property(nonatomic, readonly) NSUInteger count; |
1885 | 7810 |
| 7811 /** |
| 7812 * @return A newly instanced and empty dictionary. |
| 7813 **/ |
1886 + (instancetype)dictionary; | 7814 + (instancetype)dictionary; |
1887 + (instancetype)dictionaryWithValue:(int64_t)value | 7815 |
1888 forKey:(NSString *)key; | 7816 /** |
1889 + (instancetype)dictionaryWithValues:(const int64_t [])values | 7817 * Creates and initializes a dictionary with the single entry given. |
1890 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])
keys | 7818 * |
1891 count:(NSUInteger)count; | 7819 * @param value The value to be placed in the dictionary. |
1892 + (instancetype)dictionaryWithDictionary:(GPBStringInt64Dictionary *)dictionary; | 7820 * @param key The key under which to store the value. |
| 7821 * |
| 7822 * @return A newly instanced dictionary with the key and value in it. |
| 7823 **/ |
| 7824 + (instancetype)dictionaryWithDouble:(double)value |
| 7825 forKey:(NSString *)key; |
| 7826 |
| 7827 /** |
| 7828 * Creates and initializes a dictionary with the entries given. |
| 7829 * |
| 7830 * @param values The values to be placed in the dictionary. |
| 7831 * @param keys The keys under which to store the values. |
| 7832 * @param count The number of entries to store in the dictionary. |
| 7833 * |
| 7834 * @return A newly instanced dictionary with the keys and values in it. |
| 7835 **/ |
| 7836 + (instancetype)dictionaryWithDoubles:(const double [])values |
| 7837 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED []
)keys |
| 7838 count:(NSUInteger)count; |
| 7839 |
| 7840 /** |
| 7841 * Creates and initializes a dictionary with the entries from the given. |
| 7842 * dictionary. |
| 7843 * |
| 7844 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 7845 * |
| 7846 * @return A newly instanced dictionary with the entries from the given |
| 7847 * dictionary in it. |
| 7848 **/ |
| 7849 + (instancetype)dictionaryWithDictionary:(GPBStringDoubleDictionary *)dictionary
; |
| 7850 |
| 7851 /** |
| 7852 * Creates and initializes a dictionary with the given capacity. |
| 7853 * |
| 7854 * @param numItems Capacity needed for the dictionary. |
| 7855 * |
| 7856 * @return A newly instanced dictionary with the given capacity. |
| 7857 **/ |
1893 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 7858 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
1894 | 7859 |
1895 - (instancetype)initWithValues:(const int64_t [])values | 7860 /** |
1896 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys | 7861 * Initializes this dictionary, copying the given values and keys. |
1897 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | 7862 * |
1898 - (instancetype)initWithDictionary:(GPBStringInt64Dictionary *)dictionary; | 7863 * @param values The values to be placed in this dictionary. |
| 7864 * @param keys The keys under which to store the values. |
| 7865 * @param count The number of elements to copy into the dictionary. |
| 7866 * |
| 7867 * @return A newly initialized dictionary with a copy of the values and keys. |
| 7868 **/ |
| 7869 - (instancetype)initWithDoubles:(const double [])values |
| 7870 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys |
| 7871 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; |
| 7872 |
| 7873 /** |
| 7874 * Initializes this dictionary, copying the entries from the given dictionary. |
| 7875 * |
| 7876 * @param dictionary Dictionary containing the entries to add to this dictionary
. |
| 7877 * |
| 7878 * @return A newly initialized dictionary with the entries of the given dictiona
ry. |
| 7879 **/ |
| 7880 - (instancetype)initWithDictionary:(GPBStringDoubleDictionary *)dictionary; |
| 7881 |
| 7882 /** |
| 7883 * Initializes this dictionary with the requested capacity. |
| 7884 * |
| 7885 * @param numItems Number of items needed for this dictionary. |
| 7886 * |
| 7887 * @return A newly initialized dictionary with the requested capacity. |
| 7888 **/ |
1899 - (instancetype)initWithCapacity:(NSUInteger)numItems; | 7889 - (instancetype)initWithCapacity:(NSUInteger)numItems; |
1900 | 7890 |
1901 - (BOOL)valueForKey:(NSString *)key value:(nullable int64_t *)value; | 7891 /** |
1902 | 7892 * Gets the value for the given key. |
1903 - (void)enumerateKeysAndValuesUsingBlock: | 7893 * |
1904 (void (^)(NSString *key, int64_t value, BOOL *stop))block; | 7894 * @param value Pointer into which the value will be set, if found. |
1905 | 7895 * @param key Key under which the value is stored, if present. |
1906 - (void)addEntriesFromDictionary:(GPBStringInt64Dictionary *)otherDictionary; | 7896 * |
1907 | 7897 * @return YES if the key was found and the value was copied, NO otherwise. |
1908 - (void)setValue:(int64_t)value forKey:(NSString *)key; | 7898 **/ |
1909 | 7899 - (BOOL)getDouble:(nullable double *)value forKey:(NSString *)key; |
1910 - (void)removeValueForKey:(NSString *)aKey; | 7900 |
| 7901 /** |
| 7902 * Enumerates the keys and values on this dictionary with the given block. |
| 7903 * |
| 7904 * @param block The block to enumerate with. |
| 7905 * **key**: The key for the current entry. |
| 7906 * **value**: The value for the current entry |
| 7907 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 7908 **/ |
| 7909 - (void)enumerateKeysAndDoublesUsingBlock: |
| 7910 (void (^)(NSString *key, double value, BOOL *stop))block; |
| 7911 |
| 7912 /** |
| 7913 * Adds the keys and values from another dictionary. |
| 7914 * |
| 7915 * @param otherDictionary Dictionary containing entries to be added to this |
| 7916 * dictionary. |
| 7917 **/ |
| 7918 - (void)addEntriesFromDictionary:(GPBStringDoubleDictionary *)otherDictionary; |
| 7919 |
| 7920 /** |
| 7921 * Sets the value for the given key. |
| 7922 * |
| 7923 * @param value The value to set. |
| 7924 * @param key The key under which to store the value. |
| 7925 **/ |
| 7926 - (void)setDouble:(double)value forKey:(NSString *)key; |
| 7927 |
| 7928 /** |
| 7929 * Removes the entry for the given key. |
| 7930 * |
| 7931 * @param aKey Key to be removed from this dictionary. |
| 7932 **/ |
| 7933 - (void)removeDoubleForKey:(NSString *)aKey; |
| 7934 |
| 7935 /** |
| 7936 * Removes all entries in this dictionary. |
| 7937 **/ |
1911 - (void)removeAll; | 7938 - (void)removeAll; |
1912 | 7939 |
1913 @end | 7940 @end |
1914 | 7941 |
1915 #pragma mark - String -> Bool | 7942 #pragma mark - String -> Enum |
1916 | 7943 |
1917 @interface GPBStringBoolDictionary : NSObject <NSCopying> | 7944 /** |
1918 | 7945 * Class used for map fields of <NSString, int32_t> |
| 7946 * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 7947 * |
| 7948 * @note This class is not meant to be subclassed. |
| 7949 **/ |
| 7950 @interface GPBStringEnumDictionary : NSObject <NSCopying> |
| 7951 |
| 7952 /** Number of entries stored in this dictionary. */ |
1919 @property(nonatomic, readonly) NSUInteger count; | 7953 @property(nonatomic, readonly) NSUInteger count; |
1920 | 7954 /** The validation function to check if the enums are valid. */ |
| 7955 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; |
| 7956 |
| 7957 /** |
| 7958 * @return A newly instanced and empty dictionary. |
| 7959 **/ |
1921 + (instancetype)dictionary; | 7960 + (instancetype)dictionary; |
1922 + (instancetype)dictionaryWithValue:(BOOL)value | 7961 |
1923 forKey:(NSString *)key; | 7962 /** |
1924 + (instancetype)dictionaryWithValues:(const BOOL [])values | 7963 * Creates and initializes a dictionary with the given validation function. |
1925 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])
keys | 7964 * |
1926 count:(NSUInteger)count; | 7965 * @param func The enum validation function for the dictionary. |
1927 + (instancetype)dictionaryWithDictionary:(GPBStringBoolDictionary *)dictionary; | 7966 * |
1928 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 7967 * @return A newly instanced dictionary. |
1929 | 7968 **/ |
1930 - (instancetype)initWithValues:(const BOOL [])values | |
1931 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys | |
1932 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
1933 - (instancetype)initWithDictionary:(GPBStringBoolDictionary *)dictionary; | |
1934 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
1935 | |
1936 - (BOOL)valueForKey:(NSString *)key value:(nullable BOOL *)value; | |
1937 | |
1938 - (void)enumerateKeysAndValuesUsingBlock: | |
1939 (void (^)(NSString *key, BOOL value, BOOL *stop))block; | |
1940 | |
1941 - (void)addEntriesFromDictionary:(GPBStringBoolDictionary *)otherDictionary; | |
1942 | |
1943 - (void)setValue:(BOOL)value forKey:(NSString *)key; | |
1944 | |
1945 - (void)removeValueForKey:(NSString *)aKey; | |
1946 - (void)removeAll; | |
1947 | |
1948 @end | |
1949 | |
1950 #pragma mark - String -> Float | |
1951 | |
1952 @interface GPBStringFloatDictionary : NSObject <NSCopying> | |
1953 | |
1954 @property(nonatomic, readonly) NSUInteger count; | |
1955 | |
1956 + (instancetype)dictionary; | |
1957 + (instancetype)dictionaryWithValue:(float)value | |
1958 forKey:(NSString *)key; | |
1959 + (instancetype)dictionaryWithValues:(const float [])values | |
1960 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])
keys | |
1961 count:(NSUInteger)count; | |
1962 + (instancetype)dictionaryWithDictionary:(GPBStringFloatDictionary *)dictionary; | |
1963 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | |
1964 | |
1965 - (instancetype)initWithValues:(const float [])values | |
1966 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys | |
1967 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
1968 - (instancetype)initWithDictionary:(GPBStringFloatDictionary *)dictionary; | |
1969 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
1970 | |
1971 - (BOOL)valueForKey:(NSString *)key value:(nullable float *)value; | |
1972 | |
1973 - (void)enumerateKeysAndValuesUsingBlock: | |
1974 (void (^)(NSString *key, float value, BOOL *stop))block; | |
1975 | |
1976 - (void)addEntriesFromDictionary:(GPBStringFloatDictionary *)otherDictionary; | |
1977 | |
1978 - (void)setValue:(float)value forKey:(NSString *)key; | |
1979 | |
1980 - (void)removeValueForKey:(NSString *)aKey; | |
1981 - (void)removeAll; | |
1982 | |
1983 @end | |
1984 | |
1985 #pragma mark - String -> Double | |
1986 | |
1987 @interface GPBStringDoubleDictionary : NSObject <NSCopying> | |
1988 | |
1989 @property(nonatomic, readonly) NSUInteger count; | |
1990 | |
1991 + (instancetype)dictionary; | |
1992 + (instancetype)dictionaryWithValue:(double)value | |
1993 forKey:(NSString *)key; | |
1994 + (instancetype)dictionaryWithValues:(const double [])values | |
1995 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])
keys | |
1996 count:(NSUInteger)count; | |
1997 + (instancetype)dictionaryWithDictionary:(GPBStringDoubleDictionary *)dictionary
; | |
1998 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | |
1999 | |
2000 - (instancetype)initWithValues:(const double [])values | |
2001 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys | |
2002 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; | |
2003 - (instancetype)initWithDictionary:(GPBStringDoubleDictionary *)dictionary; | |
2004 - (instancetype)initWithCapacity:(NSUInteger)numItems; | |
2005 | |
2006 - (BOOL)valueForKey:(NSString *)key value:(nullable double *)value; | |
2007 | |
2008 - (void)enumerateKeysAndValuesUsingBlock: | |
2009 (void (^)(NSString *key, double value, BOOL *stop))block; | |
2010 | |
2011 - (void)addEntriesFromDictionary:(GPBStringDoubleDictionary *)otherDictionary; | |
2012 | |
2013 - (void)setValue:(double)value forKey:(NSString *)key; | |
2014 | |
2015 - (void)removeValueForKey:(NSString *)aKey; | |
2016 - (void)removeAll; | |
2017 | |
2018 @end | |
2019 | |
2020 #pragma mark - String -> Enum | |
2021 | |
2022 @interface GPBStringEnumDictionary : NSObject <NSCopying> | |
2023 | |
2024 @property(nonatomic, readonly) NSUInteger count; | |
2025 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; | |
2026 | |
2027 + (instancetype)dictionary; | |
2028 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func; | 7969 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func; |
| 7970 |
| 7971 /** |
| 7972 * Creates and initializes a dictionary with the single entry given. |
| 7973 * |
| 7974 * @param func The enum validation function for the dictionary. |
| 7975 * @param rawValue The raw enum value to be placed in the dictionary. |
| 7976 * @param key The key under which to store the value. |
| 7977 * |
| 7978 * @return A newly instanced dictionary with the key and value in it. |
| 7979 **/ |
2029 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 7980 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
2030 rawValue:(int32_t)rawValue | 7981 rawValue:(int32_t)rawValue |
2031 forKey:(NSString *)key; | 7982 forKey:(NSString *)key; |
| 7983 |
| 7984 /** |
| 7985 * Creates and initializes a dictionary with the entries given. |
| 7986 * |
| 7987 * @param func The enum validation function for the dictionary. |
| 7988 * @param values The raw enum values values to be placed in the dictionary. |
| 7989 * @param keys The keys under which to store the values. |
| 7990 * @param count The number of entries to store in the dictionary. |
| 7991 * |
| 7992 * @return A newly instanced dictionary with the keys and values in it. |
| 7993 **/ |
2032 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 7994 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
2033 rawValues:(const int32_t [])values | 7995 rawValues:(const int32_t [])values |
2034 forKeys:(const NSString * GPB_UNSAFE_UN
RETAINED [])keys | 7996 forKeys:(const NSString * GPB_UNSAFE_UN
RETAINED [])keys |
2035 count:(NSUInteger)count; | 7997 count:(NSUInteger)count; |
| 7998 |
| 7999 /** |
| 8000 * Creates and initializes a dictionary with the entries from the given. |
| 8001 * dictionary. |
| 8002 * |
| 8003 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 8004 * |
| 8005 * @return A newly instanced dictionary with the entries from the given |
| 8006 * dictionary in it. |
| 8007 **/ |
2036 + (instancetype)dictionaryWithDictionary:(GPBStringEnumDictionary *)dictionary; | 8008 + (instancetype)dictionaryWithDictionary:(GPBStringEnumDictionary *)dictionary; |
| 8009 |
| 8010 /** |
| 8011 * Creates and initializes a dictionary with the given capacity. |
| 8012 * |
| 8013 * @param func The enum validation function for the dictionary. |
| 8014 * @param numItems Capacity needed for the dictionary. |
| 8015 * |
| 8016 * @return A newly instanced dictionary with the given capacity. |
| 8017 **/ |
2037 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func | 8018 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc
)func |
2038 capacity:(NSUInteger)numItems; | 8019 capacity:(NSUInteger)numItems; |
2039 | 8020 |
| 8021 /** |
| 8022 * Initializes a dictionary with the given validation function. |
| 8023 * |
| 8024 * @param func The enum validation function for the dictionary. |
| 8025 * |
| 8026 * @return A newly initialized dictionary. |
| 8027 **/ |
2040 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; | 8028 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; |
| 8029 |
| 8030 /** |
| 8031 * Initializes a dictionary with the entries given. |
| 8032 * |
| 8033 * @param func The enum validation function for the dictionary. |
| 8034 * @param values The raw enum values values to be placed in the dictionary. |
| 8035 * @param keys The keys under which to store the values. |
| 8036 * @param count The number of entries to store in the dictionary. |
| 8037 * |
| 8038 * @return A newly initialized dictionary with the keys and values in it. |
| 8039 **/ |
2041 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func | 8040 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func |
2042 rawValues:(const int32_t [])values | 8041 rawValues:(const int32_t [])values |
2043 forKeys:(const NSString * GPB_UNSAFE_UNRETAIN
ED [])keys | 8042 forKeys:(const NSString * GPB_UNSAFE_UNRETAIN
ED [])keys |
2044 count:(NSUInteger)count NS_DESIGNATED_INITI
ALIZER; | 8043 count:(NSUInteger)count NS_DESIGNATED_INITI
ALIZER; |
| 8044 |
| 8045 /** |
| 8046 * Initializes a dictionary with the entries from the given. |
| 8047 * dictionary. |
| 8048 * |
| 8049 * @param dictionary Dictionary containing the entries to add to the dictionary. |
| 8050 * |
| 8051 * @return A newly initialized dictionary with the entries from the given |
| 8052 * dictionary in it. |
| 8053 **/ |
2045 - (instancetype)initWithDictionary:(GPBStringEnumDictionary *)dictionary; | 8054 - (instancetype)initWithDictionary:(GPBStringEnumDictionary *)dictionary; |
| 8055 |
| 8056 /** |
| 8057 * Initializes a dictionary with the given capacity. |
| 8058 * |
| 8059 * @param func The enum validation function for the dictionary. |
| 8060 * @param numItems Capacity needed for the dictionary. |
| 8061 * |
| 8062 * @return A newly initialized dictionary with the given capacity. |
| 8063 **/ |
2046 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func | 8064 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func |
2047 capacity:(NSUInteger)numItems; | 8065 capacity:(NSUInteger)numItems; |
2048 | 8066 |
2049 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key | 8067 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key |
2050 // is not a valid enumerator as defined by validationFunc. If the actual value i
s | 8068 // is not a valid enumerator as defined by validationFunc. If the actual value i
s |
2051 // desired, use "raw" version of the method. | 8069 // desired, use "raw" version of the method. |
2052 | 8070 |
2053 - (BOOL)valueForKey:(NSString *)key value:(nullable int32_t *)value; | 8071 /** |
| 8072 * Gets the value for the given key. |
| 8073 * |
| 8074 * @param value Pointer into which the value will be set, if found. |
| 8075 * @param key Key under which the value is stored, if present. |
| 8076 * |
| 8077 * @return YES if the key was found and the value was copied, NO otherwise. |
| 8078 **/ |
| 8079 - (BOOL)getEnum:(nullable int32_t *)value forKey:(NSString *)key; |
2054 | 8080 |
2055 - (void)enumerateKeysAndValuesUsingBlock: | 8081 /** |
| 8082 * Enumerates the keys and values on this dictionary with the given block. |
| 8083 * |
| 8084 * @param block The block to enumerate with. |
| 8085 * **key**: The key for the current entry. |
| 8086 * **value**: The value for the current entry |
| 8087 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 8088 **/ |
| 8089 - (void)enumerateKeysAndEnumsUsingBlock: |
2056 (void (^)(NSString *key, int32_t value, BOOL *stop))block; | 8090 (void (^)(NSString *key, int32_t value, BOOL *stop))block; |
2057 | 8091 |
2058 // These methods bypass the validationFunc to provide access to values that were
not | 8092 /** |
2059 // known at the time the binary was compiled. | 8093 * Gets the raw enum value for the given key. |
| 8094 * |
| 8095 * @note This method bypass the validationFunc to enable the access of values th
at |
| 8096 * were not known at the time the binary was compiled. |
| 8097 * |
| 8098 * @param rawValue Pointer into which the value will be set, if found. |
| 8099 * @param key Key under which the value is stored, if present. |
| 8100 * |
| 8101 * @return YES if the key was found and the value was copied, NO otherwise. |
| 8102 **/ |
| 8103 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(NSString *)key; |
2060 | 8104 |
2061 - (BOOL)valueForKey:(NSString *)key rawValue:(nullable int32_t *)rawValue; | 8105 /** |
2062 | 8106 * Enumerates the keys and values on this dictionary with the given block. |
| 8107 * |
| 8108 * @note This method bypass the validationFunc to enable the access of values th
at |
| 8109 * were not known at the time the binary was compiled. |
| 8110 * |
| 8111 * @param block The block to enumerate with. |
| 8112 * **key**: The key for the current entry. |
| 8113 * **rawValue**: The value for the current entry |
| 8114 * **stop**: A pointer to a boolean that when set stops the enumeration. |
| 8115 **/ |
2063 - (void)enumerateKeysAndRawValuesUsingBlock: | 8116 - (void)enumerateKeysAndRawValuesUsingBlock: |
2064 (void (^)(NSString *key, int32_t rawValue, BOOL *stop))block; | 8117 (void (^)(NSString *key, int32_t rawValue, BOOL *stop))block; |
2065 | 8118 |
| 8119 /** |
| 8120 * Adds the keys and raw enum values from another dictionary. |
| 8121 * |
| 8122 * @note This method bypass the validationFunc to enable the setting of values t
hat |
| 8123 * were not known at the time the binary was compiled. |
| 8124 * |
| 8125 * @param otherDictionary Dictionary containing entries to be added to this |
| 8126 * dictionary. |
| 8127 **/ |
2066 - (void)addRawEntriesFromDictionary:(GPBStringEnumDictionary *)otherDictionary; | 8128 - (void)addRawEntriesFromDictionary:(GPBStringEnumDictionary *)otherDictionary; |
2067 | 8129 |
2068 // If value is not a valid enumerator as defined by validationFunc, these | 8130 // If value is not a valid enumerator as defined by validationFunc, these |
2069 // methods will assert in debug, and will log in release and assign the value | 8131 // methods will assert in debug, and will log in release and assign the value |
2070 // to the default value. Use the rawValue methods below to assign non enumerator | 8132 // to the default value. Use the rawValue methods below to assign non enumerator |
2071 // values. | 8133 // values. |
2072 | 8134 |
2073 - (void)setValue:(int32_t)value forKey:(NSString *)key; | 8135 /** |
| 8136 * Sets the value for the given key. |
| 8137 * |
| 8138 * @param value The value to set. |
| 8139 * @param key The key under which to store the value. |
| 8140 **/ |
| 8141 - (void)setEnum:(int32_t)value forKey:(NSString *)key; |
2074 | 8142 |
2075 // This method bypass the validationFunc to provide setting of values that were
not | 8143 /** |
2076 // known at the time the binary was compiled. | 8144 * Sets the raw enum value for the given key. |
| 8145 * |
| 8146 * @note This method bypass the validationFunc to enable the setting of values t
hat |
| 8147 * were not known at the time the binary was compiled. |
| 8148 * |
| 8149 * @param rawValue The raw enum value to set. |
| 8150 * @param key The key under which to store the raw enum value. |
| 8151 **/ |
2077 - (void)setRawValue:(int32_t)rawValue forKey:(NSString *)key; | 8152 - (void)setRawValue:(int32_t)rawValue forKey:(NSString *)key; |
2078 | 8153 |
2079 // No validation applies to these methods. | 8154 /** |
| 8155 * Removes the entry for the given key. |
| 8156 * |
| 8157 * @param aKey Key to be removed from this dictionary. |
| 8158 **/ |
| 8159 - (void)removeEnumForKey:(NSString *)aKey; |
2080 | 8160 |
2081 - (void)removeValueForKey:(NSString *)aKey; | 8161 /** |
| 8162 * Removes all entries in this dictionary. |
| 8163 **/ |
2082 - (void)removeAll; | 8164 - (void)removeAll; |
2083 | 8165 |
2084 @end | 8166 @end |
2085 | 8167 |
2086 //%PDDM-EXPAND-END DECLARE_DICTIONARIES() | 8168 //%PDDM-EXPAND-END DECLARE_DICTIONARIES() |
2087 | 8169 |
2088 NS_ASSUME_NONNULL_END | 8170 NS_ASSUME_NONNULL_END |
2089 | 8171 |
2090 //%PDDM-DEFINE DECLARE_DICTIONARIES() | 8172 //%PDDM-DEFINE DECLARE_DICTIONARIES() |
2091 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt32, uint32_t) | 8173 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt32, uint32_t) |
2092 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int32, int32_t) | 8174 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int32, int32_t) |
2093 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt64, uint64_t) | 8175 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt64, uint64_t) |
2094 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int64, int64_t) | 8176 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int64, int64_t) |
2095 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Bool, BOOL) | 8177 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Bool, BOOL) |
2096 //%DICTIONARY_POD_INTERFACES_FOR_KEY(String, NSString, *, OBJECT) | 8178 //%DICTIONARY_POD_INTERFACES_FOR_KEY(String, NSString, *, OBJECT) |
2097 //%PDDM-DEFINE DICTIONARY_INTERFACES_FOR_POD_KEY(KEY_NAME, KEY_TYPE) | 8179 //%PDDM-DEFINE DICTIONARY_INTERFACES_FOR_POD_KEY(KEY_NAME, KEY_TYPE) |
2098 //%DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, , POD) | 8180 //%DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, , POD) |
2099 //%DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, Object, ObjectType
) | 8181 //%DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, Object, ObjectType
) |
2100 //%PDDM-DEFINE DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, KisP, KHELP
ER) | 8182 //%PDDM-DEFINE DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, KisP, KHELP
ER) |
2101 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt32, ui
nt32_t) | 8183 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt32, ui
nt32_t) |
2102 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int32, int
32_t) | 8184 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int32, int
32_t) |
2103 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt64, ui
nt64_t) | 8185 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt64, ui
nt64_t) |
2104 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int64, int
64_t) | 8186 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int64, int
64_t) |
2105 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Bool, BOOL
) | 8187 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Bool, BOOL
) |
2106 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Float, flo
at) | 8188 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Float, flo
at) |
2107 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Double, do
uble) | 8189 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Double, do
uble) |
2108 //%DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Enum, int
32_t) | 8190 //%DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Enum, int
32_t) |
2109 //%PDDM-DEFINE DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER
, VALUE_NAME, VALUE_TYPE) | 8191 //%PDDM-DEFINE DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER
, VALUE_NAME, VALUE_TYPE) |
2110 //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VA
LUE_TYPE, POD, value) | 8192 //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VA
LUE_TYPE, POD, VALUE_NAME, value) |
2111 //%PDDM-DEFINE DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, VALUE_
NAME, VALUE_TYPE) | 8193 //%PDDM-DEFINE DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, VALUE_
NAME, VALUE_TYPE) |
2112 //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, , POD, VALUE_NAME, VALUE_TYPE
, OBJECT, object) | 8194 //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, , POD, VALUE_NAME, VALUE_TYPE
, OBJECT, Object, object) |
2113 //%PDDM-DEFINE VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE) | 8195 //%PDDM-DEFINE VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME) |
2114 //%- (BOOL)valueForKey:(KEY_TYPE)key value:(nullable VALUE_TYPE *)value; | 8196 //%/** |
2115 //%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_TYPE) | 8197 //% * Gets the value for the given key. |
| 8198 //% * |
| 8199 //% * @param value Pointer into which the value will be set, if found. |
| 8200 //% * @param key Key under which the value is stored, if present. |
| 8201 //% * |
| 8202 //% * @return YES if the key was found and the value was copied, NO otherwise. |
| 8203 //% **/ |
| 8204 //%- (BOOL)get##VNAME##:(nullable VALUE_TYPE *)value forKey:(KEY_TYPE)key; |
| 8205 //%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_TYPE, VNAME) |
| 8206 //%/** |
| 8207 //% * Fetches the object stored under the given key. |
| 8208 //% * |
| 8209 //% * @param key Key under which the value is stored, if present. |
| 8210 //% * |
| 8211 //% * @return The object if found, nil otherwise. |
| 8212 //% **/ |
2116 //%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key; | 8213 //%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key; |
2117 //%PDDM-DEFINE VALUE_FOR_KEY_Enum(KEY_TYPE, VALUE_TYPE) | 8214 //%PDDM-DEFINE VALUE_FOR_KEY_Enum(KEY_TYPE, VALUE_TYPE, VNAME) |
2118 //%VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE) | 8215 //%VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME) |
2119 //%PDDM-DEFINE ARRAY_ARG_MODIFIERPOD() | 8216 //%PDDM-DEFINE ARRAY_ARG_MODIFIERPOD() |
2120 // Nothing | 8217 // Nothing |
2121 //%PDDM-DEFINE ARRAY_ARG_MODIFIEREnum() | 8218 //%PDDM-DEFINE ARRAY_ARG_MODIFIEREnum() |
2122 // Nothing | 8219 // Nothing |
2123 //%PDDM-DEFINE ARRAY_ARG_MODIFIEROBJECT() | 8220 //%PDDM-DEFINE ARRAY_ARG_MODIFIEROBJECT() |
2124 //%GPB_UNSAFE_UNRETAINED ## | 8221 //%GPB_UNSAFE_UNRETAINED ## |
2125 //%PDDM-DEFINE DICTIONARY_CLASS_DECLPOD(KEY_NAME, VALUE_NAME, VALUE_TYPE) | 8222 //%PDDM-DEFINE DICTIONARY_CLASS_DECLPOD(KEY_NAME, VALUE_NAME, VALUE_TYPE) |
2126 //%GPB##KEY_NAME##VALUE_NAME##Dictionary | 8223 //%GPB##KEY_NAME##VALUE_NAME##Dictionary |
2127 //%PDDM-DEFINE DICTIONARY_CLASS_DECLEnum(KEY_NAME, VALUE_NAME, VALUE_TYPE) | 8224 //%PDDM-DEFINE DICTIONARY_CLASS_DECLEnum(KEY_NAME, VALUE_NAME, VALUE_TYPE) |
2128 //%GPB##KEY_NAME##VALUE_NAME##Dictionary | 8225 //%GPB##KEY_NAME##VALUE_NAME##Dictionary |
2129 //%PDDM-DEFINE DICTIONARY_CLASS_DECLOBJECT(KEY_NAME, VALUE_NAME, VALUE_TYPE) | 8226 //%PDDM-DEFINE DICTIONARY_CLASS_DECLOBJECT(KEY_NAME, VALUE_NAME, VALUE_TYPE) |
2130 //%GPB##KEY_NAME##VALUE_NAME##Dictionary<__covariant VALUE_TYPE> | 8227 //%GPB##KEY_NAME##VALUE_NAME##Dictionary<__covariant VALUE_TYPE> |
2131 //%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VA
LUE_NAME, VALUE_TYPE, VHELPER, VNAME) | 8228 //%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VA
LUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) |
2132 //%#pragma mark - KEY_NAME -> VALUE_NAME | 8229 //%#pragma mark - KEY_NAME -> VALUE_NAME |
2133 //% | 8230 //% |
| 8231 //%/** |
| 8232 //% * Class used for map fields of <##KEY_TYPE##, ##VALUE_TYPE##> |
| 8233 //% * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 8234 //% * |
| 8235 //% * @note This class is not meant to be subclassed. |
| 8236 //% **/ |
2134 //%@interface DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) :
NSObject <NSCopying> | 8237 //%@interface DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) :
NSObject <NSCopying> |
2135 //% | 8238 //% |
| 8239 //%/** Number of entries stored in this dictionary. */ |
2136 //%@property(nonatomic, readonly) NSUInteger count; | 8240 //%@property(nonatomic, readonly) NSUInteger count; |
2137 //% | 8241 //% |
| 8242 //%/** |
| 8243 //% * @return A newly instanced and empty dictionary. |
| 8244 //% **/ |
2138 //%+ (instancetype)dictionary; | 8245 //%+ (instancetype)dictionary; |
2139 //%+ (instancetype)dictionaryWith##VNAME$u##:(VALUE_TYPE)##VNAME | 8246 //% |
| 8247 //%/** |
| 8248 //% * Creates and initializes a dictionary with the single entry given. |
| 8249 //% * |
| 8250 //% * @param ##VNAME_VAR The value to be placed in the dictionary. |
| 8251 //% * @param key ##VNAME_VAR$S## The key under which to store the value. |
| 8252 //% * |
| 8253 //% * @return A newly instanced dictionary with the key and value in it. |
| 8254 //% **/ |
| 8255 //%+ (instancetype)dictionaryWith##VNAME##:(VALUE_TYPE)##VNAME_VAR |
2140 //% ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key; | 8256 //% ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key; |
2141 //%+ (instancetype)dictionaryWith##VNAME$u##s:(const VALUE_TYPE ARRAY_ARG_MODIFI
ER##VHELPER()[])##VNAME##s | 8257 //% |
| 8258 //%/** |
| 8259 //% * Creates and initializes a dictionary with the entries given. |
| 8260 //% * |
| 8261 //% * @param ##VNAME_VAR##s The values to be placed in the dictionary. |
| 8262 //% * @param keys ##VNAME_VAR$S## The keys under which to store the values. |
| 8263 //% * @param count ##VNAME_VAR$S## The number of entries to store in the diction
ary. |
| 8264 //% * |
| 8265 //% * @return A newly instanced dictionary with the keys and values in it. |
| 8266 //% **/ |
| 8267 //%+ (instancetype)dictionaryWith##VNAME##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER
##VHELPER()[])##VNAME_VAR##s |
2142 //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRA
Y_ARG_MODIFIER##KHELPER()[])keys | 8268 //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRA
Y_ARG_MODIFIER##KHELPER()[])keys |
2143 //% ##VNAME$S## count:(NSUInteger)count; | 8269 //% ##VNAME$S## count:(NSUInteger)count; |
| 8270 //% |
| 8271 //%/** |
| 8272 //% * Creates and initializes a dictionary with the entries from the given. |
| 8273 //% * dictionary. |
| 8274 //% * |
| 8275 //% * @param dictionary Dictionary containing the entries to add to the dictiona
ry. |
| 8276 //% * |
| 8277 //% * @return A newly instanced dictionary with the entries from the given |
| 8278 //% * dictionary in it. |
| 8279 //% **/ |
2144 //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictiona
ry *)dictionary; | 8280 //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictiona
ry *)dictionary; |
| 8281 //% |
| 8282 //%/** |
| 8283 //% * Creates and initializes a dictionary with the given capacity. |
| 8284 //% * |
| 8285 //% * @param numItems Capacity needed for the dictionary. |
| 8286 //% * |
| 8287 //% * @return A newly instanced dictionary with the given capacity. |
| 8288 //% **/ |
2145 //%+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; | 8289 //%+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; |
2146 //% | 8290 //% |
2147 //%- (instancetype)initWith##VNAME$u##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VH
ELPER()[])##VNAME##s | 8291 //%/** |
| 8292 //% * Initializes this dictionary, copying the given values and keys. |
| 8293 //% * |
| 8294 //% * @param ##VNAME_VAR##s The values to be placed in this dictionary. |
| 8295 //% * @param keys ##VNAME_VAR$S## The keys under which to store the values. |
| 8296 //% * @param count ##VNAME_VAR$S## The number of elements to copy into the dicti
onary. |
| 8297 //% * |
| 8298 //% * @return A newly initialized dictionary with a copy of the values and keys. |
| 8299 //% **/ |
| 8300 //%- (instancetype)initWith##VNAME##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHEL
PER()[])##VNAME_VAR##s |
2148 //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_
MODIFIER##KHELPER()[])keys | 8301 //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_
MODIFIER##KHELPER()[])keys |
2149 //% ##VNAME$S## count:(NSUInteger)count NS_DESIGNATED_INITIALI
ZER; | 8302 //% ##VNAME$S## count:(NSUInteger)count NS_DESIGNATED_INITIALI
ZER; |
| 8303 //% |
| 8304 //%/** |
| 8305 //% * Initializes this dictionary, copying the entries from the given dictionary
. |
| 8306 //% * |
| 8307 //% * @param dictionary Dictionary containing the entries to add to this diction
ary. |
| 8308 //% * |
| 8309 //% * @return A newly initialized dictionary with the entries of the given dicti
onary. |
| 8310 //% **/ |
2150 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)d
ictionary; | 8311 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)d
ictionary; |
| 8312 //% |
| 8313 //%/** |
| 8314 //% * Initializes this dictionary with the requested capacity. |
| 8315 //% * |
| 8316 //% * @param numItems Number of items needed for this dictionary. |
| 8317 //% * |
| 8318 //% * @return A newly initialized dictionary with the requested capacity. |
| 8319 //% **/ |
2151 //%- (instancetype)initWithCapacity:(NSUInteger)numItems; | 8320 //%- (instancetype)initWithCapacity:(NSUInteger)numItems; |
2152 //% | 8321 //% |
2153 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TY
PE, VHELPER, VNAME) | 8322 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TY
PE, VHELPER, VNAME, VNAME_VAR) |
2154 //% | 8323 //% |
| 8324 //%/** |
| 8325 //% * Adds the keys and values from another dictionary. |
| 8326 //% * |
| 8327 //% * @param otherDictionary Dictionary containing entries to be added to this |
| 8328 //% * dictionary. |
| 8329 //% **/ |
2155 //%- (void)addEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)oth
erDictionary; | 8330 //%- (void)addEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)oth
erDictionary; |
2156 //% | 8331 //% |
2157 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE
, VHELPER, VNAME) | 8332 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE
, VHELPER, VNAME, VNAME_VAR) |
2158 //% | 8333 //% |
2159 //%@end | 8334 //%@end |
2160 //% | 8335 //% |
2161 | 8336 |
2162 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPE
R, VALUE_NAME, VALUE_TYPE) | 8337 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPE
R, VALUE_NAME, VALUE_TYPE) |
2163 //%DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NA
ME, VALUE_TYPE, Enum) | 8338 //%DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NA
ME, VALUE_TYPE, Enum) |
2164 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELP
ER, VALUE_NAME, VALUE_TYPE, VHELPER) | 8339 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELP
ER, VALUE_NAME, VALUE_TYPE, VHELPER) |
2165 //%#pragma mark - KEY_NAME -> VALUE_NAME | 8340 //%#pragma mark - KEY_NAME -> VALUE_NAME |
2166 //% | 8341 //% |
| 8342 //%/** |
| 8343 //% * Class used for map fields of <##KEY_TYPE##, ##VALUE_TYPE##> |
| 8344 //% * values. This performs better than boxing into NSNumbers in NSDictionaries. |
| 8345 //% * |
| 8346 //% * @note This class is not meant to be subclassed. |
| 8347 //% **/ |
2167 //%@interface GPB##KEY_NAME##VALUE_NAME##Dictionary : NSObject <NSCopying> | 8348 //%@interface GPB##KEY_NAME##VALUE_NAME##Dictionary : NSObject <NSCopying> |
2168 //% | 8349 //% |
| 8350 //%/** Number of entries stored in this dictionary. */ |
2169 //%@property(nonatomic, readonly) NSUInteger count; | 8351 //%@property(nonatomic, readonly) NSUInteger count; |
| 8352 //%/** The validation function to check if the enums are valid. */ |
2170 //%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; | 8353 //%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; |
2171 //% | 8354 //% |
| 8355 //%/** |
| 8356 //% * @return A newly instanced and empty dictionary. |
| 8357 //% **/ |
2172 //%+ (instancetype)dictionary; | 8358 //%+ (instancetype)dictionary; |
| 8359 //% |
| 8360 //%/** |
| 8361 //% * Creates and initializes a dictionary with the given validation function. |
| 8362 //% * |
| 8363 //% * @param func The enum validation function for the dictionary. |
| 8364 //% * |
| 8365 //% * @return A newly instanced dictionary. |
| 8366 //% **/ |
2173 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF
unc)func; | 8367 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF
unc)func; |
| 8368 //% |
| 8369 //%/** |
| 8370 //% * Creates and initializes a dictionary with the single entry given. |
| 8371 //% * |
| 8372 //% * @param func The enum validation function for the dictionary. |
| 8373 //% * @param rawValue The raw enum value to be placed in the dictionary. |
| 8374 //% * @param key The key under which to store the value. |
| 8375 //% * |
| 8376 //% * @return A newly instanced dictionary with the key and value in it. |
| 8377 //% **/ |
2174 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF
unc)func | 8378 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF
unc)func |
2175 //% rawValue:(VALUE_TYPE)rawValue | 8379 //% rawValue:(VALUE_TYPE)rawValue |
2176 //% forKey:(KEY_TYPE##KisP$S##KisP)key; | 8380 //% forKey:(KEY_TYPE##KisP$S##KisP)key; |
| 8381 //% |
| 8382 //%/** |
| 8383 //% * Creates and initializes a dictionary with the entries given. |
| 8384 //% * |
| 8385 //% * @param func The enum validation function for the dictionary. |
| 8386 //% * @param values The raw enum values values to be placed in the dictionary. |
| 8387 //% * @param keys The keys under which to store the values. |
| 8388 //% * @param count The number of entries to store in the dictionary. |
| 8389 //% * |
| 8390 //% * @return A newly instanced dictionary with the keys and values in it. |
| 8391 //% **/ |
2177 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF
unc)func | 8392 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF
unc)func |
2178 //% rawValues:(const VALUE_TYPE ARRAY_ARG_
MODIFIER##VHELPER()[])values | 8393 //% rawValues:(const VALUE_TYPE ARRAY_ARG_
MODIFIER##VHELPER()[])values |
2179 //% forKeys:(const KEY_TYPE##KisP$S##Kis
P ARRAY_ARG_MODIFIER##KHELPER()[])keys | 8394 //% forKeys:(const KEY_TYPE##KisP$S##Kis
P ARRAY_ARG_MODIFIER##KHELPER()[])keys |
2180 //% count:(NSUInteger)count; | 8395 //% count:(NSUInteger)count; |
| 8396 //% |
| 8397 //%/** |
| 8398 //% * Creates and initializes a dictionary with the entries from the given. |
| 8399 //% * dictionary. |
| 8400 //% * |
| 8401 //% * @param dictionary Dictionary containing the entries to add to the dictiona
ry. |
| 8402 //% * |
| 8403 //% * @return A newly instanced dictionary with the entries from the given |
| 8404 //% * dictionary in it. |
| 8405 //% **/ |
2181 //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictiona
ry *)dictionary; | 8406 //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictiona
ry *)dictionary; |
| 8407 //% |
| 8408 //%/** |
| 8409 //% * Creates and initializes a dictionary with the given capacity. |
| 8410 //% * |
| 8411 //% * @param func The enum validation function for the dictionary. |
| 8412 //% * @param numItems Capacity needed for the dictionary. |
| 8413 //% * |
| 8414 //% * @return A newly instanced dictionary with the given capacity. |
| 8415 //% **/ |
2182 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF
unc)func | 8416 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF
unc)func |
2183 //% capacity:(NSUInteger)numItems; | 8417 //% capacity:(NSUInteger)numItems; |
2184 //% | 8418 //% |
| 8419 //%/** |
| 8420 //% * Initializes a dictionary with the given validation function. |
| 8421 //% * |
| 8422 //% * @param func The enum validation function for the dictionary. |
| 8423 //% * |
| 8424 //% * @return A newly initialized dictionary. |
| 8425 //% **/ |
2185 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)fu
nc; | 8426 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)fu
nc; |
| 8427 //% |
| 8428 //%/** |
| 8429 //% * Initializes a dictionary with the entries given. |
| 8430 //% * |
| 8431 //% * @param func The enum validation function for the dictionary. |
| 8432 //% * @param values The raw enum values values to be placed in the dictionary. |
| 8433 //% * @param keys The keys under which to store the values. |
| 8434 //% * @param count The number of entries to store in the dictionary. |
| 8435 //% * |
| 8436 //% * @return A newly initialized dictionary with the keys and values in it. |
| 8437 //% **/ |
2186 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)fu
nc | 8438 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)fu
nc |
2187 //% rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFI
ER##VHELPER()[])values | 8439 //% rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFI
ER##VHELPER()[])values |
2188 //% forKeys:(const KEY_TYPE##KisP$S##KisP ARRA
Y_ARG_MODIFIER##KHELPER()[])keys | 8440 //% forKeys:(const KEY_TYPE##KisP$S##KisP ARRA
Y_ARG_MODIFIER##KHELPER()[])keys |
2189 //% count:(NSUInteger)count NS_DESIGNATED_IN
ITIALIZER; | 8441 //% count:(NSUInteger)count NS_DESIGNATED_IN
ITIALIZER; |
| 8442 //% |
| 8443 //%/** |
| 8444 //% * Initializes a dictionary with the entries from the given. |
| 8445 //% * dictionary. |
| 8446 //% * |
| 8447 //% * @param dictionary Dictionary containing the entries to add to the dictiona
ry. |
| 8448 //% * |
| 8449 //% * @return A newly initialized dictionary with the entries from the given |
| 8450 //% * dictionary in it. |
| 8451 //% **/ |
2190 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)d
ictionary; | 8452 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)d
ictionary; |
| 8453 //% |
| 8454 //%/** |
| 8455 //% * Initializes a dictionary with the given capacity. |
| 8456 //% * |
| 8457 //% * @param func The enum validation function for the dictionary. |
| 8458 //% * @param numItems Capacity needed for the dictionary. |
| 8459 //% * |
| 8460 //% * @return A newly initialized dictionary with the given capacity. |
| 8461 //% **/ |
2191 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)fu
nc | 8462 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)fu
nc |
2192 //% capacity:(NSUInteger)numItems; | 8463 //% capacity:(NSUInteger)numItems; |
2193 //% | 8464 //% |
2194 //%// These will return kGPBUnrecognizedEnumeratorValue if the value for the key | 8465 //%// These will return kGPBUnrecognizedEnumeratorValue if the value for the key |
2195 //%// is not a valid enumerator as defined by validationFunc. If the actual valu
e is | 8466 //%// is not a valid enumerator as defined by validationFunc. If the actual valu
e is |
2196 //%// desired, use "raw" version of the method. | 8467 //%// desired, use "raw" version of the method. |
2197 //% | 8468 //% |
2198 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TY
PE, VHELPER, value) | 8469 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TY
PE, VHELPER, Enum, value) |
2199 //% | 8470 //% |
2200 //%// These methods bypass the validationFunc to provide access to values that w
ere not | 8471 //%/** |
2201 //%// known at the time the binary was compiled. | 8472 //% * Gets the raw enum value for the given key. |
| 8473 //% * |
| 8474 //% * @note This method bypass the validationFunc to enable the access of values
that |
| 8475 //% * were not known at the time the binary was compiled. |
| 8476 //% * |
| 8477 //% * @param rawValue Pointer into which the value will be set, if found. |
| 8478 //% * @param key Key under which the value is stored, if present. |
| 8479 //% * |
| 8480 //% * @return YES if the key was found and the value was copied, NO otherwise. |
| 8481 //% **/ |
| 8482 //%- (BOOL)getRawValue:(nullable VALUE_TYPE *)rawValue forKey:(KEY_TYPE##KisP$S#
#KisP)key; |
2202 //% | 8483 //% |
2203 //%- (BOOL)valueForKey:(KEY_TYPE##KisP$S##KisP)key rawValue:(nullable VALUE_TYPE
*)rawValue; | 8484 //%/** |
2204 //% | 8485 //% * Enumerates the keys and values on this dictionary with the given block. |
| 8486 //% * |
| 8487 //% * @note This method bypass the validationFunc to enable the access of values
that |
| 8488 //% * were not known at the time the binary was compiled. |
| 8489 //% * |
| 8490 //% * @param block The block to enumerate with. |
| 8491 //% * **key**: The key for the current entry. |
| 8492 //% * **rawValue**: The value for the current entry |
| 8493 //% * **stop**: A pointer to a boolean that when set stops the enumeration
. |
| 8494 //% **/ |
2205 //%- (void)enumerateKeysAndRawValuesUsingBlock: | 8495 //%- (void)enumerateKeysAndRawValuesUsingBlock: |
2206 //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE rawValue, BOOL *stop))block; | 8496 //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE rawValue, BOOL *stop))block; |
2207 //% | 8497 //% |
| 8498 //%/** |
| 8499 //% * Adds the keys and raw enum values from another dictionary. |
| 8500 //% * |
| 8501 //% * @note This method bypass the validationFunc to enable the setting of value
s that |
| 8502 //% * were not known at the time the binary was compiled. |
| 8503 //% * |
| 8504 //% * @param otherDictionary Dictionary containing entries to be added to this |
| 8505 //% * dictionary. |
| 8506 //% **/ |
2208 //%- (void)addRawEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)
otherDictionary; | 8507 //%- (void)addRawEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)
otherDictionary; |
2209 //% | 8508 //% |
2210 //%// If value is not a valid enumerator as defined by validationFunc, these | 8509 //%// If value is not a valid enumerator as defined by validationFunc, these |
2211 //%// methods will assert in debug, and will log in release and assign the value | 8510 //%// methods will assert in debug, and will log in release and assign the value |
2212 //%// to the default value. Use the rawValue methods below to assign non enumera
tor | 8511 //%// to the default value. Use the rawValue methods below to assign non enumera
tor |
2213 //%// values. | 8512 //%// values. |
2214 //% | 8513 //% |
2215 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE
, VHELPER, value) | 8514 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE
, VHELPER, Enum, value) |
2216 //% | 8515 //% |
2217 //%@end | 8516 //%@end |
2218 //% | 8517 //% |
2219 | 8518 |
2220 //%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NA
ME, VALUE_TYPE, VHELPER, VNAME) | 8519 //%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NA
ME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) |
2221 //%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_TYPE) | 8520 //%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_TYPE, VNAME) |
2222 //% | 8521 //% |
2223 //%- (void)enumerateKeysAnd##VNAME$u##sUsingBlock: | 8522 //%/** |
2224 //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME, BOOL *stop))block; | 8523 //% * Enumerates the keys and values on this dictionary with the given block. |
| 8524 //% * |
| 8525 //% * @param block The block to enumerate with. |
| 8526 //% * **key**: ##VNAME_VAR$S## The key for the current entry. |
| 8527 //% * **VNAME_VAR**: The value for the current entry |
| 8528 //% * **stop**: ##VNAME_VAR$S## A pointer to a boolean that when set stops the
enumeration. |
| 8529 //% **/ |
| 8530 //%- (void)enumerateKeysAnd##VNAME##sUsingBlock: |
| 8531 //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME_VAR, BOOL *stop))block; |
2225 | 8532 |
2226 //%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME
, VALUE_TYPE, VHELPER, VNAME) | 8533 //%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME
, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) |
2227 //%- (void)set##VNAME$u##:(VALUE_TYPE)##VNAME forKey:(KEY_TYPE##KisP$S##KisP)key
; | 8534 //%/** |
| 8535 //% * Sets the value for the given key. |
| 8536 //% * |
| 8537 //% * @param ##VNAME_VAR The value to set. |
| 8538 //% * @param key ##VNAME_VAR$S## The key under which to store the value. |
| 8539 //% **/ |
| 8540 //%- (void)set##VNAME##:(VALUE_TYPE)##VNAME_VAR forKey:(KEY_TYPE##KisP$S##KisP)k
ey; |
2228 //%DICTIONARY_EXTRA_MUTABLE_METHODS_##VHELPER(KEY_NAME, KEY_TYPE, KisP, VALUE_NA
ME, VALUE_TYPE) | 8541 //%DICTIONARY_EXTRA_MUTABLE_METHODS_##VHELPER(KEY_NAME, KEY_TYPE, KisP, VALUE_NA
ME, VALUE_TYPE) |
2229 //%- (void)remove##VNAME$u##ForKey:(KEY_TYPE##KisP$S##KisP)aKey; | 8542 //%/** |
| 8543 //% * Removes the entry for the given key. |
| 8544 //% * |
| 8545 //% * @param aKey Key to be removed from this dictionary. |
| 8546 //% **/ |
| 8547 //%- (void)remove##VNAME##ForKey:(KEY_TYPE##KisP$S##KisP)aKey; |
| 8548 //% |
| 8549 //%/** |
| 8550 //% * Removes all entries in this dictionary. |
| 8551 //% **/ |
2230 //%- (void)removeAll; | 8552 //%- (void)removeAll; |
2231 | 8553 |
2232 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_POD(KEY_NAME, KEY_TYPE, KisP, VA
LUE_NAME, VALUE_TYPE) | 8554 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_POD(KEY_NAME, KEY_TYPE, KisP, VA
LUE_NAME, VALUE_TYPE) |
2233 // Empty | 8555 // Empty |
2234 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_OBJECT(KEY_NAME, KEY_TYPE, KisP,
VALUE_NAME, VALUE_TYPE) | 8556 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_OBJECT(KEY_NAME, KEY_TYPE, KisP,
VALUE_NAME, VALUE_TYPE) |
2235 // Empty | 8557 // Empty |
2236 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_Enum(KEY_NAME, KEY_TYPE, KisP, V
ALUE_NAME, VALUE_TYPE) | 8558 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_Enum(KEY_NAME, KEY_TYPE, KisP, V
ALUE_NAME, VALUE_TYPE) |
2237 //% | 8559 //% |
2238 //%// This method bypass the validationFunc to provide setting of values that we
re not | 8560 //%/** |
2239 //%// known at the time the binary was compiled. | 8561 //% * Sets the raw enum value for the given key. |
| 8562 //% * |
| 8563 //% * @note This method bypass the validationFunc to enable the setting of value
s that |
| 8564 //% * were not known at the time the binary was compiled. |
| 8565 //% * |
| 8566 //% * @param rawValue The raw enum value to set. |
| 8567 //% * @param key The key under which to store the raw enum value. |
| 8568 //% **/ |
2240 //%- (void)setRawValue:(VALUE_TYPE)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key; | 8569 //%- (void)setRawValue:(VALUE_TYPE)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key; |
2241 //% | 8570 //% |
2242 //%// No validation applies to these methods. | |
2243 //% | |
OLD | NEW |