Home | History | Annotate | Download | only in objectivec
      1 // Protocol Buffers - Google's data interchange format
      2 // Copyright 2008 Google Inc.  All rights reserved.
      3 // https://developers.google.com/protocol-buffers/
      4 //
      5 // Redistribution and use in source and binary forms, with or without
      6 // modification, are permitted provided that the following conditions are
      7 // met:
      8 //
      9 //     * Redistributions of source code must retain the above copyright
     10 // notice, this list of conditions and the following disclaimer.
     11 //     * Redistributions in binary form must reproduce the above
     12 // copyright notice, this list of conditions and the following disclaimer
     13 // in the documentation and/or other materials provided with the
     14 // distribution.
     15 //     * Neither the name of Google Inc. nor the names of its
     16 // contributors may be used to endorse or promote products derived from
     17 // this software without specific prior written permission.
     18 //
     19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     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.
     30 
     31 #import <Foundation/Foundation.h>
     32 
     33 #import "GPBRuntimeTypes.h"
     34 
     35 // These classes are used for map fields of basic data types. They are used because
     36 // they perform better than boxing into NSNumbers in NSDictionaries.
     37 
     38 // Note: These are not meant to be subclassed.
     39 
     40 NS_ASSUME_NONNULL_BEGIN
     41 
     42 //%PDDM-EXPAND DECLARE_DICTIONARIES()
     43 // This block of code is generated, do not edit it directly.
     44 
     45 #pragma mark - UInt32 -> UInt32
     46 
     47 @interface GPBUInt32UInt32Dictionary : NSObject <NSCopying>
     48 
     49 @property(nonatomic, readonly) NSUInteger count;
     50 
     51 + (instancetype)dictionary;
     52 + (instancetype)dictionaryWithValue:(uint32_t)value
     53                              forKey:(uint32_t)key;
     54 + (instancetype)dictionaryWithValues:(const uint32_t [])values
     55                              forKeys:(const uint32_t [])keys
     56                                count:(NSUInteger)count;
     57 + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary;
     58 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
     59 
     60 - (instancetype)initWithValues:(const uint32_t [])values
     61                        forKeys:(const uint32_t [])keys
     62                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
     63 - (instancetype)initWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary;
     64 - (instancetype)initWithCapacity:(NSUInteger)numItems;
     65 
     66 - (BOOL)valueForKey:(uint32_t)key value:(nullable uint32_t *)value;
     67 
     68 - (void)enumerateKeysAndValuesUsingBlock:
     69     (void (^)(uint32_t key, uint32_t value, BOOL *stop))block;
     70 
     71 - (void)addEntriesFromDictionary:(GPBUInt32UInt32Dictionary *)otherDictionary;
     72 
     73 - (void)setValue:(uint32_t)value forKey:(uint32_t)key;
     74 
     75 - (void)removeValueForKey:(uint32_t)aKey;
     76 - (void)removeAll;
     77 
     78 @end
     79 
     80 #pragma mark - UInt32 -> Int32
     81 
     82 @interface GPBUInt32Int32Dictionary : NSObject <NSCopying>
     83 
     84 @property(nonatomic, readonly) NSUInteger count;
     85 
     86 + (instancetype)dictionary;
     87 + (instancetype)dictionaryWithValue:(int32_t)value
     88                              forKey:(uint32_t)key;
     89 + (instancetype)dictionaryWithValues:(const int32_t [])values
     90                              forKeys:(const uint32_t [])keys
     91                                count:(NSUInteger)count;
     92 + (instancetype)dictionaryWithDictionary:(GPBUInt32Int32Dictionary *)dictionary;
     93 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
     94 
     95 - (instancetype)initWithValues:(const int32_t [])values
     96                        forKeys:(const uint32_t [])keys
     97                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
     98 - (instancetype)initWithDictionary:(GPBUInt32Int32Dictionary *)dictionary;
     99 - (instancetype)initWithCapacity:(NSUInteger)numItems;
    100 
    101 - (BOOL)valueForKey:(uint32_t)key value:(nullable int32_t *)value;
    102 
    103 - (void)enumerateKeysAndValuesUsingBlock:
    104     (void (^)(uint32_t key, int32_t value, BOOL *stop))block;
    105 
    106 - (void)addEntriesFromDictionary:(GPBUInt32Int32Dictionary *)otherDictionary;
    107 
    108 - (void)setValue:(int32_t)value forKey:(uint32_t)key;
    109 
    110 - (void)removeValueForKey:(uint32_t)aKey;
    111 - (void)removeAll;
    112 
    113 @end
    114 
    115 #pragma mark - UInt32 -> UInt64
    116 
    117 @interface GPBUInt32UInt64Dictionary : NSObject <NSCopying>
    118 
    119 @property(nonatomic, readonly) NSUInteger count;
    120 
    121 + (instancetype)dictionary;
    122 + (instancetype)dictionaryWithValue:(uint64_t)value
    123                              forKey:(uint32_t)key;
    124 + (instancetype)dictionaryWithValues:(const uint64_t [])values
    125                              forKeys:(const uint32_t [])keys
    126                                count:(NSUInteger)count;
    127 + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary;
    128 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    129 
    130 - (instancetype)initWithValues:(const uint64_t [])values
    131                        forKeys:(const uint32_t [])keys
    132                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    133 - (instancetype)initWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary;
    134 - (instancetype)initWithCapacity:(NSUInteger)numItems;
    135 
    136 - (BOOL)valueForKey:(uint32_t)key value:(nullable uint64_t *)value;
    137 
    138 - (void)enumerateKeysAndValuesUsingBlock:
    139     (void (^)(uint32_t key, uint64_t value, BOOL *stop))block;
    140 
    141 - (void)addEntriesFromDictionary:(GPBUInt32UInt64Dictionary *)otherDictionary;
    142 
    143 - (void)setValue:(uint64_t)value forKey:(uint32_t)key;
    144 
    145 - (void)removeValueForKey:(uint32_t)aKey;
    146 - (void)removeAll;
    147 
    148 @end
    149 
    150 #pragma mark - UInt32 -> Int64
    151 
    152 @interface GPBUInt32Int64Dictionary : NSObject <NSCopying>
    153 
    154 @property(nonatomic, readonly) NSUInteger count;
    155 
    156 + (instancetype)dictionary;
    157 + (instancetype)dictionaryWithValue:(int64_t)value
    158                              forKey:(uint32_t)key;
    159 + (instancetype)dictionaryWithValues:(const int64_t [])values
    160                              forKeys:(const uint32_t [])keys
    161                                count:(NSUInteger)count;
    162 + (instancetype)dictionaryWithDictionary:(GPBUInt32Int64Dictionary *)dictionary;
    163 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    164 
    165 - (instancetype)initWithValues:(const int64_t [])values
    166                        forKeys:(const uint32_t [])keys
    167                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    168 - (instancetype)initWithDictionary:(GPBUInt32Int64Dictionary *)dictionary;
    169 - (instancetype)initWithCapacity:(NSUInteger)numItems;
    170 
    171 - (BOOL)valueForKey:(uint32_t)key value:(nullable int64_t *)value;
    172 
    173 - (void)enumerateKeysAndValuesUsingBlock:
    174     (void (^)(uint32_t key, int64_t value, BOOL *stop))block;
    175 
    176 - (void)addEntriesFromDictionary:(GPBUInt32Int64Dictionary *)otherDictionary;
    177 
    178 - (void)setValue:(int64_t)value forKey:(uint32_t)key;
    179 
    180 - (void)removeValueForKey:(uint32_t)aKey;
    181 - (void)removeAll;
    182 
    183 @end
    184 
    185 #pragma mark - UInt32 -> Bool
    186 
    187 @interface GPBUInt32BoolDictionary : NSObject <NSCopying>
    188 
    189 @property(nonatomic, readonly) NSUInteger count;
    190 
    191 + (instancetype)dictionary;
    192 + (instancetype)dictionaryWithValue:(BOOL)value
    193                              forKey:(uint32_t)key;
    194 + (instancetype)dictionaryWithValues:(const BOOL [])values
    195                              forKeys:(const uint32_t [])keys
    196                                count:(NSUInteger)count;
    197 + (instancetype)dictionaryWithDictionary:(GPBUInt32BoolDictionary *)dictionary;
    198 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    199 
    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;
    299 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
    300                                         rawValue:(int32_t)rawValue
    301                                           forKey:(uint32_t)key;
    302 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
    303                                        rawValues:(const int32_t [])values
    304                                          forKeys:(const uint32_t [])keys
    305                                            count:(NSUInteger)count;
    306 + (instancetype)dictionaryWithDictionary:(GPBUInt32EnumDictionary *)dictionary;
    307 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
    308                                         capacity:(NSUInteger)numItems;
    309 
    310 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
    311 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
    312                                  rawValues:(const int32_t [])values
    313                                    forKeys:(const uint32_t [])keys
    314                                      count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    315 - (instancetype)initWithDictionary:(GPBUInt32EnumDictionary *)dictionary;
    316 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
    317                                   capacity:(NSUInteger)numItems;
    318 
    319 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
    320 // is not a valid enumerator as defined by validationFunc. If the actual value is
    321 // desired, use "raw" version of the method.
    322 
    323 - (BOOL)valueForKey:(uint32_t)key value:(nullable int32_t *)value;
    324 
    325 - (void)enumerateKeysAndValuesUsingBlock:
    326     (void (^)(uint32_t key, int32_t value, BOOL *stop))block;
    327 
    328 // These methods bypass the validationFunc to provide access to values that were not
    329 // known at the time the binary was compiled.
    330 
    331 - (BOOL)valueForKey:(uint32_t)key rawValue:(nullable int32_t *)rawValue;
    332 
    333 - (void)enumerateKeysAndRawValuesUsingBlock:
    334     (void (^)(uint32_t key, int32_t rawValue, BOOL *stop))block;
    335 
    336 - (void)addRawEntriesFromDictionary:(GPBUInt32EnumDictionary *)otherDictionary;
    337 
    338 // 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
    340 // to the default value. Use the rawValue methods below to assign non enumerator
    341 // values.
    342 
    343 - (void)setValue:(int32_t)value forKey:(uint32_t)key;
    344 
    345 // This method bypass the validationFunc to provide setting of values that were not
    346 // known at the time the binary was compiled.
    347 - (void)setRawValue:(int32_t)rawValue forKey:(uint32_t)key;
    348 
    349 // No validation applies to these methods.
    350 
    351 - (void)removeValueForKey:(uint32_t)aKey;
    352 - (void)removeAll;
    353 
    354 @end
    355 
    356 #pragma mark - UInt32 -> Object
    357 
    358 @interface GPBUInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
    359 
    360 @property(nonatomic, readonly) NSUInteger count;
    361 
    362 + (instancetype)dictionary;
    363 + (instancetype)dictionaryWithObject:(ObjectType)object
    364                               forKey:(uint32_t)key;
    365 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
    366                               forKeys:(const uint32_t [])keys
    367                                 count:(NSUInteger)count;
    368 + (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary;
    369 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    370 
    371 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
    372                         forKeys:(const uint32_t [])keys
    373                           count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    374 - (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary;
    375 - (instancetype)initWithCapacity:(NSUInteger)numItems;
    376 
    377 - (ObjectType)objectForKey:(uint32_t)key;
    378 
    379 - (void)enumerateKeysAndObjectsUsingBlock:
    380     (void (^)(uint32_t key, ObjectType object, BOOL *stop))block;
    381 
    382 - (void)addEntriesFromDictionary:(GPBUInt32ObjectDictionary *)otherDictionary;
    383 
    384 - (void)setObject:(ObjectType)object forKey:(uint32_t)key;
    385 
    386 - (void)removeObjectForKey:(uint32_t)aKey;
    387 - (void)removeAll;
    388 
    389 @end
    390 
    391 #pragma mark - Int32 -> UInt32
    392 
    393 @interface GPBInt32UInt32Dictionary : NSObject <NSCopying>
    394 
    395 @property(nonatomic, readonly) NSUInteger count;
    396 
    397 + (instancetype)dictionary;
    398 + (instancetype)dictionaryWithValue:(uint32_t)value
    399                              forKey:(int32_t)key;
    400 + (instancetype)dictionaryWithValues:(const uint32_t [])values
    401                              forKeys:(const int32_t [])keys
    402                                count:(NSUInteger)count;
    403 + (instancetype)dictionaryWithDictionary:(GPBInt32UInt32Dictionary *)dictionary;
    404 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    405 
    406 - (instancetype)initWithValues:(const uint32_t [])values
    407                        forKeys:(const int32_t [])keys
    408                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    409 - (instancetype)initWithDictionary:(GPBInt32UInt32Dictionary *)dictionary;
    410 - (instancetype)initWithCapacity:(NSUInteger)numItems;
    411 
    412 - (BOOL)valueForKey:(int32_t)key value:(nullable uint32_t *)value;
    413 
    414 - (void)enumerateKeysAndValuesUsingBlock:
    415     (void (^)(int32_t key, uint32_t value, BOOL *stop))block;
    416 
    417 - (void)addEntriesFromDictionary:(GPBInt32UInt32Dictionary *)otherDictionary;
    418 
    419 - (void)setValue:(uint32_t)value forKey:(int32_t)key;
    420 
    421 - (void)removeValueForKey:(int32_t)aKey;
    422 - (void)removeAll;
    423 
    424 @end
    425 
    426 #pragma mark - Int32 -> Int32
    427 
    428 @interface GPBInt32Int32Dictionary : NSObject <NSCopying>
    429 
    430 @property(nonatomic, readonly) NSUInteger count;
    431 
    432 + (instancetype)dictionary;
    433 + (instancetype)dictionaryWithValue:(int32_t)value
    434                              forKey:(int32_t)key;
    435 + (instancetype)dictionaryWithValues:(const int32_t [])values
    436                              forKeys:(const int32_t [])keys
    437                                count:(NSUInteger)count;
    438 + (instancetype)dictionaryWithDictionary:(GPBInt32Int32Dictionary *)dictionary;
    439 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    440 
    441 - (instancetype)initWithValues:(const int32_t [])values
    442                        forKeys:(const int32_t [])keys
    443                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    444 - (instancetype)initWithDictionary:(GPBInt32Int32Dictionary *)dictionary;
    445 - (instancetype)initWithCapacity:(NSUInteger)numItems;
    446 
    447 - (BOOL)valueForKey:(int32_t)key value:(nullable int32_t *)value;
    448 
    449 - (void)enumerateKeysAndValuesUsingBlock:
    450     (void (^)(int32_t key, int32_t value, BOOL *stop))block;
    451 
    452 - (void)addEntriesFromDictionary:(GPBInt32Int32Dictionary *)otherDictionary;
    453 
    454 - (void)setValue:(int32_t)value forKey:(int32_t)key;
    455 
    456 - (void)removeValueForKey:(int32_t)aKey;
    457 - (void)removeAll;
    458 
    459 @end
    460 
    461 #pragma mark - Int32 -> UInt64
    462 
    463 @interface GPBInt32UInt64Dictionary : NSObject <NSCopying>
    464 
    465 @property(nonatomic, readonly) NSUInteger count;
    466 
    467 + (instancetype)dictionary;
    468 + (instancetype)dictionaryWithValue:(uint64_t)value
    469                              forKey:(int32_t)key;
    470 + (instancetype)dictionaryWithValues:(const uint64_t [])values
    471                              forKeys:(const int32_t [])keys
    472                                count:(NSUInteger)count;
    473 + (instancetype)dictionaryWithDictionary:(GPBInt32UInt64Dictionary *)dictionary;
    474 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    475 
    476 - (instancetype)initWithValues:(const uint64_t [])values
    477                        forKeys:(const int32_t [])keys
    478                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    479 - (instancetype)initWithDictionary:(GPBInt32UInt64Dictionary *)dictionary;
    480 - (instancetype)initWithCapacity:(NSUInteger)numItems;
    481 
    482 - (BOOL)valueForKey:(int32_t)key value:(nullable uint64_t *)value;
    483 
    484 - (void)enumerateKeysAndValuesUsingBlock:
    485     (void (^)(int32_t key, uint64_t value, BOOL *stop))block;
    486 
    487 - (void)addEntriesFromDictionary:(GPBInt32UInt64Dictionary *)otherDictionary;
    488 
    489 - (void)setValue:(uint64_t)value forKey:(int32_t)key;
    490 
    491 - (void)removeValueForKey:(int32_t)aKey;
    492 - (void)removeAll;
    493 
    494 @end
    495 
    496 #pragma mark - Int32 -> Int64
    497 
    498 @interface GPBInt32Int64Dictionary : NSObject <NSCopying>
    499 
    500 @property(nonatomic, readonly) NSUInteger count;
    501 
    502 + (instancetype)dictionary;
    503 + (instancetype)dictionaryWithValue:(int64_t)value
    504                              forKey:(int32_t)key;
    505 + (instancetype)dictionaryWithValues:(const int64_t [])values
    506                              forKeys:(const int32_t [])keys
    507                                count:(NSUInteger)count;
    508 + (instancetype)dictionaryWithDictionary:(GPBInt32Int64Dictionary *)dictionary;
    509 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    510 
    511 - (instancetype)initWithValues:(const int64_t [])values
    512                        forKeys:(const int32_t [])keys
    513                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    514 - (instancetype)initWithDictionary:(GPBInt32Int64Dictionary *)dictionary;
    515 - (instancetype)initWithCapacity:(NSUInteger)numItems;
    516 
    517 - (BOOL)valueForKey:(int32_t)key value:(nullable int64_t *)value;
    518 
    519 - (void)enumerateKeysAndValuesUsingBlock:
    520     (void (^)(int32_t key, int64_t value, BOOL *stop))block;
    521 
    522 - (void)addEntriesFromDictionary:(GPBInt32Int64Dictionary *)otherDictionary;
    523 
    524 - (void)setValue:(int64_t)value forKey:(int32_t)key;
    525 
    526 - (void)removeValueForKey:(int32_t)aKey;
    527 - (void)removeAll;
    528 
    529 @end
    530 
    531 #pragma mark - Int32 -> Bool
    532 
    533 @interface GPBInt32BoolDictionary : NSObject <NSCopying>
    534 
    535 @property(nonatomic, readonly) NSUInteger count;
    536 
    537 + (instancetype)dictionary;
    538 + (instancetype)dictionaryWithValue:(BOOL)value
    539                              forKey:(int32_t)key;
    540 + (instancetype)dictionaryWithValues:(const BOOL [])values
    541                              forKeys:(const int32_t [])keys
    542                                count:(NSUInteger)count;
    543 + (instancetype)dictionaryWithDictionary:(GPBInt32BoolDictionary *)dictionary;
    544 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    545 
    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;
    645 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
    646                                         rawValue:(int32_t)rawValue
    647                                           forKey:(int32_t)key;
    648 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
    649                                        rawValues:(const int32_t [])values
    650                                          forKeys:(const int32_t [])keys
    651                                            count:(NSUInteger)count;
    652 + (instancetype)dictionaryWithDictionary:(GPBInt32EnumDictionary *)dictionary;
    653 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
    654                                         capacity:(NSUInteger)numItems;
    655 
    656 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
    657 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
    658                                  rawValues:(const int32_t [])values
    659                                    forKeys:(const int32_t [])keys
    660                                      count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    661 - (instancetype)initWithDictionary:(GPBInt32EnumDictionary *)dictionary;
    662 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
    663                                   capacity:(NSUInteger)numItems;
    664 
    665 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
    666 // is not a valid enumerator as defined by validationFunc. If the actual value is
    667 // desired, use "raw" version of the method.
    668 
    669 - (BOOL)valueForKey:(int32_t)key value:(nullable int32_t *)value;
    670 
    671 - (void)enumerateKeysAndValuesUsingBlock:
    672     (void (^)(int32_t key, int32_t value, BOOL *stop))block;
    673 
    674 // These methods bypass the validationFunc to provide access to values that were not
    675 // known at the time the binary was compiled.
    676 
    677 - (BOOL)valueForKey:(int32_t)key rawValue:(nullable int32_t *)rawValue;
    678 
    679 - (void)enumerateKeysAndRawValuesUsingBlock:
    680     (void (^)(int32_t key, int32_t rawValue, BOOL *stop))block;
    681 
    682 - (void)addRawEntriesFromDictionary:(GPBInt32EnumDictionary *)otherDictionary;
    683 
    684 // 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
    686 // to the default value. Use the rawValue methods below to assign non enumerator
    687 // values.
    688 
    689 - (void)setValue:(int32_t)value forKey:(int32_t)key;
    690 
    691 // This method bypass the validationFunc to provide setting of values that were not
    692 // known at the time the binary was compiled.
    693 - (void)setRawValue:(int32_t)rawValue forKey:(int32_t)key;
    694 
    695 // No validation applies to these methods.
    696 
    697 - (void)removeValueForKey:(int32_t)aKey;
    698 - (void)removeAll;
    699 
    700 @end
    701 
    702 #pragma mark - Int32 -> Object
    703 
    704 @interface GPBInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
    705 
    706 @property(nonatomic, readonly) NSUInteger count;
    707 
    708 + (instancetype)dictionary;
    709 + (instancetype)dictionaryWithObject:(ObjectType)object
    710                               forKey:(int32_t)key;
    711 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
    712                               forKeys:(const int32_t [])keys
    713                                 count:(NSUInteger)count;
    714 + (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
    715 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    716 
    717 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
    718                         forKeys:(const int32_t [])keys
    719                           count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    720 - (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
    721 - (instancetype)initWithCapacity:(NSUInteger)numItems;
    722 
    723 - (ObjectType)objectForKey:(int32_t)key;
    724 
    725 - (void)enumerateKeysAndObjectsUsingBlock:
    726     (void (^)(int32_t key, ObjectType object, BOOL *stop))block;
    727 
    728 - (void)addEntriesFromDictionary:(GPBInt32ObjectDictionary *)otherDictionary;
    729 
    730 - (void)setObject:(ObjectType)object forKey:(int32_t)key;
    731 
    732 - (void)removeObjectForKey:(int32_t)aKey;
    733 - (void)removeAll;
    734 
    735 @end
    736 
    737 #pragma mark - UInt64 -> UInt32
    738 
    739 @interface GPBUInt64UInt32Dictionary : NSObject <NSCopying>
    740 
    741 @property(nonatomic, readonly) NSUInteger count;
    742 
    743 + (instancetype)dictionary;
    744 + (instancetype)dictionaryWithValue:(uint32_t)value
    745                              forKey:(uint64_t)key;
    746 + (instancetype)dictionaryWithValues:(const uint32_t [])values
    747                              forKeys:(const uint64_t [])keys
    748                                count:(NSUInteger)count;
    749 + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary;
    750 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    751 
    752 - (instancetype)initWithValues:(const uint32_t [])values
    753                        forKeys:(const uint64_t [])keys
    754                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    755 - (instancetype)initWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary;
    756 - (instancetype)initWithCapacity:(NSUInteger)numItems;
    757 
    758 - (BOOL)valueForKey:(uint64_t)key value:(nullable uint32_t *)value;
    759 
    760 - (void)enumerateKeysAndValuesUsingBlock:
    761     (void (^)(uint64_t key, uint32_t value, BOOL *stop))block;
    762 
    763 - (void)addEntriesFromDictionary:(GPBUInt64UInt32Dictionary *)otherDictionary;
    764 
    765 - (void)setValue:(uint32_t)value forKey:(uint64_t)key;
    766 
    767 - (void)removeValueForKey:(uint64_t)aKey;
    768 - (void)removeAll;
    769 
    770 @end
    771 
    772 #pragma mark - UInt64 -> Int32
    773 
    774 @interface GPBUInt64Int32Dictionary : NSObject <NSCopying>
    775 
    776 @property(nonatomic, readonly) NSUInteger count;
    777 
    778 + (instancetype)dictionary;
    779 + (instancetype)dictionaryWithValue:(int32_t)value
    780                              forKey:(uint64_t)key;
    781 + (instancetype)dictionaryWithValues:(const int32_t [])values
    782                              forKeys:(const uint64_t [])keys
    783                                count:(NSUInteger)count;
    784 + (instancetype)dictionaryWithDictionary:(GPBUInt64Int32Dictionary *)dictionary;
    785 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    786 
    787 - (instancetype)initWithValues:(const int32_t [])values
    788                        forKeys:(const uint64_t [])keys
    789                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    790 - (instancetype)initWithDictionary:(GPBUInt64Int32Dictionary *)dictionary;
    791 - (instancetype)initWithCapacity:(NSUInteger)numItems;
    792 
    793 - (BOOL)valueForKey:(uint64_t)key value:(nullable int32_t *)value;
    794 
    795 - (void)enumerateKeysAndValuesUsingBlock:
    796     (void (^)(uint64_t key, int32_t value, BOOL *stop))block;
    797 
    798 - (void)addEntriesFromDictionary:(GPBUInt64Int32Dictionary *)otherDictionary;
    799 
    800 - (void)setValue:(int32_t)value forKey:(uint64_t)key;
    801 
    802 - (void)removeValueForKey:(uint64_t)aKey;
    803 - (void)removeAll;
    804 
    805 @end
    806 
    807 #pragma mark - UInt64 -> UInt64
    808 
    809 @interface GPBUInt64UInt64Dictionary : NSObject <NSCopying>
    810 
    811 @property(nonatomic, readonly) NSUInteger count;
    812 
    813 + (instancetype)dictionary;
    814 + (instancetype)dictionaryWithValue:(uint64_t)value
    815                              forKey:(uint64_t)key;
    816 + (instancetype)dictionaryWithValues:(const uint64_t [])values
    817                              forKeys:(const uint64_t [])keys
    818                                count:(NSUInteger)count;
    819 + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary;
    820 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    821 
    822 - (instancetype)initWithValues:(const uint64_t [])values
    823                        forKeys:(const uint64_t [])keys
    824                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    825 - (instancetype)initWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary;
    826 - (instancetype)initWithCapacity:(NSUInteger)numItems;
    827 
    828 - (BOOL)valueForKey:(uint64_t)key value:(nullable uint64_t *)value;
    829 
    830 - (void)enumerateKeysAndValuesUsingBlock:
    831     (void (^)(uint64_t key, uint64_t value, BOOL *stop))block;
    832 
    833 - (void)addEntriesFromDictionary:(GPBUInt64UInt64Dictionary *)otherDictionary;
    834 
    835 - (void)setValue:(uint64_t)value forKey:(uint64_t)key;
    836 
    837 - (void)removeValueForKey:(uint64_t)aKey;
    838 - (void)removeAll;
    839 
    840 @end
    841 
    842 #pragma mark - UInt64 -> Int64
    843 
    844 @interface GPBUInt64Int64Dictionary : NSObject <NSCopying>
    845 
    846 @property(nonatomic, readonly) NSUInteger count;
    847 
    848 + (instancetype)dictionary;
    849 + (instancetype)dictionaryWithValue:(int64_t)value
    850                              forKey:(uint64_t)key;
    851 + (instancetype)dictionaryWithValues:(const int64_t [])values
    852                              forKeys:(const uint64_t [])keys
    853                                count:(NSUInteger)count;
    854 + (instancetype)dictionaryWithDictionary:(GPBUInt64Int64Dictionary *)dictionary;
    855 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    856 
    857 - (instancetype)initWithValues:(const int64_t [])values
    858                        forKeys:(const uint64_t [])keys
    859                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
    860 - (instancetype)initWithDictionary:(GPBUInt64Int64Dictionary *)dictionary;
    861 - (instancetype)initWithCapacity:(NSUInteger)numItems;
    862 
    863 - (BOOL)valueForKey:(uint64_t)key value:(nullable int64_t *)value;
    864 
    865 - (void)enumerateKeysAndValuesUsingBlock:
    866     (void (^)(uint64_t key, int64_t value, BOOL *stop))block;
    867 
    868 - (void)addEntriesFromDictionary:(GPBUInt64Int64Dictionary *)otherDictionary;
    869 
    870 - (void)setValue:(int64_t)value forKey:(uint64_t)key;
    871 
    872 - (void)removeValueForKey:(uint64_t)aKey;
    873 - (void)removeAll;
    874 
    875 @end
    876 
    877 #pragma mark - UInt64 -> Bool
    878 
    879 @interface GPBUInt64BoolDictionary : NSObject <NSCopying>
    880 
    881 @property(nonatomic, readonly) NSUInteger count;
    882 
    883 + (instancetype)dictionary;
    884 + (instancetype)dictionaryWithValue:(BOOL)value
    885                              forKey:(uint64_t)key;
    886 + (instancetype)dictionaryWithValues:(const BOOL [])values
    887                              forKeys:(const uint64_t [])keys
    888                                count:(NSUInteger)count;
    889 + (instancetype)dictionaryWithDictionary:(GPBUInt64BoolDictionary *)dictionary;
    890 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
    891 
    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;
    991 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
    992                                         rawValue:(int32_t)rawValue
    993                                           forKey:(uint64_t)key;
    994 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
    995                                        rawValues:(const int32_t [])values
    996                                          forKeys:(const uint64_t [])keys
    997                                            count:(NSUInteger)count;
    998 + (instancetype)dictionaryWithDictionary:(GPBUInt64EnumDictionary *)dictionary;
    999 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
   1000                                         capacity:(NSUInteger)numItems;
   1001 
   1002 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
   1003 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
   1004                                  rawValues:(const int32_t [])values
   1005                                    forKeys:(const uint64_t [])keys
   1006                                      count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1007 - (instancetype)initWithDictionary:(GPBUInt64EnumDictionary *)dictionary;
   1008 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
   1009                                   capacity:(NSUInteger)numItems;
   1010 
   1011 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
   1012 // is not a valid enumerator as defined by validationFunc. If the actual value is
   1013 // desired, use "raw" version of the method.
   1014 
   1015 - (BOOL)valueForKey:(uint64_t)key value:(nullable int32_t *)value;
   1016 
   1017 - (void)enumerateKeysAndValuesUsingBlock:
   1018     (void (^)(uint64_t key, int32_t value, BOOL *stop))block;
   1019 
   1020 // These methods bypass the validationFunc to provide access to values that were not
   1021 // known at the time the binary was compiled.
   1022 
   1023 - (BOOL)valueForKey:(uint64_t)key rawValue:(nullable int32_t *)rawValue;
   1024 
   1025 - (void)enumerateKeysAndRawValuesUsingBlock:
   1026     (void (^)(uint64_t key, int32_t rawValue, BOOL *stop))block;
   1027 
   1028 - (void)addRawEntriesFromDictionary:(GPBUInt64EnumDictionary *)otherDictionary;
   1029 
   1030 // 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
   1032 // to the default value. Use the rawValue methods below to assign non enumerator
   1033 // values.
   1034 
   1035 - (void)setValue:(int32_t)value forKey:(uint64_t)key;
   1036 
   1037 // This method bypass the validationFunc to provide setting of values that were not
   1038 // known at the time the binary was compiled.
   1039 - (void)setRawValue:(int32_t)rawValue forKey:(uint64_t)key;
   1040 
   1041 // No validation applies to these methods.
   1042 
   1043 - (void)removeValueForKey:(uint64_t)aKey;
   1044 - (void)removeAll;
   1045 
   1046 @end
   1047 
   1048 #pragma mark - UInt64 -> Object
   1049 
   1050 @interface GPBUInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
   1051 
   1052 @property(nonatomic, readonly) NSUInteger count;
   1053 
   1054 + (instancetype)dictionary;
   1055 + (instancetype)dictionaryWithObject:(ObjectType)object
   1056                               forKey:(uint64_t)key;
   1057 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
   1058                               forKeys:(const uint64_t [])keys
   1059                                 count:(NSUInteger)count;
   1060 + (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary;
   1061 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1062 
   1063 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
   1064                         forKeys:(const uint64_t [])keys
   1065                           count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1066 - (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary;
   1067 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1068 
   1069 - (ObjectType)objectForKey:(uint64_t)key;
   1070 
   1071 - (void)enumerateKeysAndObjectsUsingBlock:
   1072     (void (^)(uint64_t key, ObjectType object, BOOL *stop))block;
   1073 
   1074 - (void)addEntriesFromDictionary:(GPBUInt64ObjectDictionary *)otherDictionary;
   1075 
   1076 - (void)setObject:(ObjectType)object forKey:(uint64_t)key;
   1077 
   1078 - (void)removeObjectForKey:(uint64_t)aKey;
   1079 - (void)removeAll;
   1080 
   1081 @end
   1082 
   1083 #pragma mark - Int64 -> UInt32
   1084 
   1085 @interface GPBInt64UInt32Dictionary : NSObject <NSCopying>
   1086 
   1087 @property(nonatomic, readonly) NSUInteger count;
   1088 
   1089 + (instancetype)dictionary;
   1090 + (instancetype)dictionaryWithValue:(uint32_t)value
   1091                              forKey:(int64_t)key;
   1092 + (instancetype)dictionaryWithValues:(const uint32_t [])values
   1093                              forKeys:(const int64_t [])keys
   1094                                count:(NSUInteger)count;
   1095 + (instancetype)dictionaryWithDictionary:(GPBInt64UInt32Dictionary *)dictionary;
   1096 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1097 
   1098 - (instancetype)initWithValues:(const uint32_t [])values
   1099                        forKeys:(const int64_t [])keys
   1100                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1101 - (instancetype)initWithDictionary:(GPBInt64UInt32Dictionary *)dictionary;
   1102 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1103 
   1104 - (BOOL)valueForKey:(int64_t)key value:(nullable uint32_t *)value;
   1105 
   1106 - (void)enumerateKeysAndValuesUsingBlock:
   1107     (void (^)(int64_t key, uint32_t value, BOOL *stop))block;
   1108 
   1109 - (void)addEntriesFromDictionary:(GPBInt64UInt32Dictionary *)otherDictionary;
   1110 
   1111 - (void)setValue:(uint32_t)value forKey:(int64_t)key;
   1112 
   1113 - (void)removeValueForKey:(int64_t)aKey;
   1114 - (void)removeAll;
   1115 
   1116 @end
   1117 
   1118 #pragma mark - Int64 -> Int32
   1119 
   1120 @interface GPBInt64Int32Dictionary : NSObject <NSCopying>
   1121 
   1122 @property(nonatomic, readonly) NSUInteger count;
   1123 
   1124 + (instancetype)dictionary;
   1125 + (instancetype)dictionaryWithValue:(int32_t)value
   1126                              forKey:(int64_t)key;
   1127 + (instancetype)dictionaryWithValues:(const int32_t [])values
   1128                              forKeys:(const int64_t [])keys
   1129                                count:(NSUInteger)count;
   1130 + (instancetype)dictionaryWithDictionary:(GPBInt64Int32Dictionary *)dictionary;
   1131 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1132 
   1133 - (instancetype)initWithValues:(const int32_t [])values
   1134                        forKeys:(const int64_t [])keys
   1135                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1136 - (instancetype)initWithDictionary:(GPBInt64Int32Dictionary *)dictionary;
   1137 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1138 
   1139 - (BOOL)valueForKey:(int64_t)key value:(nullable int32_t *)value;
   1140 
   1141 - (void)enumerateKeysAndValuesUsingBlock:
   1142     (void (^)(int64_t key, int32_t value, BOOL *stop))block;
   1143 
   1144 - (void)addEntriesFromDictionary:(GPBInt64Int32Dictionary *)otherDictionary;
   1145 
   1146 - (void)setValue:(int32_t)value forKey:(int64_t)key;
   1147 
   1148 - (void)removeValueForKey:(int64_t)aKey;
   1149 - (void)removeAll;
   1150 
   1151 @end
   1152 
   1153 #pragma mark - Int64 -> UInt64
   1154 
   1155 @interface GPBInt64UInt64Dictionary : NSObject <NSCopying>
   1156 
   1157 @property(nonatomic, readonly) NSUInteger count;
   1158 
   1159 + (instancetype)dictionary;
   1160 + (instancetype)dictionaryWithValue:(uint64_t)value
   1161                              forKey:(int64_t)key;
   1162 + (instancetype)dictionaryWithValues:(const uint64_t [])values
   1163                              forKeys:(const int64_t [])keys
   1164                                count:(NSUInteger)count;
   1165 + (instancetype)dictionaryWithDictionary:(GPBInt64UInt64Dictionary *)dictionary;
   1166 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1167 
   1168 - (instancetype)initWithValues:(const uint64_t [])values
   1169                        forKeys:(const int64_t [])keys
   1170                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1171 - (instancetype)initWithDictionary:(GPBInt64UInt64Dictionary *)dictionary;
   1172 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1173 
   1174 - (BOOL)valueForKey:(int64_t)key value:(nullable uint64_t *)value;
   1175 
   1176 - (void)enumerateKeysAndValuesUsingBlock:
   1177     (void (^)(int64_t key, uint64_t value, BOOL *stop))block;
   1178 
   1179 - (void)addEntriesFromDictionary:(GPBInt64UInt64Dictionary *)otherDictionary;
   1180 
   1181 - (void)setValue:(uint64_t)value forKey:(int64_t)key;
   1182 
   1183 - (void)removeValueForKey:(int64_t)aKey;
   1184 - (void)removeAll;
   1185 
   1186 @end
   1187 
   1188 #pragma mark - Int64 -> Int64
   1189 
   1190 @interface GPBInt64Int64Dictionary : NSObject <NSCopying>
   1191 
   1192 @property(nonatomic, readonly) NSUInteger count;
   1193 
   1194 + (instancetype)dictionary;
   1195 + (instancetype)dictionaryWithValue:(int64_t)value
   1196                              forKey:(int64_t)key;
   1197 + (instancetype)dictionaryWithValues:(const int64_t [])values
   1198                              forKeys:(const int64_t [])keys
   1199                                count:(NSUInteger)count;
   1200 + (instancetype)dictionaryWithDictionary:(GPBInt64Int64Dictionary *)dictionary;
   1201 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1202 
   1203 - (instancetype)initWithValues:(const int64_t [])values
   1204                        forKeys:(const int64_t [])keys
   1205                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1206 - (instancetype)initWithDictionary:(GPBInt64Int64Dictionary *)dictionary;
   1207 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1208 
   1209 - (BOOL)valueForKey:(int64_t)key value:(nullable int64_t *)value;
   1210 
   1211 - (void)enumerateKeysAndValuesUsingBlock:
   1212     (void (^)(int64_t key, int64_t value, BOOL *stop))block;
   1213 
   1214 - (void)addEntriesFromDictionary:(GPBInt64Int64Dictionary *)otherDictionary;
   1215 
   1216 - (void)setValue:(int64_t)value forKey:(int64_t)key;
   1217 
   1218 - (void)removeValueForKey:(int64_t)aKey;
   1219 - (void)removeAll;
   1220 
   1221 @end
   1222 
   1223 #pragma mark - Int64 -> Bool
   1224 
   1225 @interface GPBInt64BoolDictionary : NSObject <NSCopying>
   1226 
   1227 @property(nonatomic, readonly) NSUInteger count;
   1228 
   1229 + (instancetype)dictionary;
   1230 + (instancetype)dictionaryWithValue:(BOOL)value
   1231                              forKey:(int64_t)key;
   1232 + (instancetype)dictionaryWithValues:(const BOOL [])values
   1233                              forKeys:(const int64_t [])keys
   1234                                count:(NSUInteger)count;
   1235 + (instancetype)dictionaryWithDictionary:(GPBInt64BoolDictionary *)dictionary;
   1236 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1237 
   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;
   1337 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
   1338                                         rawValue:(int32_t)rawValue
   1339                                           forKey:(int64_t)key;
   1340 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
   1341                                        rawValues:(const int32_t [])values
   1342                                          forKeys:(const int64_t [])keys
   1343                                            count:(NSUInteger)count;
   1344 + (instancetype)dictionaryWithDictionary:(GPBInt64EnumDictionary *)dictionary;
   1345 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
   1346                                         capacity:(NSUInteger)numItems;
   1347 
   1348 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
   1349 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
   1350                                  rawValues:(const int32_t [])values
   1351                                    forKeys:(const int64_t [])keys
   1352                                      count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1353 - (instancetype)initWithDictionary:(GPBInt64EnumDictionary *)dictionary;
   1354 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
   1355                                   capacity:(NSUInteger)numItems;
   1356 
   1357 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
   1358 // is not a valid enumerator as defined by validationFunc. If the actual value is
   1359 // desired, use "raw" version of the method.
   1360 
   1361 - (BOOL)valueForKey:(int64_t)key value:(nullable int32_t *)value;
   1362 
   1363 - (void)enumerateKeysAndValuesUsingBlock:
   1364     (void (^)(int64_t key, int32_t value, BOOL *stop))block;
   1365 
   1366 // These methods bypass the validationFunc to provide access to values that were not
   1367 // known at the time the binary was compiled.
   1368 
   1369 - (BOOL)valueForKey:(int64_t)key rawValue:(nullable int32_t *)rawValue;
   1370 
   1371 - (void)enumerateKeysAndRawValuesUsingBlock:
   1372     (void (^)(int64_t key, int32_t rawValue, BOOL *stop))block;
   1373 
   1374 - (void)addRawEntriesFromDictionary:(GPBInt64EnumDictionary *)otherDictionary;
   1375 
   1376 // 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
   1378 // to the default value. Use the rawValue methods below to assign non enumerator
   1379 // values.
   1380 
   1381 - (void)setValue:(int32_t)value forKey:(int64_t)key;
   1382 
   1383 // This method bypass the validationFunc to provide setting of values that were not
   1384 // known at the time the binary was compiled.
   1385 - (void)setRawValue:(int32_t)rawValue forKey:(int64_t)key;
   1386 
   1387 // No validation applies to these methods.
   1388 
   1389 - (void)removeValueForKey:(int64_t)aKey;
   1390 - (void)removeAll;
   1391 
   1392 @end
   1393 
   1394 #pragma mark - Int64 -> Object
   1395 
   1396 @interface GPBInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
   1397 
   1398 @property(nonatomic, readonly) NSUInteger count;
   1399 
   1400 + (instancetype)dictionary;
   1401 + (instancetype)dictionaryWithObject:(ObjectType)object
   1402                               forKey:(int64_t)key;
   1403 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
   1404                               forKeys:(const int64_t [])keys
   1405                                 count:(NSUInteger)count;
   1406 + (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
   1407 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1408 
   1409 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
   1410                         forKeys:(const int64_t [])keys
   1411                           count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1412 - (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
   1413 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1414 
   1415 - (ObjectType)objectForKey:(int64_t)key;
   1416 
   1417 - (void)enumerateKeysAndObjectsUsingBlock:
   1418     (void (^)(int64_t key, ObjectType object, BOOL *stop))block;
   1419 
   1420 - (void)addEntriesFromDictionary:(GPBInt64ObjectDictionary *)otherDictionary;
   1421 
   1422 - (void)setObject:(ObjectType)object forKey:(int64_t)key;
   1423 
   1424 - (void)removeObjectForKey:(int64_t)aKey;
   1425 - (void)removeAll;
   1426 
   1427 @end
   1428 
   1429 #pragma mark - Bool -> UInt32
   1430 
   1431 @interface GPBBoolUInt32Dictionary : NSObject <NSCopying>
   1432 
   1433 @property(nonatomic, readonly) NSUInteger count;
   1434 
   1435 + (instancetype)dictionary;
   1436 + (instancetype)dictionaryWithValue:(uint32_t)value
   1437                              forKey:(BOOL)key;
   1438 + (instancetype)dictionaryWithValues:(const uint32_t [])values
   1439                              forKeys:(const BOOL [])keys
   1440                                count:(NSUInteger)count;
   1441 + (instancetype)dictionaryWithDictionary:(GPBBoolUInt32Dictionary *)dictionary;
   1442 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1443 
   1444 - (instancetype)initWithValues:(const uint32_t [])values
   1445                        forKeys:(const BOOL [])keys
   1446                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1447 - (instancetype)initWithDictionary:(GPBBoolUInt32Dictionary *)dictionary;
   1448 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1449 
   1450 - (BOOL)valueForKey:(BOOL)key value:(nullable uint32_t *)value;
   1451 
   1452 - (void)enumerateKeysAndValuesUsingBlock:
   1453     (void (^)(BOOL key, uint32_t value, BOOL *stop))block;
   1454 
   1455 - (void)addEntriesFromDictionary:(GPBBoolUInt32Dictionary *)otherDictionary;
   1456 
   1457 - (void)setValue:(uint32_t)value forKey:(BOOL)key;
   1458 
   1459 - (void)removeValueForKey:(BOOL)aKey;
   1460 - (void)removeAll;
   1461 
   1462 @end
   1463 
   1464 #pragma mark - Bool -> Int32
   1465 
   1466 @interface GPBBoolInt32Dictionary : NSObject <NSCopying>
   1467 
   1468 @property(nonatomic, readonly) NSUInteger count;
   1469 
   1470 + (instancetype)dictionary;
   1471 + (instancetype)dictionaryWithValue:(int32_t)value
   1472                              forKey:(BOOL)key;
   1473 + (instancetype)dictionaryWithValues:(const int32_t [])values
   1474                              forKeys:(const BOOL [])keys
   1475                                count:(NSUInteger)count;
   1476 + (instancetype)dictionaryWithDictionary:(GPBBoolInt32Dictionary *)dictionary;
   1477 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1478 
   1479 - (instancetype)initWithValues:(const int32_t [])values
   1480                        forKeys:(const BOOL [])keys
   1481                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1482 - (instancetype)initWithDictionary:(GPBBoolInt32Dictionary *)dictionary;
   1483 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1484 
   1485 - (BOOL)valueForKey:(BOOL)key value:(nullable int32_t *)value;
   1486 
   1487 - (void)enumerateKeysAndValuesUsingBlock:
   1488     (void (^)(BOOL key, int32_t value, BOOL *stop))block;
   1489 
   1490 - (void)addEntriesFromDictionary:(GPBBoolInt32Dictionary *)otherDictionary;
   1491 
   1492 - (void)setValue:(int32_t)value forKey:(BOOL)key;
   1493 
   1494 - (void)removeValueForKey:(BOOL)aKey;
   1495 - (void)removeAll;
   1496 
   1497 @end
   1498 
   1499 #pragma mark - Bool -> UInt64
   1500 
   1501 @interface GPBBoolUInt64Dictionary : NSObject <NSCopying>
   1502 
   1503 @property(nonatomic, readonly) NSUInteger count;
   1504 
   1505 + (instancetype)dictionary;
   1506 + (instancetype)dictionaryWithValue:(uint64_t)value
   1507                              forKey:(BOOL)key;
   1508 + (instancetype)dictionaryWithValues:(const uint64_t [])values
   1509                              forKeys:(const BOOL [])keys
   1510                                count:(NSUInteger)count;
   1511 + (instancetype)dictionaryWithDictionary:(GPBBoolUInt64Dictionary *)dictionary;
   1512 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1513 
   1514 - (instancetype)initWithValues:(const uint64_t [])values
   1515                        forKeys:(const BOOL [])keys
   1516                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1517 - (instancetype)initWithDictionary:(GPBBoolUInt64Dictionary *)dictionary;
   1518 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1519 
   1520 - (BOOL)valueForKey:(BOOL)key value:(nullable uint64_t *)value;
   1521 
   1522 - (void)enumerateKeysAndValuesUsingBlock:
   1523     (void (^)(BOOL key, uint64_t value, BOOL *stop))block;
   1524 
   1525 - (void)addEntriesFromDictionary:(GPBBoolUInt64Dictionary *)otherDictionary;
   1526 
   1527 - (void)setValue:(uint64_t)value forKey:(BOOL)key;
   1528 
   1529 - (void)removeValueForKey:(BOOL)aKey;
   1530 - (void)removeAll;
   1531 
   1532 @end
   1533 
   1534 #pragma mark - Bool -> Int64
   1535 
   1536 @interface GPBBoolInt64Dictionary : NSObject <NSCopying>
   1537 
   1538 @property(nonatomic, readonly) NSUInteger count;
   1539 
   1540 + (instancetype)dictionary;
   1541 + (instancetype)dictionaryWithValue:(int64_t)value
   1542                              forKey:(BOOL)key;
   1543 + (instancetype)dictionaryWithValues:(const int64_t [])values
   1544                              forKeys:(const BOOL [])keys
   1545                                count:(NSUInteger)count;
   1546 + (instancetype)dictionaryWithDictionary:(GPBBoolInt64Dictionary *)dictionary;
   1547 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1548 
   1549 - (instancetype)initWithValues:(const int64_t [])values
   1550                        forKeys:(const BOOL [])keys
   1551                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1552 - (instancetype)initWithDictionary:(GPBBoolInt64Dictionary *)dictionary;
   1553 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1554 
   1555 - (BOOL)valueForKey:(BOOL)key value:(nullable int64_t *)value;
   1556 
   1557 - (void)enumerateKeysAndValuesUsingBlock:
   1558     (void (^)(BOOL key, int64_t value, BOOL *stop))block;
   1559 
   1560 - (void)addEntriesFromDictionary:(GPBBoolInt64Dictionary *)otherDictionary;
   1561 
   1562 - (void)setValue:(int64_t)value forKey:(BOOL)key;
   1563 
   1564 - (void)removeValueForKey:(BOOL)aKey;
   1565 - (void)removeAll;
   1566 
   1567 @end
   1568 
   1569 #pragma mark - Bool -> Bool
   1570 
   1571 @interface GPBBoolBoolDictionary : NSObject <NSCopying>
   1572 
   1573 @property(nonatomic, readonly) NSUInteger count;
   1574 
   1575 + (instancetype)dictionary;
   1576 + (instancetype)dictionaryWithValue:(BOOL)value
   1577                              forKey:(BOOL)key;
   1578 + (instancetype)dictionaryWithValues:(const BOOL [])values
   1579                              forKeys:(const BOOL [])keys
   1580                                count:(NSUInteger)count;
   1581 + (instancetype)dictionaryWithDictionary:(GPBBoolBoolDictionary *)dictionary;
   1582 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1583 
   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;
   1683 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
   1684                                         rawValue:(int32_t)rawValue
   1685                                           forKey:(BOOL)key;
   1686 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
   1687                                        rawValues:(const int32_t [])values
   1688                                          forKeys:(const BOOL [])keys
   1689                                            count:(NSUInteger)count;
   1690 + (instancetype)dictionaryWithDictionary:(GPBBoolEnumDictionary *)dictionary;
   1691 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
   1692                                         capacity:(NSUInteger)numItems;
   1693 
   1694 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
   1695 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
   1696                                  rawValues:(const int32_t [])values
   1697                                    forKeys:(const BOOL [])keys
   1698                                      count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1699 - (instancetype)initWithDictionary:(GPBBoolEnumDictionary *)dictionary;
   1700 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
   1701                                   capacity:(NSUInteger)numItems;
   1702 
   1703 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
   1704 // is not a valid enumerator as defined by validationFunc. If the actual value is
   1705 // desired, use "raw" version of the method.
   1706 
   1707 - (BOOL)valueForKey:(BOOL)key value:(nullable int32_t *)value;
   1708 
   1709 - (void)enumerateKeysAndValuesUsingBlock:
   1710     (void (^)(BOOL key, int32_t value, BOOL *stop))block;
   1711 
   1712 // These methods bypass the validationFunc to provide access to values that were not
   1713 // known at the time the binary was compiled.
   1714 
   1715 - (BOOL)valueForKey:(BOOL)key rawValue:(nullable int32_t *)rawValue;
   1716 
   1717 - (void)enumerateKeysAndRawValuesUsingBlock:
   1718     (void (^)(BOOL key, int32_t rawValue, BOOL *stop))block;
   1719 
   1720 - (void)addRawEntriesFromDictionary:(GPBBoolEnumDictionary *)otherDictionary;
   1721 
   1722 // 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
   1724 // to the default value. Use the rawValue methods below to assign non enumerator
   1725 // values.
   1726 
   1727 - (void)setValue:(int32_t)value forKey:(BOOL)key;
   1728 
   1729 // This method bypass the validationFunc to provide setting of values that were not
   1730 // known at the time the binary was compiled.
   1731 - (void)setRawValue:(int32_t)rawValue forKey:(BOOL)key;
   1732 
   1733 // No validation applies to these methods.
   1734 
   1735 - (void)removeValueForKey:(BOOL)aKey;
   1736 - (void)removeAll;
   1737 
   1738 @end
   1739 
   1740 #pragma mark - Bool -> Object
   1741 
   1742 @interface GPBBoolObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
   1743 
   1744 @property(nonatomic, readonly) NSUInteger count;
   1745 
   1746 + (instancetype)dictionary;
   1747 + (instancetype)dictionaryWithObject:(ObjectType)object
   1748                               forKey:(BOOL)key;
   1749 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
   1750                               forKeys:(const BOOL [])keys
   1751                                 count:(NSUInteger)count;
   1752 + (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary;
   1753 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1754 
   1755 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
   1756                         forKeys:(const BOOL [])keys
   1757                           count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1758 - (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary;
   1759 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1760 
   1761 - (ObjectType)objectForKey:(BOOL)key;
   1762 
   1763 - (void)enumerateKeysAndObjectsUsingBlock:
   1764     (void (^)(BOOL key, ObjectType object, BOOL *stop))block;
   1765 
   1766 - (void)addEntriesFromDictionary:(GPBBoolObjectDictionary *)otherDictionary;
   1767 
   1768 - (void)setObject:(ObjectType)object forKey:(BOOL)key;
   1769 
   1770 - (void)removeObjectForKey:(BOOL)aKey;
   1771 - (void)removeAll;
   1772 
   1773 @end
   1774 
   1775 #pragma mark - String -> UInt32
   1776 
   1777 @interface GPBStringUInt32Dictionary : NSObject <NSCopying>
   1778 
   1779 @property(nonatomic, readonly) NSUInteger count;
   1780 
   1781 + (instancetype)dictionary;
   1782 + (instancetype)dictionaryWithValue:(uint32_t)value
   1783                              forKey:(NSString *)key;
   1784 + (instancetype)dictionaryWithValues:(const uint32_t [])values
   1785                              forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
   1786                                count:(NSUInteger)count;
   1787 + (instancetype)dictionaryWithDictionary:(GPBStringUInt32Dictionary *)dictionary;
   1788 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1789 
   1790 - (instancetype)initWithValues:(const uint32_t [])values
   1791                        forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
   1792                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1793 - (instancetype)initWithDictionary:(GPBStringUInt32Dictionary *)dictionary;
   1794 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1795 
   1796 - (BOOL)valueForKey:(NSString *)key value:(nullable uint32_t *)value;
   1797 
   1798 - (void)enumerateKeysAndValuesUsingBlock:
   1799     (void (^)(NSString *key, uint32_t value, BOOL *stop))block;
   1800 
   1801 - (void)addEntriesFromDictionary:(GPBStringUInt32Dictionary *)otherDictionary;
   1802 
   1803 - (void)setValue:(uint32_t)value forKey:(NSString *)key;
   1804 
   1805 - (void)removeValueForKey:(NSString *)aKey;
   1806 - (void)removeAll;
   1807 
   1808 @end
   1809 
   1810 #pragma mark - String -> Int32
   1811 
   1812 @interface GPBStringInt32Dictionary : NSObject <NSCopying>
   1813 
   1814 @property(nonatomic, readonly) NSUInteger count;
   1815 
   1816 + (instancetype)dictionary;
   1817 + (instancetype)dictionaryWithValue:(int32_t)value
   1818                              forKey:(NSString *)key;
   1819 + (instancetype)dictionaryWithValues:(const int32_t [])values
   1820                              forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
   1821                                count:(NSUInteger)count;
   1822 + (instancetype)dictionaryWithDictionary:(GPBStringInt32Dictionary *)dictionary;
   1823 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1824 
   1825 - (instancetype)initWithValues:(const int32_t [])values
   1826                        forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
   1827                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1828 - (instancetype)initWithDictionary:(GPBStringInt32Dictionary *)dictionary;
   1829 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1830 
   1831 - (BOOL)valueForKey:(NSString *)key value:(nullable int32_t *)value;
   1832 
   1833 - (void)enumerateKeysAndValuesUsingBlock:
   1834     (void (^)(NSString *key, int32_t value, BOOL *stop))block;
   1835 
   1836 - (void)addEntriesFromDictionary:(GPBStringInt32Dictionary *)otherDictionary;
   1837 
   1838 - (void)setValue:(int32_t)value forKey:(NSString *)key;
   1839 
   1840 - (void)removeValueForKey:(NSString *)aKey;
   1841 - (void)removeAll;
   1842 
   1843 @end
   1844 
   1845 #pragma mark - String -> UInt64
   1846 
   1847 @interface GPBStringUInt64Dictionary : NSObject <NSCopying>
   1848 
   1849 @property(nonatomic, readonly) NSUInteger count;
   1850 
   1851 + (instancetype)dictionary;
   1852 + (instancetype)dictionaryWithValue:(uint64_t)value
   1853                              forKey:(NSString *)key;
   1854 + (instancetype)dictionaryWithValues:(const uint64_t [])values
   1855                              forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
   1856                                count:(NSUInteger)count;
   1857 + (instancetype)dictionaryWithDictionary:(GPBStringUInt64Dictionary *)dictionary;
   1858 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1859 
   1860 - (instancetype)initWithValues:(const uint64_t [])values
   1861                        forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
   1862                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1863 - (instancetype)initWithDictionary:(GPBStringUInt64Dictionary *)dictionary;
   1864 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1865 
   1866 - (BOOL)valueForKey:(NSString *)key value:(nullable uint64_t *)value;
   1867 
   1868 - (void)enumerateKeysAndValuesUsingBlock:
   1869     (void (^)(NSString *key, uint64_t value, BOOL *stop))block;
   1870 
   1871 - (void)addEntriesFromDictionary:(GPBStringUInt64Dictionary *)otherDictionary;
   1872 
   1873 - (void)setValue:(uint64_t)value forKey:(NSString *)key;
   1874 
   1875 - (void)removeValueForKey:(NSString *)aKey;
   1876 - (void)removeAll;
   1877 
   1878 @end
   1879 
   1880 #pragma mark - String -> Int64
   1881 
   1882 @interface GPBStringInt64Dictionary : NSObject <NSCopying>
   1883 
   1884 @property(nonatomic, readonly) NSUInteger count;
   1885 
   1886 + (instancetype)dictionary;
   1887 + (instancetype)dictionaryWithValue:(int64_t)value
   1888                              forKey:(NSString *)key;
   1889 + (instancetype)dictionaryWithValues:(const int64_t [])values
   1890                              forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
   1891                                count:(NSUInteger)count;
   1892 + (instancetype)dictionaryWithDictionary:(GPBStringInt64Dictionary *)dictionary;
   1893 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1894 
   1895 - (instancetype)initWithValues:(const int64_t [])values
   1896                        forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
   1897                          count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   1898 - (instancetype)initWithDictionary:(GPBStringInt64Dictionary *)dictionary;
   1899 - (instancetype)initWithCapacity:(NSUInteger)numItems;
   1900 
   1901 - (BOOL)valueForKey:(NSString *)key value:(nullable int64_t *)value;
   1902 
   1903 - (void)enumerateKeysAndValuesUsingBlock:
   1904     (void (^)(NSString *key, int64_t value, BOOL *stop))block;
   1905 
   1906 - (void)addEntriesFromDictionary:(GPBStringInt64Dictionary *)otherDictionary;
   1907 
   1908 - (void)setValue:(int64_t)value forKey:(NSString *)key;
   1909 
   1910 - (void)removeValueForKey:(NSString *)aKey;
   1911 - (void)removeAll;
   1912 
   1913 @end
   1914 
   1915 #pragma mark - String -> Bool
   1916 
   1917 @interface GPBStringBoolDictionary : NSObject <NSCopying>
   1918 
   1919 @property(nonatomic, readonly) NSUInteger count;
   1920 
   1921 + (instancetype)dictionary;
   1922 + (instancetype)dictionaryWithValue:(BOOL)value
   1923                              forKey:(NSString *)key;
   1924 + (instancetype)dictionaryWithValues:(const BOOL [])values
   1925                              forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
   1926                                count:(NSUInteger)count;
   1927 + (instancetype)dictionaryWithDictionary:(GPBStringBoolDictionary *)dictionary;
   1928 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   1929 
   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;
   2029 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
   2030                                         rawValue:(int32_t)rawValue
   2031                                           forKey:(NSString *)key;
   2032 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
   2033                                        rawValues:(const int32_t [])values
   2034                                          forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
   2035                                            count:(NSUInteger)count;
   2036 + (instancetype)dictionaryWithDictionary:(GPBStringEnumDictionary *)dictionary;
   2037 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
   2038                                         capacity:(NSUInteger)numItems;
   2039 
   2040 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
   2041 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
   2042                                  rawValues:(const int32_t [])values
   2043                                    forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
   2044                                      count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   2045 - (instancetype)initWithDictionary:(GPBStringEnumDictionary *)dictionary;
   2046 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
   2047                                   capacity:(NSUInteger)numItems;
   2048 
   2049 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
   2050 // is not a valid enumerator as defined by validationFunc. If the actual value is
   2051 // desired, use "raw" version of the method.
   2052 
   2053 - (BOOL)valueForKey:(NSString *)key value:(nullable int32_t *)value;
   2054 
   2055 - (void)enumerateKeysAndValuesUsingBlock:
   2056     (void (^)(NSString *key, int32_t value, BOOL *stop))block;
   2057 
   2058 // These methods bypass the validationFunc to provide access to values that were not
   2059 // known at the time the binary was compiled.
   2060 
   2061 - (BOOL)valueForKey:(NSString *)key rawValue:(nullable int32_t *)rawValue;
   2062 
   2063 - (void)enumerateKeysAndRawValuesUsingBlock:
   2064     (void (^)(NSString *key, int32_t rawValue, BOOL *stop))block;
   2065 
   2066 - (void)addRawEntriesFromDictionary:(GPBStringEnumDictionary *)otherDictionary;
   2067 
   2068 // 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
   2070 // to the default value. Use the rawValue methods below to assign non enumerator
   2071 // values.
   2072 
   2073 - (void)setValue:(int32_t)value forKey:(NSString *)key;
   2074 
   2075 // This method bypass the validationFunc to provide setting of values that were not
   2076 // known at the time the binary was compiled.
   2077 - (void)setRawValue:(int32_t)rawValue forKey:(NSString *)key;
   2078 
   2079 // No validation applies to these methods.
   2080 
   2081 - (void)removeValueForKey:(NSString *)aKey;
   2082 - (void)removeAll;
   2083 
   2084 @end
   2085 
   2086 //%PDDM-EXPAND-END DECLARE_DICTIONARIES()
   2087 
   2088 NS_ASSUME_NONNULL_END
   2089 
   2090 //%PDDM-DEFINE DECLARE_DICTIONARIES()
   2091 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt32, uint32_t)
   2092 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int32, int32_t)
   2093 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt64, uint64_t)
   2094 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int64, int64_t)
   2095 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Bool, BOOL)
   2096 //%DICTIONARY_POD_INTERFACES_FOR_KEY(String, NSString, *, OBJECT)
   2097 //%PDDM-DEFINE DICTIONARY_INTERFACES_FOR_POD_KEY(KEY_NAME, KEY_TYPE)
   2098 //%DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, , POD)
   2099 //%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, KHELPER)
   2101 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt32, uint32_t)
   2102 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int32, int32_t)
   2103 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt64, uint64_t)
   2104 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int64, int64_t)
   2105 //%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, float)
   2107 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Double, double)
   2108 //%DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Enum, int32_t)
   2109 //%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, VALUE_TYPE, POD, value)
   2111 //%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)
   2113 //%PDDM-DEFINE VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE)
   2114 //%- (BOOL)valueForKey:(KEY_TYPE)key value:(nullable VALUE_TYPE *)value;
   2115 //%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_TYPE)
   2116 //%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key;
   2117 //%PDDM-DEFINE VALUE_FOR_KEY_Enum(KEY_TYPE, VALUE_TYPE)
   2118 //%VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE)
   2119 //%PDDM-DEFINE ARRAY_ARG_MODIFIERPOD()
   2120 // Nothing
   2121 //%PDDM-DEFINE ARRAY_ARG_MODIFIEREnum()
   2122 // Nothing
   2123 //%PDDM-DEFINE ARRAY_ARG_MODIFIEROBJECT()
   2124 //%GPB_UNSAFE_UNRETAINED ##
   2125 //%PDDM-DEFINE DICTIONARY_CLASS_DECLPOD(KEY_NAME, VALUE_NAME, VALUE_TYPE)
   2126 //%GPB##KEY_NAME##VALUE_NAME##Dictionary
   2127 //%PDDM-DEFINE DICTIONARY_CLASS_DECLEnum(KEY_NAME, VALUE_NAME, VALUE_TYPE)
   2128 //%GPB##KEY_NAME##VALUE_NAME##Dictionary
   2129 //%PDDM-DEFINE DICTIONARY_CLASS_DECLOBJECT(KEY_NAME, VALUE_NAME, VALUE_TYPE)
   2130 //%GPB##KEY_NAME##VALUE_NAME##Dictionary<__covariant VALUE_TYPE>
   2131 //%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
   2132 //%#pragma mark - KEY_NAME -> VALUE_NAME
   2133 //%
   2134 //%@interface DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) : NSObject <NSCopying>
   2135 //%
   2136 //%@property(nonatomic, readonly) NSUInteger count;
   2137 //%
   2138 //%+ (instancetype)dictionary;
   2139 //%+ (instancetype)dictionaryWith##VNAME$u##:(VALUE_TYPE)##VNAME
   2140 //%                       ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key;
   2141 //%+ (instancetype)dictionaryWith##VNAME$u##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])##VNAME##s
   2142 //%                      ##VNAME$S##  forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
   2143 //%                      ##VNAME$S##    count:(NSUInteger)count;
   2144 //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
   2145 //%+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
   2146 //%
   2147 //%- (instancetype)initWith##VNAME$u##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])##VNAME##s
   2148 //%                ##VNAME$S##  forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
   2149 //%                ##VNAME$S##    count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   2150 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
   2151 //%- (instancetype)initWithCapacity:(NSUInteger)numItems;
   2152 //%
   2153 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
   2154 //%
   2155 //%- (void)addEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary;
   2156 //%
   2157 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
   2158 //%
   2159 //%@end
   2160 //%
   2161 
   2162 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE)
   2163 //%DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, Enum)
   2164 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER)
   2165 //%#pragma mark - KEY_NAME -> VALUE_NAME
   2166 //%
   2167 //%@interface GPB##KEY_NAME##VALUE_NAME##Dictionary : NSObject <NSCopying>
   2168 //%
   2169 //%@property(nonatomic, readonly) NSUInteger count;
   2170 //%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
   2171 //%
   2172 //%+ (instancetype)dictionary;
   2173 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
   2174 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
   2175 //%                                        rawValue:(VALUE_TYPE)rawValue
   2176 //%                                          forKey:(KEY_TYPE##KisP$S##KisP)key;
   2177 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
   2178 //%                                       rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])values
   2179 //%                                         forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
   2180 //%                                           count:(NSUInteger)count;
   2181 //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
   2182 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
   2183 //%                                        capacity:(NSUInteger)numItems;
   2184 //%
   2185 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
   2186 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
   2187 //%                                 rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])values
   2188 //%                                   forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
   2189 //%                                     count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
   2190 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
   2191 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
   2192 //%                                  capacity:(NSUInteger)numItems;
   2193 //%
   2194 //%// These will return kGPBUnrecognizedEnumeratorValue if the value for the key
   2195 //%// is not a valid enumerator as defined by validationFunc. If the actual value is
   2196 //%// desired, use "raw" version of the method.
   2197 //%
   2198 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, value)
   2199 //%
   2200 //%// These methods bypass the validationFunc to provide access to values that were not
   2201 //%// known at the time the binary was compiled.
   2202 //%
   2203 //%- (BOOL)valueForKey:(KEY_TYPE##KisP$S##KisP)key rawValue:(nullable VALUE_TYPE *)rawValue;
   2204 //%
   2205 //%- (void)enumerateKeysAndRawValuesUsingBlock:
   2206 //%    (void (^)(KEY_TYPE KisP##key, VALUE_TYPE rawValue, BOOL *stop))block;
   2207 //%
   2208 //%- (void)addRawEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary;
   2209 //%
   2210 //%// 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
   2212 //%// to the default value. Use the rawValue methods below to assign non enumerator
   2213 //%// values.
   2214 //%
   2215 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, value)
   2216 //%
   2217 //%@end
   2218 //%
   2219 
   2220 //%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
   2221 //%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_TYPE)
   2222 //%
   2223 //%- (void)enumerateKeysAnd##VNAME$u##sUsingBlock:
   2224 //%    (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME, BOOL *stop))block;
   2225 
   2226 //%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
   2227 //%- (void)set##VNAME$u##:(VALUE_TYPE)##VNAME forKey:(KEY_TYPE##KisP$S##KisP)key;
   2228 //%DICTIONARY_EXTRA_MUTABLE_METHODS_##VHELPER(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
   2229 //%- (void)remove##VNAME$u##ForKey:(KEY_TYPE##KisP$S##KisP)aKey;
   2230 //%- (void)removeAll;
   2231 
   2232 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_POD(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
   2233 // Empty
   2234 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_OBJECT(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
   2235 // Empty
   2236 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_Enum(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
   2237 //%
   2238 //%// This method bypass the validationFunc to provide setting of values that were not
   2239 //%// known at the time the binary was compiled.
   2240 //%- (void)setRawValue:(VALUE_TYPE)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key;
   2241 //%
   2242 //%// No validation applies to these methods.
   2243 //%
   2244