1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
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
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.
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.
31 #import <Foundation/Foundation.h>
33 #import "GPBRuntimeTypes.h"
35 // Note on naming: for the classes holding numeric values, a more natural
36 // naming of the method might be things like "-valueForKey:",
37 // "-setValue:forKey:"; etc. But those selectors are also defined by Key Value
38 // Coding (KVC) as categories on NSObject. So "overloading" the selectors with
39 // other meanings can cause warnings (based on compiler settings), but more
40 // importantly, some of those selector get called as KVC breaks up keypaths.
41 // So if those selectors are used, using KVC will compile cleanly, but could
42 // crash as it invokes those selectors with the wrong types of arguments.
44 NS_ASSUME_NONNULL_BEGIN
46 //%PDDM-EXPAND DECLARE_DICTIONARIES()
47 // This block of code is generated, do not edit it directly.
49 #pragma mark - UInt32 -> UInt32
52 * Class used for map fields of <uint32_t, uint32_t>
53 * values. This performs better than boxing into NSNumbers in NSDictionaries.
55 * @note This class is not meant to be subclassed.
57 @interface GPBUInt32UInt32Dictionary : NSObject <NSCopying>
59 /** Number of entries stored in this dictionary. */
60 @property(nonatomic, readonly) NSUInteger count;
63 * Initializes this dictionary, copying the given values and keys.
65 * @param values The values to be placed in this dictionary.
66 * @param keys The keys under which to store the values.
67 * @param count The number of elements to copy into the dictionary.
69 * @return A newly initialized dictionary with a copy of the values and keys.
71 - (instancetype)initWithUInt32s:(const uint32_t [__nullable])values
72 forKeys:(const uint32_t [__nullable])keys
73 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
76 * Initializes this dictionary, copying the entries from the given dictionary.
78 * @param dictionary Dictionary containing the entries to add to this dictionary.
80 * @return A newly initialized dictionary with the entries of the given dictionary.
82 - (instancetype)initWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary;
85 * Initializes this dictionary with the requested capacity.
87 * @param numItems Number of items needed for this dictionary.
89 * @return A newly initialized dictionary with the requested capacity.
91 - (instancetype)initWithCapacity:(NSUInteger)numItems;
94 * Gets the value for the given key.
96 * @param value Pointer into which the value will be set, if found.
97 * @param key Key under which the value is stored, if present.
99 * @return YES if the key was found and the value was copied, NO otherwise.
101 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint32_t)key;
104 * Enumerates the keys and values on this dictionary with the given block.
106 * @param block The block to enumerate with.
107 * **key**: The key for the current entry.
108 * **value**: The value for the current entry
109 * **stop**: A pointer to a boolean that when set stops the enumeration.
111 - (void)enumerateKeysAndUInt32sUsingBlock:
112 (void (^)(uint32_t key, uint32_t value, BOOL *stop))block;
115 * Adds the keys and values from another dictionary.
117 * @param otherDictionary Dictionary containing entries to be added to this
120 - (void)addEntriesFromDictionary:(GPBUInt32UInt32Dictionary *)otherDictionary;
123 * Sets the value for the given key.
125 * @param value The value to set.
126 * @param key The key under which to store the value.
128 - (void)setUInt32:(uint32_t)value forKey:(uint32_t)key;
131 * Removes the entry for the given key.
133 * @param aKey Key to be removed from this dictionary.
135 - (void)removeUInt32ForKey:(uint32_t)aKey;
138 * Removes all entries in this dictionary.
144 #pragma mark - UInt32 -> Int32
147 * Class used for map fields of <uint32_t, int32_t>
148 * values. This performs better than boxing into NSNumbers in NSDictionaries.
150 * @note This class is not meant to be subclassed.
152 @interface GPBUInt32Int32Dictionary : NSObject <NSCopying>
154 /** Number of entries stored in this dictionary. */
155 @property(nonatomic, readonly) NSUInteger count;
158 * Initializes this dictionary, copying the given values and keys.
160 * @param values The values to be placed in this dictionary.
161 * @param keys The keys under which to store the values.
162 * @param count The number of elements to copy into the dictionary.
164 * @return A newly initialized dictionary with a copy of the values and keys.
166 - (instancetype)initWithInt32s:(const int32_t [__nullable])values
167 forKeys:(const uint32_t [__nullable])keys
168 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
171 * Initializes this dictionary, copying the entries from the given dictionary.
173 * @param dictionary Dictionary containing the entries to add to this dictionary.
175 * @return A newly initialized dictionary with the entries of the given dictionary.
177 - (instancetype)initWithDictionary:(GPBUInt32Int32Dictionary *)dictionary;
180 * Initializes this dictionary with the requested capacity.
182 * @param numItems Number of items needed for this dictionary.
184 * @return A newly initialized dictionary with the requested capacity.
186 - (instancetype)initWithCapacity:(NSUInteger)numItems;
189 * Gets the value for the given key.
191 * @param value Pointer into which the value will be set, if found.
192 * @param key Key under which the value is stored, if present.
194 * @return YES if the key was found and the value was copied, NO otherwise.
196 - (BOOL)getInt32:(nullable int32_t *)value forKey:(uint32_t)key;
199 * Enumerates the keys and values on this dictionary with the given block.
201 * @param block The block to enumerate with.
202 * **key**: The key for the current entry.
203 * **value**: The value for the current entry
204 * **stop**: A pointer to a boolean that when set stops the enumeration.
206 - (void)enumerateKeysAndInt32sUsingBlock:
207 (void (^)(uint32_t key, int32_t value, BOOL *stop))block;
210 * Adds the keys and values from another dictionary.
212 * @param otherDictionary Dictionary containing entries to be added to this
215 - (void)addEntriesFromDictionary:(GPBUInt32Int32Dictionary *)otherDictionary;
218 * Sets the value for the given key.
220 * @param value The value to set.
221 * @param key The key under which to store the value.
223 - (void)setInt32:(int32_t)value forKey:(uint32_t)key;
226 * Removes the entry for the given key.
228 * @param aKey Key to be removed from this dictionary.
230 - (void)removeInt32ForKey:(uint32_t)aKey;
233 * Removes all entries in this dictionary.
239 #pragma mark - UInt32 -> UInt64
242 * Class used for map fields of <uint32_t, uint64_t>
243 * values. This performs better than boxing into NSNumbers in NSDictionaries.
245 * @note This class is not meant to be subclassed.
247 @interface GPBUInt32UInt64Dictionary : NSObject <NSCopying>
249 /** Number of entries stored in this dictionary. */
250 @property(nonatomic, readonly) NSUInteger count;
253 * Initializes this dictionary, copying the given values and keys.
255 * @param values The values to be placed in this dictionary.
256 * @param keys The keys under which to store the values.
257 * @param count The number of elements to copy into the dictionary.
259 * @return A newly initialized dictionary with a copy of the values and keys.
261 - (instancetype)initWithUInt64s:(const uint64_t [__nullable])values
262 forKeys:(const uint32_t [__nullable])keys
263 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
266 * Initializes this dictionary, copying the entries from the given dictionary.
268 * @param dictionary Dictionary containing the entries to add to this dictionary.
270 * @return A newly initialized dictionary with the entries of the given dictionary.
272 - (instancetype)initWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary;
275 * Initializes this dictionary with the requested capacity.
277 * @param numItems Number of items needed for this dictionary.
279 * @return A newly initialized dictionary with the requested capacity.
281 - (instancetype)initWithCapacity:(NSUInteger)numItems;
284 * Gets the value for the given key.
286 * @param value Pointer into which the value will be set, if found.
287 * @param key Key under which the value is stored, if present.
289 * @return YES if the key was found and the value was copied, NO otherwise.
291 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint32_t)key;
294 * Enumerates the keys and values on this dictionary with the given block.
296 * @param block The block to enumerate with.
297 * **key**: The key for the current entry.
298 * **value**: The value for the current entry
299 * **stop**: A pointer to a boolean that when set stops the enumeration.
301 - (void)enumerateKeysAndUInt64sUsingBlock:
302 (void (^)(uint32_t key, uint64_t value, BOOL *stop))block;
305 * Adds the keys and values from another dictionary.
307 * @param otherDictionary Dictionary containing entries to be added to this
310 - (void)addEntriesFromDictionary:(GPBUInt32UInt64Dictionary *)otherDictionary;
313 * Sets the value for the given key.
315 * @param value The value to set.
316 * @param key The key under which to store the value.
318 - (void)setUInt64:(uint64_t)value forKey:(uint32_t)key;
321 * Removes the entry for the given key.
323 * @param aKey Key to be removed from this dictionary.
325 - (void)removeUInt64ForKey:(uint32_t)aKey;
328 * Removes all entries in this dictionary.
334 #pragma mark - UInt32 -> Int64
337 * Class used for map fields of <uint32_t, int64_t>
338 * values. This performs better than boxing into NSNumbers in NSDictionaries.
340 * @note This class is not meant to be subclassed.
342 @interface GPBUInt32Int64Dictionary : NSObject <NSCopying>
344 /** Number of entries stored in this dictionary. */
345 @property(nonatomic, readonly) NSUInteger count;
348 * Initializes this dictionary, copying the given values and keys.
350 * @param values The values to be placed in this dictionary.
351 * @param keys The keys under which to store the values.
352 * @param count The number of elements to copy into the dictionary.
354 * @return A newly initialized dictionary with a copy of the values and keys.
356 - (instancetype)initWithInt64s:(const int64_t [__nullable])values
357 forKeys:(const uint32_t [__nullable])keys
358 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
361 * Initializes this dictionary, copying the entries from the given dictionary.
363 * @param dictionary Dictionary containing the entries to add to this dictionary.
365 * @return A newly initialized dictionary with the entries of the given dictionary.
367 - (instancetype)initWithDictionary:(GPBUInt32Int64Dictionary *)dictionary;
370 * Initializes this dictionary with the requested capacity.
372 * @param numItems Number of items needed for this dictionary.
374 * @return A newly initialized dictionary with the requested capacity.
376 - (instancetype)initWithCapacity:(NSUInteger)numItems;
379 * Gets the value for the given key.
381 * @param value Pointer into which the value will be set, if found.
382 * @param key Key under which the value is stored, if present.
384 * @return YES if the key was found and the value was copied, NO otherwise.
386 - (BOOL)getInt64:(nullable int64_t *)value forKey:(uint32_t)key;
389 * Enumerates the keys and values on this dictionary with the given block.
391 * @param block The block to enumerate with.
392 * **key**: The key for the current entry.
393 * **value**: The value for the current entry
394 * **stop**: A pointer to a boolean that when set stops the enumeration.
396 - (void)enumerateKeysAndInt64sUsingBlock:
397 (void (^)(uint32_t key, int64_t value, BOOL *stop))block;
400 * Adds the keys and values from another dictionary.
402 * @param otherDictionary Dictionary containing entries to be added to this
405 - (void)addEntriesFromDictionary:(GPBUInt32Int64Dictionary *)otherDictionary;
408 * Sets the value for the given key.
410 * @param value The value to set.
411 * @param key The key under which to store the value.
413 - (void)setInt64:(int64_t)value forKey:(uint32_t)key;
416 * Removes the entry for the given key.
418 * @param aKey Key to be removed from this dictionary.
420 - (void)removeInt64ForKey:(uint32_t)aKey;
423 * Removes all entries in this dictionary.
429 #pragma mark - UInt32 -> Bool
432 * Class used for map fields of <uint32_t, BOOL>
433 * values. This performs better than boxing into NSNumbers in NSDictionaries.
435 * @note This class is not meant to be subclassed.
437 @interface GPBUInt32BoolDictionary : NSObject <NSCopying>
439 /** Number of entries stored in this dictionary. */
440 @property(nonatomic, readonly) NSUInteger count;
443 * Initializes this dictionary, copying the given values and keys.
445 * @param values The values to be placed in this dictionary.
446 * @param keys The keys under which to store the values.
447 * @param count The number of elements to copy into the dictionary.
449 * @return A newly initialized dictionary with a copy of the values and keys.
451 - (instancetype)initWithBools:(const BOOL [__nullable])values
452 forKeys:(const uint32_t [__nullable])keys
453 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
456 * Initializes this dictionary, copying the entries from the given dictionary.
458 * @param dictionary Dictionary containing the entries to add to this dictionary.
460 * @return A newly initialized dictionary with the entries of the given dictionary.
462 - (instancetype)initWithDictionary:(GPBUInt32BoolDictionary *)dictionary;
465 * Initializes this dictionary with the requested capacity.
467 * @param numItems Number of items needed for this dictionary.
469 * @return A newly initialized dictionary with the requested capacity.
471 - (instancetype)initWithCapacity:(NSUInteger)numItems;
474 * Gets the value for the given key.
476 * @param value Pointer into which the value will be set, if found.
477 * @param key Key under which the value is stored, if present.
479 * @return YES if the key was found and the value was copied, NO otherwise.
481 - (BOOL)getBool:(nullable BOOL *)value forKey:(uint32_t)key;
484 * Enumerates the keys and values on this dictionary with the given block.
486 * @param block The block to enumerate with.
487 * **key**: The key for the current entry.
488 * **value**: The value for the current entry
489 * **stop**: A pointer to a boolean that when set stops the enumeration.
491 - (void)enumerateKeysAndBoolsUsingBlock:
492 (void (^)(uint32_t key, BOOL value, BOOL *stop))block;
495 * Adds the keys and values from another dictionary.
497 * @param otherDictionary Dictionary containing entries to be added to this
500 - (void)addEntriesFromDictionary:(GPBUInt32BoolDictionary *)otherDictionary;
503 * Sets the value for the given key.
505 * @param value The value to set.
506 * @param key The key under which to store the value.
508 - (void)setBool:(BOOL)value forKey:(uint32_t)key;
511 * Removes the entry for the given key.
513 * @param aKey Key to be removed from this dictionary.
515 - (void)removeBoolForKey:(uint32_t)aKey;
518 * Removes all entries in this dictionary.
524 #pragma mark - UInt32 -> Float
527 * Class used for map fields of <uint32_t, float>
528 * values. This performs better than boxing into NSNumbers in NSDictionaries.
530 * @note This class is not meant to be subclassed.
532 @interface GPBUInt32FloatDictionary : NSObject <NSCopying>
534 /** Number of entries stored in this dictionary. */
535 @property(nonatomic, readonly) NSUInteger count;
538 * Initializes this dictionary, copying the given values and keys.
540 * @param values The values to be placed in this dictionary.
541 * @param keys The keys under which to store the values.
542 * @param count The number of elements to copy into the dictionary.
544 * @return A newly initialized dictionary with a copy of the values and keys.
546 - (instancetype)initWithFloats:(const float [__nullable])values
547 forKeys:(const uint32_t [__nullable])keys
548 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
551 * Initializes this dictionary, copying the entries from the given dictionary.
553 * @param dictionary Dictionary containing the entries to add to this dictionary.
555 * @return A newly initialized dictionary with the entries of the given dictionary.
557 - (instancetype)initWithDictionary:(GPBUInt32FloatDictionary *)dictionary;
560 * Initializes this dictionary with the requested capacity.
562 * @param numItems Number of items needed for this dictionary.
564 * @return A newly initialized dictionary with the requested capacity.
566 - (instancetype)initWithCapacity:(NSUInteger)numItems;
569 * Gets the value for the given key.
571 * @param value Pointer into which the value will be set, if found.
572 * @param key Key under which the value is stored, if present.
574 * @return YES if the key was found and the value was copied, NO otherwise.
576 - (BOOL)getFloat:(nullable float *)value forKey:(uint32_t)key;
579 * Enumerates the keys and values on this dictionary with the given block.
581 * @param block The block to enumerate with.
582 * **key**: The key for the current entry.
583 * **value**: The value for the current entry
584 * **stop**: A pointer to a boolean that when set stops the enumeration.
586 - (void)enumerateKeysAndFloatsUsingBlock:
587 (void (^)(uint32_t key, float value, BOOL *stop))block;
590 * Adds the keys and values from another dictionary.
592 * @param otherDictionary Dictionary containing entries to be added to this
595 - (void)addEntriesFromDictionary:(GPBUInt32FloatDictionary *)otherDictionary;
598 * Sets the value for the given key.
600 * @param value The value to set.
601 * @param key The key under which to store the value.
603 - (void)setFloat:(float)value forKey:(uint32_t)key;
606 * Removes the entry for the given key.
608 * @param aKey Key to be removed from this dictionary.
610 - (void)removeFloatForKey:(uint32_t)aKey;
613 * Removes all entries in this dictionary.
619 #pragma mark - UInt32 -> Double
622 * Class used for map fields of <uint32_t, double>
623 * values. This performs better than boxing into NSNumbers in NSDictionaries.
625 * @note This class is not meant to be subclassed.
627 @interface GPBUInt32DoubleDictionary : NSObject <NSCopying>
629 /** Number of entries stored in this dictionary. */
630 @property(nonatomic, readonly) NSUInteger count;
633 * Initializes this dictionary, copying the given values and keys.
635 * @param values The values to be placed in this dictionary.
636 * @param keys The keys under which to store the values.
637 * @param count The number of elements to copy into the dictionary.
639 * @return A newly initialized dictionary with a copy of the values and keys.
641 - (instancetype)initWithDoubles:(const double [__nullable])values
642 forKeys:(const uint32_t [__nullable])keys
643 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
646 * Initializes this dictionary, copying the entries from the given dictionary.
648 * @param dictionary Dictionary containing the entries to add to this dictionary.
650 * @return A newly initialized dictionary with the entries of the given dictionary.
652 - (instancetype)initWithDictionary:(GPBUInt32DoubleDictionary *)dictionary;
655 * Initializes this dictionary with the requested capacity.
657 * @param numItems Number of items needed for this dictionary.
659 * @return A newly initialized dictionary with the requested capacity.
661 - (instancetype)initWithCapacity:(NSUInteger)numItems;
664 * Gets the value for the given key.
666 * @param value Pointer into which the value will be set, if found.
667 * @param key Key under which the value is stored, if present.
669 * @return YES if the key was found and the value was copied, NO otherwise.
671 - (BOOL)getDouble:(nullable double *)value forKey:(uint32_t)key;
674 * Enumerates the keys and values on this dictionary with the given block.
676 * @param block The block to enumerate with.
677 * **key**: The key for the current entry.
678 * **value**: The value for the current entry
679 * **stop**: A pointer to a boolean that when set stops the enumeration.
681 - (void)enumerateKeysAndDoublesUsingBlock:
682 (void (^)(uint32_t key, double value, BOOL *stop))block;
685 * Adds the keys and values from another dictionary.
687 * @param otherDictionary Dictionary containing entries to be added to this
690 - (void)addEntriesFromDictionary:(GPBUInt32DoubleDictionary *)otherDictionary;
693 * Sets the value for the given key.
695 * @param value The value to set.
696 * @param key The key under which to store the value.
698 - (void)setDouble:(double)value forKey:(uint32_t)key;
701 * Removes the entry for the given key.
703 * @param aKey Key to be removed from this dictionary.
705 - (void)removeDoubleForKey:(uint32_t)aKey;
708 * Removes all entries in this dictionary.
714 #pragma mark - UInt32 -> Enum
717 * Class used for map fields of <uint32_t, int32_t>
718 * values. This performs better than boxing into NSNumbers in NSDictionaries.
720 * @note This class is not meant to be subclassed.
722 @interface GPBUInt32EnumDictionary : NSObject <NSCopying>
724 /** Number of entries stored in this dictionary. */
725 @property(nonatomic, readonly) NSUInteger count;
726 /** The validation function to check if the enums are valid. */
727 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
730 * Initializes a dictionary with the given validation function.
732 * @param func The enum validation function for the dictionary.
734 * @return A newly initialized dictionary.
736 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
739 * Initializes a dictionary with the entries given.
741 * @param func The enum validation function for the dictionary.
742 * @param values The raw enum values values to be placed in the dictionary.
743 * @param keys The keys under which to store the values.
744 * @param count The number of entries to store in the dictionary.
746 * @return A newly initialized dictionary with the keys and values in it.
748 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
749 rawValues:(const int32_t [__nullable])values
750 forKeys:(const uint32_t [__nullable])keys
751 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
754 * Initializes a dictionary with the entries from the given.
757 * @param dictionary Dictionary containing the entries to add to the dictionary.
759 * @return A newly initialized dictionary with the entries from the given
762 - (instancetype)initWithDictionary:(GPBUInt32EnumDictionary *)dictionary;
765 * Initializes a dictionary with the given capacity.
767 * @param func The enum validation function for the dictionary.
768 * @param numItems Capacity needed for the dictionary.
770 * @return A newly initialized dictionary with the given capacity.
772 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
773 capacity:(NSUInteger)numItems;
775 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
776 // is not a valid enumerator as defined by validationFunc. If the actual value is
777 // desired, use "raw" version of the method.
780 * Gets the value for the given key.
782 * @param value Pointer into which the value will be set, if found.
783 * @param key Key under which the value is stored, if present.
785 * @return YES if the key was found and the value was copied, NO otherwise.
787 - (BOOL)getEnum:(nullable int32_t *)value forKey:(uint32_t)key;
790 * Enumerates the keys and values on this dictionary with the given block.
792 * @param block The block to enumerate with.
793 * **key**: The key for the current entry.
794 * **value**: The value for the current entry
795 * **stop**: A pointer to a boolean that when set stops the enumeration.
797 - (void)enumerateKeysAndEnumsUsingBlock:
798 (void (^)(uint32_t key, int32_t value, BOOL *stop))block;
801 * Gets the raw enum value for the given key.
803 * @note This method bypass the validationFunc to enable the access of values that
804 * were not known at the time the binary was compiled.
806 * @param rawValue Pointer into which the value will be set, if found.
807 * @param key Key under which the value is stored, if present.
809 * @return YES if the key was found and the value was copied, NO otherwise.
811 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint32_t)key;
814 * Enumerates the keys and values on this dictionary with the given block.
816 * @note This method bypass the validationFunc to enable the access of values that
817 * were not known at the time the binary was compiled.
819 * @param block The block to enumerate with.
820 * **key**: The key for the current entry.
821 * **rawValue**: The value for the current entry
822 * **stop**: A pointer to a boolean that when set stops the enumeration.
824 - (void)enumerateKeysAndRawValuesUsingBlock:
825 (void (^)(uint32_t key, int32_t rawValue, BOOL *stop))block;
828 * Adds the keys and raw enum values from another dictionary.
830 * @note This method bypass the validationFunc to enable the setting of values that
831 * were not known at the time the binary was compiled.
833 * @param otherDictionary Dictionary containing entries to be added to this
836 - (void)addRawEntriesFromDictionary:(GPBUInt32EnumDictionary *)otherDictionary;
838 // If value is not a valid enumerator as defined by validationFunc, these
839 // methods will assert in debug, and will log in release and assign the value
840 // to the default value. Use the rawValue methods below to assign non enumerator
844 * Sets the value for the given key.
846 * @param value The value to set.
847 * @param key The key under which to store the value.
849 - (void)setEnum:(int32_t)value forKey:(uint32_t)key;
852 * Sets the raw enum value for the given key.
854 * @note This method bypass the validationFunc to enable the setting of values that
855 * were not known at the time the binary was compiled.
857 * @param rawValue The raw enum value to set.
858 * @param key The key under which to store the raw enum value.
860 - (void)setRawValue:(int32_t)rawValue forKey:(uint32_t)key;
863 * Removes the entry for the given key.
865 * @param aKey Key to be removed from this dictionary.
867 - (void)removeEnumForKey:(uint32_t)aKey;
870 * Removes all entries in this dictionary.
876 #pragma mark - UInt32 -> Object
879 * Class used for map fields of <uint32_t, ObjectType>
880 * values. This performs better than boxing into NSNumbers in NSDictionaries.
882 * @note This class is not meant to be subclassed.
884 @interface GPBUInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
886 /** Number of entries stored in this dictionary. */
887 @property(nonatomic, readonly) NSUInteger count;
890 * Initializes this dictionary, copying the given values and keys.
892 * @param objects The values to be placed in this dictionary.
893 * @param keys The keys under which to store the values.
894 * @param count The number of elements to copy into the dictionary.
896 * @return A newly initialized dictionary with a copy of the values and keys.
898 - (instancetype)initWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects
899 forKeys:(const uint32_t [__nullable])keys
900 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
903 * Initializes this dictionary, copying the entries from the given dictionary.
905 * @param dictionary Dictionary containing the entries to add to this dictionary.
907 * @return A newly initialized dictionary with the entries of the given dictionary.
909 - (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary;
912 * Initializes this dictionary with the requested capacity.
914 * @param numItems Number of items needed for this dictionary.
916 * @return A newly initialized dictionary with the requested capacity.
918 - (instancetype)initWithCapacity:(NSUInteger)numItems;
921 * Fetches the object stored under the given key.
923 * @param key Key under which the value is stored, if present.
925 * @return The object if found, nil otherwise.
927 - (ObjectType)objectForKey:(uint32_t)key;
930 * Enumerates the keys and values on this dictionary with the given block.
932 * @param block The block to enumerate with.
933 * **key**: The key for the current entry.
934 * **object**: The value for the current entry
935 * **stop**: A pointer to a boolean that when set stops the enumeration.
937 - (void)enumerateKeysAndObjectsUsingBlock:
938 (void (^)(uint32_t key, ObjectType object, BOOL *stop))block;
941 * Adds the keys and values from another dictionary.
943 * @param otherDictionary Dictionary containing entries to be added to this
946 - (void)addEntriesFromDictionary:(GPBUInt32ObjectDictionary *)otherDictionary;
949 * Sets the value for the given key.
951 * @param object The value to set.
952 * @param key The key under which to store the value.
954 - (void)setObject:(ObjectType)object forKey:(uint32_t)key;
957 * Removes the entry for the given key.
959 * @param aKey Key to be removed from this dictionary.
961 - (void)removeObjectForKey:(uint32_t)aKey;
964 * Removes all entries in this dictionary.
970 #pragma mark - Int32 -> UInt32
973 * Class used for map fields of <int32_t, uint32_t>
974 * values. This performs better than boxing into NSNumbers in NSDictionaries.
976 * @note This class is not meant to be subclassed.
978 @interface GPBInt32UInt32Dictionary : NSObject <NSCopying>
980 /** Number of entries stored in this dictionary. */
981 @property(nonatomic, readonly) NSUInteger count;
984 * Initializes this dictionary, copying the given values and keys.
986 * @param values The values to be placed in this dictionary.
987 * @param keys The keys under which to store the values.
988 * @param count The number of elements to copy into the dictionary.
990 * @return A newly initialized dictionary with a copy of the values and keys.
992 - (instancetype)initWithUInt32s:(const uint32_t [__nullable])values
993 forKeys:(const int32_t [__nullable])keys
994 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
997 * Initializes this dictionary, copying the entries from the given dictionary.
999 * @param dictionary Dictionary containing the entries to add to this dictionary.
1001 * @return A newly initialized dictionary with the entries of the given dictionary.
1003 - (instancetype)initWithDictionary:(GPBInt32UInt32Dictionary *)dictionary;
1006 * Initializes this dictionary with the requested capacity.
1008 * @param numItems Number of items needed for this dictionary.
1010 * @return A newly initialized dictionary with the requested capacity.
1012 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1015 * Gets the value for the given key.
1017 * @param value Pointer into which the value will be set, if found.
1018 * @param key Key under which the value is stored, if present.
1020 * @return YES if the key was found and the value was copied, NO otherwise.
1022 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int32_t)key;
1025 * Enumerates the keys and values on this dictionary with the given block.
1027 * @param block The block to enumerate with.
1028 * **key**: The key for the current entry.
1029 * **value**: The value for the current entry
1030 * **stop**: A pointer to a boolean that when set stops the enumeration.
1032 - (void)enumerateKeysAndUInt32sUsingBlock:
1033 (void (^)(int32_t key, uint32_t value, BOOL *stop))block;
1036 * Adds the keys and values from another dictionary.
1038 * @param otherDictionary Dictionary containing entries to be added to this
1041 - (void)addEntriesFromDictionary:(GPBInt32UInt32Dictionary *)otherDictionary;
1044 * Sets the value for the given key.
1046 * @param value The value to set.
1047 * @param key The key under which to store the value.
1049 - (void)setUInt32:(uint32_t)value forKey:(int32_t)key;
1052 * Removes the entry for the given key.
1054 * @param aKey Key to be removed from this dictionary.
1056 - (void)removeUInt32ForKey:(int32_t)aKey;
1059 * Removes all entries in this dictionary.
1065 #pragma mark - Int32 -> Int32
1068 * Class used for map fields of <int32_t, int32_t>
1069 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1071 * @note This class is not meant to be subclassed.
1073 @interface GPBInt32Int32Dictionary : NSObject <NSCopying>
1075 /** Number of entries stored in this dictionary. */
1076 @property(nonatomic, readonly) NSUInteger count;
1079 * Initializes this dictionary, copying the given values and keys.
1081 * @param values The values to be placed in this dictionary.
1082 * @param keys The keys under which to store the values.
1083 * @param count The number of elements to copy into the dictionary.
1085 * @return A newly initialized dictionary with a copy of the values and keys.
1087 - (instancetype)initWithInt32s:(const int32_t [__nullable])values
1088 forKeys:(const int32_t [__nullable])keys
1089 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1092 * Initializes this dictionary, copying the entries from the given dictionary.
1094 * @param dictionary Dictionary containing the entries to add to this dictionary.
1096 * @return A newly initialized dictionary with the entries of the given dictionary.
1098 - (instancetype)initWithDictionary:(GPBInt32Int32Dictionary *)dictionary;
1101 * Initializes this dictionary with the requested capacity.
1103 * @param numItems Number of items needed for this dictionary.
1105 * @return A newly initialized dictionary with the requested capacity.
1107 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1110 * Gets the value for the given key.
1112 * @param value Pointer into which the value will be set, if found.
1113 * @param key Key under which the value is stored, if present.
1115 * @return YES if the key was found and the value was copied, NO otherwise.
1117 - (BOOL)getInt32:(nullable int32_t *)value forKey:(int32_t)key;
1120 * Enumerates the keys and values on this dictionary with the given block.
1122 * @param block The block to enumerate with.
1123 * **key**: The key for the current entry.
1124 * **value**: The value for the current entry
1125 * **stop**: A pointer to a boolean that when set stops the enumeration.
1127 - (void)enumerateKeysAndInt32sUsingBlock:
1128 (void (^)(int32_t key, int32_t value, BOOL *stop))block;
1131 * Adds the keys and values from another dictionary.
1133 * @param otherDictionary Dictionary containing entries to be added to this
1136 - (void)addEntriesFromDictionary:(GPBInt32Int32Dictionary *)otherDictionary;
1139 * Sets the value for the given key.
1141 * @param value The value to set.
1142 * @param key The key under which to store the value.
1144 - (void)setInt32:(int32_t)value forKey:(int32_t)key;
1147 * Removes the entry for the given key.
1149 * @param aKey Key to be removed from this dictionary.
1151 - (void)removeInt32ForKey:(int32_t)aKey;
1154 * Removes all entries in this dictionary.
1160 #pragma mark - Int32 -> UInt64
1163 * Class used for map fields of <int32_t, uint64_t>
1164 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1166 * @note This class is not meant to be subclassed.
1168 @interface GPBInt32UInt64Dictionary : NSObject <NSCopying>
1170 /** Number of entries stored in this dictionary. */
1171 @property(nonatomic, readonly) NSUInteger count;
1174 * Initializes this dictionary, copying the given values and keys.
1176 * @param values The values to be placed in this dictionary.
1177 * @param keys The keys under which to store the values.
1178 * @param count The number of elements to copy into the dictionary.
1180 * @return A newly initialized dictionary with a copy of the values and keys.
1182 - (instancetype)initWithUInt64s:(const uint64_t [__nullable])values
1183 forKeys:(const int32_t [__nullable])keys
1184 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1187 * Initializes this dictionary, copying the entries from the given dictionary.
1189 * @param dictionary Dictionary containing the entries to add to this dictionary.
1191 * @return A newly initialized dictionary with the entries of the given dictionary.
1193 - (instancetype)initWithDictionary:(GPBInt32UInt64Dictionary *)dictionary;
1196 * Initializes this dictionary with the requested capacity.
1198 * @param numItems Number of items needed for this dictionary.
1200 * @return A newly initialized dictionary with the requested capacity.
1202 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1205 * Gets the value for the given key.
1207 * @param value Pointer into which the value will be set, if found.
1208 * @param key Key under which the value is stored, if present.
1210 * @return YES if the key was found and the value was copied, NO otherwise.
1212 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int32_t)key;
1215 * Enumerates the keys and values on this dictionary with the given block.
1217 * @param block The block to enumerate with.
1218 * **key**: The key for the current entry.
1219 * **value**: The value for the current entry
1220 * **stop**: A pointer to a boolean that when set stops the enumeration.
1222 - (void)enumerateKeysAndUInt64sUsingBlock:
1223 (void (^)(int32_t key, uint64_t value, BOOL *stop))block;
1226 * Adds the keys and values from another dictionary.
1228 * @param otherDictionary Dictionary containing entries to be added to this
1231 - (void)addEntriesFromDictionary:(GPBInt32UInt64Dictionary *)otherDictionary;
1234 * Sets the value for the given key.
1236 * @param value The value to set.
1237 * @param key The key under which to store the value.
1239 - (void)setUInt64:(uint64_t)value forKey:(int32_t)key;
1242 * Removes the entry for the given key.
1244 * @param aKey Key to be removed from this dictionary.
1246 - (void)removeUInt64ForKey:(int32_t)aKey;
1249 * Removes all entries in this dictionary.
1255 #pragma mark - Int32 -> Int64
1258 * Class used for map fields of <int32_t, int64_t>
1259 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1261 * @note This class is not meant to be subclassed.
1263 @interface GPBInt32Int64Dictionary : NSObject <NSCopying>
1265 /** Number of entries stored in this dictionary. */
1266 @property(nonatomic, readonly) NSUInteger count;
1269 * Initializes this dictionary, copying the given values and keys.
1271 * @param values The values to be placed in this dictionary.
1272 * @param keys The keys under which to store the values.
1273 * @param count The number of elements to copy into the dictionary.
1275 * @return A newly initialized dictionary with a copy of the values and keys.
1277 - (instancetype)initWithInt64s:(const int64_t [__nullable])values
1278 forKeys:(const int32_t [__nullable])keys
1279 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1282 * Initializes this dictionary, copying the entries from the given dictionary.
1284 * @param dictionary Dictionary containing the entries to add to this dictionary.
1286 * @return A newly initialized dictionary with the entries of the given dictionary.
1288 - (instancetype)initWithDictionary:(GPBInt32Int64Dictionary *)dictionary;
1291 * Initializes this dictionary with the requested capacity.
1293 * @param numItems Number of items needed for this dictionary.
1295 * @return A newly initialized dictionary with the requested capacity.
1297 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1300 * Gets the value for the given key.
1302 * @param value Pointer into which the value will be set, if found.
1303 * @param key Key under which the value is stored, if present.
1305 * @return YES if the key was found and the value was copied, NO otherwise.
1307 - (BOOL)getInt64:(nullable int64_t *)value forKey:(int32_t)key;
1310 * Enumerates the keys and values on this dictionary with the given block.
1312 * @param block The block to enumerate with.
1313 * **key**: The key for the current entry.
1314 * **value**: The value for the current entry
1315 * **stop**: A pointer to a boolean that when set stops the enumeration.
1317 - (void)enumerateKeysAndInt64sUsingBlock:
1318 (void (^)(int32_t key, int64_t value, BOOL *stop))block;
1321 * Adds the keys and values from another dictionary.
1323 * @param otherDictionary Dictionary containing entries to be added to this
1326 - (void)addEntriesFromDictionary:(GPBInt32Int64Dictionary *)otherDictionary;
1329 * Sets the value for the given key.
1331 * @param value The value to set.
1332 * @param key The key under which to store the value.
1334 - (void)setInt64:(int64_t)value forKey:(int32_t)key;
1337 * Removes the entry for the given key.
1339 * @param aKey Key to be removed from this dictionary.
1341 - (void)removeInt64ForKey:(int32_t)aKey;
1344 * Removes all entries in this dictionary.
1350 #pragma mark - Int32 -> Bool
1353 * Class used for map fields of <int32_t, BOOL>
1354 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1356 * @note This class is not meant to be subclassed.
1358 @interface GPBInt32BoolDictionary : NSObject <NSCopying>
1360 /** Number of entries stored in this dictionary. */
1361 @property(nonatomic, readonly) NSUInteger count;
1364 * Initializes this dictionary, copying the given values and keys.
1366 * @param values The values to be placed in this dictionary.
1367 * @param keys The keys under which to store the values.
1368 * @param count The number of elements to copy into the dictionary.
1370 * @return A newly initialized dictionary with a copy of the values and keys.
1372 - (instancetype)initWithBools:(const BOOL [__nullable])values
1373 forKeys:(const int32_t [__nullable])keys
1374 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1377 * Initializes this dictionary, copying the entries from the given dictionary.
1379 * @param dictionary Dictionary containing the entries to add to this dictionary.
1381 * @return A newly initialized dictionary with the entries of the given dictionary.
1383 - (instancetype)initWithDictionary:(GPBInt32BoolDictionary *)dictionary;
1386 * Initializes this dictionary with the requested capacity.
1388 * @param numItems Number of items needed for this dictionary.
1390 * @return A newly initialized dictionary with the requested capacity.
1392 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1395 * Gets the value for the given key.
1397 * @param value Pointer into which the value will be set, if found.
1398 * @param key Key under which the value is stored, if present.
1400 * @return YES if the key was found and the value was copied, NO otherwise.
1402 - (BOOL)getBool:(nullable BOOL *)value forKey:(int32_t)key;
1405 * Enumerates the keys and values on this dictionary with the given block.
1407 * @param block The block to enumerate with.
1408 * **key**: The key for the current entry.
1409 * **value**: The value for the current entry
1410 * **stop**: A pointer to a boolean that when set stops the enumeration.
1412 - (void)enumerateKeysAndBoolsUsingBlock:
1413 (void (^)(int32_t key, BOOL value, BOOL *stop))block;
1416 * Adds the keys and values from another dictionary.
1418 * @param otherDictionary Dictionary containing entries to be added to this
1421 - (void)addEntriesFromDictionary:(GPBInt32BoolDictionary *)otherDictionary;
1424 * Sets the value for the given key.
1426 * @param value The value to set.
1427 * @param key The key under which to store the value.
1429 - (void)setBool:(BOOL)value forKey:(int32_t)key;
1432 * Removes the entry for the given key.
1434 * @param aKey Key to be removed from this dictionary.
1436 - (void)removeBoolForKey:(int32_t)aKey;
1439 * Removes all entries in this dictionary.
1445 #pragma mark - Int32 -> Float
1448 * Class used for map fields of <int32_t, float>
1449 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1451 * @note This class is not meant to be subclassed.
1453 @interface GPBInt32FloatDictionary : NSObject <NSCopying>
1455 /** Number of entries stored in this dictionary. */
1456 @property(nonatomic, readonly) NSUInteger count;
1459 * Initializes this dictionary, copying the given values and keys.
1461 * @param values The values to be placed in this dictionary.
1462 * @param keys The keys under which to store the values.
1463 * @param count The number of elements to copy into the dictionary.
1465 * @return A newly initialized dictionary with a copy of the values and keys.
1467 - (instancetype)initWithFloats:(const float [__nullable])values
1468 forKeys:(const int32_t [__nullable])keys
1469 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1472 * Initializes this dictionary, copying the entries from the given dictionary.
1474 * @param dictionary Dictionary containing the entries to add to this dictionary.
1476 * @return A newly initialized dictionary with the entries of the given dictionary.
1478 - (instancetype)initWithDictionary:(GPBInt32FloatDictionary *)dictionary;
1481 * Initializes this dictionary with the requested capacity.
1483 * @param numItems Number of items needed for this dictionary.
1485 * @return A newly initialized dictionary with the requested capacity.
1487 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1490 * Gets the value for the given key.
1492 * @param value Pointer into which the value will be set, if found.
1493 * @param key Key under which the value is stored, if present.
1495 * @return YES if the key was found and the value was copied, NO otherwise.
1497 - (BOOL)getFloat:(nullable float *)value forKey:(int32_t)key;
1500 * Enumerates the keys and values on this dictionary with the given block.
1502 * @param block The block to enumerate with.
1503 * **key**: The key for the current entry.
1504 * **value**: The value for the current entry
1505 * **stop**: A pointer to a boolean that when set stops the enumeration.
1507 - (void)enumerateKeysAndFloatsUsingBlock:
1508 (void (^)(int32_t key, float value, BOOL *stop))block;
1511 * Adds the keys and values from another dictionary.
1513 * @param otherDictionary Dictionary containing entries to be added to this
1516 - (void)addEntriesFromDictionary:(GPBInt32FloatDictionary *)otherDictionary;
1519 * Sets the value for the given key.
1521 * @param value The value to set.
1522 * @param key The key under which to store the value.
1524 - (void)setFloat:(float)value forKey:(int32_t)key;
1527 * Removes the entry for the given key.
1529 * @param aKey Key to be removed from this dictionary.
1531 - (void)removeFloatForKey:(int32_t)aKey;
1534 * Removes all entries in this dictionary.
1540 #pragma mark - Int32 -> Double
1543 * Class used for map fields of <int32_t, double>
1544 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1546 * @note This class is not meant to be subclassed.
1548 @interface GPBInt32DoubleDictionary : NSObject <NSCopying>
1550 /** Number of entries stored in this dictionary. */
1551 @property(nonatomic, readonly) NSUInteger count;
1554 * Initializes this dictionary, copying the given values and keys.
1556 * @param values The values to be placed in this dictionary.
1557 * @param keys The keys under which to store the values.
1558 * @param count The number of elements to copy into the dictionary.
1560 * @return A newly initialized dictionary with a copy of the values and keys.
1562 - (instancetype)initWithDoubles:(const double [__nullable])values
1563 forKeys:(const int32_t [__nullable])keys
1564 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1567 * Initializes this dictionary, copying the entries from the given dictionary.
1569 * @param dictionary Dictionary containing the entries to add to this dictionary.
1571 * @return A newly initialized dictionary with the entries of the given dictionary.
1573 - (instancetype)initWithDictionary:(GPBInt32DoubleDictionary *)dictionary;
1576 * Initializes this dictionary with the requested capacity.
1578 * @param numItems Number of items needed for this dictionary.
1580 * @return A newly initialized dictionary with the requested capacity.
1582 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1585 * Gets the value for the given key.
1587 * @param value Pointer into which the value will be set, if found.
1588 * @param key Key under which the value is stored, if present.
1590 * @return YES if the key was found and the value was copied, NO otherwise.
1592 - (BOOL)getDouble:(nullable double *)value forKey:(int32_t)key;
1595 * Enumerates the keys and values on this dictionary with the given block.
1597 * @param block The block to enumerate with.
1598 * **key**: The key for the current entry.
1599 * **value**: The value for the current entry
1600 * **stop**: A pointer to a boolean that when set stops the enumeration.
1602 - (void)enumerateKeysAndDoublesUsingBlock:
1603 (void (^)(int32_t key, double value, BOOL *stop))block;
1606 * Adds the keys and values from another dictionary.
1608 * @param otherDictionary Dictionary containing entries to be added to this
1611 - (void)addEntriesFromDictionary:(GPBInt32DoubleDictionary *)otherDictionary;
1614 * Sets the value for the given key.
1616 * @param value The value to set.
1617 * @param key The key under which to store the value.
1619 - (void)setDouble:(double)value forKey:(int32_t)key;
1622 * Removes the entry for the given key.
1624 * @param aKey Key to be removed from this dictionary.
1626 - (void)removeDoubleForKey:(int32_t)aKey;
1629 * Removes all entries in this dictionary.
1635 #pragma mark - Int32 -> Enum
1638 * Class used for map fields of <int32_t, int32_t>
1639 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1641 * @note This class is not meant to be subclassed.
1643 @interface GPBInt32EnumDictionary : NSObject <NSCopying>
1645 /** Number of entries stored in this dictionary. */
1646 @property(nonatomic, readonly) NSUInteger count;
1647 /** The validation function to check if the enums are valid. */
1648 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
1651 * Initializes a dictionary with the given validation function.
1653 * @param func The enum validation function for the dictionary.
1655 * @return A newly initialized dictionary.
1657 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
1660 * Initializes a dictionary with the entries given.
1662 * @param func The enum validation function for the dictionary.
1663 * @param values The raw enum values values to be placed in the dictionary.
1664 * @param keys The keys under which to store the values.
1665 * @param count The number of entries to store in the dictionary.
1667 * @return A newly initialized dictionary with the keys and values in it.
1669 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1670 rawValues:(const int32_t [__nullable])values
1671 forKeys:(const int32_t [__nullable])keys
1672 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1675 * Initializes a dictionary with the entries from the given.
1678 * @param dictionary Dictionary containing the entries to add to the dictionary.
1680 * @return A newly initialized dictionary with the entries from the given
1683 - (instancetype)initWithDictionary:(GPBInt32EnumDictionary *)dictionary;
1686 * Initializes a dictionary with the given capacity.
1688 * @param func The enum validation function for the dictionary.
1689 * @param numItems Capacity needed for the dictionary.
1691 * @return A newly initialized dictionary with the given capacity.
1693 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1694 capacity:(NSUInteger)numItems;
1696 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
1697 // is not a valid enumerator as defined by validationFunc. If the actual value is
1698 // desired, use "raw" version of the method.
1701 * Gets the value for the given key.
1703 * @param value Pointer into which the value will be set, if found.
1704 * @param key Key under which the value is stored, if present.
1706 * @return YES if the key was found and the value was copied, NO otherwise.
1708 - (BOOL)getEnum:(nullable int32_t *)value forKey:(int32_t)key;
1711 * Enumerates the keys and values on this dictionary with the given block.
1713 * @param block The block to enumerate with.
1714 * **key**: The key for the current entry.
1715 * **value**: The value for the current entry
1716 * **stop**: A pointer to a boolean that when set stops the enumeration.
1718 - (void)enumerateKeysAndEnumsUsingBlock:
1719 (void (^)(int32_t key, int32_t value, BOOL *stop))block;
1722 * Gets the raw enum value for the given key.
1724 * @note This method bypass the validationFunc to enable the access of values that
1725 * were not known at the time the binary was compiled.
1727 * @param rawValue Pointer into which the value will be set, if found.
1728 * @param key Key under which the value is stored, if present.
1730 * @return YES if the key was found and the value was copied, NO otherwise.
1732 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int32_t)key;
1735 * Enumerates the keys and values on this dictionary with the given block.
1737 * @note This method bypass the validationFunc to enable the access of values that
1738 * were not known at the time the binary was compiled.
1740 * @param block The block to enumerate with.
1741 * **key**: The key for the current entry.
1742 * **rawValue**: The value for the current entry
1743 * **stop**: A pointer to a boolean that when set stops the enumeration.
1745 - (void)enumerateKeysAndRawValuesUsingBlock:
1746 (void (^)(int32_t key, int32_t rawValue, BOOL *stop))block;
1749 * Adds the keys and raw enum values from another dictionary.
1751 * @note This method bypass the validationFunc to enable the setting of values that
1752 * were not known at the time the binary was compiled.
1754 * @param otherDictionary Dictionary containing entries to be added to this
1757 - (void)addRawEntriesFromDictionary:(GPBInt32EnumDictionary *)otherDictionary;
1759 // If value is not a valid enumerator as defined by validationFunc, these
1760 // methods will assert in debug, and will log in release and assign the value
1761 // to the default value. Use the rawValue methods below to assign non enumerator
1765 * Sets the value for the given key.
1767 * @param value The value to set.
1768 * @param key The key under which to store the value.
1770 - (void)setEnum:(int32_t)value forKey:(int32_t)key;
1773 * Sets the raw enum value for the given key.
1775 * @note This method bypass the validationFunc to enable the setting of values that
1776 * were not known at the time the binary was compiled.
1778 * @param rawValue The raw enum value to set.
1779 * @param key The key under which to store the raw enum value.
1781 - (void)setRawValue:(int32_t)rawValue forKey:(int32_t)key;
1784 * Removes the entry for the given key.
1786 * @param aKey Key to be removed from this dictionary.
1788 - (void)removeEnumForKey:(int32_t)aKey;
1791 * Removes all entries in this dictionary.
1797 #pragma mark - Int32 -> Object
1800 * Class used for map fields of <int32_t, ObjectType>
1801 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1803 * @note This class is not meant to be subclassed.
1805 @interface GPBInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
1807 /** Number of entries stored in this dictionary. */
1808 @property(nonatomic, readonly) NSUInteger count;
1811 * Initializes this dictionary, copying the given values and keys.
1813 * @param objects The values to be placed in this dictionary.
1814 * @param keys The keys under which to store the values.
1815 * @param count The number of elements to copy into the dictionary.
1817 * @return A newly initialized dictionary with a copy of the values and keys.
1819 - (instancetype)initWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects
1820 forKeys:(const int32_t [__nullable])keys
1821 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1824 * Initializes this dictionary, copying the entries from the given dictionary.
1826 * @param dictionary Dictionary containing the entries to add to this dictionary.
1828 * @return A newly initialized dictionary with the entries of the given dictionary.
1830 - (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
1833 * Initializes this dictionary with the requested capacity.
1835 * @param numItems Number of items needed for this dictionary.
1837 * @return A newly initialized dictionary with the requested capacity.
1839 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1842 * Fetches the object stored under the given key.
1844 * @param key Key under which the value is stored, if present.
1846 * @return The object if found, nil otherwise.
1848 - (ObjectType)objectForKey:(int32_t)key;
1851 * Enumerates the keys and values on this dictionary with the given block.
1853 * @param block The block to enumerate with.
1854 * **key**: The key for the current entry.
1855 * **object**: The value for the current entry
1856 * **stop**: A pointer to a boolean that when set stops the enumeration.
1858 - (void)enumerateKeysAndObjectsUsingBlock:
1859 (void (^)(int32_t key, ObjectType object, BOOL *stop))block;
1862 * Adds the keys and values from another dictionary.
1864 * @param otherDictionary Dictionary containing entries to be added to this
1867 - (void)addEntriesFromDictionary:(GPBInt32ObjectDictionary *)otherDictionary;
1870 * Sets the value for the given key.
1872 * @param object The value to set.
1873 * @param key The key under which to store the value.
1875 - (void)setObject:(ObjectType)object forKey:(int32_t)key;
1878 * Removes the entry for the given key.
1880 * @param aKey Key to be removed from this dictionary.
1882 - (void)removeObjectForKey:(int32_t)aKey;
1885 * Removes all entries in this dictionary.
1891 #pragma mark - UInt64 -> UInt32
1894 * Class used for map fields of <uint64_t, uint32_t>
1895 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1897 * @note This class is not meant to be subclassed.
1899 @interface GPBUInt64UInt32Dictionary : NSObject <NSCopying>
1901 /** Number of entries stored in this dictionary. */
1902 @property(nonatomic, readonly) NSUInteger count;
1905 * Initializes this dictionary, copying the given values and keys.
1907 * @param values The values to be placed in this dictionary.
1908 * @param keys The keys under which to store the values.
1909 * @param count The number of elements to copy into the dictionary.
1911 * @return A newly initialized dictionary with a copy of the values and keys.
1913 - (instancetype)initWithUInt32s:(const uint32_t [__nullable])values
1914 forKeys:(const uint64_t [__nullable])keys
1915 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1918 * Initializes this dictionary, copying the entries from the given dictionary.
1920 * @param dictionary Dictionary containing the entries to add to this dictionary.
1922 * @return A newly initialized dictionary with the entries of the given dictionary.
1924 - (instancetype)initWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary;
1927 * Initializes this dictionary with the requested capacity.
1929 * @param numItems Number of items needed for this dictionary.
1931 * @return A newly initialized dictionary with the requested capacity.
1933 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1936 * Gets the value for the given key.
1938 * @param value Pointer into which the value will be set, if found.
1939 * @param key Key under which the value is stored, if present.
1941 * @return YES if the key was found and the value was copied, NO otherwise.
1943 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint64_t)key;
1946 * Enumerates the keys and values on this dictionary with the given block.
1948 * @param block The block to enumerate with.
1949 * **key**: The key for the current entry.
1950 * **value**: The value for the current entry
1951 * **stop**: A pointer to a boolean that when set stops the enumeration.
1953 - (void)enumerateKeysAndUInt32sUsingBlock:
1954 (void (^)(uint64_t key, uint32_t value, BOOL *stop))block;
1957 * Adds the keys and values from another dictionary.
1959 * @param otherDictionary Dictionary containing entries to be added to this
1962 - (void)addEntriesFromDictionary:(GPBUInt64UInt32Dictionary *)otherDictionary;
1965 * Sets the value for the given key.
1967 * @param value The value to set.
1968 * @param key The key under which to store the value.
1970 - (void)setUInt32:(uint32_t)value forKey:(uint64_t)key;
1973 * Removes the entry for the given key.
1975 * @param aKey Key to be removed from this dictionary.
1977 - (void)removeUInt32ForKey:(uint64_t)aKey;
1980 * Removes all entries in this dictionary.
1986 #pragma mark - UInt64 -> Int32
1989 * Class used for map fields of <uint64_t, int32_t>
1990 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1992 * @note This class is not meant to be subclassed.
1994 @interface GPBUInt64Int32Dictionary : NSObject <NSCopying>
1996 /** Number of entries stored in this dictionary. */
1997 @property(nonatomic, readonly) NSUInteger count;
2000 * Initializes this dictionary, copying the given values and keys.
2002 * @param values The values to be placed in this dictionary.
2003 * @param keys The keys under which to store the values.
2004 * @param count The number of elements to copy into the dictionary.
2006 * @return A newly initialized dictionary with a copy of the values and keys.
2008 - (instancetype)initWithInt32s:(const int32_t [__nullable])values
2009 forKeys:(const uint64_t [__nullable])keys
2010 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2013 * Initializes this dictionary, copying the entries from the given dictionary.
2015 * @param dictionary Dictionary containing the entries to add to this dictionary.
2017 * @return A newly initialized dictionary with the entries of the given dictionary.
2019 - (instancetype)initWithDictionary:(GPBUInt64Int32Dictionary *)dictionary;
2022 * Initializes this dictionary with the requested capacity.
2024 * @param numItems Number of items needed for this dictionary.
2026 * @return A newly initialized dictionary with the requested capacity.
2028 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2031 * Gets the value for the given key.
2033 * @param value Pointer into which the value will be set, if found.
2034 * @param key Key under which the value is stored, if present.
2036 * @return YES if the key was found and the value was copied, NO otherwise.
2038 - (BOOL)getInt32:(nullable int32_t *)value forKey:(uint64_t)key;
2041 * Enumerates the keys and values on this dictionary with the given block.
2043 * @param block The block to enumerate with.
2044 * **key**: The key for the current entry.
2045 * **value**: The value for the current entry
2046 * **stop**: A pointer to a boolean that when set stops the enumeration.
2048 - (void)enumerateKeysAndInt32sUsingBlock:
2049 (void (^)(uint64_t key, int32_t value, BOOL *stop))block;
2052 * Adds the keys and values from another dictionary.
2054 * @param otherDictionary Dictionary containing entries to be added to this
2057 - (void)addEntriesFromDictionary:(GPBUInt64Int32Dictionary *)otherDictionary;
2060 * Sets the value for the given key.
2062 * @param value The value to set.
2063 * @param key The key under which to store the value.
2065 - (void)setInt32:(int32_t)value forKey:(uint64_t)key;
2068 * Removes the entry for the given key.
2070 * @param aKey Key to be removed from this dictionary.
2072 - (void)removeInt32ForKey:(uint64_t)aKey;
2075 * Removes all entries in this dictionary.
2081 #pragma mark - UInt64 -> UInt64
2084 * Class used for map fields of <uint64_t, uint64_t>
2085 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2087 * @note This class is not meant to be subclassed.
2089 @interface GPBUInt64UInt64Dictionary : NSObject <NSCopying>
2091 /** Number of entries stored in this dictionary. */
2092 @property(nonatomic, readonly) NSUInteger count;
2095 * Initializes this dictionary, copying the given values and keys.
2097 * @param values The values to be placed in this dictionary.
2098 * @param keys The keys under which to store the values.
2099 * @param count The number of elements to copy into the dictionary.
2101 * @return A newly initialized dictionary with a copy of the values and keys.
2103 - (instancetype)initWithUInt64s:(const uint64_t [__nullable])values
2104 forKeys:(const uint64_t [__nullable])keys
2105 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2108 * Initializes this dictionary, copying the entries from the given dictionary.
2110 * @param dictionary Dictionary containing the entries to add to this dictionary.
2112 * @return A newly initialized dictionary with the entries of the given dictionary.
2114 - (instancetype)initWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary;
2117 * Initializes this dictionary with the requested capacity.
2119 * @param numItems Number of items needed for this dictionary.
2121 * @return A newly initialized dictionary with the requested capacity.
2123 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2126 * Gets the value for the given key.
2128 * @param value Pointer into which the value will be set, if found.
2129 * @param key Key under which the value is stored, if present.
2131 * @return YES if the key was found and the value was copied, NO otherwise.
2133 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint64_t)key;
2136 * Enumerates the keys and values on this dictionary with the given block.
2138 * @param block The block to enumerate with.
2139 * **key**: The key for the current entry.
2140 * **value**: The value for the current entry
2141 * **stop**: A pointer to a boolean that when set stops the enumeration.
2143 - (void)enumerateKeysAndUInt64sUsingBlock:
2144 (void (^)(uint64_t key, uint64_t value, BOOL *stop))block;
2147 * Adds the keys and values from another dictionary.
2149 * @param otherDictionary Dictionary containing entries to be added to this
2152 - (void)addEntriesFromDictionary:(GPBUInt64UInt64Dictionary *)otherDictionary;
2155 * Sets the value for the given key.
2157 * @param value The value to set.
2158 * @param key The key under which to store the value.
2160 - (void)setUInt64:(uint64_t)value forKey:(uint64_t)key;
2163 * Removes the entry for the given key.
2165 * @param aKey Key to be removed from this dictionary.
2167 - (void)removeUInt64ForKey:(uint64_t)aKey;
2170 * Removes all entries in this dictionary.
2176 #pragma mark - UInt64 -> Int64
2179 * Class used for map fields of <uint64_t, int64_t>
2180 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2182 * @note This class is not meant to be subclassed.
2184 @interface GPBUInt64Int64Dictionary : NSObject <NSCopying>
2186 /** Number of entries stored in this dictionary. */
2187 @property(nonatomic, readonly) NSUInteger count;
2190 * Initializes this dictionary, copying the given values and keys.
2192 * @param values The values to be placed in this dictionary.
2193 * @param keys The keys under which to store the values.
2194 * @param count The number of elements to copy into the dictionary.
2196 * @return A newly initialized dictionary with a copy of the values and keys.
2198 - (instancetype)initWithInt64s:(const int64_t [__nullable])values
2199 forKeys:(const uint64_t [__nullable])keys
2200 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2203 * Initializes this dictionary, copying the entries from the given dictionary.
2205 * @param dictionary Dictionary containing the entries to add to this dictionary.
2207 * @return A newly initialized dictionary with the entries of the given dictionary.
2209 - (instancetype)initWithDictionary:(GPBUInt64Int64Dictionary *)dictionary;
2212 * Initializes this dictionary with the requested capacity.
2214 * @param numItems Number of items needed for this dictionary.
2216 * @return A newly initialized dictionary with the requested capacity.
2218 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2221 * Gets the value for the given key.
2223 * @param value Pointer into which the value will be set, if found.
2224 * @param key Key under which the value is stored, if present.
2226 * @return YES if the key was found and the value was copied, NO otherwise.
2228 - (BOOL)getInt64:(nullable int64_t *)value forKey:(uint64_t)key;
2231 * Enumerates the keys and values on this dictionary with the given block.
2233 * @param block The block to enumerate with.
2234 * **key**: The key for the current entry.
2235 * **value**: The value for the current entry
2236 * **stop**: A pointer to a boolean that when set stops the enumeration.
2238 - (void)enumerateKeysAndInt64sUsingBlock:
2239 (void (^)(uint64_t key, int64_t value, BOOL *stop))block;
2242 * Adds the keys and values from another dictionary.
2244 * @param otherDictionary Dictionary containing entries to be added to this
2247 - (void)addEntriesFromDictionary:(GPBUInt64Int64Dictionary *)otherDictionary;
2250 * Sets the value for the given key.
2252 * @param value The value to set.
2253 * @param key The key under which to store the value.
2255 - (void)setInt64:(int64_t)value forKey:(uint64_t)key;
2258 * Removes the entry for the given key.
2260 * @param aKey Key to be removed from this dictionary.
2262 - (void)removeInt64ForKey:(uint64_t)aKey;
2265 * Removes all entries in this dictionary.
2271 #pragma mark - UInt64 -> Bool
2274 * Class used for map fields of <uint64_t, BOOL>
2275 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2277 * @note This class is not meant to be subclassed.
2279 @interface GPBUInt64BoolDictionary : NSObject <NSCopying>
2281 /** Number of entries stored in this dictionary. */
2282 @property(nonatomic, readonly) NSUInteger count;
2285 * Initializes this dictionary, copying the given values and keys.
2287 * @param values The values to be placed in this dictionary.
2288 * @param keys The keys under which to store the values.
2289 * @param count The number of elements to copy into the dictionary.
2291 * @return A newly initialized dictionary with a copy of the values and keys.
2293 - (instancetype)initWithBools:(const BOOL [__nullable])values
2294 forKeys:(const uint64_t [__nullable])keys
2295 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2298 * Initializes this dictionary, copying the entries from the given dictionary.
2300 * @param dictionary Dictionary containing the entries to add to this dictionary.
2302 * @return A newly initialized dictionary with the entries of the given dictionary.
2304 - (instancetype)initWithDictionary:(GPBUInt64BoolDictionary *)dictionary;
2307 * Initializes this dictionary with the requested capacity.
2309 * @param numItems Number of items needed for this dictionary.
2311 * @return A newly initialized dictionary with the requested capacity.
2313 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2316 * Gets the value for the given key.
2318 * @param value Pointer into which the value will be set, if found.
2319 * @param key Key under which the value is stored, if present.
2321 * @return YES if the key was found and the value was copied, NO otherwise.
2323 - (BOOL)getBool:(nullable BOOL *)value forKey:(uint64_t)key;
2326 * Enumerates the keys and values on this dictionary with the given block.
2328 * @param block The block to enumerate with.
2329 * **key**: The key for the current entry.
2330 * **value**: The value for the current entry
2331 * **stop**: A pointer to a boolean that when set stops the enumeration.
2333 - (void)enumerateKeysAndBoolsUsingBlock:
2334 (void (^)(uint64_t key, BOOL value, BOOL *stop))block;
2337 * Adds the keys and values from another dictionary.
2339 * @param otherDictionary Dictionary containing entries to be added to this
2342 - (void)addEntriesFromDictionary:(GPBUInt64BoolDictionary *)otherDictionary;
2345 * Sets the value for the given key.
2347 * @param value The value to set.
2348 * @param key The key under which to store the value.
2350 - (void)setBool:(BOOL)value forKey:(uint64_t)key;
2353 * Removes the entry for the given key.
2355 * @param aKey Key to be removed from this dictionary.
2357 - (void)removeBoolForKey:(uint64_t)aKey;
2360 * Removes all entries in this dictionary.
2366 #pragma mark - UInt64 -> Float
2369 * Class used for map fields of <uint64_t, float>
2370 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2372 * @note This class is not meant to be subclassed.
2374 @interface GPBUInt64FloatDictionary : NSObject <NSCopying>
2376 /** Number of entries stored in this dictionary. */
2377 @property(nonatomic, readonly) NSUInteger count;
2380 * Initializes this dictionary, copying the given values and keys.
2382 * @param values The values to be placed in this dictionary.
2383 * @param keys The keys under which to store the values.
2384 * @param count The number of elements to copy into the dictionary.
2386 * @return A newly initialized dictionary with a copy of the values and keys.
2388 - (instancetype)initWithFloats:(const float [__nullable])values
2389 forKeys:(const uint64_t [__nullable])keys
2390 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2393 * Initializes this dictionary, copying the entries from the given dictionary.
2395 * @param dictionary Dictionary containing the entries to add to this dictionary.
2397 * @return A newly initialized dictionary with the entries of the given dictionary.
2399 - (instancetype)initWithDictionary:(GPBUInt64FloatDictionary *)dictionary;
2402 * Initializes this dictionary with the requested capacity.
2404 * @param numItems Number of items needed for this dictionary.
2406 * @return A newly initialized dictionary with the requested capacity.
2408 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2411 * Gets the value for the given key.
2413 * @param value Pointer into which the value will be set, if found.
2414 * @param key Key under which the value is stored, if present.
2416 * @return YES if the key was found and the value was copied, NO otherwise.
2418 - (BOOL)getFloat:(nullable float *)value forKey:(uint64_t)key;
2421 * Enumerates the keys and values on this dictionary with the given block.
2423 * @param block The block to enumerate with.
2424 * **key**: The key for the current entry.
2425 * **value**: The value for the current entry
2426 * **stop**: A pointer to a boolean that when set stops the enumeration.
2428 - (void)enumerateKeysAndFloatsUsingBlock:
2429 (void (^)(uint64_t key, float value, BOOL *stop))block;
2432 * Adds the keys and values from another dictionary.
2434 * @param otherDictionary Dictionary containing entries to be added to this
2437 - (void)addEntriesFromDictionary:(GPBUInt64FloatDictionary *)otherDictionary;
2440 * Sets the value for the given key.
2442 * @param value The value to set.
2443 * @param key The key under which to store the value.
2445 - (void)setFloat:(float)value forKey:(uint64_t)key;
2448 * Removes the entry for the given key.
2450 * @param aKey Key to be removed from this dictionary.
2452 - (void)removeFloatForKey:(uint64_t)aKey;
2455 * Removes all entries in this dictionary.
2461 #pragma mark - UInt64 -> Double
2464 * Class used for map fields of <uint64_t, double>
2465 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2467 * @note This class is not meant to be subclassed.
2469 @interface GPBUInt64DoubleDictionary : NSObject <NSCopying>
2471 /** Number of entries stored in this dictionary. */
2472 @property(nonatomic, readonly) NSUInteger count;
2475 * Initializes this dictionary, copying the given values and keys.
2477 * @param values The values to be placed in this dictionary.
2478 * @param keys The keys under which to store the values.
2479 * @param count The number of elements to copy into the dictionary.
2481 * @return A newly initialized dictionary with a copy of the values and keys.
2483 - (instancetype)initWithDoubles:(const double [__nullable])values
2484 forKeys:(const uint64_t [__nullable])keys
2485 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2488 * Initializes this dictionary, copying the entries from the given dictionary.
2490 * @param dictionary Dictionary containing the entries to add to this dictionary.
2492 * @return A newly initialized dictionary with the entries of the given dictionary.
2494 - (instancetype)initWithDictionary:(GPBUInt64DoubleDictionary *)dictionary;
2497 * Initializes this dictionary with the requested capacity.
2499 * @param numItems Number of items needed for this dictionary.
2501 * @return A newly initialized dictionary with the requested capacity.
2503 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2506 * Gets the value for the given key.
2508 * @param value Pointer into which the value will be set, if found.
2509 * @param key Key under which the value is stored, if present.
2511 * @return YES if the key was found and the value was copied, NO otherwise.
2513 - (BOOL)getDouble:(nullable double *)value forKey:(uint64_t)key;
2516 * Enumerates the keys and values on this dictionary with the given block.
2518 * @param block The block to enumerate with.
2519 * **key**: The key for the current entry.
2520 * **value**: The value for the current entry
2521 * **stop**: A pointer to a boolean that when set stops the enumeration.
2523 - (void)enumerateKeysAndDoublesUsingBlock:
2524 (void (^)(uint64_t key, double value, BOOL *stop))block;
2527 * Adds the keys and values from another dictionary.
2529 * @param otherDictionary Dictionary containing entries to be added to this
2532 - (void)addEntriesFromDictionary:(GPBUInt64DoubleDictionary *)otherDictionary;
2535 * Sets the value for the given key.
2537 * @param value The value to set.
2538 * @param key The key under which to store the value.
2540 - (void)setDouble:(double)value forKey:(uint64_t)key;
2543 * Removes the entry for the given key.
2545 * @param aKey Key to be removed from this dictionary.
2547 - (void)removeDoubleForKey:(uint64_t)aKey;
2550 * Removes all entries in this dictionary.
2556 #pragma mark - UInt64 -> Enum
2559 * Class used for map fields of <uint64_t, int32_t>
2560 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2562 * @note This class is not meant to be subclassed.
2564 @interface GPBUInt64EnumDictionary : NSObject <NSCopying>
2566 /** Number of entries stored in this dictionary. */
2567 @property(nonatomic, readonly) NSUInteger count;
2568 /** The validation function to check if the enums are valid. */
2569 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
2572 * Initializes a dictionary with the given validation function.
2574 * @param func The enum validation function for the dictionary.
2576 * @return A newly initialized dictionary.
2578 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
2581 * Initializes a dictionary with the entries given.
2583 * @param func The enum validation function for the dictionary.
2584 * @param values The raw enum values values to be placed in the dictionary.
2585 * @param keys The keys under which to store the values.
2586 * @param count The number of entries to store in the dictionary.
2588 * @return A newly initialized dictionary with the keys and values in it.
2590 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
2591 rawValues:(const int32_t [__nullable])values
2592 forKeys:(const uint64_t [__nullable])keys
2593 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2596 * Initializes a dictionary with the entries from the given.
2599 * @param dictionary Dictionary containing the entries to add to the dictionary.
2601 * @return A newly initialized dictionary with the entries from the given
2604 - (instancetype)initWithDictionary:(GPBUInt64EnumDictionary *)dictionary;
2607 * Initializes a dictionary with the given capacity.
2609 * @param func The enum validation function for the dictionary.
2610 * @param numItems Capacity needed for the dictionary.
2612 * @return A newly initialized dictionary with the given capacity.
2614 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
2615 capacity:(NSUInteger)numItems;
2617 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
2618 // is not a valid enumerator as defined by validationFunc. If the actual value is
2619 // desired, use "raw" version of the method.
2622 * Gets the value for the given key.
2624 * @param value Pointer into which the value will be set, if found.
2625 * @param key Key under which the value is stored, if present.
2627 * @return YES if the key was found and the value was copied, NO otherwise.
2629 - (BOOL)getEnum:(nullable int32_t *)value forKey:(uint64_t)key;
2632 * Enumerates the keys and values on this dictionary with the given block.
2634 * @param block The block to enumerate with.
2635 * **key**: The key for the current entry.
2636 * **value**: The value for the current entry
2637 * **stop**: A pointer to a boolean that when set stops the enumeration.
2639 - (void)enumerateKeysAndEnumsUsingBlock:
2640 (void (^)(uint64_t key, int32_t value, BOOL *stop))block;
2643 * Gets the raw enum value for the given key.
2645 * @note This method bypass the validationFunc to enable the access of values that
2646 * were not known at the time the binary was compiled.
2648 * @param rawValue Pointer into which the value will be set, if found.
2649 * @param key Key under which the value is stored, if present.
2651 * @return YES if the key was found and the value was copied, NO otherwise.
2653 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint64_t)key;
2656 * Enumerates the keys and values on this dictionary with the given block.
2658 * @note This method bypass the validationFunc to enable the access of values that
2659 * were not known at the time the binary was compiled.
2661 * @param block The block to enumerate with.
2662 * **key**: The key for the current entry.
2663 * **rawValue**: The value for the current entry
2664 * **stop**: A pointer to a boolean that when set stops the enumeration.
2666 - (void)enumerateKeysAndRawValuesUsingBlock:
2667 (void (^)(uint64_t key, int32_t rawValue, BOOL *stop))block;
2670 * Adds the keys and raw enum values from another dictionary.
2672 * @note This method bypass the validationFunc to enable the setting of values that
2673 * were not known at the time the binary was compiled.
2675 * @param otherDictionary Dictionary containing entries to be added to this
2678 - (void)addRawEntriesFromDictionary:(GPBUInt64EnumDictionary *)otherDictionary;
2680 // If value is not a valid enumerator as defined by validationFunc, these
2681 // methods will assert in debug, and will log in release and assign the value
2682 // to the default value. Use the rawValue methods below to assign non enumerator
2686 * Sets the value for the given key.
2688 * @param value The value to set.
2689 * @param key The key under which to store the value.
2691 - (void)setEnum:(int32_t)value forKey:(uint64_t)key;
2694 * Sets the raw enum value for the given key.
2696 * @note This method bypass the validationFunc to enable the setting of values that
2697 * were not known at the time the binary was compiled.
2699 * @param rawValue The raw enum value to set.
2700 * @param key The key under which to store the raw enum value.
2702 - (void)setRawValue:(int32_t)rawValue forKey:(uint64_t)key;
2705 * Removes the entry for the given key.
2707 * @param aKey Key to be removed from this dictionary.
2709 - (void)removeEnumForKey:(uint64_t)aKey;
2712 * Removes all entries in this dictionary.
2718 #pragma mark - UInt64 -> Object
2721 * Class used for map fields of <uint64_t, ObjectType>
2722 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2724 * @note This class is not meant to be subclassed.
2726 @interface GPBUInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
2728 /** Number of entries stored in this dictionary. */
2729 @property(nonatomic, readonly) NSUInteger count;
2732 * Initializes this dictionary, copying the given values and keys.
2734 * @param objects The values to be placed in this dictionary.
2735 * @param keys The keys under which to store the values.
2736 * @param count The number of elements to copy into the dictionary.
2738 * @return A newly initialized dictionary with a copy of the values and keys.
2740 - (instancetype)initWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects
2741 forKeys:(const uint64_t [__nullable])keys
2742 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2745 * Initializes this dictionary, copying the entries from the given dictionary.
2747 * @param dictionary Dictionary containing the entries to add to this dictionary.
2749 * @return A newly initialized dictionary with the entries of the given dictionary.
2751 - (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary;
2754 * Initializes this dictionary with the requested capacity.
2756 * @param numItems Number of items needed for this dictionary.
2758 * @return A newly initialized dictionary with the requested capacity.
2760 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2763 * Fetches the object stored under the given key.
2765 * @param key Key under which the value is stored, if present.
2767 * @return The object if found, nil otherwise.
2769 - (ObjectType)objectForKey:(uint64_t)key;
2772 * Enumerates the keys and values on this dictionary with the given block.
2774 * @param block The block to enumerate with.
2775 * **key**: The key for the current entry.
2776 * **object**: The value for the current entry
2777 * **stop**: A pointer to a boolean that when set stops the enumeration.
2779 - (void)enumerateKeysAndObjectsUsingBlock:
2780 (void (^)(uint64_t key, ObjectType object, BOOL *stop))block;
2783 * Adds the keys and values from another dictionary.
2785 * @param otherDictionary Dictionary containing entries to be added to this
2788 - (void)addEntriesFromDictionary:(GPBUInt64ObjectDictionary *)otherDictionary;
2791 * Sets the value for the given key.
2793 * @param object The value to set.
2794 * @param key The key under which to store the value.
2796 - (void)setObject:(ObjectType)object forKey:(uint64_t)key;
2799 * Removes the entry for the given key.
2801 * @param aKey Key to be removed from this dictionary.
2803 - (void)removeObjectForKey:(uint64_t)aKey;
2806 * Removes all entries in this dictionary.
2812 #pragma mark - Int64 -> UInt32
2815 * Class used for map fields of <int64_t, uint32_t>
2816 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2818 * @note This class is not meant to be subclassed.
2820 @interface GPBInt64UInt32Dictionary : NSObject <NSCopying>
2822 /** Number of entries stored in this dictionary. */
2823 @property(nonatomic, readonly) NSUInteger count;
2826 * Initializes this dictionary, copying the given values and keys.
2828 * @param values The values to be placed in this dictionary.
2829 * @param keys The keys under which to store the values.
2830 * @param count The number of elements to copy into the dictionary.
2832 * @return A newly initialized dictionary with a copy of the values and keys.
2834 - (instancetype)initWithUInt32s:(const uint32_t [__nullable])values
2835 forKeys:(const int64_t [__nullable])keys
2836 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2839 * Initializes this dictionary, copying the entries from the given dictionary.
2841 * @param dictionary Dictionary containing the entries to add to this dictionary.
2843 * @return A newly initialized dictionary with the entries of the given dictionary.
2845 - (instancetype)initWithDictionary:(GPBInt64UInt32Dictionary *)dictionary;
2848 * Initializes this dictionary with the requested capacity.
2850 * @param numItems Number of items needed for this dictionary.
2852 * @return A newly initialized dictionary with the requested capacity.
2854 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2857 * Gets the value for the given key.
2859 * @param value Pointer into which the value will be set, if found.
2860 * @param key Key under which the value is stored, if present.
2862 * @return YES if the key was found and the value was copied, NO otherwise.
2864 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int64_t)key;
2867 * Enumerates the keys and values on this dictionary with the given block.
2869 * @param block The block to enumerate with.
2870 * **key**: The key for the current entry.
2871 * **value**: The value for the current entry
2872 * **stop**: A pointer to a boolean that when set stops the enumeration.
2874 - (void)enumerateKeysAndUInt32sUsingBlock:
2875 (void (^)(int64_t key, uint32_t value, BOOL *stop))block;
2878 * Adds the keys and values from another dictionary.
2880 * @param otherDictionary Dictionary containing entries to be added to this
2883 - (void)addEntriesFromDictionary:(GPBInt64UInt32Dictionary *)otherDictionary;
2886 * Sets the value for the given key.
2888 * @param value The value to set.
2889 * @param key The key under which to store the value.
2891 - (void)setUInt32:(uint32_t)value forKey:(int64_t)key;
2894 * Removes the entry for the given key.
2896 * @param aKey Key to be removed from this dictionary.
2898 - (void)removeUInt32ForKey:(int64_t)aKey;
2901 * Removes all entries in this dictionary.
2907 #pragma mark - Int64 -> Int32
2910 * Class used for map fields of <int64_t, int32_t>
2911 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2913 * @note This class is not meant to be subclassed.
2915 @interface GPBInt64Int32Dictionary : NSObject <NSCopying>
2917 /** Number of entries stored in this dictionary. */
2918 @property(nonatomic, readonly) NSUInteger count;
2921 * Initializes this dictionary, copying the given values and keys.
2923 * @param values The values to be placed in this dictionary.
2924 * @param keys The keys under which to store the values.
2925 * @param count The number of elements to copy into the dictionary.
2927 * @return A newly initialized dictionary with a copy of the values and keys.
2929 - (instancetype)initWithInt32s:(const int32_t [__nullable])values
2930 forKeys:(const int64_t [__nullable])keys
2931 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2934 * Initializes this dictionary, copying the entries from the given dictionary.
2936 * @param dictionary Dictionary containing the entries to add to this dictionary.
2938 * @return A newly initialized dictionary with the entries of the given dictionary.
2940 - (instancetype)initWithDictionary:(GPBInt64Int32Dictionary *)dictionary;
2943 * Initializes this dictionary with the requested capacity.
2945 * @param numItems Number of items needed for this dictionary.
2947 * @return A newly initialized dictionary with the requested capacity.
2949 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2952 * Gets the value for the given key.
2954 * @param value Pointer into which the value will be set, if found.
2955 * @param key Key under which the value is stored, if present.
2957 * @return YES if the key was found and the value was copied, NO otherwise.
2959 - (BOOL)getInt32:(nullable int32_t *)value forKey:(int64_t)key;
2962 * Enumerates the keys and values on this dictionary with the given block.
2964 * @param block The block to enumerate with.
2965 * **key**: The key for the current entry.
2966 * **value**: The value for the current entry
2967 * **stop**: A pointer to a boolean that when set stops the enumeration.
2969 - (void)enumerateKeysAndInt32sUsingBlock:
2970 (void (^)(int64_t key, int32_t value, BOOL *stop))block;
2973 * Adds the keys and values from another dictionary.
2975 * @param otherDictionary Dictionary containing entries to be added to this
2978 - (void)addEntriesFromDictionary:(GPBInt64Int32Dictionary *)otherDictionary;
2981 * Sets the value for the given key.
2983 * @param value The value to set.
2984 * @param key The key under which to store the value.
2986 - (void)setInt32:(int32_t)value forKey:(int64_t)key;
2989 * Removes the entry for the given key.
2991 * @param aKey Key to be removed from this dictionary.
2993 - (void)removeInt32ForKey:(int64_t)aKey;
2996 * Removes all entries in this dictionary.
3002 #pragma mark - Int64 -> UInt64
3005 * Class used for map fields of <int64_t, uint64_t>
3006 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3008 * @note This class is not meant to be subclassed.
3010 @interface GPBInt64UInt64Dictionary : NSObject <NSCopying>
3012 /** Number of entries stored in this dictionary. */
3013 @property(nonatomic, readonly) NSUInteger count;
3016 * Initializes this dictionary, copying the given values and keys.
3018 * @param values The values to be placed in this dictionary.
3019 * @param keys The keys under which to store the values.
3020 * @param count The number of elements to copy into the dictionary.
3022 * @return A newly initialized dictionary with a copy of the values and keys.
3024 - (instancetype)initWithUInt64s:(const uint64_t [__nullable])values
3025 forKeys:(const int64_t [__nullable])keys
3026 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3029 * Initializes this dictionary, copying the entries from the given dictionary.
3031 * @param dictionary Dictionary containing the entries to add to this dictionary.
3033 * @return A newly initialized dictionary with the entries of the given dictionary.
3035 - (instancetype)initWithDictionary:(GPBInt64UInt64Dictionary *)dictionary;
3038 * Initializes this dictionary with the requested capacity.
3040 * @param numItems Number of items needed for this dictionary.
3042 * @return A newly initialized dictionary with the requested capacity.
3044 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3047 * Gets the value for the given key.
3049 * @param value Pointer into which the value will be set, if found.
3050 * @param key Key under which the value is stored, if present.
3052 * @return YES if the key was found and the value was copied, NO otherwise.
3054 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int64_t)key;
3057 * Enumerates the keys and values on this dictionary with the given block.
3059 * @param block The block to enumerate with.
3060 * **key**: The key for the current entry.
3061 * **value**: The value for the current entry
3062 * **stop**: A pointer to a boolean that when set stops the enumeration.
3064 - (void)enumerateKeysAndUInt64sUsingBlock:
3065 (void (^)(int64_t key, uint64_t value, BOOL *stop))block;
3068 * Adds the keys and values from another dictionary.
3070 * @param otherDictionary Dictionary containing entries to be added to this
3073 - (void)addEntriesFromDictionary:(GPBInt64UInt64Dictionary *)otherDictionary;
3076 * Sets the value for the given key.
3078 * @param value The value to set.
3079 * @param key The key under which to store the value.
3081 - (void)setUInt64:(uint64_t)value forKey:(int64_t)key;
3084 * Removes the entry for the given key.
3086 * @param aKey Key to be removed from this dictionary.
3088 - (void)removeUInt64ForKey:(int64_t)aKey;
3091 * Removes all entries in this dictionary.
3097 #pragma mark - Int64 -> Int64
3100 * Class used for map fields of <int64_t, int64_t>
3101 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3103 * @note This class is not meant to be subclassed.
3105 @interface GPBInt64Int64Dictionary : NSObject <NSCopying>
3107 /** Number of entries stored in this dictionary. */
3108 @property(nonatomic, readonly) NSUInteger count;
3111 * Initializes this dictionary, copying the given values and keys.
3113 * @param values The values to be placed in this dictionary.
3114 * @param keys The keys under which to store the values.
3115 * @param count The number of elements to copy into the dictionary.
3117 * @return A newly initialized dictionary with a copy of the values and keys.
3119 - (instancetype)initWithInt64s:(const int64_t [__nullable])values
3120 forKeys:(const int64_t [__nullable])keys
3121 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3124 * Initializes this dictionary, copying the entries from the given dictionary.
3126 * @param dictionary Dictionary containing the entries to add to this dictionary.
3128 * @return A newly initialized dictionary with the entries of the given dictionary.
3130 - (instancetype)initWithDictionary:(GPBInt64Int64Dictionary *)dictionary;
3133 * Initializes this dictionary with the requested capacity.
3135 * @param numItems Number of items needed for this dictionary.
3137 * @return A newly initialized dictionary with the requested capacity.
3139 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3142 * Gets the value for the given key.
3144 * @param value Pointer into which the value will be set, if found.
3145 * @param key Key under which the value is stored, if present.
3147 * @return YES if the key was found and the value was copied, NO otherwise.
3149 - (BOOL)getInt64:(nullable int64_t *)value forKey:(int64_t)key;
3152 * Enumerates the keys and values on this dictionary with the given block.
3154 * @param block The block to enumerate with.
3155 * **key**: The key for the current entry.
3156 * **value**: The value for the current entry
3157 * **stop**: A pointer to a boolean that when set stops the enumeration.
3159 - (void)enumerateKeysAndInt64sUsingBlock:
3160 (void (^)(int64_t key, int64_t value, BOOL *stop))block;
3163 * Adds the keys and values from another dictionary.
3165 * @param otherDictionary Dictionary containing entries to be added to this
3168 - (void)addEntriesFromDictionary:(GPBInt64Int64Dictionary *)otherDictionary;
3171 * Sets the value for the given key.
3173 * @param value The value to set.
3174 * @param key The key under which to store the value.
3176 - (void)setInt64:(int64_t)value forKey:(int64_t)key;
3179 * Removes the entry for the given key.
3181 * @param aKey Key to be removed from this dictionary.
3183 - (void)removeInt64ForKey:(int64_t)aKey;
3186 * Removes all entries in this dictionary.
3192 #pragma mark - Int64 -> Bool
3195 * Class used for map fields of <int64_t, BOOL>
3196 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3198 * @note This class is not meant to be subclassed.
3200 @interface GPBInt64BoolDictionary : NSObject <NSCopying>
3202 /** Number of entries stored in this dictionary. */
3203 @property(nonatomic, readonly) NSUInteger count;
3206 * Initializes this dictionary, copying the given values and keys.
3208 * @param values The values to be placed in this dictionary.
3209 * @param keys The keys under which to store the values.
3210 * @param count The number of elements to copy into the dictionary.
3212 * @return A newly initialized dictionary with a copy of the values and keys.
3214 - (instancetype)initWithBools:(const BOOL [__nullable])values
3215 forKeys:(const int64_t [__nullable])keys
3216 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3219 * Initializes this dictionary, copying the entries from the given dictionary.
3221 * @param dictionary Dictionary containing the entries to add to this dictionary.
3223 * @return A newly initialized dictionary with the entries of the given dictionary.
3225 - (instancetype)initWithDictionary:(GPBInt64BoolDictionary *)dictionary;
3228 * Initializes this dictionary with the requested capacity.
3230 * @param numItems Number of items needed for this dictionary.
3232 * @return A newly initialized dictionary with the requested capacity.
3234 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3237 * Gets the value for the given key.
3239 * @param value Pointer into which the value will be set, if found.
3240 * @param key Key under which the value is stored, if present.
3242 * @return YES if the key was found and the value was copied, NO otherwise.
3244 - (BOOL)getBool:(nullable BOOL *)value forKey:(int64_t)key;
3247 * Enumerates the keys and values on this dictionary with the given block.
3249 * @param block The block to enumerate with.
3250 * **key**: The key for the current entry.
3251 * **value**: The value for the current entry
3252 * **stop**: A pointer to a boolean that when set stops the enumeration.
3254 - (void)enumerateKeysAndBoolsUsingBlock:
3255 (void (^)(int64_t key, BOOL value, BOOL *stop))block;
3258 * Adds the keys and values from another dictionary.
3260 * @param otherDictionary Dictionary containing entries to be added to this
3263 - (void)addEntriesFromDictionary:(GPBInt64BoolDictionary *)otherDictionary;
3266 * Sets the value for the given key.
3268 * @param value The value to set.
3269 * @param key The key under which to store the value.
3271 - (void)setBool:(BOOL)value forKey:(int64_t)key;
3274 * Removes the entry for the given key.
3276 * @param aKey Key to be removed from this dictionary.
3278 - (void)removeBoolForKey:(int64_t)aKey;
3281 * Removes all entries in this dictionary.
3287 #pragma mark - Int64 -> Float
3290 * Class used for map fields of <int64_t, float>
3291 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3293 * @note This class is not meant to be subclassed.
3295 @interface GPBInt64FloatDictionary : NSObject <NSCopying>
3297 /** Number of entries stored in this dictionary. */
3298 @property(nonatomic, readonly) NSUInteger count;
3301 * Initializes this dictionary, copying the given values and keys.
3303 * @param values The values to be placed in this dictionary.
3304 * @param keys The keys under which to store the values.
3305 * @param count The number of elements to copy into the dictionary.
3307 * @return A newly initialized dictionary with a copy of the values and keys.
3309 - (instancetype)initWithFloats:(const float [__nullable])values
3310 forKeys:(const int64_t [__nullable])keys
3311 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3314 * Initializes this dictionary, copying the entries from the given dictionary.
3316 * @param dictionary Dictionary containing the entries to add to this dictionary.
3318 * @return A newly initialized dictionary with the entries of the given dictionary.
3320 - (instancetype)initWithDictionary:(GPBInt64FloatDictionary *)dictionary;
3323 * Initializes this dictionary with the requested capacity.
3325 * @param numItems Number of items needed for this dictionary.
3327 * @return A newly initialized dictionary with the requested capacity.
3329 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3332 * Gets the value for the given key.
3334 * @param value Pointer into which the value will be set, if found.
3335 * @param key Key under which the value is stored, if present.
3337 * @return YES if the key was found and the value was copied, NO otherwise.
3339 - (BOOL)getFloat:(nullable float *)value forKey:(int64_t)key;
3342 * Enumerates the keys and values on this dictionary with the given block.
3344 * @param block The block to enumerate with.
3345 * **key**: The key for the current entry.
3346 * **value**: The value for the current entry
3347 * **stop**: A pointer to a boolean that when set stops the enumeration.
3349 - (void)enumerateKeysAndFloatsUsingBlock:
3350 (void (^)(int64_t key, float value, BOOL *stop))block;
3353 * Adds the keys and values from another dictionary.
3355 * @param otherDictionary Dictionary containing entries to be added to this
3358 - (void)addEntriesFromDictionary:(GPBInt64FloatDictionary *)otherDictionary;
3361 * Sets the value for the given key.
3363 * @param value The value to set.
3364 * @param key The key under which to store the value.
3366 - (void)setFloat:(float)value forKey:(int64_t)key;
3369 * Removes the entry for the given key.
3371 * @param aKey Key to be removed from this dictionary.
3373 - (void)removeFloatForKey:(int64_t)aKey;
3376 * Removes all entries in this dictionary.
3382 #pragma mark - Int64 -> Double
3385 * Class used for map fields of <int64_t, double>
3386 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3388 * @note This class is not meant to be subclassed.
3390 @interface GPBInt64DoubleDictionary : NSObject <NSCopying>
3392 /** Number of entries stored in this dictionary. */
3393 @property(nonatomic, readonly) NSUInteger count;
3396 * Initializes this dictionary, copying the given values and keys.
3398 * @param values The values to be placed in this dictionary.
3399 * @param keys The keys under which to store the values.
3400 * @param count The number of elements to copy into the dictionary.
3402 * @return A newly initialized dictionary with a copy of the values and keys.
3404 - (instancetype)initWithDoubles:(const double [__nullable])values
3405 forKeys:(const int64_t [__nullable])keys
3406 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3409 * Initializes this dictionary, copying the entries from the given dictionary.
3411 * @param dictionary Dictionary containing the entries to add to this dictionary.
3413 * @return A newly initialized dictionary with the entries of the given dictionary.
3415 - (instancetype)initWithDictionary:(GPBInt64DoubleDictionary *)dictionary;
3418 * Initializes this dictionary with the requested capacity.
3420 * @param numItems Number of items needed for this dictionary.
3422 * @return A newly initialized dictionary with the requested capacity.
3424 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3427 * Gets the value for the given key.
3429 * @param value Pointer into which the value will be set, if found.
3430 * @param key Key under which the value is stored, if present.
3432 * @return YES if the key was found and the value was copied, NO otherwise.
3434 - (BOOL)getDouble:(nullable double *)value forKey:(int64_t)key;
3437 * Enumerates the keys and values on this dictionary with the given block.
3439 * @param block The block to enumerate with.
3440 * **key**: The key for the current entry.
3441 * **value**: The value for the current entry
3442 * **stop**: A pointer to a boolean that when set stops the enumeration.
3444 - (void)enumerateKeysAndDoublesUsingBlock:
3445 (void (^)(int64_t key, double value, BOOL *stop))block;
3448 * Adds the keys and values from another dictionary.
3450 * @param otherDictionary Dictionary containing entries to be added to this
3453 - (void)addEntriesFromDictionary:(GPBInt64DoubleDictionary *)otherDictionary;
3456 * Sets the value for the given key.
3458 * @param value The value to set.
3459 * @param key The key under which to store the value.
3461 - (void)setDouble:(double)value forKey:(int64_t)key;
3464 * Removes the entry for the given key.
3466 * @param aKey Key to be removed from this dictionary.
3468 - (void)removeDoubleForKey:(int64_t)aKey;
3471 * Removes all entries in this dictionary.
3477 #pragma mark - Int64 -> Enum
3480 * Class used for map fields of <int64_t, int32_t>
3481 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3483 * @note This class is not meant to be subclassed.
3485 @interface GPBInt64EnumDictionary : NSObject <NSCopying>
3487 /** Number of entries stored in this dictionary. */
3488 @property(nonatomic, readonly) NSUInteger count;
3489 /** The validation function to check if the enums are valid. */
3490 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
3493 * Initializes a dictionary with the given validation function.
3495 * @param func The enum validation function for the dictionary.
3497 * @return A newly initialized dictionary.
3499 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
3502 * Initializes a dictionary with the entries given.
3504 * @param func The enum validation function for the dictionary.
3505 * @param values The raw enum values values to be placed in the dictionary.
3506 * @param keys The keys under which to store the values.
3507 * @param count The number of entries to store in the dictionary.
3509 * @return A newly initialized dictionary with the keys and values in it.
3511 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
3512 rawValues:(const int32_t [__nullable])values
3513 forKeys:(const int64_t [__nullable])keys
3514 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3517 * Initializes a dictionary with the entries from the given.
3520 * @param dictionary Dictionary containing the entries to add to the dictionary.
3522 * @return A newly initialized dictionary with the entries from the given
3525 - (instancetype)initWithDictionary:(GPBInt64EnumDictionary *)dictionary;
3528 * Initializes a dictionary with the given capacity.
3530 * @param func The enum validation function for the dictionary.
3531 * @param numItems Capacity needed for the dictionary.
3533 * @return A newly initialized dictionary with the given capacity.
3535 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
3536 capacity:(NSUInteger)numItems;
3538 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
3539 // is not a valid enumerator as defined by validationFunc. If the actual value is
3540 // desired, use "raw" version of the method.
3543 * Gets the value for the given key.
3545 * @param value Pointer into which the value will be set, if found.
3546 * @param key Key under which the value is stored, if present.
3548 * @return YES if the key was found and the value was copied, NO otherwise.
3550 - (BOOL)getEnum:(nullable int32_t *)value forKey:(int64_t)key;
3553 * Enumerates the keys and values on this dictionary with the given block.
3555 * @param block The block to enumerate with.
3556 * **key**: The key for the current entry.
3557 * **value**: The value for the current entry
3558 * **stop**: A pointer to a boolean that when set stops the enumeration.
3560 - (void)enumerateKeysAndEnumsUsingBlock:
3561 (void (^)(int64_t key, int32_t value, BOOL *stop))block;
3564 * Gets the raw enum value for the given key.
3566 * @note This method bypass the validationFunc to enable the access of values that
3567 * were not known at the time the binary was compiled.
3569 * @param rawValue Pointer into which the value will be set, if found.
3570 * @param key Key under which the value is stored, if present.
3572 * @return YES if the key was found and the value was copied, NO otherwise.
3574 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int64_t)key;
3577 * Enumerates the keys and values on this dictionary with the given block.
3579 * @note This method bypass the validationFunc to enable the access of values that
3580 * were not known at the time the binary was compiled.
3582 * @param block The block to enumerate with.
3583 * **key**: The key for the current entry.
3584 * **rawValue**: The value for the current entry
3585 * **stop**: A pointer to a boolean that when set stops the enumeration.
3587 - (void)enumerateKeysAndRawValuesUsingBlock:
3588 (void (^)(int64_t key, int32_t rawValue, BOOL *stop))block;
3591 * Adds the keys and raw enum values from another dictionary.
3593 * @note This method bypass the validationFunc to enable the setting of values that
3594 * were not known at the time the binary was compiled.
3596 * @param otherDictionary Dictionary containing entries to be added to this
3599 - (void)addRawEntriesFromDictionary:(GPBInt64EnumDictionary *)otherDictionary;
3601 // If value is not a valid enumerator as defined by validationFunc, these
3602 // methods will assert in debug, and will log in release and assign the value
3603 // to the default value. Use the rawValue methods below to assign non enumerator
3607 * Sets the value for the given key.
3609 * @param value The value to set.
3610 * @param key The key under which to store the value.
3612 - (void)setEnum:(int32_t)value forKey:(int64_t)key;
3615 * Sets the raw enum value for the given key.
3617 * @note This method bypass the validationFunc to enable the setting of values that
3618 * were not known at the time the binary was compiled.
3620 * @param rawValue The raw enum value to set.
3621 * @param key The key under which to store the raw enum value.
3623 - (void)setRawValue:(int32_t)rawValue forKey:(int64_t)key;
3626 * Removes the entry for the given key.
3628 * @param aKey Key to be removed from this dictionary.
3630 - (void)removeEnumForKey:(int64_t)aKey;
3633 * Removes all entries in this dictionary.
3639 #pragma mark - Int64 -> Object
3642 * Class used for map fields of <int64_t, ObjectType>
3643 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3645 * @note This class is not meant to be subclassed.
3647 @interface GPBInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
3649 /** Number of entries stored in this dictionary. */
3650 @property(nonatomic, readonly) NSUInteger count;
3653 * Initializes this dictionary, copying the given values and keys.
3655 * @param objects The values to be placed in this dictionary.
3656 * @param keys The keys under which to store the values.
3657 * @param count The number of elements to copy into the dictionary.
3659 * @return A newly initialized dictionary with a copy of the values and keys.
3661 - (instancetype)initWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects
3662 forKeys:(const int64_t [__nullable])keys
3663 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3666 * Initializes this dictionary, copying the entries from the given dictionary.
3668 * @param dictionary Dictionary containing the entries to add to this dictionary.
3670 * @return A newly initialized dictionary with the entries of the given dictionary.
3672 - (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
3675 * Initializes this dictionary with the requested capacity.
3677 * @param numItems Number of items needed for this dictionary.
3679 * @return A newly initialized dictionary with the requested capacity.
3681 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3684 * Fetches the object stored under the given key.
3686 * @param key Key under which the value is stored, if present.
3688 * @return The object if found, nil otherwise.
3690 - (ObjectType)objectForKey:(int64_t)key;
3693 * Enumerates the keys and values on this dictionary with the given block.
3695 * @param block The block to enumerate with.
3696 * **key**: The key for the current entry.
3697 * **object**: The value for the current entry
3698 * **stop**: A pointer to a boolean that when set stops the enumeration.
3700 - (void)enumerateKeysAndObjectsUsingBlock:
3701 (void (^)(int64_t key, ObjectType object, BOOL *stop))block;
3704 * Adds the keys and values from another dictionary.
3706 * @param otherDictionary Dictionary containing entries to be added to this
3709 - (void)addEntriesFromDictionary:(GPBInt64ObjectDictionary *)otherDictionary;
3712 * Sets the value for the given key.
3714 * @param object The value to set.
3715 * @param key The key under which to store the value.
3717 - (void)setObject:(ObjectType)object forKey:(int64_t)key;
3720 * Removes the entry for the given key.
3722 * @param aKey Key to be removed from this dictionary.
3724 - (void)removeObjectForKey:(int64_t)aKey;
3727 * Removes all entries in this dictionary.
3733 #pragma mark - Bool -> UInt32
3736 * Class used for map fields of <BOOL, uint32_t>
3737 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3739 * @note This class is not meant to be subclassed.
3741 @interface GPBBoolUInt32Dictionary : NSObject <NSCopying>
3743 /** Number of entries stored in this dictionary. */
3744 @property(nonatomic, readonly) NSUInteger count;
3747 * Initializes this dictionary, copying the given values and keys.
3749 * @param values The values to be placed in this dictionary.
3750 * @param keys The keys under which to store the values.
3751 * @param count The number of elements to copy into the dictionary.
3753 * @return A newly initialized dictionary with a copy of the values and keys.
3755 - (instancetype)initWithUInt32s:(const uint32_t [__nullable])values
3756 forKeys:(const BOOL [__nullable])keys
3757 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3760 * Initializes this dictionary, copying the entries from the given dictionary.
3762 * @param dictionary Dictionary containing the entries to add to this dictionary.
3764 * @return A newly initialized dictionary with the entries of the given dictionary.
3766 - (instancetype)initWithDictionary:(GPBBoolUInt32Dictionary *)dictionary;
3769 * Initializes this dictionary with the requested capacity.
3771 * @param numItems Number of items needed for this dictionary.
3773 * @return A newly initialized dictionary with the requested capacity.
3775 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3778 * Gets the value for the given key.
3780 * @param value Pointer into which the value will be set, if found.
3781 * @param key Key under which the value is stored, if present.
3783 * @return YES if the key was found and the value was copied, NO otherwise.
3785 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(BOOL)key;
3788 * Enumerates the keys and values on this dictionary with the given block.
3790 * @param block The block to enumerate with.
3791 * **key**: The key for the current entry.
3792 * **value**: The value for the current entry
3793 * **stop**: A pointer to a boolean that when set stops the enumeration.
3795 - (void)enumerateKeysAndUInt32sUsingBlock:
3796 (void (^)(BOOL key, uint32_t value, BOOL *stop))block;
3799 * Adds the keys and values from another dictionary.
3801 * @param otherDictionary Dictionary containing entries to be added to this
3804 - (void)addEntriesFromDictionary:(GPBBoolUInt32Dictionary *)otherDictionary;
3807 * Sets the value for the given key.
3809 * @param value The value to set.
3810 * @param key The key under which to store the value.
3812 - (void)setUInt32:(uint32_t)value forKey:(BOOL)key;
3815 * Removes the entry for the given key.
3817 * @param aKey Key to be removed from this dictionary.
3819 - (void)removeUInt32ForKey:(BOOL)aKey;
3822 * Removes all entries in this dictionary.
3828 #pragma mark - Bool -> Int32
3831 * Class used for map fields of <BOOL, int32_t>
3832 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3834 * @note This class is not meant to be subclassed.
3836 @interface GPBBoolInt32Dictionary : NSObject <NSCopying>
3838 /** Number of entries stored in this dictionary. */
3839 @property(nonatomic, readonly) NSUInteger count;
3842 * Initializes this dictionary, copying the given values and keys.
3844 * @param values The values to be placed in this dictionary.
3845 * @param keys The keys under which to store the values.
3846 * @param count The number of elements to copy into the dictionary.
3848 * @return A newly initialized dictionary with a copy of the values and keys.
3850 - (instancetype)initWithInt32s:(const int32_t [__nullable])values
3851 forKeys:(const BOOL [__nullable])keys
3852 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3855 * Initializes this dictionary, copying the entries from the given dictionary.
3857 * @param dictionary Dictionary containing the entries to add to this dictionary.
3859 * @return A newly initialized dictionary with the entries of the given dictionary.
3861 - (instancetype)initWithDictionary:(GPBBoolInt32Dictionary *)dictionary;
3864 * Initializes this dictionary with the requested capacity.
3866 * @param numItems Number of items needed for this dictionary.
3868 * @return A newly initialized dictionary with the requested capacity.
3870 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3873 * Gets the value for the given key.
3875 * @param value Pointer into which the value will be set, if found.
3876 * @param key Key under which the value is stored, if present.
3878 * @return YES if the key was found and the value was copied, NO otherwise.
3880 - (BOOL)getInt32:(nullable int32_t *)value forKey:(BOOL)key;
3883 * Enumerates the keys and values on this dictionary with the given block.
3885 * @param block The block to enumerate with.
3886 * **key**: The key for the current entry.
3887 * **value**: The value for the current entry
3888 * **stop**: A pointer to a boolean that when set stops the enumeration.
3890 - (void)enumerateKeysAndInt32sUsingBlock:
3891 (void (^)(BOOL key, int32_t value, BOOL *stop))block;
3894 * Adds the keys and values from another dictionary.
3896 * @param otherDictionary Dictionary containing entries to be added to this
3899 - (void)addEntriesFromDictionary:(GPBBoolInt32Dictionary *)otherDictionary;
3902 * Sets the value for the given key.
3904 * @param value The value to set.
3905 * @param key The key under which to store the value.
3907 - (void)setInt32:(int32_t)value forKey:(BOOL)key;
3910 * Removes the entry for the given key.
3912 * @param aKey Key to be removed from this dictionary.
3914 - (void)removeInt32ForKey:(BOOL)aKey;
3917 * Removes all entries in this dictionary.
3923 #pragma mark - Bool -> UInt64
3926 * Class used for map fields of <BOOL, uint64_t>
3927 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3929 * @note This class is not meant to be subclassed.
3931 @interface GPBBoolUInt64Dictionary : NSObject <NSCopying>
3933 /** Number of entries stored in this dictionary. */
3934 @property(nonatomic, readonly) NSUInteger count;
3937 * Initializes this dictionary, copying the given values and keys.
3939 * @param values The values to be placed in this dictionary.
3940 * @param keys The keys under which to store the values.
3941 * @param count The number of elements to copy into the dictionary.
3943 * @return A newly initialized dictionary with a copy of the values and keys.
3945 - (instancetype)initWithUInt64s:(const uint64_t [__nullable])values
3946 forKeys:(const BOOL [__nullable])keys
3947 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3950 * Initializes this dictionary, copying the entries from the given dictionary.
3952 * @param dictionary Dictionary containing the entries to add to this dictionary.
3954 * @return A newly initialized dictionary with the entries of the given dictionary.
3956 - (instancetype)initWithDictionary:(GPBBoolUInt64Dictionary *)dictionary;
3959 * Initializes this dictionary with the requested capacity.
3961 * @param numItems Number of items needed for this dictionary.
3963 * @return A newly initialized dictionary with the requested capacity.
3965 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3968 * Gets the value for the given key.
3970 * @param value Pointer into which the value will be set, if found.
3971 * @param key Key under which the value is stored, if present.
3973 * @return YES if the key was found and the value was copied, NO otherwise.
3975 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(BOOL)key;
3978 * Enumerates the keys and values on this dictionary with the given block.
3980 * @param block The block to enumerate with.
3981 * **key**: The key for the current entry.
3982 * **value**: The value for the current entry
3983 * **stop**: A pointer to a boolean that when set stops the enumeration.
3985 - (void)enumerateKeysAndUInt64sUsingBlock:
3986 (void (^)(BOOL key, uint64_t value, BOOL *stop))block;
3989 * Adds the keys and values from another dictionary.
3991 * @param otherDictionary Dictionary containing entries to be added to this
3994 - (void)addEntriesFromDictionary:(GPBBoolUInt64Dictionary *)otherDictionary;
3997 * Sets the value for the given key.
3999 * @param value The value to set.
4000 * @param key The key under which to store the value.
4002 - (void)setUInt64:(uint64_t)value forKey:(BOOL)key;
4005 * Removes the entry for the given key.
4007 * @param aKey Key to be removed from this dictionary.
4009 - (void)removeUInt64ForKey:(BOOL)aKey;
4012 * Removes all entries in this dictionary.
4018 #pragma mark - Bool -> Int64
4021 * Class used for map fields of <BOOL, int64_t>
4022 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4024 * @note This class is not meant to be subclassed.
4026 @interface GPBBoolInt64Dictionary : NSObject <NSCopying>
4028 /** Number of entries stored in this dictionary. */
4029 @property(nonatomic, readonly) NSUInteger count;
4032 * Initializes this dictionary, copying the given values and keys.
4034 * @param values The values to be placed in this dictionary.
4035 * @param keys The keys under which to store the values.
4036 * @param count The number of elements to copy into the dictionary.
4038 * @return A newly initialized dictionary with a copy of the values and keys.
4040 - (instancetype)initWithInt64s:(const int64_t [__nullable])values
4041 forKeys:(const BOOL [__nullable])keys
4042 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4045 * Initializes this dictionary, copying the entries from the given dictionary.
4047 * @param dictionary Dictionary containing the entries to add to this dictionary.
4049 * @return A newly initialized dictionary with the entries of the given dictionary.
4051 - (instancetype)initWithDictionary:(GPBBoolInt64Dictionary *)dictionary;
4054 * Initializes this dictionary with the requested capacity.
4056 * @param numItems Number of items needed for this dictionary.
4058 * @return A newly initialized dictionary with the requested capacity.
4060 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4063 * Gets the value for the given key.
4065 * @param value Pointer into which the value will be set, if found.
4066 * @param key Key under which the value is stored, if present.
4068 * @return YES if the key was found and the value was copied, NO otherwise.
4070 - (BOOL)getInt64:(nullable int64_t *)value forKey:(BOOL)key;
4073 * Enumerates the keys and values on this dictionary with the given block.
4075 * @param block The block to enumerate with.
4076 * **key**: The key for the current entry.
4077 * **value**: The value for the current entry
4078 * **stop**: A pointer to a boolean that when set stops the enumeration.
4080 - (void)enumerateKeysAndInt64sUsingBlock:
4081 (void (^)(BOOL key, int64_t value, BOOL *stop))block;
4084 * Adds the keys and values from another dictionary.
4086 * @param otherDictionary Dictionary containing entries to be added to this
4089 - (void)addEntriesFromDictionary:(GPBBoolInt64Dictionary *)otherDictionary;
4092 * Sets the value for the given key.
4094 * @param value The value to set.
4095 * @param key The key under which to store the value.
4097 - (void)setInt64:(int64_t)value forKey:(BOOL)key;
4100 * Removes the entry for the given key.
4102 * @param aKey Key to be removed from this dictionary.
4104 - (void)removeInt64ForKey:(BOOL)aKey;
4107 * Removes all entries in this dictionary.
4113 #pragma mark - Bool -> Bool
4116 * Class used for map fields of <BOOL, BOOL>
4117 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4119 * @note This class is not meant to be subclassed.
4121 @interface GPBBoolBoolDictionary : NSObject <NSCopying>
4123 /** Number of entries stored in this dictionary. */
4124 @property(nonatomic, readonly) NSUInteger count;
4127 * Initializes this dictionary, copying the given values and keys.
4129 * @param values The values to be placed in this dictionary.
4130 * @param keys The keys under which to store the values.
4131 * @param count The number of elements to copy into the dictionary.
4133 * @return A newly initialized dictionary with a copy of the values and keys.
4135 - (instancetype)initWithBools:(const BOOL [__nullable])values
4136 forKeys:(const BOOL [__nullable])keys
4137 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4140 * Initializes this dictionary, copying the entries from the given dictionary.
4142 * @param dictionary Dictionary containing the entries to add to this dictionary.
4144 * @return A newly initialized dictionary with the entries of the given dictionary.
4146 - (instancetype)initWithDictionary:(GPBBoolBoolDictionary *)dictionary;
4149 * Initializes this dictionary with the requested capacity.
4151 * @param numItems Number of items needed for this dictionary.
4153 * @return A newly initialized dictionary with the requested capacity.
4155 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4158 * Gets the value for the given key.
4160 * @param value Pointer into which the value will be set, if found.
4161 * @param key Key under which the value is stored, if present.
4163 * @return YES if the key was found and the value was copied, NO otherwise.
4165 - (BOOL)getBool:(nullable BOOL *)value forKey:(BOOL)key;
4168 * Enumerates the keys and values on this dictionary with the given block.
4170 * @param block The block to enumerate with.
4171 * **key**: The key for the current entry.
4172 * **value**: The value for the current entry
4173 * **stop**: A pointer to a boolean that when set stops the enumeration.
4175 - (void)enumerateKeysAndBoolsUsingBlock:
4176 (void (^)(BOOL key, BOOL value, BOOL *stop))block;
4179 * Adds the keys and values from another dictionary.
4181 * @param otherDictionary Dictionary containing entries to be added to this
4184 - (void)addEntriesFromDictionary:(GPBBoolBoolDictionary *)otherDictionary;
4187 * Sets the value for the given key.
4189 * @param value The value to set.
4190 * @param key The key under which to store the value.
4192 - (void)setBool:(BOOL)value forKey:(BOOL)key;
4195 * Removes the entry for the given key.
4197 * @param aKey Key to be removed from this dictionary.
4199 - (void)removeBoolForKey:(BOOL)aKey;
4202 * Removes all entries in this dictionary.
4208 #pragma mark - Bool -> Float
4211 * Class used for map fields of <BOOL, float>
4212 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4214 * @note This class is not meant to be subclassed.
4216 @interface GPBBoolFloatDictionary : NSObject <NSCopying>
4218 /** Number of entries stored in this dictionary. */
4219 @property(nonatomic, readonly) NSUInteger count;
4222 * Initializes this dictionary, copying the given values and keys.
4224 * @param values The values to be placed in this dictionary.
4225 * @param keys The keys under which to store the values.
4226 * @param count The number of elements to copy into the dictionary.
4228 * @return A newly initialized dictionary with a copy of the values and keys.
4230 - (instancetype)initWithFloats:(const float [__nullable])values
4231 forKeys:(const BOOL [__nullable])keys
4232 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4235 * Initializes this dictionary, copying the entries from the given dictionary.
4237 * @param dictionary Dictionary containing the entries to add to this dictionary.
4239 * @return A newly initialized dictionary with the entries of the given dictionary.
4241 - (instancetype)initWithDictionary:(GPBBoolFloatDictionary *)dictionary;
4244 * Initializes this dictionary with the requested capacity.
4246 * @param numItems Number of items needed for this dictionary.
4248 * @return A newly initialized dictionary with the requested capacity.
4250 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4253 * Gets the value for the given key.
4255 * @param value Pointer into which the value will be set, if found.
4256 * @param key Key under which the value is stored, if present.
4258 * @return YES if the key was found and the value was copied, NO otherwise.
4260 - (BOOL)getFloat:(nullable float *)value forKey:(BOOL)key;
4263 * Enumerates the keys and values on this dictionary with the given block.
4265 * @param block The block to enumerate with.
4266 * **key**: The key for the current entry.
4267 * **value**: The value for the current entry
4268 * **stop**: A pointer to a boolean that when set stops the enumeration.
4270 - (void)enumerateKeysAndFloatsUsingBlock:
4271 (void (^)(BOOL key, float value, BOOL *stop))block;
4274 * Adds the keys and values from another dictionary.
4276 * @param otherDictionary Dictionary containing entries to be added to this
4279 - (void)addEntriesFromDictionary:(GPBBoolFloatDictionary *)otherDictionary;
4282 * Sets the value for the given key.
4284 * @param value The value to set.
4285 * @param key The key under which to store the value.
4287 - (void)setFloat:(float)value forKey:(BOOL)key;
4290 * Removes the entry for the given key.
4292 * @param aKey Key to be removed from this dictionary.
4294 - (void)removeFloatForKey:(BOOL)aKey;
4297 * Removes all entries in this dictionary.
4303 #pragma mark - Bool -> Double
4306 * Class used for map fields of <BOOL, double>
4307 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4309 * @note This class is not meant to be subclassed.
4311 @interface GPBBoolDoubleDictionary : NSObject <NSCopying>
4313 /** Number of entries stored in this dictionary. */
4314 @property(nonatomic, readonly) NSUInteger count;
4317 * Initializes this dictionary, copying the given values and keys.
4319 * @param values The values to be placed in this dictionary.
4320 * @param keys The keys under which to store the values.
4321 * @param count The number of elements to copy into the dictionary.
4323 * @return A newly initialized dictionary with a copy of the values and keys.
4325 - (instancetype)initWithDoubles:(const double [__nullable])values
4326 forKeys:(const BOOL [__nullable])keys
4327 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4330 * Initializes this dictionary, copying the entries from the given dictionary.
4332 * @param dictionary Dictionary containing the entries to add to this dictionary.
4334 * @return A newly initialized dictionary with the entries of the given dictionary.
4336 - (instancetype)initWithDictionary:(GPBBoolDoubleDictionary *)dictionary;
4339 * Initializes this dictionary with the requested capacity.
4341 * @param numItems Number of items needed for this dictionary.
4343 * @return A newly initialized dictionary with the requested capacity.
4345 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4348 * Gets the value for the given key.
4350 * @param value Pointer into which the value will be set, if found.
4351 * @param key Key under which the value is stored, if present.
4353 * @return YES if the key was found and the value was copied, NO otherwise.
4355 - (BOOL)getDouble:(nullable double *)value forKey:(BOOL)key;
4358 * Enumerates the keys and values on this dictionary with the given block.
4360 * @param block The block to enumerate with.
4361 * **key**: The key for the current entry.
4362 * **value**: The value for the current entry
4363 * **stop**: A pointer to a boolean that when set stops the enumeration.
4365 - (void)enumerateKeysAndDoublesUsingBlock:
4366 (void (^)(BOOL key, double value, BOOL *stop))block;
4369 * Adds the keys and values from another dictionary.
4371 * @param otherDictionary Dictionary containing entries to be added to this
4374 - (void)addEntriesFromDictionary:(GPBBoolDoubleDictionary *)otherDictionary;
4377 * Sets the value for the given key.
4379 * @param value The value to set.
4380 * @param key The key under which to store the value.
4382 - (void)setDouble:(double)value forKey:(BOOL)key;
4385 * Removes the entry for the given key.
4387 * @param aKey Key to be removed from this dictionary.
4389 - (void)removeDoubleForKey:(BOOL)aKey;
4392 * Removes all entries in this dictionary.
4398 #pragma mark - Bool -> Enum
4401 * Class used for map fields of <BOOL, int32_t>
4402 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4404 * @note This class is not meant to be subclassed.
4406 @interface GPBBoolEnumDictionary : NSObject <NSCopying>
4408 /** Number of entries stored in this dictionary. */
4409 @property(nonatomic, readonly) NSUInteger count;
4410 /** The validation function to check if the enums are valid. */
4411 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
4414 * Initializes a dictionary with the given validation function.
4416 * @param func The enum validation function for the dictionary.
4418 * @return A newly initialized dictionary.
4420 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
4423 * Initializes a dictionary with the entries given.
4425 * @param func The enum validation function for the dictionary.
4426 * @param values The raw enum values values to be placed in the dictionary.
4427 * @param keys The keys under which to store the values.
4428 * @param count The number of entries to store in the dictionary.
4430 * @return A newly initialized dictionary with the keys and values in it.
4432 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
4433 rawValues:(const int32_t [__nullable])values
4434 forKeys:(const BOOL [__nullable])keys
4435 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4438 * Initializes a dictionary with the entries from the given.
4441 * @param dictionary Dictionary containing the entries to add to the dictionary.
4443 * @return A newly initialized dictionary with the entries from the given
4446 - (instancetype)initWithDictionary:(GPBBoolEnumDictionary *)dictionary;
4449 * Initializes a dictionary with the given capacity.
4451 * @param func The enum validation function for the dictionary.
4452 * @param numItems Capacity needed for the dictionary.
4454 * @return A newly initialized dictionary with the given capacity.
4456 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
4457 capacity:(NSUInteger)numItems;
4459 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
4460 // is not a valid enumerator as defined by validationFunc. If the actual value is
4461 // desired, use "raw" version of the method.
4464 * Gets the value for the given key.
4466 * @param value Pointer into which the value will be set, if found.
4467 * @param key Key under which the value is stored, if present.
4469 * @return YES if the key was found and the value was copied, NO otherwise.
4471 - (BOOL)getEnum:(nullable int32_t *)value forKey:(BOOL)key;
4474 * Enumerates the keys and values on this dictionary with the given block.
4476 * @param block The block to enumerate with.
4477 * **key**: The key for the current entry.
4478 * **value**: The value for the current entry
4479 * **stop**: A pointer to a boolean that when set stops the enumeration.
4481 - (void)enumerateKeysAndEnumsUsingBlock:
4482 (void (^)(BOOL key, int32_t value, BOOL *stop))block;
4485 * Gets the raw enum value for the given key.
4487 * @note This method bypass the validationFunc to enable the access of values that
4488 * were not known at the time the binary was compiled.
4490 * @param rawValue Pointer into which the value will be set, if found.
4491 * @param key Key under which the value is stored, if present.
4493 * @return YES if the key was found and the value was copied, NO otherwise.
4495 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(BOOL)key;
4498 * Enumerates the keys and values on this dictionary with the given block.
4500 * @note This method bypass the validationFunc to enable the access of values that
4501 * were not known at the time the binary was compiled.
4503 * @param block The block to enumerate with.
4504 * **key**: The key for the current entry.
4505 * **rawValue**: The value for the current entry
4506 * **stop**: A pointer to a boolean that when set stops the enumeration.
4508 - (void)enumerateKeysAndRawValuesUsingBlock:
4509 (void (^)(BOOL key, int32_t rawValue, BOOL *stop))block;
4512 * Adds the keys and raw enum values from another dictionary.
4514 * @note This method bypass the validationFunc to enable the setting of values that
4515 * were not known at the time the binary was compiled.
4517 * @param otherDictionary Dictionary containing entries to be added to this
4520 - (void)addRawEntriesFromDictionary:(GPBBoolEnumDictionary *)otherDictionary;
4522 // If value is not a valid enumerator as defined by validationFunc, these
4523 // methods will assert in debug, and will log in release and assign the value
4524 // to the default value. Use the rawValue methods below to assign non enumerator
4528 * Sets the value for the given key.
4530 * @param value The value to set.
4531 * @param key The key under which to store the value.
4533 - (void)setEnum:(int32_t)value forKey:(BOOL)key;
4536 * Sets the raw enum value for the given key.
4538 * @note This method bypass the validationFunc to enable the setting of values that
4539 * were not known at the time the binary was compiled.
4541 * @param rawValue The raw enum value to set.
4542 * @param key The key under which to store the raw enum value.
4544 - (void)setRawValue:(int32_t)rawValue forKey:(BOOL)key;
4547 * Removes the entry for the given key.
4549 * @param aKey Key to be removed from this dictionary.
4551 - (void)removeEnumForKey:(BOOL)aKey;
4554 * Removes all entries in this dictionary.
4560 #pragma mark - Bool -> Object
4563 * Class used for map fields of <BOOL, ObjectType>
4564 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4566 * @note This class is not meant to be subclassed.
4568 @interface GPBBoolObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
4570 /** Number of entries stored in this dictionary. */
4571 @property(nonatomic, readonly) NSUInteger count;
4574 * Initializes this dictionary, copying the given values and keys.
4576 * @param objects The values to be placed in this dictionary.
4577 * @param keys The keys under which to store the values.
4578 * @param count The number of elements to copy into the dictionary.
4580 * @return A newly initialized dictionary with a copy of the values and keys.
4582 - (instancetype)initWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects
4583 forKeys:(const BOOL [__nullable])keys
4584 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4587 * Initializes this dictionary, copying the entries from the given dictionary.
4589 * @param dictionary Dictionary containing the entries to add to this dictionary.
4591 * @return A newly initialized dictionary with the entries of the given dictionary.
4593 - (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary;
4596 * Initializes this dictionary with the requested capacity.
4598 * @param numItems Number of items needed for this dictionary.
4600 * @return A newly initialized dictionary with the requested capacity.
4602 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4605 * Fetches the object stored under the given key.
4607 * @param key Key under which the value is stored, if present.
4609 * @return The object if found, nil otherwise.
4611 - (ObjectType)objectForKey:(BOOL)key;
4614 * Enumerates the keys and values on this dictionary with the given block.
4616 * @param block The block to enumerate with.
4617 * **key**: The key for the current entry.
4618 * **object**: The value for the current entry
4619 * **stop**: A pointer to a boolean that when set stops the enumeration.
4621 - (void)enumerateKeysAndObjectsUsingBlock:
4622 (void (^)(BOOL key, ObjectType object, BOOL *stop))block;
4625 * Adds the keys and values from another dictionary.
4627 * @param otherDictionary Dictionary containing entries to be added to this
4630 - (void)addEntriesFromDictionary:(GPBBoolObjectDictionary *)otherDictionary;
4633 * Sets the value for the given key.
4635 * @param object The value to set.
4636 * @param key The key under which to store the value.
4638 - (void)setObject:(ObjectType)object forKey:(BOOL)key;
4641 * Removes the entry for the given key.
4643 * @param aKey Key to be removed from this dictionary.
4645 - (void)removeObjectForKey:(BOOL)aKey;
4648 * Removes all entries in this dictionary.
4654 #pragma mark - String -> UInt32
4657 * Class used for map fields of <NSString, uint32_t>
4658 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4660 * @note This class is not meant to be subclassed.
4662 @interface GPBStringUInt32Dictionary : NSObject <NSCopying>
4664 /** Number of entries stored in this dictionary. */
4665 @property(nonatomic, readonly) NSUInteger count;
4668 * Initializes this dictionary, copying the given values and keys.
4670 * @param values The values to be placed in this dictionary.
4671 * @param keys The keys under which to store the values.
4672 * @param count The number of elements to copy into the dictionary.
4674 * @return A newly initialized dictionary with a copy of the values and keys.
4676 - (instancetype)initWithUInt32s:(const uint32_t [__nullable])values
4677 forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
4678 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4681 * Initializes this dictionary, copying the entries from the given dictionary.
4683 * @param dictionary Dictionary containing the entries to add to this dictionary.
4685 * @return A newly initialized dictionary with the entries of the given dictionary.
4687 - (instancetype)initWithDictionary:(GPBStringUInt32Dictionary *)dictionary;
4690 * Initializes this dictionary with the requested capacity.
4692 * @param numItems Number of items needed for this dictionary.
4694 * @return A newly initialized dictionary with the requested capacity.
4696 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4699 * Gets the value for the given key.
4701 * @param value Pointer into which the value will be set, if found.
4702 * @param key Key under which the value is stored, if present.
4704 * @return YES if the key was found and the value was copied, NO otherwise.
4706 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(NSString *)key;
4709 * Enumerates the keys and values on this dictionary with the given block.
4711 * @param block The block to enumerate with.
4712 * **key**: The key for the current entry.
4713 * **value**: The value for the current entry
4714 * **stop**: A pointer to a boolean that when set stops the enumeration.
4716 - (void)enumerateKeysAndUInt32sUsingBlock:
4717 (void (^)(NSString *key, uint32_t value, BOOL *stop))block;
4720 * Adds the keys and values from another dictionary.
4722 * @param otherDictionary Dictionary containing entries to be added to this
4725 - (void)addEntriesFromDictionary:(GPBStringUInt32Dictionary *)otherDictionary;
4728 * Sets the value for the given key.
4730 * @param value The value to set.
4731 * @param key The key under which to store the value.
4733 - (void)setUInt32:(uint32_t)value forKey:(NSString *)key;
4736 * Removes the entry for the given key.
4738 * @param aKey Key to be removed from this dictionary.
4740 - (void)removeUInt32ForKey:(NSString *)aKey;
4743 * Removes all entries in this dictionary.
4749 #pragma mark - String -> Int32
4752 * Class used for map fields of <NSString, int32_t>
4753 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4755 * @note This class is not meant to be subclassed.
4757 @interface GPBStringInt32Dictionary : NSObject <NSCopying>
4759 /** Number of entries stored in this dictionary. */
4760 @property(nonatomic, readonly) NSUInteger count;
4763 * Initializes this dictionary, copying the given values and keys.
4765 * @param values The values to be placed in this dictionary.
4766 * @param keys The keys under which to store the values.
4767 * @param count The number of elements to copy into the dictionary.
4769 * @return A newly initialized dictionary with a copy of the values and keys.
4771 - (instancetype)initWithInt32s:(const int32_t [__nullable])values
4772 forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
4773 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4776 * Initializes this dictionary, copying the entries from the given dictionary.
4778 * @param dictionary Dictionary containing the entries to add to this dictionary.
4780 * @return A newly initialized dictionary with the entries of the given dictionary.
4782 - (instancetype)initWithDictionary:(GPBStringInt32Dictionary *)dictionary;
4785 * Initializes this dictionary with the requested capacity.
4787 * @param numItems Number of items needed for this dictionary.
4789 * @return A newly initialized dictionary with the requested capacity.
4791 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4794 * Gets the value for the given key.
4796 * @param value Pointer into which the value will be set, if found.
4797 * @param key Key under which the value is stored, if present.
4799 * @return YES if the key was found and the value was copied, NO otherwise.
4801 - (BOOL)getInt32:(nullable int32_t *)value forKey:(NSString *)key;
4804 * Enumerates the keys and values on this dictionary with the given block.
4806 * @param block The block to enumerate with.
4807 * **key**: The key for the current entry.
4808 * **value**: The value for the current entry
4809 * **stop**: A pointer to a boolean that when set stops the enumeration.
4811 - (void)enumerateKeysAndInt32sUsingBlock:
4812 (void (^)(NSString *key, int32_t value, BOOL *stop))block;
4815 * Adds the keys and values from another dictionary.
4817 * @param otherDictionary Dictionary containing entries to be added to this
4820 - (void)addEntriesFromDictionary:(GPBStringInt32Dictionary *)otherDictionary;
4823 * Sets the value for the given key.
4825 * @param value The value to set.
4826 * @param key The key under which to store the value.
4828 - (void)setInt32:(int32_t)value forKey:(NSString *)key;
4831 * Removes the entry for the given key.
4833 * @param aKey Key to be removed from this dictionary.
4835 - (void)removeInt32ForKey:(NSString *)aKey;
4838 * Removes all entries in this dictionary.
4844 #pragma mark - String -> UInt64
4847 * Class used for map fields of <NSString, uint64_t>
4848 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4850 * @note This class is not meant to be subclassed.
4852 @interface GPBStringUInt64Dictionary : NSObject <NSCopying>
4854 /** Number of entries stored in this dictionary. */
4855 @property(nonatomic, readonly) NSUInteger count;
4858 * Initializes this dictionary, copying the given values and keys.
4860 * @param values The values to be placed in this dictionary.
4861 * @param keys The keys under which to store the values.
4862 * @param count The number of elements to copy into the dictionary.
4864 * @return A newly initialized dictionary with a copy of the values and keys.
4866 - (instancetype)initWithUInt64s:(const uint64_t [__nullable])values
4867 forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
4868 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4871 * Initializes this dictionary, copying the entries from the given dictionary.
4873 * @param dictionary Dictionary containing the entries to add to this dictionary.
4875 * @return A newly initialized dictionary with the entries of the given dictionary.
4877 - (instancetype)initWithDictionary:(GPBStringUInt64Dictionary *)dictionary;
4880 * Initializes this dictionary with the requested capacity.
4882 * @param numItems Number of items needed for this dictionary.
4884 * @return A newly initialized dictionary with the requested capacity.
4886 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4889 * Gets the value for the given key.
4891 * @param value Pointer into which the value will be set, if found.
4892 * @param key Key under which the value is stored, if present.
4894 * @return YES if the key was found and the value was copied, NO otherwise.
4896 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(NSString *)key;
4899 * Enumerates the keys and values on this dictionary with the given block.
4901 * @param block The block to enumerate with.
4902 * **key**: The key for the current entry.
4903 * **value**: The value for the current entry
4904 * **stop**: A pointer to a boolean that when set stops the enumeration.
4906 - (void)enumerateKeysAndUInt64sUsingBlock:
4907 (void (^)(NSString *key, uint64_t value, BOOL *stop))block;
4910 * Adds the keys and values from another dictionary.
4912 * @param otherDictionary Dictionary containing entries to be added to this
4915 - (void)addEntriesFromDictionary:(GPBStringUInt64Dictionary *)otherDictionary;
4918 * Sets the value for the given key.
4920 * @param value The value to set.
4921 * @param key The key under which to store the value.
4923 - (void)setUInt64:(uint64_t)value forKey:(NSString *)key;
4926 * Removes the entry for the given key.
4928 * @param aKey Key to be removed from this dictionary.
4930 - (void)removeUInt64ForKey:(NSString *)aKey;
4933 * Removes all entries in this dictionary.
4939 #pragma mark - String -> Int64
4942 * Class used for map fields of <NSString, int64_t>
4943 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4945 * @note This class is not meant to be subclassed.
4947 @interface GPBStringInt64Dictionary : NSObject <NSCopying>
4949 /** Number of entries stored in this dictionary. */
4950 @property(nonatomic, readonly) NSUInteger count;
4953 * Initializes this dictionary, copying the given values and keys.
4955 * @param values The values to be placed in this dictionary.
4956 * @param keys The keys under which to store the values.
4957 * @param count The number of elements to copy into the dictionary.
4959 * @return A newly initialized dictionary with a copy of the values and keys.
4961 - (instancetype)initWithInt64s:(const int64_t [__nullable])values
4962 forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
4963 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4966 * Initializes this dictionary, copying the entries from the given dictionary.
4968 * @param dictionary Dictionary containing the entries to add to this dictionary.
4970 * @return A newly initialized dictionary with the entries of the given dictionary.
4972 - (instancetype)initWithDictionary:(GPBStringInt64Dictionary *)dictionary;
4975 * Initializes this dictionary with the requested capacity.
4977 * @param numItems Number of items needed for this dictionary.
4979 * @return A newly initialized dictionary with the requested capacity.
4981 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4984 * Gets the value for the given key.
4986 * @param value Pointer into which the value will be set, if found.
4987 * @param key Key under which the value is stored, if present.
4989 * @return YES if the key was found and the value was copied, NO otherwise.
4991 - (BOOL)getInt64:(nullable int64_t *)value forKey:(NSString *)key;
4994 * Enumerates the keys and values on this dictionary with the given block.
4996 * @param block The block to enumerate with.
4997 * **key**: The key for the current entry.
4998 * **value**: The value for the current entry
4999 * **stop**: A pointer to a boolean that when set stops the enumeration.
5001 - (void)enumerateKeysAndInt64sUsingBlock:
5002 (void (^)(NSString *key, int64_t value, BOOL *stop))block;
5005 * Adds the keys and values from another dictionary.
5007 * @param otherDictionary Dictionary containing entries to be added to this
5010 - (void)addEntriesFromDictionary:(GPBStringInt64Dictionary *)otherDictionary;
5013 * Sets the value for the given key.
5015 * @param value The value to set.
5016 * @param key The key under which to store the value.
5018 - (void)setInt64:(int64_t)value forKey:(NSString *)key;
5021 * Removes the entry for the given key.
5023 * @param aKey Key to be removed from this dictionary.
5025 - (void)removeInt64ForKey:(NSString *)aKey;
5028 * Removes all entries in this dictionary.
5034 #pragma mark - String -> Bool
5037 * Class used for map fields of <NSString, BOOL>
5038 * values. This performs better than boxing into NSNumbers in NSDictionaries.
5040 * @note This class is not meant to be subclassed.
5042 @interface GPBStringBoolDictionary : NSObject <NSCopying>
5044 /** Number of entries stored in this dictionary. */
5045 @property(nonatomic, readonly) NSUInteger count;
5048 * Initializes this dictionary, copying the given values and keys.
5050 * @param values The values to be placed in this dictionary.
5051 * @param keys The keys under which to store the values.
5052 * @param count The number of elements to copy into the dictionary.
5054 * @return A newly initialized dictionary with a copy of the values and keys.
5056 - (instancetype)initWithBools:(const BOOL [__nullable])values
5057 forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
5058 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5061 * Initializes this dictionary, copying the entries from the given dictionary.
5063 * @param dictionary Dictionary containing the entries to add to this dictionary.
5065 * @return A newly initialized dictionary with the entries of the given dictionary.
5067 - (instancetype)initWithDictionary:(GPBStringBoolDictionary *)dictionary;
5070 * Initializes this dictionary with the requested capacity.
5072 * @param numItems Number of items needed for this dictionary.
5074 * @return A newly initialized dictionary with the requested capacity.
5076 - (instancetype)initWithCapacity:(NSUInteger)numItems;
5079 * Gets the value for the given key.
5081 * @param value Pointer into which the value will be set, if found.
5082 * @param key Key under which the value is stored, if present.
5084 * @return YES if the key was found and the value was copied, NO otherwise.
5086 - (BOOL)getBool:(nullable BOOL *)value forKey:(NSString *)key;
5089 * Enumerates the keys and values on this dictionary with the given block.
5091 * @param block The block to enumerate with.
5092 * **key**: The key for the current entry.
5093 * **value**: The value for the current entry
5094 * **stop**: A pointer to a boolean that when set stops the enumeration.
5096 - (void)enumerateKeysAndBoolsUsingBlock:
5097 (void (^)(NSString *key, BOOL value, BOOL *stop))block;
5100 * Adds the keys and values from another dictionary.
5102 * @param otherDictionary Dictionary containing entries to be added to this
5105 - (void)addEntriesFromDictionary:(GPBStringBoolDictionary *)otherDictionary;
5108 * Sets the value for the given key.
5110 * @param value The value to set.
5111 * @param key The key under which to store the value.
5113 - (void)setBool:(BOOL)value forKey:(NSString *)key;
5116 * Removes the entry for the given key.
5118 * @param aKey Key to be removed from this dictionary.
5120 - (void)removeBoolForKey:(NSString *)aKey;
5123 * Removes all entries in this dictionary.
5129 #pragma mark - String -> Float
5132 * Class used for map fields of <NSString, float>
5133 * values. This performs better than boxing into NSNumbers in NSDictionaries.
5135 * @note This class is not meant to be subclassed.
5137 @interface GPBStringFloatDictionary : NSObject <NSCopying>
5139 /** Number of entries stored in this dictionary. */
5140 @property(nonatomic, readonly) NSUInteger count;
5143 * Initializes this dictionary, copying the given values and keys.
5145 * @param values The values to be placed in this dictionary.
5146 * @param keys The keys under which to store the values.
5147 * @param count The number of elements to copy into the dictionary.
5149 * @return A newly initialized dictionary with a copy of the values and keys.
5151 - (instancetype)initWithFloats:(const float [__nullable])values
5152 forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
5153 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5156 * Initializes this dictionary, copying the entries from the given dictionary.
5158 * @param dictionary Dictionary containing the entries to add to this dictionary.
5160 * @return A newly initialized dictionary with the entries of the given dictionary.
5162 - (instancetype)initWithDictionary:(GPBStringFloatDictionary *)dictionary;
5165 * Initializes this dictionary with the requested capacity.
5167 * @param numItems Number of items needed for this dictionary.
5169 * @return A newly initialized dictionary with the requested capacity.
5171 - (instancetype)initWithCapacity:(NSUInteger)numItems;
5174 * Gets the value for the given key.
5176 * @param value Pointer into which the value will be set, if found.
5177 * @param key Key under which the value is stored, if present.
5179 * @return YES if the key was found and the value was copied, NO otherwise.
5181 - (BOOL)getFloat:(nullable float *)value forKey:(NSString *)key;
5184 * Enumerates the keys and values on this dictionary with the given block.
5186 * @param block The block to enumerate with.
5187 * **key**: The key for the current entry.
5188 * **value**: The value for the current entry
5189 * **stop**: A pointer to a boolean that when set stops the enumeration.
5191 - (void)enumerateKeysAndFloatsUsingBlock:
5192 (void (^)(NSString *key, float value, BOOL *stop))block;
5195 * Adds the keys and values from another dictionary.
5197 * @param otherDictionary Dictionary containing entries to be added to this
5200 - (void)addEntriesFromDictionary:(GPBStringFloatDictionary *)otherDictionary;
5203 * Sets the value for the given key.
5205 * @param value The value to set.
5206 * @param key The key under which to store the value.
5208 - (void)setFloat:(float)value forKey:(NSString *)key;
5211 * Removes the entry for the given key.
5213 * @param aKey Key to be removed from this dictionary.
5215 - (void)removeFloatForKey:(NSString *)aKey;
5218 * Removes all entries in this dictionary.
5224 #pragma mark - String -> Double
5227 * Class used for map fields of <NSString, double>
5228 * values. This performs better than boxing into NSNumbers in NSDictionaries.
5230 * @note This class is not meant to be subclassed.
5232 @interface GPBStringDoubleDictionary : NSObject <NSCopying>
5234 /** Number of entries stored in this dictionary. */
5235 @property(nonatomic, readonly) NSUInteger count;
5238 * Initializes this dictionary, copying the given values and keys.
5240 * @param values The values to be placed in this dictionary.
5241 * @param keys The keys under which to store the values.
5242 * @param count The number of elements to copy into the dictionary.
5244 * @return A newly initialized dictionary with a copy of the values and keys.
5246 - (instancetype)initWithDoubles:(const double [__nullable])values
5247 forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
5248 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5251 * Initializes this dictionary, copying the entries from the given dictionary.
5253 * @param dictionary Dictionary containing the entries to add to this dictionary.
5255 * @return A newly initialized dictionary with the entries of the given dictionary.
5257 - (instancetype)initWithDictionary:(GPBStringDoubleDictionary *)dictionary;
5260 * Initializes this dictionary with the requested capacity.
5262 * @param numItems Number of items needed for this dictionary.
5264 * @return A newly initialized dictionary with the requested capacity.
5266 - (instancetype)initWithCapacity:(NSUInteger)numItems;
5269 * Gets the value for the given key.
5271 * @param value Pointer into which the value will be set, if found.
5272 * @param key Key under which the value is stored, if present.
5274 * @return YES if the key was found and the value was copied, NO otherwise.
5276 - (BOOL)getDouble:(nullable double *)value forKey:(NSString *)key;
5279 * Enumerates the keys and values on this dictionary with the given block.
5281 * @param block The block to enumerate with.
5282 * **key**: The key for the current entry.
5283 * **value**: The value for the current entry
5284 * **stop**: A pointer to a boolean that when set stops the enumeration.
5286 - (void)enumerateKeysAndDoublesUsingBlock:
5287 (void (^)(NSString *key, double value, BOOL *stop))block;
5290 * Adds the keys and values from another dictionary.
5292 * @param otherDictionary Dictionary containing entries to be added to this
5295 - (void)addEntriesFromDictionary:(GPBStringDoubleDictionary *)otherDictionary;
5298 * Sets the value for the given key.
5300 * @param value The value to set.
5301 * @param key The key under which to store the value.
5303 - (void)setDouble:(double)value forKey:(NSString *)key;
5306 * Removes the entry for the given key.
5308 * @param aKey Key to be removed from this dictionary.
5310 - (void)removeDoubleForKey:(NSString *)aKey;
5313 * Removes all entries in this dictionary.
5319 #pragma mark - String -> Enum
5322 * Class used for map fields of <NSString, int32_t>
5323 * values. This performs better than boxing into NSNumbers in NSDictionaries.
5325 * @note This class is not meant to be subclassed.
5327 @interface GPBStringEnumDictionary : NSObject <NSCopying>
5329 /** Number of entries stored in this dictionary. */
5330 @property(nonatomic, readonly) NSUInteger count;
5331 /** The validation function to check if the enums are valid. */
5332 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
5335 * Initializes a dictionary with the given validation function.
5337 * @param func The enum validation function for the dictionary.
5339 * @return A newly initialized dictionary.
5341 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
5344 * Initializes a dictionary with the entries given.
5346 * @param func The enum validation function for the dictionary.
5347 * @param values The raw enum values values to be placed in the dictionary.
5348 * @param keys The keys under which to store the values.
5349 * @param count The number of entries to store in the dictionary.
5351 * @return A newly initialized dictionary with the keys and values in it.
5353 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
5354 rawValues:(const int32_t [__nullable])values
5355 forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys
5356 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5359 * Initializes a dictionary with the entries from the given.
5362 * @param dictionary Dictionary containing the entries to add to the dictionary.
5364 * @return A newly initialized dictionary with the entries from the given
5367 - (instancetype)initWithDictionary:(GPBStringEnumDictionary *)dictionary;
5370 * Initializes a dictionary with the given capacity.
5372 * @param func The enum validation function for the dictionary.
5373 * @param numItems Capacity needed for the dictionary.
5375 * @return A newly initialized dictionary with the given capacity.
5377 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
5378 capacity:(NSUInteger)numItems;
5380 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
5381 // is not a valid enumerator as defined by validationFunc. If the actual value is
5382 // desired, use "raw" version of the method.
5385 * Gets the value for the given key.
5387 * @param value Pointer into which the value will be set, if found.
5388 * @param key Key under which the value is stored, if present.
5390 * @return YES if the key was found and the value was copied, NO otherwise.
5392 - (BOOL)getEnum:(nullable int32_t *)value forKey:(NSString *)key;
5395 * Enumerates the keys and values on this dictionary with the given block.
5397 * @param block The block to enumerate with.
5398 * **key**: The key for the current entry.
5399 * **value**: The value for the current entry
5400 * **stop**: A pointer to a boolean that when set stops the enumeration.
5402 - (void)enumerateKeysAndEnumsUsingBlock:
5403 (void (^)(NSString *key, int32_t value, BOOL *stop))block;
5406 * Gets the raw enum value for the given key.
5408 * @note This method bypass the validationFunc to enable the access of values that
5409 * were not known at the time the binary was compiled.
5411 * @param rawValue Pointer into which the value will be set, if found.
5412 * @param key Key under which the value is stored, if present.
5414 * @return YES if the key was found and the value was copied, NO otherwise.
5416 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(NSString *)key;
5419 * Enumerates the keys and values on this dictionary with the given block.
5421 * @note This method bypass the validationFunc to enable the access of values that
5422 * were not known at the time the binary was compiled.
5424 * @param block The block to enumerate with.
5425 * **key**: The key for the current entry.
5426 * **rawValue**: The value for the current entry
5427 * **stop**: A pointer to a boolean that when set stops the enumeration.
5429 - (void)enumerateKeysAndRawValuesUsingBlock:
5430 (void (^)(NSString *key, int32_t rawValue, BOOL *stop))block;
5433 * Adds the keys and raw enum values from another dictionary.
5435 * @note This method bypass the validationFunc to enable the setting of values that
5436 * were not known at the time the binary was compiled.
5438 * @param otherDictionary Dictionary containing entries to be added to this
5441 - (void)addRawEntriesFromDictionary:(GPBStringEnumDictionary *)otherDictionary;
5443 // If value is not a valid enumerator as defined by validationFunc, these
5444 // methods will assert in debug, and will log in release and assign the value
5445 // to the default value. Use the rawValue methods below to assign non enumerator
5449 * Sets the value for the given key.
5451 * @param value The value to set.
5452 * @param key The key under which to store the value.
5454 - (void)setEnum:(int32_t)value forKey:(NSString *)key;
5457 * Sets the raw enum value for the given key.
5459 * @note This method bypass the validationFunc to enable the setting of values that
5460 * were not known at the time the binary was compiled.
5462 * @param rawValue The raw enum value to set.
5463 * @param key The key under which to store the raw enum value.
5465 - (void)setRawValue:(int32_t)rawValue forKey:(NSString *)key;
5468 * Removes the entry for the given key.
5470 * @param aKey Key to be removed from this dictionary.
5472 - (void)removeEnumForKey:(NSString *)aKey;
5475 * Removes all entries in this dictionary.
5481 //%PDDM-EXPAND-END DECLARE_DICTIONARIES()
5483 NS_ASSUME_NONNULL_END
5485 //%PDDM-DEFINE DECLARE_DICTIONARIES()
5486 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt32, uint32_t)
5487 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int32, int32_t)
5488 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt64, uint64_t)
5489 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int64, int64_t)
5490 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Bool, BOOL)
5491 //%DICTIONARY_POD_INTERFACES_FOR_KEY(String, NSString, *, OBJECT)
5492 //%PDDM-DEFINE DICTIONARY_INTERFACES_FOR_POD_KEY(KEY_NAME, KEY_TYPE)
5493 //%DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, , POD)
5494 //%DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, Object, ObjectType)
5495 //%PDDM-DEFINE DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, KisP, KHELPER)
5496 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt32, uint32_t)
5497 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int32, int32_t)
5498 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt64, uint64_t)
5499 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int64, int64_t)
5500 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Bool, BOOL)
5501 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Float, float)
5502 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Double, double)
5503 //%DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Enum, int32_t)
5504 //%PDDM-DEFINE DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE)
5505 //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, POD, VALUE_NAME, value)
5506 //%PDDM-DEFINE DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, VALUE_NAME, VALUE_TYPE)
5507 //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, , POD, VALUE_NAME, VALUE_TYPE, OBJECT, Object, object)
5508 //%PDDM-DEFINE VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME)
5510 //% * Gets the value for the given key.
5512 //% * @param value Pointer into which the value will be set, if found.
5513 //% * @param key Key under which the value is stored, if present.
5515 //% * @return YES if the key was found and the value was copied, NO otherwise.
5517 //%- (BOOL)get##VNAME##:(nullable VALUE_TYPE *)value forKey:(KEY_TYPE)key;
5518 //%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_TYPE, VNAME)
5520 //% * Fetches the object stored under the given key.
5522 //% * @param key Key under which the value is stored, if present.
5524 //% * @return The object if found, nil otherwise.
5526 //%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key;
5527 //%PDDM-DEFINE VALUE_FOR_KEY_Enum(KEY_TYPE, VALUE_TYPE, VNAME)
5528 //%VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME)
5529 //%PDDM-DEFINE ARRAY_ARG_MODIFIERPOD()
5531 //%PDDM-DEFINE ARRAY_ARG_MODIFIEREnum()
5533 //%PDDM-DEFINE ARRAY_ARG_MODIFIEROBJECT()
5534 //%__nonnull GPB_UNSAFE_UNRETAINED ##
5535 //%PDDM-DEFINE DICTIONARY_CLASS_DECLPOD(KEY_NAME, VALUE_NAME, VALUE_TYPE)
5536 //%GPB##KEY_NAME##VALUE_NAME##Dictionary
5537 //%PDDM-DEFINE DICTIONARY_CLASS_DECLEnum(KEY_NAME, VALUE_NAME, VALUE_TYPE)
5538 //%GPB##KEY_NAME##VALUE_NAME##Dictionary
5539 //%PDDM-DEFINE DICTIONARY_CLASS_DECLOBJECT(KEY_NAME, VALUE_NAME, VALUE_TYPE)
5540 //%GPB##KEY_NAME##VALUE_NAME##Dictionary<__covariant VALUE_TYPE>
5541 //%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
5542 //%#pragma mark - KEY_NAME -> VALUE_NAME
5545 //% * Class used for map fields of <##KEY_TYPE##, ##VALUE_TYPE##>
5546 //% * values. This performs better than boxing into NSNumbers in NSDictionaries.
5548 //% * @note This class is not meant to be subclassed.
5550 //%@interface DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) : NSObject <NSCopying>
5552 //%/** Number of entries stored in this dictionary. */
5553 //%@property(nonatomic, readonly) NSUInteger count;
5556 //% * Initializes this dictionary, copying the given values and keys.
5558 //% * @param ##VNAME_VAR##s The values to be placed in this dictionary.
5559 //% * @param keys ##VNAME_VAR$S## The keys under which to store the values.
5560 //% * @param count ##VNAME_VAR$S## The number of elements to copy into the dictionary.
5562 //% * @return A newly initialized dictionary with a copy of the values and keys.
5564 //%- (instancetype)initWith##VNAME##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[__nullable])##VNAME_VAR##s
5565 //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[__nullable])keys
5566 //% ##VNAME$S## count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5569 //% * Initializes this dictionary, copying the entries from the given dictionary.
5571 //% * @param dictionary Dictionary containing the entries to add to this dictionary.
5573 //% * @return A newly initialized dictionary with the entries of the given dictionary.
5575 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
5578 //% * Initializes this dictionary with the requested capacity.
5580 //% * @param numItems Number of items needed for this dictionary.
5582 //% * @return A newly initialized dictionary with the requested capacity.
5584 //%- (instancetype)initWithCapacity:(NSUInteger)numItems;
5586 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
5589 //% * Adds the keys and values from another dictionary.
5591 //% * @param otherDictionary Dictionary containing entries to be added to this
5594 //%- (void)addEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary;
5596 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
5601 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE)
5602 //%DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, Enum)
5603 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER)
5604 //%#pragma mark - KEY_NAME -> VALUE_NAME
5607 //% * Class used for map fields of <##KEY_TYPE##, ##VALUE_TYPE##>
5608 //% * values. This performs better than boxing into NSNumbers in NSDictionaries.
5610 //% * @note This class is not meant to be subclassed.
5612 //%@interface GPB##KEY_NAME##VALUE_NAME##Dictionary : NSObject <NSCopying>
5614 //%/** Number of entries stored in this dictionary. */
5615 //%@property(nonatomic, readonly) NSUInteger count;
5616 //%/** The validation function to check if the enums are valid. */
5617 //%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
5620 //% * Initializes a dictionary with the given validation function.
5622 //% * @param func The enum validation function for the dictionary.
5624 //% * @return A newly initialized dictionary.
5626 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
5629 //% * Initializes a dictionary with the entries given.
5631 //% * @param func The enum validation function for the dictionary.
5632 //% * @param values The raw enum values values to be placed in the dictionary.
5633 //% * @param keys The keys under which to store the values.
5634 //% * @param count The number of entries to store in the dictionary.
5636 //% * @return A newly initialized dictionary with the keys and values in it.
5638 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
5639 //% rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[__nullable])values
5640 //% forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[__nullable])keys
5641 //% count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5644 //% * Initializes a dictionary with the entries from the given.
5647 //% * @param dictionary Dictionary containing the entries to add to the dictionary.
5649 //% * @return A newly initialized dictionary with the entries from the given
5650 //% * dictionary in it.
5652 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
5655 //% * Initializes a dictionary with the given capacity.
5657 //% * @param func The enum validation function for the dictionary.
5658 //% * @param numItems Capacity needed for the dictionary.
5660 //% * @return A newly initialized dictionary with the given capacity.
5662 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
5663 //% capacity:(NSUInteger)numItems;
5665 //%// These will return kGPBUnrecognizedEnumeratorValue if the value for the key
5666 //%// is not a valid enumerator as defined by validationFunc. If the actual value is
5667 //%// desired, use "raw" version of the method.
5669 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, Enum, value)
5672 //% * Gets the raw enum value for the given key.
5674 //% * @note This method bypass the validationFunc to enable the access of values that
5675 //% * were not known at the time the binary was compiled.
5677 //% * @param rawValue Pointer into which the value will be set, if found.
5678 //% * @param key Key under which the value is stored, if present.
5680 //% * @return YES if the key was found and the value was copied, NO otherwise.
5682 //%- (BOOL)getRawValue:(nullable VALUE_TYPE *)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key;
5685 //% * Enumerates the keys and values on this dictionary with the given block.
5687 //% * @note This method bypass the validationFunc to enable the access of values that
5688 //% * were not known at the time the binary was compiled.
5690 //% * @param block The block to enumerate with.
5691 //% * **key**: The key for the current entry.
5692 //% * **rawValue**: The value for the current entry
5693 //% * **stop**: A pointer to a boolean that when set stops the enumeration.
5695 //%- (void)enumerateKeysAndRawValuesUsingBlock:
5696 //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE rawValue, BOOL *stop))block;
5699 //% * Adds the keys and raw enum values from another dictionary.
5701 //% * @note This method bypass the validationFunc to enable the setting of values that
5702 //% * were not known at the time the binary was compiled.
5704 //% * @param otherDictionary Dictionary containing entries to be added to this
5707 //%- (void)addRawEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary;
5709 //%// If value is not a valid enumerator as defined by validationFunc, these
5710 //%// methods will assert in debug, and will log in release and assign the value
5711 //%// to the default value. Use the rawValue methods below to assign non enumerator
5714 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, Enum, value)
5719 //%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
5720 //%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_TYPE, VNAME)
5723 //% * Enumerates the keys and values on this dictionary with the given block.
5725 //% * @param block The block to enumerate with.
5726 //% * **key**: ##VNAME_VAR$S## The key for the current entry.
5727 //% * **VNAME_VAR**: The value for the current entry
5728 //% * **stop**: ##VNAME_VAR$S## A pointer to a boolean that when set stops the enumeration.
5730 //%- (void)enumerateKeysAnd##VNAME##sUsingBlock:
5731 //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME_VAR, BOOL *stop))block;
5733 //%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
5735 //% * Sets the value for the given key.
5737 //% * @param ##VNAME_VAR The value to set.
5738 //% * @param key ##VNAME_VAR$S## The key under which to store the value.
5740 //%- (void)set##VNAME##:(VALUE_TYPE)##VNAME_VAR forKey:(KEY_TYPE##KisP$S##KisP)key;
5741 //%DICTIONARY_EXTRA_MUTABLE_METHODS_##VHELPER(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
5743 //% * Removes the entry for the given key.
5745 //% * @param aKey Key to be removed from this dictionary.
5747 //%- (void)remove##VNAME##ForKey:(KEY_TYPE##KisP$S##KisP)aKey;
5750 //% * Removes all entries in this dictionary.
5752 //%- (void)removeAll;
5754 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_POD(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
5756 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_OBJECT(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
5758 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_Enum(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
5761 //% * Sets the raw enum value for the given key.
5763 //% * @note This method bypass the validationFunc to enable the setting of values that
5764 //% * were not known at the time the binary was compiled.
5766 //% * @param rawValue The raw enum value to set.
5767 //% * @param key The key under which to store the raw enum value.
5769 //%- (void)setRawValue:(VALUE_TYPE)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key;