aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Campamá <kaipi@google.com>2016-08-08 07:15:02 -0700
committerThomas Van Lenten <thomasvl@google.com>2016-08-08 10:15:02 -0400
commit32fadc0d4928c5f2d2c76fc4ddc39270673b7fa7 (patch)
treef74e367bf821c07eda9642c2fed0b8007fec5352
parent1102a8a7675d6b718e81b28a10173a2e073c3820 (diff)
downloadprotobuf-32fadc0d4928c5f2d2c76fc4ddc39270673b7fa7.tar.gz
protobuf-32fadc0d4928c5f2d2c76fc4ddc39270673b7fa7.tar.bz2
protobuf-32fadc0d4928c5f2d2c76fc4ddc39270673b7fa7.zip
Migrating documentation of the ObjectiveC runtime code to appledoc. (#1867)
Work for #1866 Migrates all the public class docs over to appledoc format. While Xcode is fine with blank lines in `///` comments, appledoc (used by cocoadocs) isn't and was leaving a bunch of info off the doc pages. The generator still needs to be updated to do this also; that will be a follow up CL.
-rw-r--r--objectivec/GPBArray.h1448
-rw-r--r--objectivec/GPBBootstrap.h37
-rw-r--r--objectivec/GPBCodedInputStream.h199
-rw-r--r--objectivec/GPBCodedOutputStream.h599
-rw-r--r--objectivec/GPBDescriptor.h153
-rw-r--r--objectivec/GPBDictionary.h6538
-rw-r--r--objectivec/GPBExtensionRegistry.h71
-rw-r--r--objectivec/GPBMessage.h525
-rw-r--r--objectivec/GPBRootObject.h13
-rw-r--r--objectivec/GPBRuntimeTypes.h72
-rw-r--r--objectivec/GPBUnknownField.h63
-rw-r--r--objectivec/GPBUnknownFieldSet.h47
-rw-r--r--objectivec/GPBUtilities.h493
-rw-r--r--objectivec/GPBWellKnownTypes.h40
14 files changed, 9524 insertions, 774 deletions
diff --git a/objectivec/GPBArray.h b/objectivec/GPBArray.h
index afda57f3..781cfb6f 100644
--- a/objectivec/GPBArray.h
+++ b/objectivec/GPBArray.h
@@ -32,11 +32,6 @@
#import "GPBRuntimeTypes.h"
-// These classes are used for repeated fields of basic data types. They are used because
-// they perform better than boxing into NSNumbers in NSArrays.
-
-// Note: These are not meant to be subclassed.
-
NS_ASSUME_NONNULL_BEGIN
//%PDDM-EXPAND DECLARE_ARRAYS()
@@ -44,39 +39,171 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Int32
+/**
+ * Class used for repeated fields of int32_t values. This performs better than
+ * boxing into NSNumbers in NSArrays.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt32Array : NSObject <NSCopying>
+/** The number of elements contained in the array. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty GPBInt32Array.
+ **/
+ (instancetype)array;
+
+/**
+ * Creates and initializes a GPBInt32Array with the single element given.
+ *
+ * @param value The value to be placed in the array.
+ *
+ * @return A newly instanced GPBInt32Array with value in it.
+ **/
+ (instancetype)arrayWithValue:(int32_t)value;
+
+/**
+ * Creates and initializes a GPBInt32Array with the contents of the given
+ * array.
+ *
+ * @param array Array with the contents to be put into the new array.
+ *
+ * @return A newly instanced GPBInt32Array with the contents of array.
+ **/
+ (instancetype)arrayWithValueArray:(GPBInt32Array *)array;
+
+/**
+ * Creates and initializes a GPBInt32Array with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly instanced GPBInt32Array with a capacity of count.
+ **/
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
+/**
+ * @return A newly initialized and empty GPBInt32Array.
+ **/
- (instancetype)init NS_DESIGNATED_INITIALIZER;
-// Initializes the array, copying the values.
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param values An array with the values to put inside this array.
+ * @param count The number of elements to copy into the array.
+ *
+ * @return A newly initialized GPBInt32Array with a copy of the values.
+ **/
- (instancetype)initWithValues:(const int32_t [])values
count:(NSUInteger)count;
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param array An array with the values to put inside this array.
+ *
+ * @return A newly initialized GPBInt32Array with a copy of the values.
+ **/
- (instancetype)initWithValueArray:(GPBInt32Array *)array;
+
+/**
+ * Initializes the array with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly initialized GPBInt32Array with a capacity of count.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)count;
+/**
+ * Gets the value at the given index.
+ *
+ * @param index The index of the value to get.
+ *
+ * @return The value at the given index.
+ **/
- (int32_t)valueAtIndex:(NSUInteger)index;
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
+
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param opts Options to control the enumeration.
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
usingBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
+/**
+ * Adds a value to this array.
+ *
+ * @param value The value to add to this array.
+ **/
- (void)addValue:(int32_t)value;
+
+/**
+ * Adds values to this array.
+ *
+ * @param values The values to add to this array.
+ * @param count The number of elements to add.
+ **/
- (void)addValues:(const int32_t [])values count:(NSUInteger)count;
+
+/**
+ * Adds the values from the given array to this array.
+ *
+ * @param array The array containing the elements to add to this array.
+ **/
- (void)addValuesFromArray:(GPBInt32Array *)array;
+/**
+ * Inserts a value into the given position.
+ *
+ * @param value The value to add to this array.
+ * @param index The index into which to insert the value.
+ **/
- (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
+/**
+ * Replaces the value at the given index with the given value.
+ *
+ * @param index The index for which to replace the value.
+ * @param value The value to replace with.
+ **/
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
+/**
+ * Removes the value at the given index.
+ *
+ * @param index The index of the value to remove.
+ **/
- (void)removeValueAtIndex:(NSUInteger)index;
+
+/**
+ * Removes all the values from this array.
+ **/
- (void)removeAll;
+/**
+ * Exchanges the values between the given indexes.
+ *
+ * @param idx1 The index of the first element to exchange.
+ * @param idx2 The index of the second element to exchange.
+ **/
- (void)exchangeValueAtIndex:(NSUInteger)idx1
withValueAtIndex:(NSUInteger)idx2;
@@ -84,39 +211,171 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - UInt32
+/**
+ * Class used for repeated fields of uint32_t values. This performs better than
+ * boxing into NSNumbers in NSArrays.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt32Array : NSObject <NSCopying>
+/** The number of elements contained in the array. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty GPBUInt32Array.
+ **/
+ (instancetype)array;
+
+/**
+ * Creates and initializes a GPBUInt32Array with the single element given.
+ *
+ * @param value The value to be placed in the array.
+ *
+ * @return A newly instanced GPBUInt32Array with value in it.
+ **/
+ (instancetype)arrayWithValue:(uint32_t)value;
+
+/**
+ * Creates and initializes a GPBUInt32Array with the contents of the given
+ * array.
+ *
+ * @param array Array with the contents to be put into the new array.
+ *
+ * @return A newly instanced GPBUInt32Array with the contents of array.
+ **/
+ (instancetype)arrayWithValueArray:(GPBUInt32Array *)array;
+
+/**
+ * Creates and initializes a GPBUInt32Array with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly instanced GPBUInt32Array with a capacity of count.
+ **/
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
+/**
+ * @return A newly initialized and empty GPBUInt32Array.
+ **/
- (instancetype)init NS_DESIGNATED_INITIALIZER;
-// Initializes the array, copying the values.
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param values An array with the values to put inside this array.
+ * @param count The number of elements to copy into the array.
+ *
+ * @return A newly initialized GPBUInt32Array with a copy of the values.
+ **/
- (instancetype)initWithValues:(const uint32_t [])values
count:(NSUInteger)count;
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param array An array with the values to put inside this array.
+ *
+ * @return A newly initialized GPBUInt32Array with a copy of the values.
+ **/
- (instancetype)initWithValueArray:(GPBUInt32Array *)array;
+
+/**
+ * Initializes the array with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly initialized GPBUInt32Array with a capacity of count.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)count;
+/**
+ * Gets the value at the given index.
+ *
+ * @param index The index of the value to get.
+ *
+ * @return The value at the given index.
+ **/
- (uint32_t)valueAtIndex:(NSUInteger)index;
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithBlock:(void (^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
+
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param opts Options to control the enumeration.
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
usingBlock:(void (^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
+/**
+ * Adds a value to this array.
+ *
+ * @param value The value to add to this array.
+ **/
- (void)addValue:(uint32_t)value;
+
+/**
+ * Adds values to this array.
+ *
+ * @param values The values to add to this array.
+ * @param count The number of elements to add.
+ **/
- (void)addValues:(const uint32_t [])values count:(NSUInteger)count;
+
+/**
+ * Adds the values from the given array to this array.
+ *
+ * @param array The array containing the elements to add to this array.
+ **/
- (void)addValuesFromArray:(GPBUInt32Array *)array;
+/**
+ * Inserts a value into the given position.
+ *
+ * @param value The value to add to this array.
+ * @param index The index into which to insert the value.
+ **/
- (void)insertValue:(uint32_t)value atIndex:(NSUInteger)index;
+/**
+ * Replaces the value at the given index with the given value.
+ *
+ * @param index The index for which to replace the value.
+ * @param value The value to replace with.
+ **/
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint32_t)value;
+/**
+ * Removes the value at the given index.
+ *
+ * @param index The index of the value to remove.
+ **/
- (void)removeValueAtIndex:(NSUInteger)index;
+
+/**
+ * Removes all the values from this array.
+ **/
- (void)removeAll;
+/**
+ * Exchanges the values between the given indexes.
+ *
+ * @param idx1 The index of the first element to exchange.
+ * @param idx2 The index of the second element to exchange.
+ **/
- (void)exchangeValueAtIndex:(NSUInteger)idx1
withValueAtIndex:(NSUInteger)idx2;
@@ -124,39 +383,171 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Int64
+/**
+ * Class used for repeated fields of int64_t values. This performs better than
+ * boxing into NSNumbers in NSArrays.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt64Array : NSObject <NSCopying>
+/** The number of elements contained in the array. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty GPBInt64Array.
+ **/
+ (instancetype)array;
+
+/**
+ * Creates and initializes a GPBInt64Array with the single element given.
+ *
+ * @param value The value to be placed in the array.
+ *
+ * @return A newly instanced GPBInt64Array with value in it.
+ **/
+ (instancetype)arrayWithValue:(int64_t)value;
+
+/**
+ * Creates and initializes a GPBInt64Array with the contents of the given
+ * array.
+ *
+ * @param array Array with the contents to be put into the new array.
+ *
+ * @return A newly instanced GPBInt64Array with the contents of array.
+ **/
+ (instancetype)arrayWithValueArray:(GPBInt64Array *)array;
+
+/**
+ * Creates and initializes a GPBInt64Array with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly instanced GPBInt64Array with a capacity of count.
+ **/
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
+/**
+ * @return A newly initialized and empty GPBInt64Array.
+ **/
- (instancetype)init NS_DESIGNATED_INITIALIZER;
-// Initializes the array, copying the values.
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param values An array with the values to put inside this array.
+ * @param count The number of elements to copy into the array.
+ *
+ * @return A newly initialized GPBInt64Array with a copy of the values.
+ **/
- (instancetype)initWithValues:(const int64_t [])values
count:(NSUInteger)count;
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param array An array with the values to put inside this array.
+ *
+ * @return A newly initialized GPBInt64Array with a copy of the values.
+ **/
- (instancetype)initWithValueArray:(GPBInt64Array *)array;
+
+/**
+ * Initializes the array with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly initialized GPBInt64Array with a capacity of count.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)count;
+/**
+ * Gets the value at the given index.
+ *
+ * @param index The index of the value to get.
+ *
+ * @return The value at the given index.
+ **/
- (int64_t)valueAtIndex:(NSUInteger)index;
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithBlock:(void (^)(int64_t value, NSUInteger idx, BOOL *stop))block;
+
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param opts Options to control the enumeration.
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
usingBlock:(void (^)(int64_t value, NSUInteger idx, BOOL *stop))block;
+/**
+ * Adds a value to this array.
+ *
+ * @param value The value to add to this array.
+ **/
- (void)addValue:(int64_t)value;
+
+/**
+ * Adds values to this array.
+ *
+ * @param values The values to add to this array.
+ * @param count The number of elements to add.
+ **/
- (void)addValues:(const int64_t [])values count:(NSUInteger)count;
+
+/**
+ * Adds the values from the given array to this array.
+ *
+ * @param array The array containing the elements to add to this array.
+ **/
- (void)addValuesFromArray:(GPBInt64Array *)array;
+/**
+ * Inserts a value into the given position.
+ *
+ * @param value The value to add to this array.
+ * @param index The index into which to insert the value.
+ **/
- (void)insertValue:(int64_t)value atIndex:(NSUInteger)index;
+/**
+ * Replaces the value at the given index with the given value.
+ *
+ * @param index The index for which to replace the value.
+ * @param value The value to replace with.
+ **/
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int64_t)value;
+/**
+ * Removes the value at the given index.
+ *
+ * @param index The index of the value to remove.
+ **/
- (void)removeValueAtIndex:(NSUInteger)index;
+
+/**
+ * Removes all the values from this array.
+ **/
- (void)removeAll;
+/**
+ * Exchanges the values between the given indexes.
+ *
+ * @param idx1 The index of the first element to exchange.
+ * @param idx2 The index of the second element to exchange.
+ **/
- (void)exchangeValueAtIndex:(NSUInteger)idx1
withValueAtIndex:(NSUInteger)idx2;
@@ -164,39 +555,171 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - UInt64
+/**
+ * Class used for repeated fields of uint64_t values. This performs better than
+ * boxing into NSNumbers in NSArrays.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt64Array : NSObject <NSCopying>
+/** The number of elements contained in the array. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty GPBUInt64Array.
+ **/
+ (instancetype)array;
+
+/**
+ * Creates and initializes a GPBUInt64Array with the single element given.
+ *
+ * @param value The value to be placed in the array.
+ *
+ * @return A newly instanced GPBUInt64Array with value in it.
+ **/
+ (instancetype)arrayWithValue:(uint64_t)value;
+
+/**
+ * Creates and initializes a GPBUInt64Array with the contents of the given
+ * array.
+ *
+ * @param array Array with the contents to be put into the new array.
+ *
+ * @return A newly instanced GPBUInt64Array with the contents of array.
+ **/
+ (instancetype)arrayWithValueArray:(GPBUInt64Array *)array;
+
+/**
+ * Creates and initializes a GPBUInt64Array with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly instanced GPBUInt64Array with a capacity of count.
+ **/
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
+/**
+ * @return A newly initialized and empty GPBUInt64Array.
+ **/
- (instancetype)init NS_DESIGNATED_INITIALIZER;
-// Initializes the array, copying the values.
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param values An array with the values to put inside this array.
+ * @param count The number of elements to copy into the array.
+ *
+ * @return A newly initialized GPBUInt64Array with a copy of the values.
+ **/
- (instancetype)initWithValues:(const uint64_t [])values
count:(NSUInteger)count;
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param array An array with the values to put inside this array.
+ *
+ * @return A newly initialized GPBUInt64Array with a copy of the values.
+ **/
- (instancetype)initWithValueArray:(GPBUInt64Array *)array;
+
+/**
+ * Initializes the array with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly initialized GPBUInt64Array with a capacity of count.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)count;
+/**
+ * Gets the value at the given index.
+ *
+ * @param index The index of the value to get.
+ *
+ * @return The value at the given index.
+ **/
- (uint64_t)valueAtIndex:(NSUInteger)index;
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithBlock:(void (^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
+
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param opts Options to control the enumeration.
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
usingBlock:(void (^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
+/**
+ * Adds a value to this array.
+ *
+ * @param value The value to add to this array.
+ **/
- (void)addValue:(uint64_t)value;
+
+/**
+ * Adds values to this array.
+ *
+ * @param values The values to add to this array.
+ * @param count The number of elements to add.
+ **/
- (void)addValues:(const uint64_t [])values count:(NSUInteger)count;
+
+/**
+ * Adds the values from the given array to this array.
+ *
+ * @param array The array containing the elements to add to this array.
+ **/
- (void)addValuesFromArray:(GPBUInt64Array *)array;
+/**
+ * Inserts a value into the given position.
+ *
+ * @param value The value to add to this array.
+ * @param index The index into which to insert the value.
+ **/
- (void)insertValue:(uint64_t)value atIndex:(NSUInteger)index;
+/**
+ * Replaces the value at the given index with the given value.
+ *
+ * @param index The index for which to replace the value.
+ * @param value The value to replace with.
+ **/
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint64_t)value;
+/**
+ * Removes the value at the given index.
+ *
+ * @param index The index of the value to remove.
+ **/
- (void)removeValueAtIndex:(NSUInteger)index;
+
+/**
+ * Removes all the values from this array.
+ **/
- (void)removeAll;
+/**
+ * Exchanges the values between the given indexes.
+ *
+ * @param idx1 The index of the first element to exchange.
+ * @param idx2 The index of the second element to exchange.
+ **/
- (void)exchangeValueAtIndex:(NSUInteger)idx1
withValueAtIndex:(NSUInteger)idx2;
@@ -204,39 +727,171 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Float
+/**
+ * Class used for repeated fields of float values. This performs better than
+ * boxing into NSNumbers in NSArrays.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBFloatArray : NSObject <NSCopying>
+/** The number of elements contained in the array. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty GPBFloatArray.
+ **/
+ (instancetype)array;
+
+/**
+ * Creates and initializes a GPBFloatArray with the single element given.
+ *
+ * @param value The value to be placed in the array.
+ *
+ * @return A newly instanced GPBFloatArray with value in it.
+ **/
+ (instancetype)arrayWithValue:(float)value;
+
+/**
+ * Creates and initializes a GPBFloatArray with the contents of the given
+ * array.
+ *
+ * @param array Array with the contents to be put into the new array.
+ *
+ * @return A newly instanced GPBFloatArray with the contents of array.
+ **/
+ (instancetype)arrayWithValueArray:(GPBFloatArray *)array;
+
+/**
+ * Creates and initializes a GPBFloatArray with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly instanced GPBFloatArray with a capacity of count.
+ **/
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
+/**
+ * @return A newly initialized and empty GPBFloatArray.
+ **/
- (instancetype)init NS_DESIGNATED_INITIALIZER;
-// Initializes the array, copying the values.
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param values An array with the values to put inside this array.
+ * @param count The number of elements to copy into the array.
+ *
+ * @return A newly initialized GPBFloatArray with a copy of the values.
+ **/
- (instancetype)initWithValues:(const float [])values
count:(NSUInteger)count;
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param array An array with the values to put inside this array.
+ *
+ * @return A newly initialized GPBFloatArray with a copy of the values.
+ **/
- (instancetype)initWithValueArray:(GPBFloatArray *)array;
+
+/**
+ * Initializes the array with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly initialized GPBFloatArray with a capacity of count.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)count;
+/**
+ * Gets the value at the given index.
+ *
+ * @param index The index of the value to get.
+ *
+ * @return The value at the given index.
+ **/
- (float)valueAtIndex:(NSUInteger)index;
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithBlock:(void (^)(float value, NSUInteger idx, BOOL *stop))block;
+
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param opts Options to control the enumeration.
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
usingBlock:(void (^)(float value, NSUInteger idx, BOOL *stop))block;
+/**
+ * Adds a value to this array.
+ *
+ * @param value The value to add to this array.
+ **/
- (void)addValue:(float)value;
+
+/**
+ * Adds values to this array.
+ *
+ * @param values The values to add to this array.
+ * @param count The number of elements to add.
+ **/
- (void)addValues:(const float [])values count:(NSUInteger)count;
+
+/**
+ * Adds the values from the given array to this array.
+ *
+ * @param array The array containing the elements to add to this array.
+ **/
- (void)addValuesFromArray:(GPBFloatArray *)array;
+/**
+ * Inserts a value into the given position.
+ *
+ * @param value The value to add to this array.
+ * @param index The index into which to insert the value.
+ **/
- (void)insertValue:(float)value atIndex:(NSUInteger)index;
+/**
+ * Replaces the value at the given index with the given value.
+ *
+ * @param index The index for which to replace the value.
+ * @param value The value to replace with.
+ **/
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(float)value;
+/**
+ * Removes the value at the given index.
+ *
+ * @param index The index of the value to remove.
+ **/
- (void)removeValueAtIndex:(NSUInteger)index;
+
+/**
+ * Removes all the values from this array.
+ **/
- (void)removeAll;
+/**
+ * Exchanges the values between the given indexes.
+ *
+ * @param idx1 The index of the first element to exchange.
+ * @param idx2 The index of the second element to exchange.
+ **/
- (void)exchangeValueAtIndex:(NSUInteger)idx1
withValueAtIndex:(NSUInteger)idx2;
@@ -244,39 +899,171 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Double
+/**
+ * Class used for repeated fields of double values. This performs better than
+ * boxing into NSNumbers in NSArrays.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBDoubleArray : NSObject <NSCopying>
+/** The number of elements contained in the array. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty GPBDoubleArray.
+ **/
+ (instancetype)array;
+
+/**
+ * Creates and initializes a GPBDoubleArray with the single element given.
+ *
+ * @param value The value to be placed in the array.
+ *
+ * @return A newly instanced GPBDoubleArray with value in it.
+ **/
+ (instancetype)arrayWithValue:(double)value;
+
+/**
+ * Creates and initializes a GPBDoubleArray with the contents of the given
+ * array.
+ *
+ * @param array Array with the contents to be put into the new array.
+ *
+ * @return A newly instanced GPBDoubleArray with the contents of array.
+ **/
+ (instancetype)arrayWithValueArray:(GPBDoubleArray *)array;
+
+/**
+ * Creates and initializes a GPBDoubleArray with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly instanced GPBDoubleArray with a capacity of count.
+ **/
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
+/**
+ * @return A newly initialized and empty GPBDoubleArray.
+ **/
- (instancetype)init NS_DESIGNATED_INITIALIZER;
-// Initializes the array, copying the values.
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param values An array with the values to put inside this array.
+ * @param count The number of elements to copy into the array.
+ *
+ * @return A newly initialized GPBDoubleArray with a copy of the values.
+ **/
- (instancetype)initWithValues:(const double [])values
count:(NSUInteger)count;
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param array An array with the values to put inside this array.
+ *
+ * @return A newly initialized GPBDoubleArray with a copy of the values.
+ **/
- (instancetype)initWithValueArray:(GPBDoubleArray *)array;
+
+/**
+ * Initializes the array with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly initialized GPBDoubleArray with a capacity of count.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)count;
+/**
+ * Gets the value at the given index.
+ *
+ * @param index The index of the value to get.
+ *
+ * @return The value at the given index.
+ **/
- (double)valueAtIndex:(NSUInteger)index;
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithBlock:(void (^)(double value, NSUInteger idx, BOOL *stop))block;
+
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param opts Options to control the enumeration.
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
usingBlock:(void (^)(double value, NSUInteger idx, BOOL *stop))block;
+/**
+ * Adds a value to this array.
+ *
+ * @param value The value to add to this array.
+ **/
- (void)addValue:(double)value;
+
+/**
+ * Adds values to this array.
+ *
+ * @param values The values to add to this array.
+ * @param count The number of elements to add.
+ **/
- (void)addValues:(const double [])values count:(NSUInteger)count;
+
+/**
+ * Adds the values from the given array to this array.
+ *
+ * @param array The array containing the elements to add to this array.
+ **/
- (void)addValuesFromArray:(GPBDoubleArray *)array;
+/**
+ * Inserts a value into the given position.
+ *
+ * @param value The value to add to this array.
+ * @param index The index into which to insert the value.
+ **/
- (void)insertValue:(double)value atIndex:(NSUInteger)index;
+/**
+ * Replaces the value at the given index with the given value.
+ *
+ * @param index The index for which to replace the value.
+ * @param value The value to replace with.
+ **/
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(double)value;
+/**
+ * Removes the value at the given index.
+ *
+ * @param index The index of the value to remove.
+ **/
- (void)removeValueAtIndex:(NSUInteger)index;
+
+/**
+ * Removes all the values from this array.
+ **/
- (void)removeAll;
+/**
+ * Exchanges the values between the given indexes.
+ *
+ * @param idx1 The index of the first element to exchange.
+ * @param idx2 The index of the second element to exchange.
+ **/
- (void)exchangeValueAtIndex:(NSUInteger)idx1
withValueAtIndex:(NSUInteger)idx2;
@@ -284,39 +1071,171 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Bool
+/**
+ * Class used for repeated fields of BOOL values. This performs better than
+ * boxing into NSNumbers in NSArrays.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBBoolArray : NSObject <NSCopying>
+/** The number of elements contained in the array. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty GPBBoolArray.
+ **/
+ (instancetype)array;
+
+/**
+ * Creates and initializes a GPBBoolArray with the single element given.
+ *
+ * @param value The value to be placed in the array.
+ *
+ * @return A newly instanced GPBBoolArray with value in it.
+ **/
+ (instancetype)arrayWithValue:(BOOL)value;
+
+/**
+ * Creates and initializes a GPBBoolArray with the contents of the given
+ * array.
+ *
+ * @param array Array with the contents to be put into the new array.
+ *
+ * @return A newly instanced GPBBoolArray with the contents of array.
+ **/
+ (instancetype)arrayWithValueArray:(GPBBoolArray *)array;
+
+/**
+ * Creates and initializes a GPBBoolArray with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly instanced GPBBoolArray with a capacity of count.
+ **/
+ (instancetype)arrayWithCapacity:(NSUInteger)count;
+/**
+ * @return A newly initialized and empty GPBBoolArray.
+ **/
- (instancetype)init NS_DESIGNATED_INITIALIZER;
-// Initializes the array, copying the values.
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param values An array with the values to put inside this array.
+ * @param count The number of elements to copy into the array.
+ *
+ * @return A newly initialized GPBBoolArray with a copy of the values.
+ **/
- (instancetype)initWithValues:(const BOOL [])values
count:(NSUInteger)count;
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param array An array with the values to put inside this array.
+ *
+ * @return A newly initialized GPBBoolArray with a copy of the values.
+ **/
- (instancetype)initWithValueArray:(GPBBoolArray *)array;
+
+/**
+ * Initializes the array with the given capacity.
+ *
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly initialized GPBBoolArray with a capacity of count.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)count;
+/**
+ * Gets the value at the given index.
+ *
+ * @param index The index of the value to get.
+ *
+ * @return The value at the given index.
+ **/
- (BOOL)valueAtIndex:(NSUInteger)index;
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithBlock:(void (^)(BOOL value, NSUInteger idx, BOOL *stop))block;
+
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param opts Options to control the enumeration.
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
usingBlock:(void (^)(BOOL value, NSUInteger idx, BOOL *stop))block;
+/**
+ * Adds a value to this array.
+ *
+ * @param value The value to add to this array.
+ **/
- (void)addValue:(BOOL)value;
+
+/**
+ * Adds values to this array.
+ *
+ * @param values The values to add to this array.
+ * @param count The number of elements to add.
+ **/
- (void)addValues:(const BOOL [])values count:(NSUInteger)count;
+
+/**
+ * Adds the values from the given array to this array.
+ *
+ * @param array The array containing the elements to add to this array.
+ **/
- (void)addValuesFromArray:(GPBBoolArray *)array;
+/**
+ * Inserts a value into the given position.
+ *
+ * @param value The value to add to this array.
+ * @param index The index into which to insert the value.
+ **/
- (void)insertValue:(BOOL)value atIndex:(NSUInteger)index;
+/**
+ * Replaces the value at the given index with the given value.
+ *
+ * @param index The index for which to replace the value.
+ * @param value The value to replace with.
+ **/
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(BOOL)value;
+/**
+ * Removes the value at the given index.
+ *
+ * @param index The index of the value to remove.
+ **/
- (void)removeValueAtIndex:(NSUInteger)index;
+
+/**
+ * Removes all the values from this array.
+ **/
- (void)removeAll;
+/**
+ * Exchanges the values between the given indexes.
+ *
+ * @param idx1 The index of the first element to exchange.
+ * @param idx2 The index of the second element to exchange.
+ **/
- (void)exchangeValueAtIndex:(NSUInteger)idx1
withValueAtIndex:(NSUInteger)idx2;
@@ -324,27 +1243,108 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Enum
+/**
+ * This class is used for repeated fields of int32_t values. This performs
+ * better than boxing into NSNumbers in NSArrays.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBEnumArray : NSObject <NSCopying>
+/** The number of elements contained in the array. */
@property(nonatomic, readonly) NSUInteger count;
+/** The validation function to check if the enums are valid. */
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
+/**
+ * @return A newly instanced and empty GPBEnumArray.
+ **/
+ (instancetype)array;
+
+/**
+ * Creates and initializes a GPBEnumArray with the enum validation function
+ * given.
+ *
+ * @param func The enum validation function for the array.
+ *
+ * @return A newly instanced GPBEnumArray.
+ **/
+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+
+/**
+ * Creates and initializes a GPBEnumArray with the enum validation function
+ * given and the single raw value given.
+ *
+ * @param func The enum validation function for the array.
+ * @param value The raw value to add to this array.
+ *
+ * @return A newly instanced GPBEnumArray.
+ **/
+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValue:(int32_t)value;
+
+/**
+ * Creates and initializes a GPBEnumArray that adds the elements from the
+ * given array.
+ *
+ * @param array Array containing the values to add to the new array.
+ *
+ * @return A newly instanced GPBEnumArray.
+ **/
+ (instancetype)arrayWithValueArray:(GPBEnumArray *)array;
+
+/**
+ * Creates and initializes a GPBEnumArray with the given enum validation
+ * function and with the givencapacity.
+ *
+ * @param func The enum validation function for the array.
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly instanced GPBEnumArray with a capacity of count.
+ **/
+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)count;
+/**
+ * Initializes the array with the given enum validation function.
+ *
+ * @param func The enum validation function for the array.
+ *
+ * @return A newly initialized GPBEnumArray with a copy of the values.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
NS_DESIGNATED_INITIALIZER;
-// Initializes the array, copying the values.
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param func The enum validation function for the array.
+ * @param values An array with the values to put inside this array.
+ * @param count The number of elements to copy into the array.
+ *
+ * @return A newly initialized GPBEnumArray with a copy of the values.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
count:(NSUInteger)count;
+
+/**
+ * Initializes the array, copying the given values.
+ *
+ * @param array An array with the values to put inside this array.
+ *
+ * @return A newly initialized GPBEnumArray with a copy of the values.
+ **/
- (instancetype)initWithValueArray:(GPBEnumArray *)array;
+
+/**
+ * Initializes the array with the given capacity.
+ *
+ * @param func The enum validation function for the array.
+ * @param count The capacity needed for the array.
+ *
+ * @return A newly initialized GPBEnumArray with a capacity of count.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)count;
@@ -352,18 +1352,68 @@ NS_ASSUME_NONNULL_BEGIN
// valid enumerator as defined by validationFunc. If the actual value is
// desired, use "raw" version of the method.
+/**
+ * Gets the value at the given index.
+ *
+ * @param index The index of the value to get.
+ *
+ * @return The value at the given index.
+ **/
- (int32_t)valueAtIndex:(NSUInteger)index;
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
+
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param opts Options to control the enumeration.
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
usingBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
// These methods bypass the validationFunc to provide access to values that were not
// known at the time the binary was compiled.
+/**
+ * Gets the raw enum value at the given index.
+ *
+ * @param index The index of the raw enum value to get.
+ *
+ * @return The raw enum value at the given index.
+ **/
- (int32_t)rawValueAtIndex:(NSUInteger)index;
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateRawValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
+
+/**
+ * Enumerates the values on this array with the given block.
+ *
+ * @param opts Options to control the enumeration.
+ * @param block The block to enumerate with.
+ * **value**: The current value being enumerated.
+ * **idx**: The index of the current value.
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
usingBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
@@ -372,29 +1422,114 @@ NS_ASSUME_NONNULL_BEGIN
// to the default value. Use the rawValue methods below to assign non enumerator
// values.
+/**
+ * Adds a value to this array.
+ *
+ * @param value The value to add to this array.
+ **/
- (void)addValue:(int32_t)value;
+
+/**
+ * Adds values to this array.
+ *
+ * @param values The values to add to this array.
+ * @param count The number of elements to add.
+ **/
- (void)addValues:(const int32_t [])values count:(NSUInteger)count;
+
+/**
+ * Inserts a value into the given position.
+ *
+ * @param value The value to add to this array.
+ * @param index The index into which to insert the value.
+ **/
- (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
+/**
+ * Replaces the value at the given index with the given value.
+ *
+ * @param index The index for which to replace the value.
+ * @param value The value to replace with.
+ **/
- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
// These methods bypass the validationFunc to provide setting of values that were not
// known at the time the binary was compiled.
+/**
+ * Adds a raw enum value to this array.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param value The raw enum value to add to the array.
+ **/
- (void)addRawValue:(int32_t)value;
+
+/**
+ * Adds raw enum values to this array.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param array Array containing the raw enum values to add to this array.
+ **/
- (void)addRawValuesFromArray:(GPBEnumArray *)array;
+
+/**
+ * Adds raw enum values to this array.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param values Array containing the raw enum values to add to this array.
+ * @param count The number of raw values to add.
+ **/
- (void)addRawValues:(const int32_t [])values count:(NSUInteger)count;
+/**
+ * Inserts a raw enum value at the given index.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param value Raw enum value to add.
+ * @param index The index into which to insert the value.
+ **/
- (void)insertRawValue:(int32_t)value atIndex:(NSUInteger)index;
+/**
+ * Replaces the raw enum value at the given index with the given value.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param index The index for which to replace the value.
+ * @param value The raw enum value to replace with.
+ **/
- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(int32_t)value;
// No validation applies to these methods.
+/**
+ * Removes the value at the given index.
+ *
+ * @param index The index of the value to remove.
+ **/
- (void)removeValueAtIndex:(NSUInteger)index;
+
+/**
+ * Removes all the values from this array.
+ **/
- (void)removeAll;
+/**
+ * Exchanges the values between the given indexes.
+ *
+ * @param idx1 The index of the first element to exchange.
+ * @param idx2 The index of the second element to exchange.
+ **/
- (void)exchangeValueAtIndex:(NSUInteger)idx1
withValueAtIndex:(NSUInteger)idx2;
@@ -421,20 +1556,82 @@ NS_ASSUME_NONNULL_END
//%PDDM-DEFINE ARRAY_INTERFACE_SIMPLE(NAME, TYPE)
//%#pragma mark - NAME
//%
+//%/**
+//% * Class used for repeated fields of ##TYPE## values. This performs better than
+//% * boxing into NSNumbers in NSArrays.
+//% *
+//% * @note This class is not meant to be subclassed.
+//% **/
//%@interface GPB##NAME##Array : NSObject <NSCopying>
//%
+//%/** The number of elements contained in the array. */
//%@property(nonatomic, readonly) NSUInteger count;
//%
+//%/**
+//% * @return A newly instanced and empty GPB##NAME##Array.
+//% **/
//%+ (instancetype)array;
+//%
+//%/**
+//% * Creates and initializes a GPB##NAME##Array with the single element given.
+//% *
+//% * @param value The value to be placed in the array.
+//% *
+//% * @return A newly instanced GPB##NAME##Array with value in it.
+//% **/
//%+ (instancetype)arrayWithValue:(TYPE)value;
+//%
+//%/**
+//% * Creates and initializes a GPB##NAME##Array with the contents of the given
+//% * array.
+//% *
+//% * @param array Array with the contents to be put into the new array.
+//% *
+//% * @return A newly instanced GPB##NAME##Array with the contents of array.
+//% **/
//%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
+//%
+//%/**
+//% * Creates and initializes a GPB##NAME##Array with the given capacity.
+//% *
+//% * @param count The capacity needed for the array.
+//% *
+//% * @return A newly instanced GPB##NAME##Array with a capacity of count.
+//% **/
//%+ (instancetype)arrayWithCapacity:(NSUInteger)count;
//%
+//%/**
+//% * @return A newly initialized and empty GPB##NAME##Array.
+//% **/
//%- (instancetype)init NS_DESIGNATED_INITIALIZER;
-//%// Initializes the array, copying the values.
+//%
+//%/**
+//% * Initializes the array, copying the given values.
+//% *
+//% * @param values An array with the values to put inside this array.
+//% * @param count The number of elements to copy into the array.
+//% *
+//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
+//% **/
//%- (instancetype)initWithValues:(const TYPE [])values
//% count:(NSUInteger)count;
+//%
+//%/**
+//% * Initializes the array, copying the given values.
+//% *
+//% * @param array An array with the values to put inside this array.
+//% *
+//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
+//% **/
//%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
+//%
+//%/**
+//% * Initializes the array with the given capacity.
+//% *
+//% * @param count The capacity needed for the array.
+//% *
+//% * @return A newly initialized GPB##NAME##Array with a capacity of count.
+//% **/
//%- (instancetype)initWithCapacity:(NSUInteger)count;
//%
//%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, Basic)
@@ -451,27 +1648,108 @@ NS_ASSUME_NONNULL_END
//%PDDM-DEFINE ARRAY_INTERFACE_ENUM(NAME, TYPE)
//%#pragma mark - NAME
//%
+//%/**
+//% * This class is used for repeated fields of ##TYPE## values. This performs
+//% * better than boxing into NSNumbers in NSArrays.
+//% *
+//% * @note This class is not meant to be subclassed.
+//% **/
//%@interface GPB##NAME##Array : NSObject <NSCopying>
//%
+//%/** The number of elements contained in the array. */
//%@property(nonatomic, readonly) NSUInteger count;
+//%/** The validation function to check if the enums are valid. */
//%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
//%
+//%/**
+//% * @return A newly instanced and empty GPB##NAME##Array.
+//% **/
//%+ (instancetype)array;
+//%
+//%/**
+//% * Creates and initializes a GPB##NAME##Array with the enum validation function
+//% * given.
+//% *
+//% * @param func The enum validation function for the array.
+//% *
+//% * @return A newly instanced GPB##NAME##Array.
+//% **/
//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+//%
+//%/**
+//% * Creates and initializes a GPB##NAME##Array with the enum validation function
+//% * given and the single raw value given.
+//% *
+//% * @param func The enum validation function for the array.
+//% * @param value The raw value to add to this array.
+//% *
+//% * @return A newly instanced GPB##NAME##Array.
+//% **/
//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
//% rawValue:(TYPE)value;
+//%
+//%/**
+//% * Creates and initializes a GPB##NAME##Array that adds the elements from the
+//% * given array.
+//% *
+//% * @param array Array containing the values to add to the new array.
+//% *
+//% * @return A newly instanced GPB##NAME##Array.
+//% **/
//%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
+//%
+//%/**
+//% * Creates and initializes a GPB##NAME##Array with the given enum validation
+//% * function and with the givencapacity.
+//% *
+//% * @param func The enum validation function for the array.
+//% * @param count The capacity needed for the array.
+//% *
+//% * @return A newly instanced GPB##NAME##Array with a capacity of count.
+//% **/
//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
//% capacity:(NSUInteger)count;
//%
+//%/**
+//% * Initializes the array with the given enum validation function.
+//% *
+//% * @param func The enum validation function for the array.
+//% *
+//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
+//% **/
//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
//% NS_DESIGNATED_INITIALIZER;
//%
-//%// Initializes the array, copying the values.
+//%/**
+//% * Initializes the array, copying the given values.
+//% *
+//% * @param func The enum validation function for the array.
+//% * @param values An array with the values to put inside this array.
+//% * @param count The number of elements to copy into the array.
+//% *
+//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
+//% **/
//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
//% rawValues:(const TYPE [])values
//% count:(NSUInteger)count;
+//%
+//%/**
+//% * Initializes the array, copying the given values.
+//% *
+//% * @param array An array with the values to put inside this array.
+//% *
+//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
+//% **/
//%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
+//%
+//%/**
+//% * Initializes the array with the given capacity.
+//% *
+//% * @param func The enum validation function for the array.
+//% * @param count The capacity needed for the array.
+//% *
+//% * @return A newly initialized GPB##NAME##Array with a capacity of count.
+//% **/
//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
//% capacity:(NSUInteger)count;
//%
@@ -484,9 +1762,34 @@ NS_ASSUME_NONNULL_END
//%// These methods bypass the validationFunc to provide access to values that were not
//%// known at the time the binary was compiled.
//%
+//%/**
+//% * Gets the raw enum value at the given index.
+//% *
+//% * @param index The index of the raw enum value to get.
+//% *
+//% * @return The raw enum value at the given index.
+//% **/
//%- (TYPE)rawValueAtIndex:(NSUInteger)index;
//%
+//%/**
+//% * Enumerates the values on this array with the given block.
+//% *
+//% * @param block The block to enumerate with.
+//% * **value**: The current value being enumerated.
+//% * **idx**: The index of the current value.
+//% * **stop**: A pointer to a boolean that when set stops the enumeration.
+//% **/
//%- (void)enumerateRawValuesWithBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
+//%
+//%/**
+//% * Enumerates the values on this array with the given block.
+//% *
+//% * @param opts Options to control the enumeration.
+//% * @param block The block to enumerate with.
+//% * **value**: The current value being enumerated.
+//% * **idx**: The index of the current value.
+//% * **stop**: A pointer to a boolean that when set stops the enumeration.
+//% **/
//%- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
//% usingBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
//%
@@ -501,23 +1804,88 @@ NS_ASSUME_NONNULL_END
//%
//%PDDM-DEFINE ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
+//%/**
+//% * Gets the value at the given index.
+//% *
+//% * @param index The index of the value to get.
+//% *
+//% * @return The value at the given index.
+//% **/
//%- (TYPE)valueAtIndex:(NSUInteger)index;
//%
+//%/**
+//% * Enumerates the values on this array with the given block.
+//% *
+//% * @param block The block to enumerate with.
+//% * **value**: The current value being enumerated.
+//% * **idx**: The index of the current value.
+//% * **stop**: A pointer to a boolean that when set stops the enumeration.
+//% **/
//%- (void)enumerateValuesWithBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
+//%
+//%/**
+//% * Enumerates the values on this array with the given block.
+//% *
+//% * @param opts Options to control the enumeration.
+//% * @param block The block to enumerate with.
+//% * **value**: The current value being enumerated.
+//% * **idx**: The index of the current value.
+//% * **stop**: A pointer to a boolean that when set stops the enumeration.
+//% **/
//%- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
//% usingBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
//%PDDM-DEFINE ARRAY_MUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
+//%/**
+//% * Adds a value to this array.
+//% *
+//% * @param value The value to add to this array.
+//% **/
//%- (void)addValue:(TYPE)value;
+//%
+//%/**
+//% * Adds values to this array.
+//% *
+//% * @param values The values to add to this array.
+//% * @param count The number of elements to add.
+//% **/
//%- (void)addValues:(const TYPE [])values count:(NSUInteger)count;
+//%
//%ARRAY_EXTRA_MUTABLE_METHODS1_##HELPER_NAME(NAME, TYPE)
+//%/**
+//% * Inserts a value into the given position.
+//% *
+//% * @param value The value to add to this array.
+//% * @param index The index into which to insert the value.
+//% **/
//%- (void)insertValue:(TYPE)value atIndex:(NSUInteger)index;
//%
+//%/**
+//% * Replaces the value at the given index with the given value.
+//% *
+//% * @param index The index for which to replace the value.
+//% * @param value The value to replace with.
+//% **/
//%- (void)replaceValueAtIndex:(NSUInteger)index withValue:(TYPE)value;
//%ARRAY_EXTRA_MUTABLE_METHODS2_##HELPER_NAME(NAME, TYPE)
+//%/**
+//% * Removes the value at the given index.
+//% *
+//% * @param index The index of the value to remove.
+//% **/
//%- (void)removeValueAtIndex:(NSUInteger)index;
+//%
+//%/**
+//% * Removes all the values from this array.
+//% **/
//%- (void)removeAll;
//%
+//%/**
+//% * Exchanges the values between the given indexes.
+//% *
+//% * @param idx1 The index of the first element to exchange.
+//% * @param idx2 The index of the second element to exchange.
+//% **/
//%- (void)exchangeValueAtIndex:(NSUInteger)idx1
//% withValueAtIndex:(NSUInteger)idx2;
@@ -526,6 +1894,11 @@ NS_ASSUME_NONNULL_END
//
//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Basic(NAME, TYPE)
+//%/**
+//% * Adds the values from the given array to this array.
+//% *
+//% * @param array The array containing the elements to add to this array.
+//% **/
//%- (void)addValuesFromArray:(GPB##NAME##Array *)array;
//%
//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Basic(NAME, TYPE)
@@ -537,12 +1910,57 @@ NS_ASSUME_NONNULL_END
//%// These methods bypass the validationFunc to provide setting of values that were not
//%// known at the time the binary was compiled.
//%
+//%/**
+//% * Adds a raw enum value to this array.
+//% *
+//% * @note This method bypass the validationFunc to enable the setting of values that
+//% * were not known at the time the binary was compiled.
+//% *
+//% * @param value The raw enum value to add to the array.
+//% **/
//%- (void)addRawValue:(TYPE)value;
+//%
+//%/**
+//% * Adds raw enum values to this array.
+//% *
+//% * @note This method bypass the validationFunc to enable the setting of values that
+//% * were not known at the time the binary was compiled.
+//% *
+//% * @param array Array containing the raw enum values to add to this array.
+//% **/
//%- (void)addRawValuesFromArray:(GPB##NAME##Array *)array;
+//%
+//%/**
+//% * Adds raw enum values to this array.
+//% *
+//% * @note This method bypass the validationFunc to enable the setting of values that
+//% * were not known at the time the binary was compiled.
+//% *
+//% * @param values Array containing the raw enum values to add to this array.
+//% * @param count The number of raw values to add.
+//% **/
//%- (void)addRawValues:(const TYPE [])values count:(NSUInteger)count;
//%
+//%/**
+//% * Inserts a raw enum value at the given index.
+//% *
+//% * @note This method bypass the validationFunc to enable the setting of values that
+//% * were not known at the time the binary was compiled.
+//% *
+//% * @param value Raw enum value to add.
+//% * @param index The index into which to insert the value.
+//% **/
//%- (void)insertRawValue:(TYPE)value atIndex:(NSUInteger)index;
//%
+//%/**
+//% * Replaces the raw enum value at the given index with the given value.
+//% *
+//% * @note This method bypass the validationFunc to enable the setting of values that
+//% * were not known at the time the binary was compiled.
+//% *
+//% * @param index The index for which to replace the value.
+//% * @param value The raw enum value to replace with.
+//% **/
//%- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(TYPE)value;
//%
//%// No validation applies to these methods.
diff --git a/objectivec/GPBBootstrap.h b/objectivec/GPBBootstrap.h
index 4db08e80..2e5bdc71 100644
--- a/objectivec/GPBBootstrap.h
+++ b/objectivec/GPBBootstrap.h
@@ -28,11 +28,13 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// The Objective C runtime has complete enough info that most protos don’t end
-// up using this, so leaving it on is no cost or very little cost. If you
-// happen to see it causing bloat, this is the way to disable it. If you do
-// need to disable it, try only disabling it for Release builds as having
-// full TextFormat can be useful for debugging.
+/**
+ * The Objective C runtime has complete enough info that most protos don’t end
+ * up using this, so leaving it on is no cost or very little cost. If you
+ * happen to see it causing bloat, this is the way to disable it. If you do
+ * need to disable it, try only disabling it for Release builds as having
+ * full TextFormat can be useful for debugging.
+ **/
#ifndef GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
#define GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS 0
#endif
@@ -42,6 +44,7 @@
#if !__has_feature(objc_fixed_enum)
#error All supported Xcode versions should support objc_fixed_enum.
#endif
+
// If the headers are imported into Objective-C++, we can run into an issue
// where the defintion of NS_ENUM (really CF_ENUM) changes based on the C++
// standard that is in effect. If it isn't C++11 or higher, the definition
@@ -53,19 +56,29 @@
#else
#define GPB_ENUM(X) NS_ENUM(int32_t, X)
#endif
-// GPB_ENUM_FWD_DECLARE is used for forward declaring enums, ex:
-// GPB_ENUM_FWD_DECLARE(Foo_Enum)
-// @property (nonatomic) Foo_Enum value;
+
+/**
+ * GPB_ENUM_FWD_DECLARE is used for forward declaring enums, for example:
+ *
+ * ```
+ * GPB_ENUM_FWD_DECLARE(Foo_Enum)
+ * @property (nonatomic) Foo_Enum value;
+ * ```
+ **/
#define GPB_ENUM_FWD_DECLARE(X) enum X : int32_t
-// Based upon CF_INLINE. Forces inlining in release.
+/**
+ * Based upon CF_INLINE. Forces inlining in non DEBUG builds.
+ **/
#if !defined(DEBUG)
#define GPB_INLINE static __inline__ __attribute__((always_inline))
#else
#define GPB_INLINE static __inline__
#endif
-// For use in public headers that might need to deal with ARC.
+/**
+ * For use in public headers that might need to deal with ARC.
+ **/
#ifndef GPB_UNSAFE_UNRETAINED
#if __has_feature(objc_arc)
#define GPB_UNSAFE_UNRETAINED __unsafe_unretained
@@ -76,10 +89,14 @@
// If property name starts with init we need to annotate it to get past ARC.
// http://stackoverflow.com/questions/18723226/how-do-i-annotate-an-objective-c-property-with-an-objc-method-family/18723227#18723227
+//
+// Meant to be used internally by generated code.
#define GPB_METHOD_FAMILY_NONE __attribute__((objc_method_family(none)))
// The protoc-gen-objc version which works with the current version of the
// generated Objective C sources. In general we don't want to change the
// runtime interfaces (or this version) as it means everything has to be
// regenerated.
+//
+// Meant to be used internally by generated code.
#define GOOGLE_PROTOBUF_OBJC_GEN_VERSION 30001
diff --git a/objectivec/GPBCodedInputStream.h b/objectivec/GPBCodedInputStream.h
index df9d97ba..de27b186 100644
--- a/objectivec/GPBCodedInputStream.h
+++ b/objectivec/GPBCodedInputStream.h
@@ -37,125 +37,194 @@ NS_ASSUME_NONNULL_BEGIN
CF_EXTERN_C_BEGIN
-/// GPBCodedInputStream exception name. Exceptions raised from
-/// GPBCodedInputStream contain an underlying error in the userInfo dictionary
-/// under the GPBCodedInputStreamUnderlyingErrorKey key.
+/**
+ * @c GPBCodedInputStream exception name. Exceptions raised from
+ * @c GPBCodedInputStream contain an underlying error in the userInfo dictionary
+ * under the GPBCodedInputStreamUnderlyingErrorKey key.
+ **/
extern NSString *const GPBCodedInputStreamException;
-/// The key under which the underlying NSError from the exception is stored.
+/** The key under which the underlying NSError from the exception is stored. */
extern NSString *const GPBCodedInputStreamUnderlyingErrorKey;
-/// NSError domain used for GPBCodedInputStream errors.
+/** NSError domain used for @c GPBCodedInputStream errors. */
extern NSString *const GPBCodedInputStreamErrorDomain;
-/// Error code for NSError with GPBCodedInputStreamErrorDomain.
+/**
+ * Error code for NSError with @c GPBCodedInputStreamErrorDomain.
+ **/
typedef NS_ENUM(NSInteger, GPBCodedInputStreamErrorCode) {
- /// The size does not fit in the remaining bytes to be read.
+ /** The size does not fit in the remaining bytes to be read. */
GPBCodedInputStreamErrorInvalidSize = -100,
- /// Attempted to read beyond the subsection limit.
+ /** Attempted to read beyond the subsection limit. */
GPBCodedInputStreamErrorSubsectionLimitReached = -101,
- /// The requested subsection limit is invalid.
+ /** The requested subsection limit is invalid. */
GPBCodedInputStreamErrorInvalidSubsectionLimit = -102,
- /// Invalid tag read.
+ /** Invalid tag read. */
GPBCodedInputStreamErrorInvalidTag = -103,
- /// Invalid UTF-8 character in a string.
+ /** Invalid UTF-8 character in a string. */
GPBCodedInputStreamErrorInvalidUTF8 = -104,
- /// Invalid VarInt read.
+ /** Invalid VarInt read. */
GPBCodedInputStreamErrorInvalidVarInt = -105,
- /// The maximum recursion depth of messages was exceeded.
+ /** The maximum recursion depth of messages was exceeded. */
GPBCodedInputStreamErrorRecursionDepthExceeded = -106,
};
CF_EXTERN_C_END
-/// Reads and decodes protocol message fields.
-///
-/// The common uses of protocol buffers shouldn't need to use this class.
-/// @c GPBMessage's provide a @c +parseFromData:error: and @c
-/// +parseFromData:extensionRegistry:error: method that will decode a
-/// message for you.
-///
-/// @note Subclassing of GPBCodedInputStream is NOT supported.
+/**
+ * Reads and decodes protocol message fields.
+ *
+ * The common uses of protocol buffers shouldn't need to use this class.
+ * @c GPBMessage's provide a @c +parseFromData:error: and
+ * @c +parseFromData:extensionRegistry:error: method that will decode a
+ * message for you.
+ *
+ * @note Subclassing of @c GPBCodedInputStream is NOT supported.
+ **/
@interface GPBCodedInputStream : NSObject
-/// Creates a new stream wrapping some data.
+/**
+ * Creates a new stream wrapping some data.
+ *
+ * @param data The data to wrap inside the stream.
+ *
+ * @return A newly instanced GPBCodedInputStream.
+ **/
+ (instancetype)streamWithData:(NSData *)data;
-/// Initializes a stream wrapping some data.
+/**
+ * Initializes a stream wrapping some data.
+ *
+ * @param data The data to wrap inside the stream.
+ *
+ * @return A newly initialized GPBCodedInputStream.
+ **/
- (instancetype)initWithData:(NSData *)data;
-/// Attempt to read a field tag, returning zero if we have reached EOF.
-/// Protocol message parsers use this to read tags, since a protocol message
-/// may legally end wherever a tag occurs, and zero is not a valid tag number.
+/**
+ * Attempts to read a field tag, returning zero if we have reached EOF.
+ * Protocol message parsers use this to read tags, since a protocol message
+ * may legally end wherever a tag occurs, and zero is not a valid tag number.
+ *
+ * @return The field tag, or zero if EOF was reached.
+ **/
- (int32_t)readTag;
-/// Read and return a double.
+/**
+ * @return A double read from the stream.
+ **/
- (double)readDouble;
-/// Read and return a float.
+/**
+ * @return A float read from the stream.
+ **/
- (float)readFloat;
-/// Read and return a uint64.
+/**
+ * @return A uint64 read from the stream.
+ **/
- (uint64_t)readUInt64;
-/// Read and return a uint32.
+/**
+ * @return A uint32 read from the stream.
+ **/
- (uint32_t)readUInt32;
-/// Read and return an int64.
+/**
+ * @return An int64 read from the stream.
+ **/
- (int64_t)readInt64;
-/// Read and return an int32.
+/**
+ * @return An int32 read from the stream.
+ **/
- (int32_t)readInt32;
-/// Read and return a fixed64.
+/**
+ * @return A fixed64 read from the stream.
+ **/
- (uint64_t)readFixed64;
-/// Read and return a fixed32.
+/**
+ * @return A fixed32 read from the stream.
+ **/
- (uint32_t)readFixed32;
-/// Read and return an enum (int).
+/**
+ * @return An enum read from the stream.
+ **/
- (int32_t)readEnum;
-/// Read and return a sfixed32.
+/**
+ * @return A sfixed32 read from the stream.
+ **/
- (int32_t)readSFixed32;
-/// Read and return a sfixed64.
+/**
+ * @return A fixed64 read from the stream.
+ **/
- (int64_t)readSFixed64;
-/// Read and return a sint32.
+/**
+ * @return A sint32 read from the stream.
+ **/
- (int32_t)readSInt32;
-/// Read and return a sint64.
+/**
+ * @return A sint64 read from the stream.
+ **/
- (int64_t)readSInt64;
-/// Read and return a boolean.
+/**
+ * @return A boolean read from the stream.
+ **/
- (BOOL)readBool;
-/// Read and return a string.
+/**
+ * @return A string read from the stream.
+ **/
- (NSString *)readString;
-/// Read and return length delimited data.
+/**
+ * @return Data read from the stream.
+ **/
- (NSData *)readBytes;
-/// Read an embedded message field value from the stream.
-///
-/// @param message The message to set fields on as they are read.
-/// @param extensionRegistry An optional extension registry to use to lookup
-/// extensions for @c message.
+/**
+ * Read an embedded message field value from the stream.
+ *
+ * @param message The message to set fields on as they are read.
+ * @param extensionRegistry An optional extension registry to use to lookup
+ * extensions for message.
+ **/
- (void)readMessage:(GPBMessage *)message
extensionRegistry:(nullable GPBExtensionRegistry *)extensionRegistry;
-/// Reads and discards a single field, given its tag value.
-///
-/// @param tag The tag number of the field to skip.
-///
-/// @return NO if the tag is an endgroup tag (in which case nothing is skipped),
-/// YES in all other cases.
+/**
+ * Reads and discards a single field, given its tag value.
+ *
+ * @param tag The tag number of the field to skip.
+ *
+ * @return NO if the tag is an endgroup tag (in which case nothing is skipped),
+ * YES in all other cases.
+ **/
- (BOOL)skipField:(int32_t)tag;
-/// Reads and discards an entire message. This will read either until EOF
-/// or until an endgroup tag, whichever comes first.
+/**
+ * Reads and discards an entire message. This will read either until EOF or
+ * until an endgroup tag, whichever comes first.
+ **/
- (void)skipMessage;
-/// Check to see if the logical end of the stream has been reached.
-///
-/// This can return NO when there is no more data, but the current parsing
-/// expected more data.
+/**
+ * Check to see if the logical end of the stream has been reached.
+ *
+ * @note This can return NO when there is no more data, but the current parsing
+ * expected more data.
+ *
+ * @return YES if the logical end of the stream has been reached, NO otherwise.
+ **/
- (BOOL)isAtEnd;
-/// The offset into the stream.
+/**
+ * @return The offset into the stream.
+ **/
- (size_t)position;
-/// Verifies that the last call to @c -readTag returned the given tag value.
-/// This is used to verify that a nested group ended with the correct end tag.
-/// Throws @c NSParseErrorException if value does not match the last tag.
-///
-/// @param expected The tag that was expected.
+/**
+ * Verifies that the last call to -readTag returned the given tag value. This
+ * is used to verify that a nested group ended with the correct end tag.
+ *
+ * @exception NSParseErrorException If the value does not match the last tag.
+ *
+ * @param expected The tag that was expected.
+ **/
- (void)checkLastTagWas:(int32_t)expected;
@end
diff --git a/objectivec/GPBCodedOutputStream.h b/objectivec/GPBCodedOutputStream.h
index 8272880d..d6fff3db 100644
--- a/objectivec/GPBCodedOutputStream.h
+++ b/objectivec/GPBCodedOutputStream.h
@@ -46,63 +46,122 @@
NS_ASSUME_NONNULL_BEGIN
-/// Writes out protocol message fields.
-///
-/// The common uses of protocol buffers shouldn't need to use this class.
-/// @c GPBMessage's provide a @c -data method that will serialize the message
-/// for you.
-///
-/// @note Subclassing of GPBCodedOutputStream is NOT supported.
+/**
+ * Writes out protocol message fields.
+ *
+ * The common uses of protocol buffers shouldn't need to use this class.
+ * GPBMessage's provide a -data method that will serialize the message for you.
+ *
+ * @note Subclassing of GPBCodedOutputStream is NOT supported.
+ **/
@interface GPBCodedOutputStream : NSObject
-/// Creates a stream to fill in the given data. Data must be sized to fit or
-/// an error will be raised when out of space.
+/**
+ * Creates a stream to fill in the given data. Data must be sized to fit or
+ * an error will be raised when out of space.
+ *
+ * @param data The data where the stream will be written to.
+ *
+ * @return A newly instanced GPBCodedOutputStream.
+ **/
+ (instancetype)streamWithData:(NSMutableData *)data;
-/// Creates a stream to write into the given @c NSOutputStream.
+/**
+ * Creates a stream to write into the given NSOutputStream.
+ *
+ * @param output The output stream where the stream will be written to.
+ *
+ * @return A newly instanced GPBCodedOutputStream.
+ **/
+ (instancetype)streamWithOutputStream:(NSOutputStream *)output;
-/// Initializes a stream to fill in the given data. Data must be sized to fit
-/// or an error will be raised when out of space.
+/**
+ * Initializes a stream to fill in the given data. Data must be sized to fit
+ * or an error will be raised when out of space.
+ *
+ * @param data The data where the stream will be written to.
+ *
+ * @return A newly initialized GPBCodedOutputStream.
+ **/
- (instancetype)initWithData:(NSMutableData *)data;
-/// Initializes a stream to write into the given @c NSOutputStream.
+/**
+ * Initializes a stream to write into the given @c NSOutputStream.
+ *
+ * @param output The output stream where the stream will be written to.
+ *
+ * @return A newly initialized GPBCodedOutputStream.
+ **/
- (instancetype)initWithOutputStream:(NSOutputStream *)output;
-/// Flush any buffered data out.
+/**
+ * Flush any buffered data out.
+ **/
- (void)flush;
-/// Write the raw byte out.
+/**
+ * Write the raw byte out.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeRawByte:(uint8_t)value;
-/// Write the tag for the given field number and wire format.
-///
-/// @param fieldNumber The field number.
-/// @param format The wire format the data for the field will be in.
+/**
+ * Write the tag for the given field number and wire format.
+ *
+ * @param fieldNumber The field number.
+ * @param format The wire format the data for the field will be in.
+ **/
- (void)writeTag:(uint32_t)fieldNumber format:(GPBWireFormat)format;
-/// Write a 32bit value out in little endian format.
+/**
+ * Write a 32bit value out in little endian format.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeRawLittleEndian32:(int32_t)value;
-/// Write a 64bit value out in little endian format.
+/**
+ * Write a 64bit value out in little endian format.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeRawLittleEndian64:(int64_t)value;
-/// Write a 32bit value out in varint format.
+/**
+ * Write a 32bit value out in varint format.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeRawVarint32:(int32_t)value;
-/// Write a 64bit value out in varint format.
+/**
+ * Write a 64bit value out in varint format.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeRawVarint64:(int64_t)value;
-/// Write a size_t out as a 32bit varint value.
-///
-/// @note This will truncate 64 bit values to 32.
+/**
+ * Write a size_t out as a 32bit varint value.
+ *
+ * @note This will truncate 64 bit values to 32.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeRawVarintSizeTAs32:(size_t)value;
-/// Writes the contents of an @c NSData out.
+/**
+ * Writes the contents of an NSData out.
+ *
+ * @param data The data to write out.
+ **/
- (void)writeRawData:(NSData *)data;
-/// Writes out the given data.
-///
-/// @param data The data blob to write out.
-/// @param offset The offset into the blob to start writing out.
-/// @param length The number of bytes from the blob to write out.
+/**
+ * Writes out the given data.
+ *
+ * @param data The data blob to write out.
+ * @param offset The offset into the blob to start writing out.
+ * @param length The number of bytes from the blob to write out.
+ **/
- (void)writeRawPtr:(const void *)data
offset:(size_t)offset
length:(size_t)length;
@@ -110,179 +169,471 @@ NS_ASSUME_NONNULL_BEGIN
//%PDDM-EXPAND _WRITE_DECLS()
// This block of code is generated, do not edit it directly.
-/// Write a double for the given field number.
+/**
+ * Write a double for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeDouble:(int32_t)fieldNumber value:(double)value;
-/// Write a packed array of double for the given field number.
+/**
+ * Write a packed array of double for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeDoubleArray:(int32_t)fieldNumber
values:(GPBDoubleArray *)values
tag:(uint32_t)tag;
-/// Write a double without any tag.
+/**
+ * Write a double without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeDoubleNoTag:(double)value;
-/// Write a float for the given field number.
+/**
+ * Write a float for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeFloat:(int32_t)fieldNumber value:(float)value;
-/// Write a packed array of float for the given field number.
+/**
+ * Write a packed array of float for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeFloatArray:(int32_t)fieldNumber
values:(GPBFloatArray *)values
tag:(uint32_t)tag;
-/// Write a float without any tag.
+/**
+ * Write a float without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeFloatNoTag:(float)value;
-/// Write a uint64_t for the given field number.
+/**
+ * Write a uint64_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeUInt64:(int32_t)fieldNumber value:(uint64_t)value;
-/// Write a packed array of uint64_t for the given field number.
+/**
+ * Write a packed array of uint64_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeUInt64Array:(int32_t)fieldNumber
values:(GPBUInt64Array *)values
tag:(uint32_t)tag;
-/// Write a uint64_t without any tag.
+/**
+ * Write a uint64_t without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeUInt64NoTag:(uint64_t)value;
-/// Write a int64_t for the given field number.
+/**
+ * Write a int64_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeInt64:(int32_t)fieldNumber value:(int64_t)value;
-/// Write a packed array of int64_t for the given field number.
+/**
+ * Write a packed array of int64_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeInt64Array:(int32_t)fieldNumber
values:(GPBInt64Array *)values
tag:(uint32_t)tag;
-/// Write a int64_t without any tag.
+/**
+ * Write a int64_t without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeInt64NoTag:(int64_t)value;
-/// Write a int32_t for the given field number.
+/**
+ * Write a int32_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeInt32:(int32_t)fieldNumber value:(int32_t)value;
-/// Write a packed array of int32_t for the given field number.
+/**
+ * Write a packed array of int32_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeInt32Array:(int32_t)fieldNumber
values:(GPBInt32Array *)values
tag:(uint32_t)tag;
-/// Write a int32_t without any tag.
+/**
+ * Write a int32_t without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeInt32NoTag:(int32_t)value;
-/// Write a uint32_t for the given field number.
+/**
+ * Write a uint32_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeUInt32:(int32_t)fieldNumber value:(uint32_t)value;
-/// Write a packed array of uint32_t for the given field number.
+/**
+ * Write a packed array of uint32_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeUInt32Array:(int32_t)fieldNumber
values:(GPBUInt32Array *)values
tag:(uint32_t)tag;
-/// Write a uint32_t without any tag.
+/**
+ * Write a uint32_t without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeUInt32NoTag:(uint32_t)value;
-/// Write a uint64_t for the given field number.
+/**
+ * Write a uint64_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeFixed64:(int32_t)fieldNumber value:(uint64_t)value;
-/// Write a packed array of uint64_t for the given field number.
+/**
+ * Write a packed array of uint64_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeFixed64Array:(int32_t)fieldNumber
values:(GPBUInt64Array *)values
tag:(uint32_t)tag;
-/// Write a uint64_t without any tag.
+/**
+ * Write a uint64_t without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeFixed64NoTag:(uint64_t)value;
-/// Write a uint32_t for the given field number.
+/**
+ * Write a uint32_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeFixed32:(int32_t)fieldNumber value:(uint32_t)value;
-/// Write a packed array of uint32_t for the given field number.
+/**
+ * Write a packed array of uint32_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeFixed32Array:(int32_t)fieldNumber
values:(GPBUInt32Array *)values
tag:(uint32_t)tag;
-/// Write a uint32_t without any tag.
+/**
+ * Write a uint32_t without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeFixed32NoTag:(uint32_t)value;
-/// Write a int32_t for the given field number.
+/**
+ * Write a int32_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeSInt32:(int32_t)fieldNumber value:(int32_t)value;
-/// Write a packed array of int32_t for the given field number.
+/**
+ * Write a packed array of int32_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeSInt32Array:(int32_t)fieldNumber
values:(GPBInt32Array *)values
tag:(uint32_t)tag;
-/// Write a int32_t without any tag.
+/**
+ * Write a int32_t without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeSInt32NoTag:(int32_t)value;
-/// Write a int64_t for the given field number.
+/**
+ * Write a int64_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeSInt64:(int32_t)fieldNumber value:(int64_t)value;
-/// Write a packed array of int64_t for the given field number.
+/**
+ * Write a packed array of int64_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeSInt64Array:(int32_t)fieldNumber
values:(GPBInt64Array *)values
tag:(uint32_t)tag;
-/// Write a int64_t without any tag.
+/**
+ * Write a int64_t without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeSInt64NoTag:(int64_t)value;
-/// Write a int64_t for the given field number.
+/**
+ * Write a int64_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeSFixed64:(int32_t)fieldNumber value:(int64_t)value;
-/// Write a packed array of int64_t for the given field number.
+/**
+ * Write a packed array of int64_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeSFixed64Array:(int32_t)fieldNumber
values:(GPBInt64Array *)values
tag:(uint32_t)tag;
-/// Write a int64_t without any tag.
+/**
+ * Write a int64_t without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeSFixed64NoTag:(int64_t)value;
-/// Write a int32_t for the given field number.
+/**
+ * Write a int32_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeSFixed32:(int32_t)fieldNumber value:(int32_t)value;
-/// Write a packed array of int32_t for the given field number.
+/**
+ * Write a packed array of int32_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeSFixed32Array:(int32_t)fieldNumber
values:(GPBInt32Array *)values
tag:(uint32_t)tag;
-/// Write a int32_t without any tag.
+/**
+ * Write a int32_t without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeSFixed32NoTag:(int32_t)value;
-/// Write a BOOL for the given field number.
+/**
+ * Write a BOOL for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeBool:(int32_t)fieldNumber value:(BOOL)value;
-/// Write a packed array of BOOL for the given field number.
+/**
+ * Write a packed array of BOOL for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeBoolArray:(int32_t)fieldNumber
values:(GPBBoolArray *)values
tag:(uint32_t)tag;
-/// Write a BOOL without any tag.
+/**
+ * Write a BOOL without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeBoolNoTag:(BOOL)value;
-/// Write a int32_t for the given field number.
+/**
+ * Write a int32_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeEnum:(int32_t)fieldNumber value:(int32_t)value;
-/// Write a packed array of int32_t for the given field number.
+/**
+ * Write a packed array of int32_t for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ * @param tag The tag assigned to the values.
+ **/
- (void)writeEnumArray:(int32_t)fieldNumber
values:(GPBEnumArray *)values
tag:(uint32_t)tag;
-/// Write a int32_t without any tag.
+/**
+ * Write a int32_t without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeEnumNoTag:(int32_t)value;
-/// Write a NSString for the given field number.
+/**
+ * Write a NSString for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeString:(int32_t)fieldNumber value:(NSString *)value;
-/// Write an array of NSString for the given field number.
+/**
+ * Write an array of NSString for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ **/
- (void)writeStringArray:(int32_t)fieldNumber values:(NSArray<NSString*> *)values;
-/// Write a NSString without any tag.
+/**
+ * Write a NSString without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeStringNoTag:(NSString *)value;
-/// Write a GPBMessage for the given field number.
+/**
+ * Write a GPBMessage for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeMessage:(int32_t)fieldNumber value:(GPBMessage *)value;
-/// Write an array of GPBMessage for the given field number.
+/**
+ * Write an array of GPBMessage for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ **/
- (void)writeMessageArray:(int32_t)fieldNumber values:(NSArray<GPBMessage*> *)values;
-/// Write a GPBMessage without any tag.
+/**
+ * Write a GPBMessage without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeMessageNoTag:(GPBMessage *)value;
-/// Write a NSData for the given field number.
+/**
+ * Write a NSData for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeBytes:(int32_t)fieldNumber value:(NSData *)value;
-/// Write an array of NSData for the given field number.
+/**
+ * Write an array of NSData for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ **/
- (void)writeBytesArray:(int32_t)fieldNumber values:(NSArray<NSData*> *)values;
-/// Write a NSData without any tag.
+/**
+ * Write a NSData without any tag.
+ *
+ * @param value The value to write out.
+ **/
- (void)writeBytesNoTag:(NSData *)value;
-/// Write a GPBMessage for the given field number.
+/**
+ * Write a GPBMessage for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeGroup:(int32_t)fieldNumber
value:(GPBMessage *)value;
-/// Write an array of GPBMessage for the given field number.
+/**
+ * Write an array of GPBMessage for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ **/
- (void)writeGroupArray:(int32_t)fieldNumber values:(NSArray<GPBMessage*> *)values;
-/// Write a GPBMessage without any tag (but does write the endGroup tag).
+/**
+ * Write a GPBMessage without any tag (but does write the endGroup tag).
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeGroupNoTag:(int32_t)fieldNumber
value:(GPBMessage *)value;
-/// Write a GPBUnknownFieldSet for the given field number.
+/**
+ * Write a GPBUnknownFieldSet for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeUnknownGroup:(int32_t)fieldNumber
value:(GPBUnknownFieldSet *)value;
-/// Write an array of GPBUnknownFieldSet for the given field number.
+/**
+ * Write an array of GPBUnknownFieldSet for the given field number.
+ *
+ * @param fieldNumber The field number assigned to the values.
+ * @param values The values to write out.
+ **/
- (void)writeUnknownGroupArray:(int32_t)fieldNumber values:(NSArray<GPBUnknownFieldSet*> *)values;
-/// Write a GPBUnknownFieldSet without any tag (but does write the endGroup tag).
+/**
+ * Write a GPBUnknownFieldSet without any tag (but does write the endGroup tag).
+ *
+ * @param fieldNumber The field number assigned to the value.
+ * @param value The value to write out.
+ **/
- (void)writeUnknownGroupNoTag:(int32_t)fieldNumber
value:(GPBUnknownFieldSet *)value;
//%PDDM-EXPAND-END _WRITE_DECLS()
-/// Write a MessageSet extension field to the stream. For historical reasons,
-/// the wire format differs from normal fields.
+/**
+Write a MessageSet extension field to the stream. For historical reasons,
+the wire format differs from normal fields.
+
+@param fieldNumber The extension field number to write out.
+@param value The message from where to get the extension.
+*/
- (void)writeMessageSetExtension:(int32_t)fieldNumber value:(GPBMessage *)value;
-/// Write an unparsed MessageSet extension field to the stream. For
-/// historical reasons, the wire format differs from normal fields.
+/**
+Write an unparsed MessageSet extension field to the stream. For historical
+reasons, the wire format differs from normal fields.
+
+@param fieldNumber The extension field number to write out.
+@param value The raw message from where to get the extension.
+*/
- (void)writeRawMessageSetExtension:(int32_t)fieldNumber value:(NSData *)value;
@end
@@ -291,32 +642,76 @@ NS_ASSUME_NONNULL_END
// Write methods for types that can be in packed arrays.
//%PDDM-DEFINE _WRITE_PACKABLE_DECLS(NAME, ARRAY_TYPE, TYPE)
-//%/// Write a TYPE for the given field number.
+//%/**
+//% * Write a TYPE for the given field number.
+//% *
+//% * @param fieldNumber The field number assigned to the value.
+//% * @param value The value to write out.
+//% **/
//%- (void)write##NAME:(int32_t)fieldNumber value:(TYPE)value;
-//%/// Write a packed array of TYPE for the given field number.
+//%/**
+//% * Write a packed array of TYPE for the given field number.
+//% *
+//% * @param fieldNumber The field number assigned to the values.
+//% * @param values The values to write out.
+//% * @param tag The tag assigned to the values.
+//% **/
//%- (void)write##NAME##Array:(int32_t)fieldNumber
//% NAME$S values:(GPB##ARRAY_TYPE##Array *)values
//% NAME$S tag:(uint32_t)tag;
-//%/// Write a TYPE without any tag.
+//%/**
+//% * Write a TYPE without any tag.
+//% *
+//% * @param value The value to write out.
+//% **/
//%- (void)write##NAME##NoTag:(TYPE)value;
//%
// Write methods for types that aren't in packed arrays.
//%PDDM-DEFINE _WRITE_UNPACKABLE_DECLS(NAME, TYPE)
-//%/// Write a TYPE for the given field number.
+//%/**
+//% * Write a TYPE for the given field number.
+//% *
+//% * @param fieldNumber The field number assigned to the value.
+//% * @param value The value to write out.
+//% **/
//%- (void)write##NAME:(int32_t)fieldNumber value:(TYPE *)value;
-//%/// Write an array of TYPE for the given field number.
+//%/**
+//% * Write an array of TYPE for the given field number.
+//% *
+//% * @param fieldNumber The field number assigned to the values.
+//% * @param values The values to write out.
+//% **/
//%- (void)write##NAME##Array:(int32_t)fieldNumber values:(NSArray<##TYPE##*> *)values;
-//%/// Write a TYPE without any tag.
+//%/**
+//% * Write a TYPE without any tag.
+//% *
+//% * @param value The value to write out.
+//% **/
//%- (void)write##NAME##NoTag:(TYPE *)value;
//%
// Special write methods for Groups.
//%PDDM-DEFINE _WRITE_GROUP_DECLS(NAME, TYPE)
-//%/// Write a TYPE for the given field number.
+//%/**
+//% * Write a TYPE for the given field number.
+//% *
+//% * @param fieldNumber The field number assigned to the value.
+//% * @param value The value to write out.
+//% **/
//%- (void)write##NAME:(int32_t)fieldNumber
//% NAME$S value:(TYPE *)value;
-//%/// Write an array of TYPE for the given field number.
+//%/**
+//% * Write an array of TYPE for the given field number.
+//% *
+//% * @param fieldNumber The field number assigned to the values.
+//% * @param values The values to write out.
+//% **/
//%- (void)write##NAME##Array:(int32_t)fieldNumber values:(NSArray<##TYPE##*> *)values;
-//%/// Write a TYPE without any tag (but does write the endGroup tag).
+//%/**
+//% * Write a TYPE without any tag (but does write the endGroup tag).
+//% *
+//% * @param fieldNumber The field number assigned to the value.
+//% * @param value The value to write out.
+//% **/
//%- (void)write##NAME##NoTag:(int32_t)fieldNumber
//% NAME$S value:(TYPE *)value;
//%
diff --git a/objectivec/GPBDescriptor.h b/objectivec/GPBDescriptor.h
index fe4ff390..36fb4eae 100644
--- a/objectivec/GPBDescriptor.h
+++ b/objectivec/GPBDescriptor.h
@@ -39,104 +39,241 @@
NS_ASSUME_NONNULL_BEGIN
+/** Syntax used in the proto file. */
typedef NS_ENUM(uint8_t, GPBFileSyntax) {
+ /** Unknown syntax. */
GPBFileSyntaxUnknown = 0,
+ /** Proto2 syntax. */
GPBFileSyntaxProto2 = 2,
+ /** Proto3 syntax. */
GPBFileSyntaxProto3 = 3,
};
+/** Type of proto field. */
typedef NS_ENUM(uint8_t, GPBFieldType) {
- GPBFieldTypeSingle, // optional/required
- GPBFieldTypeRepeated, // repeated
- GPBFieldTypeMap, // map<K,V>
+ /** Optional/required field. Only valid for proto2 fields. */
+ GPBFieldTypeSingle,
+ /** Repeated field. */
+ GPBFieldTypeRepeated,
+ /** Map field. */
+ GPBFieldTypeMap,
};
+/**
+ * Describes a proto message.
+ **/
@interface GPBDescriptor : NSObject<NSCopying>
+/** Name of the message. */
@property(nonatomic, readonly, copy) NSString *name;
+/** Fields declared in the message. */
@property(nonatomic, readonly, strong, nullable) NSArray<GPBFieldDescriptor*> *fields;
+/** Oneofs declared in the message. */
@property(nonatomic, readonly, strong, nullable) NSArray<GPBOneofDescriptor*> *oneofs;
+/** Extension range declared for the message. */
@property(nonatomic, readonly, nullable) const GPBExtensionRange *extensionRanges;
+/** Number of extension ranges declared for the message. */
@property(nonatomic, readonly) uint32_t extensionRangesCount;
+/** Descriptor for the file where the message was defined. */
@property(nonatomic, readonly, assign) GPBFileDescriptor *file;
+/** Whether the message is in wire format or not. */
@property(nonatomic, readonly, getter=isWireFormat) BOOL wireFormat;
+/** The class of this message. */
@property(nonatomic, readonly) Class messageClass;
+/**
+ * Gets the field for the given number.
+ *
+ * @param fieldNumber The number for the field to get.
+ *
+ * @return The field descriptor for the given number, or nil if not found.
+ **/
- (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber;
+
+/**
+ * Gets the field for the given name.
+ *
+ * @param name The name for the field to get.
+ *
+ * @return The field descriptor for the given name, or nil if not found.
+ **/
- (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name;
+
+/**
+ * Gets the oneof for the given name.
+ *
+ * @param name The name for the oneof to get.
+ *
+ * @return The oneof descriptor for the given name, or nil if not found.
+ **/
- (nullable GPBOneofDescriptor *)oneofWithName:(NSString *)name;
@end
+/**
+ * Describes a proto file.
+ **/
@interface GPBFileDescriptor : NSObject
+/** The package declared in the proto file. */
@property(nonatomic, readonly, copy) NSString *package;
+/** The syntax of the proto file. */
@property(nonatomic, readonly) GPBFileSyntax syntax;
@end
+/**
+ * Describes a oneof field.
+ **/
@interface GPBOneofDescriptor : NSObject
+/** Name of the oneof field. */
@property(nonatomic, readonly) NSString *name;
+/** Fields declared in the oneof. */
@property(nonatomic, readonly) NSArray<GPBFieldDescriptor*> *fields;
+/**
+ * Gets the field for the given number.
+ *
+ * @param fieldNumber The number for the field to get.
+ *
+ * @return The field descriptor for the given number, or nil if not found.
+ **/
- (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber;
+
+/**
+ * Gets the field for the given name.
+ *
+ * @param name The name for the field to get.
+ *
+ * @return The field descriptor for the given name, or nil if not found.
+ **/
- (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name;
+
@end
+/**
+ * Describes a proto field.
+ **/
@interface GPBFieldDescriptor : NSObject
+/** Name of the field. */
@property(nonatomic, readonly, copy) NSString *name;
+/** Number associated with the field. */
@property(nonatomic, readonly) uint32_t number;
+/** Data type contained in the field. */
@property(nonatomic, readonly) GPBDataType dataType;
+/** Whether it has a default value or not. */
@property(nonatomic, readonly) BOOL hasDefaultValue;
+/** Default value for the field. */
@property(nonatomic, readonly) GPBGenericValue defaultValue;
+/** Whether this field is required. Only valid for proto2 fields. */
@property(nonatomic, readonly, getter=isRequired) BOOL required;
+/** Whether this field is optional. */
@property(nonatomic, readonly, getter=isOptional) BOOL optional;
+/** Type of field (single, repeated, map). */
@property(nonatomic, readonly) GPBFieldType fieldType;
-// If it is a map, the value type is in -type.
+/** Type of the key if the field is a map. The value's type is -fieldType. */
@property(nonatomic, readonly) GPBDataType mapKeyDataType;
+/** Whether the field is packable. */
@property(nonatomic, readonly, getter=isPackable) BOOL packable;
+/** The containing oneof if this field is part of one, nil otherwise. */
@property(nonatomic, readonly, assign, nullable) GPBOneofDescriptor *containingOneof;
-// Message properties
+/** Class of the message if the field is of message type. */
@property(nonatomic, readonly, assign, nullable) Class msgClass;
-// Enum properties
+/** Descriptor for the enum if this field is an enum. */
@property(nonatomic, readonly, strong, nullable) GPBEnumDescriptor *enumDescriptor;
+/**
+ * Checks whether the given enum raw value is a valid enum value.
+ *
+ * @param value The raw enum value to check.
+ *
+ * @return YES if value is a valid enum raw value.
+ **/
- (BOOL)isValidEnumValue:(int32_t)value;
-// For now, this will return nil if it doesn't know the name to use for
-// TextFormat.
+/** @return Name for the text format, or nil if not known. */
- (nullable NSString *)textFormatName;
@end
+/**
+ * Describes a proto enum.
+ **/
@interface GPBEnumDescriptor : NSObject
+/** Name of the enum. */
@property(nonatomic, readonly, copy) NSString *name;
+/** Function that validates that raw values are valid enum values. */
@property(nonatomic, readonly) GPBEnumValidationFunc enumVerifier;
+/**
+ * Returns the enum value name for the given raw enum.
+ *
+ * @param number The raw enum value.
+ *
+ * @return The name of the enum value passed, or nil if not valid.
+ **/
- (nullable NSString *)enumNameForValue:(int32_t)number;
+
+/**
+ * Gets the enum raw value for the given enum name.
+ *
+ * @param outValue A pointer where the value will be set.
+ * @param name The enum name for which to get the raw value.
+ *
+ * @return YES if a value was copied into the pointer, NO otherwise.
+ **/
- (BOOL)getValue:(nullable int32_t *)outValue forEnumName:(NSString *)name;
+/**
+ * Returns the text format for the given raw enum value.
+ *
+ * @param number The raw enum value.
+ *
+ * @return The text format name for the raw enum value, or nil if not valid.
+ **/
- (nullable NSString *)textFormatNameForValue:(int32_t)number;
+
+/**
+ * Gets the enum raw value for the given text format name.
+ *
+ * @param outValue A pointer where the value will be set.
+ * @param textFormatName The text format name for which to get the raw value.
+ *
+ * @return YES if a value was copied into the pointer, NO otherwise.
+ **/
- (BOOL)getValue:(nullable int32_t *)outValue forEnumTextFormatName:(NSString *)textFormatName;
@end
+/**
+ * Describes a proto extension.
+ **/
@interface GPBExtensionDescriptor : NSObject<NSCopying>
+/** Field number under which the extension is stored. */
@property(nonatomic, readonly) uint32_t fieldNumber;
+/** The containing message class, i.e. the class extended by this extension. */
@property(nonatomic, readonly) Class containingMessageClass;
+/** Data type contained in the extension. */
@property(nonatomic, readonly) GPBDataType dataType;
+/** Whether the extension is repeated. */
@property(nonatomic, readonly, getter=isRepeated) BOOL repeated;
+/** Whether the extension is packable. */
@property(nonatomic, readonly, getter=isPackable) BOOL packable;
+/** The class of the message if the extension is of message type. */
@property(nonatomic, readonly, assign) Class msgClass;
+/** The singleton name for the extension. */
@property(nonatomic, readonly) NSString *singletonName;
+/** The enum descriptor if the extension is of enum type. */
@property(nonatomic, readonly, strong, nullable) GPBEnumDescriptor *enumDescriptor;
+/** The default value for the extension. */
@property(nonatomic, readonly, nullable) id defaultValue;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/objectivec/GPBDictionary.h b/objectivec/GPBDictionary.h
index f7959960..4b2b9ff3 100644
--- a/objectivec/GPBDictionary.h
+++ b/objectivec/GPBDictionary.h
@@ -32,11 +32,6 @@
#import "GPBRuntimeTypes.h"
-// These classes are used for map fields of basic data types. They are used because
-// they perform better than boxing into NSNumbers in NSDictionaries.
-
-// Note: These are not meant to be subclassed.
-
// Note on naming: for the classes holding numeric values, a more natural
// naming of the method might be things like "-valueForKey:",
// "-setValue:forKey:"; etc. But those selectors are also defined by Key Value
@@ -53,289 +48,1134 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - UInt32 -> UInt32
+/**
+ * Class used for map fields of <uint32_t, uint32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt32UInt32Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithUInt32:(uint32_t)value
forKey:(uint32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithUInt32s:(const uint32_t [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndUInt32sUsingBlock:
(void (^)(uint32_t key, uint32_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt32UInt32Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setUInt32:(uint32_t)value forKey:(uint32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeUInt32ForKey:(uint32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt32 -> Int32
+/**
+ * Class used for map fields of <uint32_t, int32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt32Int32Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithInt32:(int32_t)value
forKey:(uint32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithInt32s:(const int32_t [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt32Int32Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithInt32s:(const int32_t [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt32Int32Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getInt32:(nullable int32_t *)value forKey:(uint32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndInt32sUsingBlock:
(void (^)(uint32_t key, int32_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt32Int32Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setInt32:(int32_t)value forKey:(uint32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeInt32ForKey:(uint32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt32 -> UInt64
+/**
+ * Class used for map fields of <uint32_t, uint64_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt32UInt64Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithUInt64:(uint64_t)value
forKey:(uint32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithUInt64s:(const uint64_t [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndUInt64sUsingBlock:
(void (^)(uint32_t key, uint64_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt32UInt64Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setUInt64:(uint64_t)value forKey:(uint32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeUInt64ForKey:(uint32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt32 -> Int64
+/**
+ * Class used for map fields of <uint32_t, int64_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt32Int64Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithInt64:(int64_t)value
forKey:(uint32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithInt64s:(const int64_t [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt32Int64Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithInt64s:(const int64_t [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt32Int64Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getInt64:(nullable int64_t *)value forKey:(uint32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndInt64sUsingBlock:
(void (^)(uint32_t key, int64_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt32Int64Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setInt64:(int64_t)value forKey:(uint32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeInt64ForKey:(uint32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt32 -> Bool
+/**
+ * Class used for map fields of <uint32_t, BOOL>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt32BoolDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithBool:(BOOL)value
forKey:(uint32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithBools:(const BOOL [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt32BoolDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithBools:(const BOOL [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt32BoolDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getBool:(nullable BOOL *)value forKey:(uint32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndBoolsUsingBlock:
(void (^)(uint32_t key, BOOL value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt32BoolDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setBool:(BOOL)value forKey:(uint32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeBoolForKey:(uint32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt32 -> Float
+/**
+ * Class used for map fields of <uint32_t, float>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt32FloatDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithFloat:(float)value
forKey:(uint32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithFloats:(const float [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt32FloatDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithFloats:(const float [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt32FloatDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getFloat:(nullable float *)value forKey:(uint32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndFloatsUsingBlock:
(void (^)(uint32_t key, float value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt32FloatDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setFloat:(float)value forKey:(uint32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeFloatForKey:(uint32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt32 -> Double
+/**
+ * Class used for map fields of <uint32_t, double>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt32DoubleDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithDouble:(double)value
forKey:(uint32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithDoubles:(const double [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt32DoubleDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithDoubles:(const double [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt32DoubleDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getDouble:(nullable double *)value forKey:(uint32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndDoublesUsingBlock:
(void (^)(uint32_t key, double value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt32DoubleDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setDouble:(double)value forKey:(uint32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeDoubleForKey:(uint32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt32 -> Enum
+/**
+ * Class used for map fields of <uint32_t, int32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt32EnumDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/** The validation function to check if the enums are valid. */
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given validation function.
+ *
+ * @param func The enum validation function for the dictionary.
+ *
+ * @return A newly instanced dictionary.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param rawValue The raw enum value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValue:(int32_t)rawValue
forKey:(uint32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param values The raw enum values values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt32EnumDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)numItems;
+/**
+ * Initializes a dictionary with the given validation function.
+ *
+ * @param func The enum validation function for the dictionary.
+ *
+ * @return A newly initialized dictionary.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+
+/**
+ * Initializes a dictionary with the entries given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param values The raw enum values values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly initialized dictionary with the keys and values in it.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
forKeys:(const uint32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly initialized dictionary with the entries from the given
+ * dictionary in it.
+ **/
- (instancetype)initWithDictionary:(GPBUInt32EnumDictionary *)dictionary;
+
+/**
+ * Initializes a dictionary with the given capacity.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly initialized dictionary with the given capacity.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)numItems;
@@ -343,23 +1183,63 @@ NS_ASSUME_NONNULL_BEGIN
// is not a valid enumerator as defined by validationFunc. If the actual value is
// desired, use "raw" version of the method.
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getEnum:(nullable int32_t *)value forKey:(uint32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndEnumsUsingBlock:
(void (^)(uint32_t key, int32_t value, BOOL *stop))block;
-// These methods bypass the validationFunc to provide access to values that were not
-// known at the time the binary was compiled.
-
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the raw enum value for the given key.
+ *
+ * @note This method bypass the validationFunc to enable the access of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param rawValue Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @note This method bypass the validationFunc to enable the access of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **rawValue**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndRawValuesUsingBlock:
(void (^)(uint32_t key, int32_t rawValue, BOOL *stop))block;
+/**
+ * Adds the keys and raw enum values from another dictionary.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addRawEntriesFromDictionary:(GPBUInt32EnumDictionary *)otherDictionary;
// If value is not a valid enumerator as defined by validationFunc, these
@@ -367,339 +1247,1312 @@ NS_ASSUME_NONNULL_BEGIN
// to the default value. Use the rawValue methods below to assign non enumerator
// values.
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setEnum:(int32_t)value forKey:(uint32_t)key;
-// This method bypass the validationFunc to provide setting of values that were not
-// known at the time the binary was compiled.
+/**
+ * Sets the raw enum value for the given key.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param rawValue The raw enum value to set.
+ * @param key The key under which to store the raw enum value.
+ **/
- (void)setRawValue:(int32_t)rawValue forKey:(uint32_t)key;
-// No validation applies to these methods.
-
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeEnumForKey:(uint32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt32 -> Object
+/**
+ * Class used for map fields of <uint32_t, ObjectType>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param object The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithObject:(ObjectType)object
forKey:(uint32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param objects The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
forKeys:(const uint32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param objects The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
forKeys:(const uint32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
+/**
+ * Fetches the object stored under the given key.
+ *
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return The object if found, nil otherwise.
+ **/
- (ObjectType)objectForKey:(uint32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **object**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndObjectsUsingBlock:
(void (^)(uint32_t key, ObjectType object, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt32ObjectDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param object The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setObject:(ObjectType)object forKey:(uint32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeObjectForKey:(uint32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int32 -> UInt32
+/**
+ * Class used for map fields of <int32_t, uint32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt32UInt32Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithUInt32:(uint32_t)value
forKey:(int32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt32UInt32Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithUInt32s:(const uint32_t [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt32UInt32Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndUInt32sUsingBlock:
(void (^)(int32_t key, uint32_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt32UInt32Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setUInt32:(uint32_t)value forKey:(int32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeUInt32ForKey:(int32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int32 -> Int32
+/**
+ * Class used for map fields of <int32_t, int32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt32Int32Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithInt32:(int32_t)value
forKey:(int32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithInt32s:(const int32_t [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt32Int32Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithInt32s:(const int32_t [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt32Int32Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getInt32:(nullable int32_t *)value forKey:(int32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndInt32sUsingBlock:
(void (^)(int32_t key, int32_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt32Int32Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setInt32:(int32_t)value forKey:(int32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeInt32ForKey:(int32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int32 -> UInt64
+/**
+ * Class used for map fields of <int32_t, uint64_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt32UInt64Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithUInt64:(uint64_t)value
forKey:(int32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt32UInt64Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithUInt64s:(const uint64_t [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt32UInt64Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndUInt64sUsingBlock:
(void (^)(int32_t key, uint64_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt32UInt64Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setUInt64:(uint64_t)value forKey:(int32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeUInt64ForKey:(int32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int32 -> Int64
+/**
+ * Class used for map fields of <int32_t, int64_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt32Int64Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithInt64:(int64_t)value
forKey:(int32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithInt64s:(const int64_t [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt32Int64Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithInt64s:(const int64_t [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt32Int64Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getInt64:(nullable int64_t *)value forKey:(int32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndInt64sUsingBlock:
(void (^)(int32_t key, int64_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt32Int64Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setInt64:(int64_t)value forKey:(int32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeInt64ForKey:(int32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int32 -> Bool
+/**
+ * Class used for map fields of <int32_t, BOOL>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt32BoolDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithBool:(BOOL)value
forKey:(int32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithBools:(const BOOL [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt32BoolDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithBools:(const BOOL [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt32BoolDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getBool:(nullable BOOL *)value forKey:(int32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndBoolsUsingBlock:
(void (^)(int32_t key, BOOL value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt32BoolDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setBool:(BOOL)value forKey:(int32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeBoolForKey:(int32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int32 -> Float
+/**
+ * Class used for map fields of <int32_t, float>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt32FloatDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithFloat:(float)value
forKey:(int32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithFloats:(const float [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt32FloatDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithFloats:(const float [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt32FloatDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getFloat:(nullable float *)value forKey:(int32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndFloatsUsingBlock:
(void (^)(int32_t key, float value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt32FloatDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setFloat:(float)value forKey:(int32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeFloatForKey:(int32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int32 -> Double
+/**
+ * Class used for map fields of <int32_t, double>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt32DoubleDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithDouble:(double)value
forKey:(int32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithDoubles:(const double [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt32DoubleDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithDoubles:(const double [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt32DoubleDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getDouble:(nullable double *)value forKey:(int32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndDoublesUsingBlock:
(void (^)(int32_t key, double value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt32DoubleDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setDouble:(double)value forKey:(int32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeDoubleForKey:(int32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int32 -> Enum
+/**
+ * Class used for map fields of <int32_t, int32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt32EnumDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/** The validation function to check if the enums are valid. */
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given validation function.
+ *
+ * @param func The enum validation function for the dictionary.
+ *
+ * @return A newly instanced dictionary.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param rawValue The raw enum value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValue:(int32_t)rawValue
forKey:(int32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param values The raw enum values values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt32EnumDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)numItems;
+/**
+ * Initializes a dictionary with the given validation function.
+ *
+ * @param func The enum validation function for the dictionary.
+ *
+ * @return A newly initialized dictionary.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+
+/**
+ * Initializes a dictionary with the entries given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param values The raw enum values values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly initialized dictionary with the keys and values in it.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
forKeys:(const int32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly initialized dictionary with the entries from the given
+ * dictionary in it.
+ **/
- (instancetype)initWithDictionary:(GPBInt32EnumDictionary *)dictionary;
+
+/**
+ * Initializes a dictionary with the given capacity.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly initialized dictionary with the given capacity.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)numItems;
@@ -707,23 +2560,63 @@ NS_ASSUME_NONNULL_BEGIN
// is not a valid enumerator as defined by validationFunc. If the actual value is
// desired, use "raw" version of the method.
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getEnum:(nullable int32_t *)value forKey:(int32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndEnumsUsingBlock:
(void (^)(int32_t key, int32_t value, BOOL *stop))block;
-// These methods bypass the validationFunc to provide access to values that were not
-// known at the time the binary was compiled.
-
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the raw enum value for the given key.
+ *
+ * @note This method bypass the validationFunc to enable the access of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param rawValue Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @note This method bypass the validationFunc to enable the access of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **rawValue**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndRawValuesUsingBlock:
(void (^)(int32_t key, int32_t rawValue, BOOL *stop))block;
+/**
+ * Adds the keys and raw enum values from another dictionary.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addRawEntriesFromDictionary:(GPBInt32EnumDictionary *)otherDictionary;
// If value is not a valid enumerator as defined by validationFunc, these
@@ -731,339 +2624,1312 @@ NS_ASSUME_NONNULL_BEGIN
// to the default value. Use the rawValue methods below to assign non enumerator
// values.
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setEnum:(int32_t)value forKey:(int32_t)key;
-// This method bypass the validationFunc to provide setting of values that were not
-// known at the time the binary was compiled.
+/**
+ * Sets the raw enum value for the given key.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param rawValue The raw enum value to set.
+ * @param key The key under which to store the raw enum value.
+ **/
- (void)setRawValue:(int32_t)rawValue forKey:(int32_t)key;
-// No validation applies to these methods.
-
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeEnumForKey:(int32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int32 -> Object
+/**
+ * Class used for map fields of <int32_t, ObjectType>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param object The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithObject:(ObjectType)object
forKey:(int32_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param objects The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
forKeys:(const int32_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param objects The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
forKeys:(const int32_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
+/**
+ * Fetches the object stored under the given key.
+ *
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return The object if found, nil otherwise.
+ **/
- (ObjectType)objectForKey:(int32_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **object**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndObjectsUsingBlock:
(void (^)(int32_t key, ObjectType object, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt32ObjectDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param object The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setObject:(ObjectType)object forKey:(int32_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeObjectForKey:(int32_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt64 -> UInt32
+/**
+ * Class used for map fields of <uint64_t, uint32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt64UInt32Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithUInt32:(uint32_t)value
forKey:(uint64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithUInt32s:(const uint32_t [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndUInt32sUsingBlock:
(void (^)(uint64_t key, uint32_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt64UInt32Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setUInt32:(uint32_t)value forKey:(uint64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeUInt32ForKey:(uint64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt64 -> Int32
+/**
+ * Class used for map fields of <uint64_t, int32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt64Int32Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithInt32:(int32_t)value
forKey:(uint64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithInt32s:(const int32_t [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt64Int32Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithInt32s:(const int32_t [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt64Int32Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getInt32:(nullable int32_t *)value forKey:(uint64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndInt32sUsingBlock:
(void (^)(uint64_t key, int32_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt64Int32Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setInt32:(int32_t)value forKey:(uint64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeInt32ForKey:(uint64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt64 -> UInt64
+/**
+ * Class used for map fields of <uint64_t, uint64_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt64UInt64Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithUInt64:(uint64_t)value
forKey:(uint64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithUInt64s:(const uint64_t [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndUInt64sUsingBlock:
(void (^)(uint64_t key, uint64_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt64UInt64Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setUInt64:(uint64_t)value forKey:(uint64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeUInt64ForKey:(uint64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt64 -> Int64
+/**
+ * Class used for map fields of <uint64_t, int64_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt64Int64Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithInt64:(int64_t)value
forKey:(uint64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithInt64s:(const int64_t [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt64Int64Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithInt64s:(const int64_t [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt64Int64Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getInt64:(nullable int64_t *)value forKey:(uint64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndInt64sUsingBlock:
(void (^)(uint64_t key, int64_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt64Int64Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setInt64:(int64_t)value forKey:(uint64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeInt64ForKey:(uint64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt64 -> Bool
+/**
+ * Class used for map fields of <uint64_t, BOOL>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt64BoolDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithBool:(BOOL)value
forKey:(uint64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithBools:(const BOOL [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt64BoolDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithBools:(const BOOL [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt64BoolDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getBool:(nullable BOOL *)value forKey:(uint64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndBoolsUsingBlock:
(void (^)(uint64_t key, BOOL value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt64BoolDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setBool:(BOOL)value forKey:(uint64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeBoolForKey:(uint64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt64 -> Float
+/**
+ * Class used for map fields of <uint64_t, float>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt64FloatDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithFloat:(float)value
forKey:(uint64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithFloats:(const float [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt64FloatDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithFloats:(const float [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt64FloatDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getFloat:(nullable float *)value forKey:(uint64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndFloatsUsingBlock:
(void (^)(uint64_t key, float value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt64FloatDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setFloat:(float)value forKey:(uint64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeFloatForKey:(uint64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt64 -> Double
+/**
+ * Class used for map fields of <uint64_t, double>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt64DoubleDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithDouble:(double)value
forKey:(uint64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithDoubles:(const double [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt64DoubleDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithDoubles:(const double [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt64DoubleDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getDouble:(nullable double *)value forKey:(uint64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndDoublesUsingBlock:
(void (^)(uint64_t key, double value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt64DoubleDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setDouble:(double)value forKey:(uint64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeDoubleForKey:(uint64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt64 -> Enum
+/**
+ * Class used for map fields of <uint64_t, int32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt64EnumDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/** The validation function to check if the enums are valid. */
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given validation function.
+ *
+ * @param func The enum validation function for the dictionary.
+ *
+ * @return A newly instanced dictionary.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param rawValue The raw enum value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValue:(int32_t)rawValue
forKey:(uint64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param values The raw enum values values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt64EnumDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)numItems;
+/**
+ * Initializes a dictionary with the given validation function.
+ *
+ * @param func The enum validation function for the dictionary.
+ *
+ * @return A newly initialized dictionary.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+
+/**
+ * Initializes a dictionary with the entries given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param values The raw enum values values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly initialized dictionary with the keys and values in it.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
forKeys:(const uint64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly initialized dictionary with the entries from the given
+ * dictionary in it.
+ **/
- (instancetype)initWithDictionary:(GPBUInt64EnumDictionary *)dictionary;
+
+/**
+ * Initializes a dictionary with the given capacity.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly initialized dictionary with the given capacity.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)numItems;
@@ -1071,23 +3937,63 @@ NS_ASSUME_NONNULL_BEGIN
// is not a valid enumerator as defined by validationFunc. If the actual value is
// desired, use "raw" version of the method.
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getEnum:(nullable int32_t *)value forKey:(uint64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndEnumsUsingBlock:
(void (^)(uint64_t key, int32_t value, BOOL *stop))block;
-// These methods bypass the validationFunc to provide access to values that were not
-// known at the time the binary was compiled.
-
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the raw enum value for the given key.
+ *
+ * @note This method bypass the validationFunc to enable the access of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param rawValue Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @note This method bypass the validationFunc to enable the access of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **rawValue**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndRawValuesUsingBlock:
(void (^)(uint64_t key, int32_t rawValue, BOOL *stop))block;
+/**
+ * Adds the keys and raw enum values from another dictionary.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addRawEntriesFromDictionary:(GPBUInt64EnumDictionary *)otherDictionary;
// If value is not a valid enumerator as defined by validationFunc, these
@@ -1095,339 +4001,1312 @@ NS_ASSUME_NONNULL_BEGIN
// to the default value. Use the rawValue methods below to assign non enumerator
// values.
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setEnum:(int32_t)value forKey:(uint64_t)key;
-// This method bypass the validationFunc to provide setting of values that were not
-// known at the time the binary was compiled.
+/**
+ * Sets the raw enum value for the given key.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param rawValue The raw enum value to set.
+ * @param key The key under which to store the raw enum value.
+ **/
- (void)setRawValue:(int32_t)rawValue forKey:(uint64_t)key;
-// No validation applies to these methods.
-
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeEnumForKey:(uint64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - UInt64 -> Object
+/**
+ * Class used for map fields of <uint64_t, ObjectType>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBUInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param object The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithObject:(ObjectType)object
forKey:(uint64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param objects The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
forKeys:(const uint64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param objects The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
forKeys:(const uint64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
+/**
+ * Fetches the object stored under the given key.
+ *
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return The object if found, nil otherwise.
+ **/
- (ObjectType)objectForKey:(uint64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **object**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndObjectsUsingBlock:
(void (^)(uint64_t key, ObjectType object, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBUInt64ObjectDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param object The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setObject:(ObjectType)object forKey:(uint64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeObjectForKey:(uint64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int64 -> UInt32
+/**
+ * Class used for map fields of <int64_t, uint32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt64UInt32Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithUInt32:(uint32_t)value
forKey:(int64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt64UInt32Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithUInt32s:(const uint32_t [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt64UInt32Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndUInt32sUsingBlock:
(void (^)(int64_t key, uint32_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt64UInt32Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setUInt32:(uint32_t)value forKey:(int64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeUInt32ForKey:(int64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int64 -> Int32
+/**
+ * Class used for map fields of <int64_t, int32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt64Int32Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithInt32:(int32_t)value
forKey:(int64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithInt32s:(const int32_t [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt64Int32Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithInt32s:(const int32_t [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt64Int32Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getInt32:(nullable int32_t *)value forKey:(int64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndInt32sUsingBlock:
(void (^)(int64_t key, int32_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt64Int32Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setInt32:(int32_t)value forKey:(int64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeInt32ForKey:(int64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int64 -> UInt64
+/**
+ * Class used for map fields of <int64_t, uint64_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt64UInt64Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithUInt64:(uint64_t)value
forKey:(int64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt64UInt64Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithUInt64s:(const uint64_t [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt64UInt64Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndUInt64sUsingBlock:
(void (^)(int64_t key, uint64_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt64UInt64Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setUInt64:(uint64_t)value forKey:(int64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeUInt64ForKey:(int64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int64 -> Int64
+/**
+ * Class used for map fields of <int64_t, int64_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt64Int64Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithInt64:(int64_t)value
forKey:(int64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithInt64s:(const int64_t [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt64Int64Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithInt64s:(const int64_t [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt64Int64Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getInt64:(nullable int64_t *)value forKey:(int64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndInt64sUsingBlock:
(void (^)(int64_t key, int64_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt64Int64Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setInt64:(int64_t)value forKey:(int64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeInt64ForKey:(int64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int64 -> Bool
+/**
+ * Class used for map fields of <int64_t, BOOL>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt64BoolDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithBool:(BOOL)value
forKey:(int64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithBools:(const BOOL [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt64BoolDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithBools:(const BOOL [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt64BoolDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getBool:(nullable BOOL *)value forKey:(int64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndBoolsUsingBlock:
(void (^)(int64_t key, BOOL value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt64BoolDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setBool:(BOOL)value forKey:(int64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeBoolForKey:(int64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int64 -> Float
+/**
+ * Class used for map fields of <int64_t, float>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt64FloatDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithFloat:(float)value
forKey:(int64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithFloats:(const float [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt64FloatDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithFloats:(const float [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt64FloatDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getFloat:(nullable float *)value forKey:(int64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndFloatsUsingBlock:
(void (^)(int64_t key, float value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt64FloatDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setFloat:(float)value forKey:(int64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeFloatForKey:(int64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int64 -> Double
+/**
+ * Class used for map fields of <int64_t, double>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt64DoubleDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithDouble:(double)value
forKey:(int64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithDoubles:(const double [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt64DoubleDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithDoubles:(const double [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt64DoubleDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getDouble:(nullable double *)value forKey:(int64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndDoublesUsingBlock:
(void (^)(int64_t key, double value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt64DoubleDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setDouble:(double)value forKey:(int64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeDoubleForKey:(int64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int64 -> Enum
+/**
+ * Class used for map fields of <int64_t, int32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt64EnumDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/** The validation function to check if the enums are valid. */
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given validation function.
+ *
+ * @param func The enum validation function for the dictionary.
+ *
+ * @return A newly instanced dictionary.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param rawValue The raw enum value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValue:(int32_t)rawValue
forKey:(int64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param values The raw enum values values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt64EnumDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)numItems;
+/**
+ * Initializes a dictionary with the given validation function.
+ *
+ * @param func The enum validation function for the dictionary.
+ *
+ * @return A newly initialized dictionary.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+
+/**
+ * Initializes a dictionary with the entries given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param values The raw enum values values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly initialized dictionary with the keys and values in it.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
forKeys:(const int64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly initialized dictionary with the entries from the given
+ * dictionary in it.
+ **/
- (instancetype)initWithDictionary:(GPBInt64EnumDictionary *)dictionary;
+
+/**
+ * Initializes a dictionary with the given capacity.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly initialized dictionary with the given capacity.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)numItems;
@@ -1435,23 +5314,63 @@ NS_ASSUME_NONNULL_BEGIN
// is not a valid enumerator as defined by validationFunc. If the actual value is
// desired, use "raw" version of the method.
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getEnum:(nullable int32_t *)value forKey:(int64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndEnumsUsingBlock:
(void (^)(int64_t key, int32_t value, BOOL *stop))block;
-// These methods bypass the validationFunc to provide access to values that were not
-// known at the time the binary was compiled.
-
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the raw enum value for the given key.
+ *
+ * @note This method bypass the validationFunc to enable the access of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param rawValue Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @note This method bypass the validationFunc to enable the access of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **rawValue**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndRawValuesUsingBlock:
(void (^)(int64_t key, int32_t rawValue, BOOL *stop))block;
+/**
+ * Adds the keys and raw enum values from another dictionary.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addRawEntriesFromDictionary:(GPBInt64EnumDictionary *)otherDictionary;
// If value is not a valid enumerator as defined by validationFunc, these
@@ -1459,339 +5378,1312 @@ NS_ASSUME_NONNULL_BEGIN
// to the default value. Use the rawValue methods below to assign non enumerator
// values.
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setEnum:(int32_t)value forKey:(int64_t)key;
-// This method bypass the validationFunc to provide setting of values that were not
-// known at the time the binary was compiled.
+/**
+ * Sets the raw enum value for the given key.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param rawValue The raw enum value to set.
+ * @param key The key under which to store the raw enum value.
+ **/
- (void)setRawValue:(int32_t)rawValue forKey:(int64_t)key;
-// No validation applies to these methods.
-
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeEnumForKey:(int64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Int64 -> Object
+/**
+ * Class used for map fields of <int64_t, ObjectType>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param object The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithObject:(ObjectType)object
forKey:(int64_t)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param objects The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
forKeys:(const int64_t [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param objects The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
forKeys:(const int64_t [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
+/**
+ * Fetches the object stored under the given key.
+ *
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return The object if found, nil otherwise.
+ **/
- (ObjectType)objectForKey:(int64_t)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **object**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndObjectsUsingBlock:
(void (^)(int64_t key, ObjectType object, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBInt64ObjectDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param object The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setObject:(ObjectType)object forKey:(int64_t)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeObjectForKey:(int64_t)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Bool -> UInt32
+/**
+ * Class used for map fields of <BOOL, uint32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBBoolUInt32Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithUInt32:(uint32_t)value
forKey:(BOOL)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBBoolUInt32Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithUInt32s:(const uint32_t [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBBoolUInt32Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getUInt32:(nullable uint32_t *)value forKey:(BOOL)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndUInt32sUsingBlock:
(void (^)(BOOL key, uint32_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBBoolUInt32Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setUInt32:(uint32_t)value forKey:(BOOL)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeUInt32ForKey:(BOOL)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Bool -> Int32
+/**
+ * Class used for map fields of <BOOL, int32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBBoolInt32Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithInt32:(int32_t)value
forKey:(BOOL)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithInt32s:(const int32_t [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBBoolInt32Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithInt32s:(const int32_t [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBBoolInt32Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getInt32:(nullable int32_t *)value forKey:(BOOL)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndInt32sUsingBlock:
(void (^)(BOOL key, int32_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBBoolInt32Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setInt32:(int32_t)value forKey:(BOOL)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeInt32ForKey:(BOOL)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Bool -> UInt64
+/**
+ * Class used for map fields of <BOOL, uint64_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBBoolUInt64Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithUInt64:(uint64_t)value
forKey:(BOOL)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBBoolUInt64Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithUInt64s:(const uint64_t [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBBoolUInt64Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getUInt64:(nullable uint64_t *)value forKey:(BOOL)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndUInt64sUsingBlock:
(void (^)(BOOL key, uint64_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBBoolUInt64Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setUInt64:(uint64_t)value forKey:(BOOL)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeUInt64ForKey:(BOOL)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Bool -> Int64
+/**
+ * Class used for map fields of <BOOL, int64_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBBoolInt64Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithInt64:(int64_t)value
forKey:(BOOL)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithInt64s:(const int64_t [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBBoolInt64Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithInt64s:(const int64_t [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBBoolInt64Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getInt64:(nullable int64_t *)value forKey:(BOOL)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndInt64sUsingBlock:
(void (^)(BOOL key, int64_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBBoolInt64Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setInt64:(int64_t)value forKey:(BOOL)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeInt64ForKey:(BOOL)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Bool -> Bool
+/**
+ * Class used for map fields of <BOOL, BOOL>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBBoolBoolDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithBool:(BOOL)value
forKey:(BOOL)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithBools:(const BOOL [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBBoolBoolDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithBools:(const BOOL [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBBoolBoolDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getBool:(nullable BOOL *)value forKey:(BOOL)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndBoolsUsingBlock:
(void (^)(BOOL key, BOOL value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBBoolBoolDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setBool:(BOOL)value forKey:(BOOL)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeBoolForKey:(BOOL)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Bool -> Float
+/**
+ * Class used for map fields of <BOOL, float>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBBoolFloatDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithFloat:(float)value
forKey:(BOOL)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithFloats:(const float [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBBoolFloatDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithFloats:(const float [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBBoolFloatDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getFloat:(nullable float *)value forKey:(BOOL)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndFloatsUsingBlock:
(void (^)(BOOL key, float value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBBoolFloatDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setFloat:(float)value forKey:(BOOL)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeFloatForKey:(BOOL)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Bool -> Double
+/**
+ * Class used for map fields of <BOOL, double>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBBoolDoubleDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithDouble:(double)value
forKey:(BOOL)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithDoubles:(const double [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBBoolDoubleDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithDoubles:(const double [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBBoolDoubleDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getDouble:(nullable double *)value forKey:(BOOL)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndDoublesUsingBlock:
(void (^)(BOOL key, double value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBBoolDoubleDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setDouble:(double)value forKey:(BOOL)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeDoubleForKey:(BOOL)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Bool -> Enum
+/**
+ * Class used for map fields of <BOOL, int32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBBoolEnumDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/** The validation function to check if the enums are valid. */
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given validation function.
+ *
+ * @param func The enum validation function for the dictionary.
+ *
+ * @return A newly instanced dictionary.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param rawValue The raw enum value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValue:(int32_t)rawValue
forKey:(BOOL)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param values The raw enum values values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBBoolEnumDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)numItems;
+/**
+ * Initializes a dictionary with the given validation function.
+ *
+ * @param func The enum validation function for the dictionary.
+ *
+ * @return A newly initialized dictionary.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+
+/**
+ * Initializes a dictionary with the entries given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param values The raw enum values values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly initialized dictionary with the keys and values in it.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
forKeys:(const BOOL [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly initialized dictionary with the entries from the given
+ * dictionary in it.
+ **/
- (instancetype)initWithDictionary:(GPBBoolEnumDictionary *)dictionary;
+
+/**
+ * Initializes a dictionary with the given capacity.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly initialized dictionary with the given capacity.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)numItems;
@@ -1799,23 +6691,63 @@ NS_ASSUME_NONNULL_BEGIN
// is not a valid enumerator as defined by validationFunc. If the actual value is
// desired, use "raw" version of the method.
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getEnum:(nullable int32_t *)value forKey:(BOOL)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndEnumsUsingBlock:
(void (^)(BOOL key, int32_t value, BOOL *stop))block;
-// These methods bypass the validationFunc to provide access to values that were not
-// known at the time the binary was compiled.
-
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the raw enum value for the given key.
+ *
+ * @note This method bypass the validationFunc to enable the access of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param rawValue Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(BOOL)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @note This method bypass the validationFunc to enable the access of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **rawValue**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndRawValuesUsingBlock:
(void (^)(BOOL key, int32_t rawValue, BOOL *stop))block;
+/**
+ * Adds the keys and raw enum values from another dictionary.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addRawEntriesFromDictionary:(GPBBoolEnumDictionary *)otherDictionary;
// If value is not a valid enumerator as defined by validationFunc, these
@@ -1823,339 +6755,1312 @@ NS_ASSUME_NONNULL_BEGIN
// to the default value. Use the rawValue methods below to assign non enumerator
// values.
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setEnum:(int32_t)value forKey:(BOOL)key;
-// This method bypass the validationFunc to provide setting of values that were not
-// known at the time the binary was compiled.
+/**
+ * Sets the raw enum value for the given key.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param rawValue The raw enum value to set.
+ * @param key The key under which to store the raw enum value.
+ **/
- (void)setRawValue:(int32_t)rawValue forKey:(BOOL)key;
-// No validation applies to these methods.
-
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeEnumForKey:(BOOL)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - Bool -> Object
+/**
+ * Class used for map fields of <BOOL, ObjectType>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBBoolObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param object The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithObject:(ObjectType)object
forKey:(BOOL)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param objects The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
forKeys:(const BOOL [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param objects The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
forKeys:(const BOOL [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
+/**
+ * Fetches the object stored under the given key.
+ *
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return The object if found, nil otherwise.
+ **/
- (ObjectType)objectForKey:(BOOL)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **object**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndObjectsUsingBlock:
(void (^)(BOOL key, ObjectType object, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBBoolObjectDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param object The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setObject:(ObjectType)object forKey:(BOOL)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeObjectForKey:(BOOL)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - String -> UInt32
+/**
+ * Class used for map fields of <NSString, uint32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBStringUInt32Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithUInt32:(uint32_t)value
forKey:(NSString *)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBStringUInt32Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithUInt32s:(const uint32_t [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBStringUInt32Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getUInt32:(nullable uint32_t *)value forKey:(NSString *)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndUInt32sUsingBlock:
(void (^)(NSString *key, uint32_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBStringUInt32Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setUInt32:(uint32_t)value forKey:(NSString *)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeUInt32ForKey:(NSString *)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - String -> Int32
+/**
+ * Class used for map fields of <NSString, int32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBStringInt32Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithInt32:(int32_t)value
forKey:(NSString *)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithInt32s:(const int32_t [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBStringInt32Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithInt32s:(const int32_t [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBStringInt32Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getInt32:(nullable int32_t *)value forKey:(NSString *)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndInt32sUsingBlock:
(void (^)(NSString *key, int32_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBStringInt32Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setInt32:(int32_t)value forKey:(NSString *)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeInt32ForKey:(NSString *)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - String -> UInt64
+/**
+ * Class used for map fields of <NSString, uint64_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBStringUInt64Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithUInt64:(uint64_t)value
forKey:(NSString *)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBStringUInt64Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithUInt64s:(const uint64_t [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBStringUInt64Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getUInt64:(nullable uint64_t *)value forKey:(NSString *)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndUInt64sUsingBlock:
(void (^)(NSString *key, uint64_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBStringUInt64Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setUInt64:(uint64_t)value forKey:(NSString *)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeUInt64ForKey:(NSString *)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - String -> Int64
+/**
+ * Class used for map fields of <NSString, int64_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBStringInt64Dictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithInt64:(int64_t)value
forKey:(NSString *)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithInt64s:(const int64_t [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBStringInt64Dictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithInt64s:(const int64_t [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBStringInt64Dictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getInt64:(nullable int64_t *)value forKey:(NSString *)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndInt64sUsingBlock:
(void (^)(NSString *key, int64_t value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBStringInt64Dictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setInt64:(int64_t)value forKey:(NSString *)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeInt64ForKey:(NSString *)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - String -> Bool
+/**
+ * Class used for map fields of <NSString, BOOL>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBStringBoolDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithBool:(BOOL)value
forKey:(NSString *)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithBools:(const BOOL [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBStringBoolDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithBools:(const BOOL [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBStringBoolDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getBool:(nullable BOOL *)value forKey:(NSString *)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndBoolsUsingBlock:
(void (^)(NSString *key, BOOL value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBStringBoolDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setBool:(BOOL)value forKey:(NSString *)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeBoolForKey:(NSString *)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - String -> Float
+/**
+ * Class used for map fields of <NSString, float>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBStringFloatDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithFloat:(float)value
forKey:(NSString *)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithFloats:(const float [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBStringFloatDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithFloats:(const float [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBStringFloatDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getFloat:(nullable float *)value forKey:(NSString *)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndFloatsUsingBlock:
(void (^)(NSString *key, float value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBStringFloatDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setFloat:(float)value forKey:(NSString *)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeFloatForKey:(NSString *)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - String -> Double
+/**
+ * Class used for map fields of <NSString, double>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBStringDoubleDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param value The value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithDouble:(double)value
forKey:(NSString *)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param values The values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithDoubles:(const double [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBStringDoubleDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
+/**
+ * Initializes this dictionary, copying the given values and keys.
+ *
+ * @param values The values to be placed in this dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of elements to copy into the dictionary.
+ *
+ * @return A newly initialized dictionary with a copy of the values and keys.
+ **/
- (instancetype)initWithDoubles:(const double [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes this dictionary, copying the entries from the given dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to this dictionary.
+ *
+ * @return A newly initialized dictionary with the entries of the given dictionary.
+ **/
- (instancetype)initWithDictionary:(GPBStringDoubleDictionary *)dictionary;
+
+/**
+ * Initializes this dictionary with the requested capacity.
+ *
+ * @param numItems Number of items needed for this dictionary.
+ *
+ * @return A newly initialized dictionary with the requested capacity.
+ **/
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getDouble:(nullable double *)value forKey:(NSString *)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndDoublesUsingBlock:
(void (^)(NSString *key, double value, BOOL *stop))block;
+/**
+ * Adds the keys and values from another dictionary.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addEntriesFromDictionary:(GPBStringDoubleDictionary *)otherDictionary;
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setDouble:(double)value forKey:(NSString *)key;
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeDoubleForKey:(NSString *)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
#pragma mark - String -> Enum
+/**
+ * Class used for map fields of <NSString, int32_t>
+ * values. This performs better than boxing into NSNumbers in NSDictionaries.
+ *
+ * @note This class is not meant to be subclassed.
+ **/
@interface GPBStringEnumDictionary : NSObject <NSCopying>
+/** Number of entries stored in this dictionary. */
@property(nonatomic, readonly) NSUInteger count;
+/** The validation function to check if the enums are valid. */
@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
+/**
+ * @return A newly instanced and empty dictionary.
+ **/
+ (instancetype)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given validation function.
+ *
+ * @param func The enum validation function for the dictionary.
+ *
+ * @return A newly instanced dictionary.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+
+/**
+ * Creates and initializes a dictionary with the single entry given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param rawValue The raw enum value to be placed in the dictionary.
+ * @param key The key under which to store the value.
+ *
+ * @return A newly instanced dictionary with the key and value in it.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValue:(int32_t)rawValue
forKey:(NSString *)key;
+
+/**
+ * Creates and initializes a dictionary with the entries given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param values The raw enum values values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly instanced dictionary with the keys and values in it.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count;
+
+/**
+ * Creates and initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly instanced dictionary with the entries from the given
+ * dictionary in it.
+ **/
+ (instancetype)dictionaryWithDictionary:(GPBStringEnumDictionary *)dictionary;
+
+/**
+ * Creates and initializes a dictionary with the given capacity.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly instanced dictionary with the given capacity.
+ **/
+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)numItems;
+/**
+ * Initializes a dictionary with the given validation function.
+ *
+ * @param func The enum validation function for the dictionary.
+ *
+ * @return A newly initialized dictionary.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+
+/**
+ * Initializes a dictionary with the entries given.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param values The raw enum values values to be placed in the dictionary.
+ * @param keys The keys under which to store the values.
+ * @param count The number of entries to store in the dictionary.
+ *
+ * @return A newly initialized dictionary with the keys and values in it.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
rawValues:(const int32_t [])values
forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Initializes a dictionary with the entries from the given.
+ * dictionary.
+ *
+ * @param dictionary Dictionary containing the entries to add to the dictionary.
+ *
+ * @return A newly initialized dictionary with the entries from the given
+ * dictionary in it.
+ **/
- (instancetype)initWithDictionary:(GPBStringEnumDictionary *)dictionary;
+
+/**
+ * Initializes a dictionary with the given capacity.
+ *
+ * @param func The enum validation function for the dictionary.
+ * @param numItems Capacity needed for the dictionary.
+ *
+ * @return A newly initialized dictionary with the given capacity.
+ **/
- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
capacity:(NSUInteger)numItems;
@@ -2163,23 +8068,63 @@ NS_ASSUME_NONNULL_BEGIN
// is not a valid enumerator as defined by validationFunc. If the actual value is
// desired, use "raw" version of the method.
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the value for the given key.
+ *
+ * @param value Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getEnum:(nullable int32_t *)value forKey:(NSString *)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **value**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndEnumsUsingBlock:
(void (^)(NSString *key, int32_t value, BOOL *stop))block;
-// These methods bypass the validationFunc to provide access to values that were not
-// known at the time the binary was compiled.
-
-// Returns YES/NO to indicate if the key was found or not, filling in the value
-// only when the key was found.
+/**
+ * Gets the raw enum value for the given key.
+ *
+ * @note This method bypass the validationFunc to enable the access of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param rawValue Pointer into which the value will be set, if found.
+ * @param key Key under which the value is stored, if present.
+ *
+ * @return YES if the key was found and the value was copied, NO otherwise.
+ **/
- (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(NSString *)key;
+/**
+ * Enumerates the keys and values on this dictionary with the given block.
+ *
+ * @note This method bypass the validationFunc to enable the access of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param block The block to enumerate with.
+ * **key**: The key for the current entry.
+ * **rawValue**: The value for the current entry
+ * **stop**: A pointer to a boolean that when set stops the enumeration.
+ **/
- (void)enumerateKeysAndRawValuesUsingBlock:
(void (^)(NSString *key, int32_t rawValue, BOOL *stop))block;
+/**
+ * Adds the keys and raw enum values from another dictionary.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param otherDictionary Dictionary containing entries to be added to this
+ * dictionary.
+ **/
- (void)addRawEntriesFromDictionary:(GPBStringEnumDictionary *)otherDictionary;
// If value is not a valid enumerator as defined by validationFunc, these
@@ -2187,15 +8132,35 @@ NS_ASSUME_NONNULL_BEGIN
// to the default value. Use the rawValue methods below to assign non enumerator
// values.
+/**
+ * Sets the value for the given key.
+ *
+ * @param value The value to set.
+ * @param key The key under which to store the value.
+ **/
- (void)setEnum:(int32_t)value forKey:(NSString *)key;
-// This method bypass the validationFunc to provide setting of values that were not
-// known at the time the binary was compiled.
+/**
+ * Sets the raw enum value for the given key.
+ *
+ * @note This method bypass the validationFunc to enable the setting of values that
+ * were not known at the time the binary was compiled.
+ *
+ * @param rawValue The raw enum value to set.
+ * @param key The key under which to store the raw enum value.
+ **/
- (void)setRawValue:(int32_t)rawValue forKey:(NSString *)key;
-// No validation applies to these methods.
-
+/**
+ * Removes the entry for the given key.
+ *
+ * @param aKey Key to be removed from this dictionary.
+ **/
- (void)removeEnumForKey:(NSString *)aKey;
+
+/**
+ * Removes all entries in this dictionary.
+ **/
- (void)removeAll;
@end
@@ -2228,10 +8193,23 @@ NS_ASSUME_NONNULL_END
//%PDDM-DEFINE DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, VALUE_NAME, VALUE_TYPE)
//%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, , POD, VALUE_NAME, VALUE_TYPE, OBJECT, Object, object)
//%PDDM-DEFINE VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME)
-//%// Returns YES/NO to indicate if the key was found or not, filling in the value
-//%// only when the key was found.
+//%/**
+//% * Gets the value for the given key.
+//% *
+//% * @param value Pointer into which the value will be set, if found.
+//% * @param key Key under which the value is stored, if present.
+//% *
+//% * @return YES if the key was found and the value was copied, NO otherwise.
+//% **/
//%- (BOOL)get##VNAME##:(nullable VALUE_TYPE *)value forKey:(KEY_TYPE)key;
//%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_TYPE, VNAME)
+//%/**
+//% * Fetches the object stored under the given key.
+//% *
+//% * @param key Key under which the value is stored, if present.
+//% *
+//% * @return The object if found, nil otherwise.
+//% **/
//%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key;
//%PDDM-DEFINE VALUE_FOR_KEY_Enum(KEY_TYPE, VALUE_TYPE, VNAME)
//%VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME)
@@ -2250,27 +8228,105 @@ NS_ASSUME_NONNULL_END
//%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
//%#pragma mark - KEY_NAME -> VALUE_NAME
//%
+//%/**
+//% * Class used for map fields of <##KEY_TYPE##, ##VALUE_TYPE##>
+//% * values. This performs better than boxing into NSNumbers in NSDictionaries.
+//% *
+//% * @note This class is not meant to be subclassed.
+//% **/
//%@interface DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) : NSObject <NSCopying>
//%
+//%/** Number of entries stored in this dictionary. */
//%@property(nonatomic, readonly) NSUInteger count;
//%
+//%/**
+//% * @return A newly instanced and empty dictionary.
+//% **/
//%+ (instancetype)dictionary;
+//%
+//%/**
+//% * Creates and initializes a dictionary with the single entry given.
+//% *
+//% * @param ##VNAME_VAR The value to be placed in the dictionary.
+//% * @param key ##VNAME_VAR$S## The key under which to store the value.
+//% *
+//% * @return A newly instanced dictionary with the key and value in it.
+//% **/
//%+ (instancetype)dictionaryWith##VNAME##:(VALUE_TYPE)##VNAME_VAR
//% ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key;
+//%
+//%/**
+//% * Creates and initializes a dictionary with the entries given.
+//% *
+//% * @param ##VNAME_VAR##s The values to be placed in the dictionary.
+//% * @param keys ##VNAME_VAR$S## The keys under which to store the values.
+//% * @param count ##VNAME_VAR$S## The number of entries to store in the dictionary.
+//% *
+//% * @return A newly instanced dictionary with the keys and values in it.
+//% **/
//%+ (instancetype)dictionaryWith##VNAME##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])##VNAME_VAR##s
//% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
//% ##VNAME$S## count:(NSUInteger)count;
+//%
+//%/**
+//% * Creates and initializes a dictionary with the entries from the given.
+//% * dictionary.
+//% *
+//% * @param dictionary Dictionary containing the entries to add to the dictionary.
+//% *
+//% * @return A newly instanced dictionary with the entries from the given
+//% * dictionary in it.
+//% **/
//%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
+//%
+//%/**
+//% * Creates and initializes a dictionary with the given capacity.
+//% *
+//% * @param numItems Capacity needed for the dictionary.
+//% *
+//% * @return A newly instanced dictionary with the given capacity.
+//% **/
//%+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
//%
+//%/**
+//% * Initializes this dictionary, copying the given values and keys.
+//% *
+//% * @param ##VNAME_VAR##s The values to be placed in this dictionary.
+//% * @param keys ##VNAME_VAR$S## The keys under which to store the values.
+//% * @param count ##VNAME_VAR$S## The number of elements to copy into the dictionary.
+//% *
+//% * @return A newly initialized dictionary with a copy of the values and keys.
+//% **/
//%- (instancetype)initWith##VNAME##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])##VNAME_VAR##s
//% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
//% ##VNAME$S## count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+//%
+//%/**
+//% * Initializes this dictionary, copying the entries from the given dictionary.
+//% *
+//% * @param dictionary Dictionary containing the entries to add to this dictionary.
+//% *
+//% * @return A newly initialized dictionary with the entries of the given dictionary.
+//% **/
//%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
+//%
+//%/**
+//% * Initializes this dictionary with the requested capacity.
+//% *
+//% * @param numItems Number of items needed for this dictionary.
+//% *
+//% * @return A newly initialized dictionary with the requested capacity.
+//% **/
//%- (instancetype)initWithCapacity:(NSUInteger)numItems;
//%
//%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
//%
+//%/**
+//% * Adds the keys and values from another dictionary.
+//% *
+//% * @param otherDictionary Dictionary containing entries to be added to this
+//% * dictionary.
+//% **/
//%- (void)addEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary;
//%
//%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
@@ -2283,30 +8339,126 @@ NS_ASSUME_NONNULL_END
//%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER)
//%#pragma mark - KEY_NAME -> VALUE_NAME
//%
+//%/**
+//% * Class used for map fields of <##KEY_TYPE##, ##VALUE_TYPE##>
+//% * values. This performs better than boxing into NSNumbers in NSDictionaries.
+//% *
+//% * @note This class is not meant to be subclassed.
+//% **/
//%@interface GPB##KEY_NAME##VALUE_NAME##Dictionary : NSObject <NSCopying>
//%
+//%/** Number of entries stored in this dictionary. */
//%@property(nonatomic, readonly) NSUInteger count;
+//%/** The validation function to check if the enums are valid. */
//%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
//%
+//%/**
+//% * @return A newly instanced and empty dictionary.
+//% **/
//%+ (instancetype)dictionary;
+//%
+//%/**
+//% * Creates and initializes a dictionary with the given validation function.
+//% *
+//% * @param func The enum validation function for the dictionary.
+//% *
+//% * @return A newly instanced dictionary.
+//% **/
//%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+//%
+//%/**
+//% * Creates and initializes a dictionary with the single entry given.
+//% *
+//% * @param func The enum validation function for the dictionary.
+//% * @param rawValue The raw enum value to be placed in the dictionary.
+//% * @param key The key under which to store the value.
+//% *
+//% * @return A newly instanced dictionary with the key and value in it.
+//% **/
//%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
//% rawValue:(VALUE_TYPE)rawValue
//% forKey:(KEY_TYPE##KisP$S##KisP)key;
+//%
+//%/**
+//% * Creates and initializes a dictionary with the entries given.
+//% *
+//% * @param func The enum validation function for the dictionary.
+//% * @param values The raw enum values values to be placed in the dictionary.
+//% * @param keys The keys under which to store the values.
+//% * @param count The number of entries to store in the dictionary.
+//% *
+//% * @return A newly instanced dictionary with the keys and values in it.
+//% **/
//%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
//% rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])values
//% forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
//% count:(NSUInteger)count;
+//%
+//%/**
+//% * Creates and initializes a dictionary with the entries from the given.
+//% * dictionary.
+//% *
+//% * @param dictionary Dictionary containing the entries to add to the dictionary.
+//% *
+//% * @return A newly instanced dictionary with the entries from the given
+//% * dictionary in it.
+//% **/
//%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
+//%
+//%/**
+//% * Creates and initializes a dictionary with the given capacity.
+//% *
+//% * @param func The enum validation function for the dictionary.
+//% * @param numItems Capacity needed for the dictionary.
+//% *
+//% * @return A newly instanced dictionary with the given capacity.
+//% **/
//%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
//% capacity:(NSUInteger)numItems;
//%
+//%/**
+//% * Initializes a dictionary with the given validation function.
+//% *
+//% * @param func The enum validation function for the dictionary.
+//% *
+//% * @return A newly initialized dictionary.
+//% **/
//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
+//%
+//%/**
+//% * Initializes a dictionary with the entries given.
+//% *
+//% * @param func The enum validation function for the dictionary.
+//% * @param values The raw enum values values to be placed in the dictionary.
+//% * @param keys The keys under which to store the values.
+//% * @param count The number of entries to store in the dictionary.
+//% *
+//% * @return A newly initialized dictionary with the keys and values in it.
+//% **/
//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
//% rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])values
//% forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
//% count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+//%
+//%/**
+//% * Initializes a dictionary with the entries from the given.
+//% * dictionary.
+//% *
+//% * @param dictionary Dictionary containing the entries to add to the dictionary.
+//% *
+//% * @return A newly initialized dictionary with the entries from the given
+//% * dictionary in it.
+//% **/
//%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
+//%
+//%/**
+//% * Initializes a dictionary with the given capacity.
+//% *
+//% * @param func The enum validation function for the dictionary.
+//% * @param numItems Capacity needed for the dictionary.
+//% *
+//% * @return A newly initialized dictionary with the given capacity.
+//% **/
//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
//% capacity:(NSUInteger)numItems;
//%
@@ -2316,16 +8468,42 @@ NS_ASSUME_NONNULL_END
//%
//%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, Enum, value)
//%
-//%// These methods bypass the validationFunc to provide access to values that were not
-//%// known at the time the binary was compiled.
-//%
-//%// Returns YES/NO to indicate if the key was found or not, filling in the value
-//%// only when the key was found.
+//%/**
+//% * Gets the raw enum value for the given key.
+//% *
+//% * @note This method bypass the validationFunc to enable the access of values that
+//% * were not known at the time the binary was compiled.
+//% *
+//% * @param rawValue Pointer into which the value will be set, if found.
+//% * @param key Key under which the value is stored, if present.
+//% *
+//% * @return YES if the key was found and the value was copied, NO otherwise.
+//% **/
//%- (BOOL)getRawValue:(nullable VALUE_TYPE *)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key;
//%
+//%/**
+//% * Enumerates the keys and values on this dictionary with the given block.
+//% *
+//% * @note This method bypass the validationFunc to enable the access of values that
+//% * were not known at the time the binary was compiled.
+//% *
+//% * @param block The block to enumerate with.
+//% * **key**: The key for the current entry.
+//% * **rawValue**: The value for the current entry
+//% * **stop**: A pointer to a boolean that when set stops the enumeration.
+//% **/
//%- (void)enumerateKeysAndRawValuesUsingBlock:
//% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE rawValue, BOOL *stop))block;
//%
+//%/**
+//% * Adds the keys and raw enum values from another dictionary.
+//% *
+//% * @note This method bypass the validationFunc to enable the setting of values that
+//% * were not known at the time the binary was compiled.
+//% *
+//% * @param otherDictionary Dictionary containing entries to be added to this
+//% * dictionary.
+//% **/
//%- (void)addRawEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary;
//%
//%// If value is not a valid enumerator as defined by validationFunc, these
@@ -2341,13 +8519,36 @@ NS_ASSUME_NONNULL_END
//%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
//%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_TYPE, VNAME)
//%
+//%/**
+//% * Enumerates the keys and values on this dictionary with the given block.
+//% *
+//% * @param block The block to enumerate with.
+//% * **key**: ##VNAME_VAR$S## The key for the current entry.
+//% * **VNAME_VAR**: The value for the current entry
+//% * **stop**: ##VNAME_VAR$S## A pointer to a boolean that when set stops the enumeration.
+//% **/
//%- (void)enumerateKeysAnd##VNAME##sUsingBlock:
//% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME_VAR, BOOL *stop))block;
//%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
+//%/**
+//% * Sets the value for the given key.
+//% *
+//% * @param ##VNAME_VAR The value to set.
+//% * @param key ##VNAME_VAR$S## The key under which to store the value.
+//% **/
//%- (void)set##VNAME##:(VALUE_TYPE)##VNAME_VAR forKey:(KEY_TYPE##KisP$S##KisP)key;
//%DICTIONARY_EXTRA_MUTABLE_METHODS_##VHELPER(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
+//%/**
+//% * Removes the entry for the given key.
+//% *
+//% * @param aKey Key to be removed from this dictionary.
+//% **/
//%- (void)remove##VNAME##ForKey:(KEY_TYPE##KisP$S##KisP)aKey;
+//%
+//%/**
+//% * Removes all entries in this dictionary.
+//% **/
//%- (void)removeAll;
//%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_POD(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
@@ -2356,9 +8557,14 @@ NS_ASSUME_NONNULL_END
// Empty
//%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_Enum(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
//%
-//%// This method bypass the validationFunc to provide setting of values that were not
-//%// known at the time the binary was compiled.
+//%/**
+//% * Sets the raw enum value for the given key.
+//% *
+//% * @note This method bypass the validationFunc to enable the setting of values that
+//% * were not known at the time the binary was compiled.
+//% *
+//% * @param rawValue The raw enum value to set.
+//% * @param key The key under which to store the raw enum value.
+//% **/
//%- (void)setRawValue:(VALUE_TYPE)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key;
//%
-//%// No validation applies to these methods.
-//%
diff --git a/objectivec/GPBExtensionRegistry.h b/objectivec/GPBExtensionRegistry.h
index 08a6472a..b395db17 100644
--- a/objectivec/GPBExtensionRegistry.h
+++ b/objectivec/GPBExtensionRegistry.h
@@ -35,45 +35,50 @@
NS_ASSUME_NONNULL_BEGIN
-/// A table of known extensions, searchable by name or field number. When
-/// parsing a protocol message that might have extensions, you must provide a
-/// @c GPBExtensionRegistry in which you have registered any extensions that you
-/// want to be able to parse. Otherwise, those extensions will just be treated
-/// like unknown fields.
-///
-/// The @c *Root classes provide @c +extensionRegistry for the extensions defined
-/// in a given file *and* all files it imports. You can also create a
-/// @c GPBExtensionRegistry, and merge those registries to handle parsing
-/// extensions defined from non overlapping files.
-///
-/// @code
-/// GPBExtensionRegistry *registry =
-/// [[[MyProtoFileRoot extensionRegistry] copy] autorelease];
-/// [registry addExtension:[OtherMessage neededExtension]; // Not in MyProtoFile
-/// NSError *parseError = nil;
-/// MyMessage *msg = [MyMessage parseData:data
-/// extensionRegistry:registry
-/// error:&parseError];
-/// @endcode
+/**
+ * A table of known extensions, searchable by name or field number. When
+ * parsing a protocol message that might have extensions, you must provide a
+ * GPBExtensionRegistry in which you have registered any extensions that you
+ * want to be able to parse. Otherwise, those extensions will just be treated
+ * like unknown fields.
+ *
+ * The *Root classes provide `+extensionRegistry` for the extensions defined
+ * in a given file *and* all files it imports. You can also create a
+ * GPBExtensionRegistry, and merge those registries to handle parsing
+ * extensions defined from non overlapping files.
+ *
+ * ```
+ * GPBExtensionRegistry *registry = [[MyProtoFileRoot extensionRegistry] copy];
+ * [registry addExtension:[OtherMessage neededExtension]]; // Not in MyProtoFile
+ * NSError *parseError;
+ * MyMessage *msg = [MyMessage parseData:data extensionRegistry:registry error:&parseError];
+ * ```
+ **/
@interface GPBExtensionRegistry : NSObject<NSCopying>
-/// Add the given @c GPBExtensionDescriptor to this registry.
-///
-/// @param extension The extension description to add.
+/**
+ * Adds the given GPBExtensionDescriptor to this registry.
+ *
+ * @param extension The extension description to add.
+ **/
- (void)addExtension:(GPBExtensionDescriptor *)extension;
-/// Adds all the extensions from another registry to this registry.
-///
-/// @param registry The registry to merge into this registry.
+/**
+ * Adds all the extensions from another registry to this registry.
+ *
+ * @param registry The registry to merge into this registry.
+ **/
- (void)addExtensions:(GPBExtensionRegistry *)registry;
-/// Looks for the extension registered for the given field number on a given
-/// @c GPBDescriptor.
-///
-/// @param descriptor The descriptor to look for a registered extension on.
-/// @param fieldNumber The field number of an extension to look for.
-///
-/// @return The registered @c GPBExtensionDescripto or nil if none was found.
+/**
+ * Looks for the extension registered for the given field number on a given
+ * GPBDescriptor.
+ *
+ * @param descriptor The descriptor to look for a registered extension on.
+ * @param fieldNumber The field number of the extension to look for.
+ *
+ * @return The registered GPBExtensionDescripto or nil if none was found.
+ **/
- (nullable GPBExtensionDescriptor *)extensionForDescriptor:(GPBDescriptor *)descriptor
fieldNumber:(NSInteger)fieldNumber;
diff --git a/objectivec/GPBMessage.h b/objectivec/GPBMessage.h
index 7e0f58a3..0cb74f9f 100644
--- a/objectivec/GPBMessage.h
+++ b/objectivec/GPBMessage.h
@@ -44,285 +44,404 @@ NS_ASSUME_NONNULL_BEGIN
CF_EXTERN_C_BEGIN
-/// NSError domain used for errors.
+/** NSError domain used for errors. */
extern NSString *const GPBMessageErrorDomain;
-/// Error code for NSError with GPBMessageErrorDomain.
+/** Error codes for NSErrors originated in GPBMessage. */
typedef NS_ENUM(NSInteger, GPBMessageErrorCode) {
- /// Uncategorized error.
+ /** Uncategorized error. */
GPBMessageErrorCodeOther = -100,
- /// A message can't be serialized because it is missing required fields.
+ /** Message couldn't be serialized because it is missing required fields. */
GPBMessageErrorCodeMissingRequiredField = -101,
};
-/// Key under which the error's reason is stored inside the userInfo dictionary.
+/**
+ * Key under which the GPBMessage error's reason is stored inside the userInfo
+ * dictionary.
+ **/
extern NSString *const GPBErrorReasonKey;
CF_EXTERN_C_END
-/// Base class for all of the generated message classes.
+/**
+ * Base class that each generated message subclasses from.
+ **/
@interface GPBMessage : NSObject<NSSecureCoding, NSCopying>
-
-// NOTE: If you add a instance method/property to this class that may conflict
-// with methods declared in protos, you need to update objective_helpers.cc.
-// The main cases are methods that take no arguments, or setFoo:/hasFoo: type
-// methods.
-
-/// The unknown fields for this message.
-///
-/// Only messages from proto files declared with "proto2" syntax support unknown
-/// fields. For "proto3" syntax, any unknown fields found while parsing are
-/// dropped.
+
+// If you add an instance method/property to this class that may conflict with
+// fields declared in protos, you need to update objective_helpers.cc. The main
+// cases are methods that take no arguments, or setFoo:/hasFoo: type methods.
+
+/**
+ * The set of unknown fields for this message.
+ *
+ * Only messages from proto files declared with "proto2" syntax support unknown
+ * fields. For "proto3" syntax, any unknown fields found while parsing are
+ * dropped.
+ **/
@property(nonatomic, copy, nullable) GPBUnknownFieldSet *unknownFields;
-/// Are all required fields set in the message and all embedded messages.
+/**
+ * Whether the message, along with all submessages, have the required fields
+ * set. This is only applicable for files declared with "proto2" syntax, as
+ * there are no required fields for "proto3" syntax.
+ **/
@property(nonatomic, readonly, getter=isInitialized) BOOL initialized;
-/// Returns an autoreleased instance.
+/**
+ * @return An autoreleased message with the default values set.
+ **/
+ (instancetype)message;
-/// Creates a new instance by parsing the data. This method should be sent to
-/// the generated message class that the data should be interpreted as. If
-/// there is an error the method returns nil and the error is returned in
-/// errorPtr (when provided).
-///
-/// @note In DEBUG builds, the parsed message is checked to be sure all required
-/// fields were provided, and the parse will fail if some are missing.
-///
-/// @note The errors returned are likely coming from the domain and codes listed
-/// at the top of this file and GPBCodedInputStream.h.
-///
-/// @param data The data to parse.
-/// @param errorPtr An optional error pointer to fill in with a failure reason if
-/// the data can not be parsed.
-///
-/// @return A new instance of the class messaged.
+/**
+ * Creates a new instance by parsing the provided data. This method should be
+ * sent to the generated message class that the data should be interpreted as.
+ * If there is an error the method returns nil and the error is returned in
+ * errorPtr (when provided).
+ *
+ * @note In DEBUG builds, the parsed message is checked to be sure all required
+ * fields were provided, and the parse will fail if some are missing.
+ *
+ * @note The errors returned are likely coming from the domain and codes listed
+ * at the top of this file and GPBCodedInputStream.h.
+ *
+ * @param data The data to parse.
+ * @param errorPtr An optional error pointer to fill in with a failure reason if
+ * the data can not be parsed.
+ *
+ * @return A new instance of the generated class.
+ **/
+ (nullable instancetype)parseFromData:(NSData *)data error:(NSError **)errorPtr;
-/// Creates a new instance by parsing the data. This method should be sent to
-/// the generated message class that the data should be interpreted as. If
-/// there is an error the method returns nil and the error is returned in
-/// errorPtr (when provided).
-///
-/// @note In DEBUG builds, the parsed message is checked to be sure all required
-/// fields were provided, and the parse will fail if some are missing.
-///
-/// @note The errors returned are likely coming from the domain and codes listed
-/// at the top of this file and GPBCodedInputStream.h.
-///
-/// @param data The data to parse.
-/// @param extensionRegistry The extension registry to use to look up extensions.
-/// @param errorPtr An optional error pointer to fill in with a failure
-/// reason if the data can not be parsed.
-///
-/// @return A new instance of the class messaged.
+/**
+ * Creates a new instance by parsing the data. This method should be sent to
+ * the generated message class that the data should be interpreted as. If
+ * there is an error the method returns nil and the error is returned in
+ * errorPtr (when provided).
+ *
+ * @note In DEBUG builds, the parsed message is checked to be sure all required
+ * fields were provided, and the parse will fail if some are missing.
+ *
+ * @note The errors returned are likely coming from the domain and codes listed
+ * at the top of this file and GPBCodedInputStream.h.
+ *
+ * @param data The data to parse.
+ * @param extensionRegistry The extension registry to use to look up extensions.
+ * @param errorPtr An optional error pointer to fill in with a failure
+ * reason if the data can not be parsed.
+ *
+ * @return A new instance of the generated class.
+ **/
+ (nullable instancetype)parseFromData:(NSData *)data
extensionRegistry:(nullable GPBExtensionRegistry *)extensionRegistry
error:(NSError **)errorPtr;
-/// Creates a new instance by parsing the data from the given input stream. This
-/// method should be sent to the generated message class that the data should
-/// be interpreted as. If there is an error the method returns nil and the error
-/// is returned in errorPtr (when provided).
-///
-/// @note In DEBUG builds, the parsed message is checked to be sure all required
-/// fields were provided, and the parse will fail if some are missing.
-///
-/// @note The errors returned are likely coming from the domain and codes listed
-/// at the top of this file and GPBCodedInputStream.h.
-///
-/// @param input The stream to read data from.
-/// @param extensionRegistry The extension registry to use to look up extensions.
-/// @param errorPtr An optional error pointer to fill in with a failure
-/// reason if the data can not be parsed.
-///
-/// @return A new instance of the class messaged.
+/**
+ * Creates a new instance by parsing the data from the given input stream. This
+ * method should be sent to the generated message class that the data should
+ * be interpreted as. If there is an error the method returns nil and the error
+ * is returned in errorPtr (when provided).
+ *
+ * @note In DEBUG builds, the parsed message is checked to be sure all required
+ * fields were provided, and the parse will fail if some are missing.
+ *
+ * @note The errors returned are likely coming from the domain and codes listed
+ * at the top of this file and GPBCodedInputStream.h.
+ *
+ * @param input The stream to read data from.
+ * @param extensionRegistry The extension registry to use to look up extensions.
+ * @param errorPtr An optional error pointer to fill in with a failure
+ * reason if the data can not be parsed.
+ *
+ * @return A new instance of the generated class.
+ **/
+ (nullable instancetype)parseFromCodedInputStream:(GPBCodedInputStream *)input
extensionRegistry:
(nullable GPBExtensionRegistry *)extensionRegistry
error:(NSError **)errorPtr;
-/// Creates a new instance by parsing the data from the given input stream. This
-/// method should be sent to the generated message class that the data should
-/// be interpreted as. If there is an error the method returns nil and the error
-/// is returned in errorPtr (when provided).
-///
-/// @note Unlike the parseFrom... methods, this never checks to see if all of
-/// the required fields are set. So this method can be used to reload
-/// messages that may not be complete.
-///
-/// @note The errors returned are likely coming from the domain and codes listed
-/// at the top of this file and GPBCodedInputStream.h.
-///
-/// @param input The stream to read data from.
-/// @param extensionRegistry The extension registry to use to look up extensions.
-/// @param errorPtr An optional error pointer to fill in with a failure
-/// reason if the data can not be parsed.
-///
-/// @return A new instance of the class messaged.
+/**
+ * Creates a new instance by parsing the data from the given input stream. This
+ * method should be sent to the generated message class that the data should
+ * be interpreted as. If there is an error the method returns nil and the error
+ * is returned in errorPtr (when provided).
+ *
+ * @note Unlike the parseFrom... methods, this never checks to see if all of
+ * the required fields are set. So this method can be used to reload
+ * messages that may not be complete.
+ *
+ * @note The errors returned are likely coming from the domain and codes listed
+ * at the top of this file and GPBCodedInputStream.h.
+ *
+ * @param input The stream to read data from.
+ * @param extensionRegistry The extension registry to use to look up extensions.
+ * @param errorPtr An optional error pointer to fill in with a failure
+ * reason if the data can not be parsed.
+ *
+ * @return A new instance of the generated class.
+ **/
+ (nullable instancetype)parseDelimitedFromCodedInputStream:(GPBCodedInputStream *)input
extensionRegistry:
(nullable GPBExtensionRegistry *)extensionRegistry
error:(NSError **)errorPtr;
-/// Initializes an instance by parsing the data. This method should be sent to
-/// the generated message class that the data should be interpreted as. If
-/// there is an error the method returns nil and the error is returned in
-/// errorPtr (when provided).
-///
-/// @note In DEBUG builds, the parsed message is checked to be sure all required
-/// fields were provided, and the parse will fail if some are missing.
-///
-/// @note The errors returned are likely coming from the domain and codes listed
-/// at the top of this file and GPBCodedInputStream.h.
-///
-/// @param data The data to parse.
-/// @param errorPtr An optional error pointer to fill in with a failure reason if
-/// the data can not be parsed.
+/**
+ * Initializes an instance by parsing the data. This method should be sent to
+ * the generated message class that the data should be interpreted as. If
+ * there is an error the method returns nil and the error is returned in
+ * errorPtr (when provided).
+ *
+ * @note In DEBUG builds, the parsed message is checked to be sure all required
+ * fields were provided, and the parse will fail if some are missing.
+ *
+ * @note The errors returned are likely coming from the domain and codes listed
+ * at the top of this file and GPBCodedInputStream.h.
+ *
+ * @param data The data to parse.
+ * @param errorPtr An optional error pointer to fill in with a failure reason if
+ * the data can not be parsed.
+ *
+ * @return An initialized instance of the generated class.
+ **/
- (nullable instancetype)initWithData:(NSData *)data error:(NSError **)errorPtr;
-/// Initializes an instance by parsing the data. This method should be sent to
-/// the generated message class that the data should be interpreted as. If
-/// there is an error the method returns nil and the error is returned in
-/// errorPtr (when provided).
-///
-/// @note In DEBUG builds, the parsed message is checked to be sure all required
-/// fields were provided, and the parse will fail if some are missing.
-///
-/// @note The errors returned are likely coming from the domain and codes listed
-/// at the top of this file and GPBCodedInputStream.h.
-///
-/// @param data The data to parse.
-/// @param extensionRegistry The extension registry to use to look up extensions.
-/// @param errorPtr An optional error pointer to fill in with a failure
-/// reason if the data can not be parsed.
+/**
+ * Initializes an instance by parsing the data. This method should be sent to
+ * the generated message class that the data should be interpreted as. If
+ * there is an error the method returns nil and the error is returned in
+ * errorPtr (when provided).
+ *
+ * @note In DEBUG builds, the parsed message is checked to be sure all required
+ * fields were provided, and the parse will fail if some are missing.
+ *
+ * @note The errors returned are likely coming from the domain and codes listed
+ * at the top of this file and GPBCodedInputStream.h.
+ *
+ * @param data The data to parse.
+ * @param extensionRegistry The extension registry to use to look up extensions.
+ * @param errorPtr An optional error pointer to fill in with a failure
+ * reason if the data can not be parsed.
+ *
+ * @return An initialized instance of the generated class.
+ **/
- (nullable instancetype)initWithData:(NSData *)data
extensionRegistry:(nullable GPBExtensionRegistry *)extensionRegistry
error:(NSError **)errorPtr;
-/// Initializes an instance by parsing the data from the given input stream. This
-/// method should be sent to the generated message class that the data should
-/// be interpreted as. If there is an error the method returns nil and the error
-/// is returned in errorPtr (when provided).
-///
-/// @note Unlike the parseFrom... methods, this never checks to see if all of
-/// the required fields are set. So this method can be used to reload
-/// messages that may not be complete.
-///
-/// @note The errors returned are likely coming from the domain and codes listed
-/// at the top of this file and GPBCodedInputStream.h.
-///
-/// @param input The stream to read data from.
-/// @param extensionRegistry The extension registry to use to look up extensions.
-/// @param errorPtr An optional error pointer to fill in with a failure
-/// reason if the data can not be parsed.
+/**
+ * Initializes an instance by parsing the data from the given input stream. This
+ * method should be sent to the generated message class that the data should
+ * be interpreted as. If there is an error the method returns nil and the error
+ * is returned in errorPtr (when provided).
+ *
+ * @note Unlike the parseFrom... methods, this never checks to see if all of
+ * the required fields are set. So this method can be used to reload
+ * messages that may not be complete.
+ *
+ * @note The errors returned are likely coming from the domain and codes listed
+ * at the top of this file and GPBCodedInputStream.h.
+ *
+ * @param input The stream to read data from.
+ * @param extensionRegistry The extension registry to use to look up extensions.
+ * @param errorPtr An optional error pointer to fill in with a failure
+ * reason if the data can not be parsed.
+ *
+ * @return An initialized instance of the generated class.
+ **/
- (nullable instancetype)initWithCodedInputStream:(GPBCodedInputStream *)input
extensionRegistry:
(nullable GPBExtensionRegistry *)extensionRegistry
error:(NSError **)errorPtr;
-/// Writes out the message to the given output stream.
+/**
+ * Parses the given data as this message's class, and merges those values into
+ * this message.
+ *
+ * @param data The binary representation of the message to merge.
+ * @param extensionRegistry The extension registry to use to look up extensions.
+ *
+ * @exception GPBCodedInputStreamException Exception thrown when parsing was
+ * unsuccessful.
+ **/
+- (void)mergeFromData:(NSData *)data
+ extensionRegistry:(nullable GPBExtensionRegistry *)extensionRegistry;
+
+/**
+ * Merges the fields from another message (of the same type) into this
+ * message.
+ *
+ * @param other Message to merge into this message.
+ **/
+- (void)mergeFrom:(GPBMessage *)other;
+
+/**
+ * Writes out the message to the given coded output stream.
+ *
+ * @param output The coded output stream into which to write the message.
+ **/
- (void)writeToCodedOutputStream:(GPBCodedOutputStream *)output;
-/// Writes out the message to the given output stream.
+
+/**
+ * Writes out the message to the given output stream.
+ *
+ * @param output The output stream into which to write the message.
+ **/
- (void)writeToOutputStream:(NSOutputStream *)output;
-/// Writes out a varint for the message size followed by the the message to
-/// the given output stream.
+/**
+ * Writes out a varint for the message size followed by the the message to
+ * the given output stream.
+ *
+ * @param output The coded output stream into which to write the message.
+ **/
- (void)writeDelimitedToCodedOutputStream:(GPBCodedOutputStream *)output;
-/// Writes out a varint for the message size followed by the the message to
-/// the given output stream.
+
+/**
+ * Writes out a varint for the message size followed by the the message to
+ * the given output stream.
+ *
+ * @param output The output stream into which to write the message.
+ **/
- (void)writeDelimitedToOutputStream:(NSOutputStream *)output;
-/// Serializes the message to a @c NSData.
-///
-/// If there is an error while generating the data, nil is returned.
-///
-/// @note This value is not cached, so if you are using it repeatedly, cache
-/// it yourself.
-///
-/// @note In DEBUG ONLY, the message is also checked for all required field,
-/// if one is missing, nil will be returned.
+/**
+ * Serializes the message to an NSData.
+ *
+ * If there is an error while generating the data, nil is returned.
+ *
+ * @note This value is not cached, so if you are using it repeatedly, cache
+ * it yourself.
+ *
+ * @note In DEBUG ONLY, the message is also checked for all required field,
+ * if one is missing, nil will be returned.
+ *
+ * @return The binary representation of the message.
+ **/
- (nullable NSData *)data;
-/// Serializes a varint with the message size followed by the message data,
-/// returning that as a @c NSData.
-///
-/// @note This value is not cached, so if you are using it repeatedly, cache
-/// it yourself.
+/**
+ * Serializes a varint with the message size followed by the message data,
+ * returning that as an NSData.
+ *
+ * @note This value is not cached, so if you are using it repeatedly, it is
+ * recommended to keep a local copy.
+ *
+ * @return The binary representation of the size along with the message.
+ **/
- (NSData *)delimitedData;
-/// Calculates the size of the object if it were serialized.
-///
-/// This is not a cached value. If you are following a pattern like this:
-/// @code
-/// size_t size = [aMsg serializedSize];
-/// NSMutableData *foo = [NSMutableData dataWithCapacity:size + sizeof(size)];
-/// [foo writeSize:size];
-/// [foo appendData:[aMsg data]];
-/// @endcode
-/// you would be better doing:
-/// @code
-/// NSData *data = [aMsg data];
-/// NSUInteger size = [aMsg length];
-/// NSMutableData *foo = [NSMutableData dataWithCapacity:size + sizeof(size)];
-/// [foo writeSize:size];
-/// [foo appendData:data];
-/// @endcode
+/**
+ * Calculates the size of the object if it were serialized.
+ *
+ * This is not a cached value. If you are following a pattern like this:
+ *
+ * ```
+ * size_t size = [aMsg serializedSize];
+ * NSMutableData *foo = [NSMutableData dataWithCapacity:size + sizeof(size)];
+ * [foo writeSize:size];
+ * [foo appendData:[aMsg data]];
+ * ```
+ *
+ * you would be better doing:
+ *
+ * ```
+ * NSData *data = [aMsg data];
+ * NSUInteger size = [aMsg length];
+ * NSMutableData *foo = [NSMutableData dataWithCapacity:size + sizeof(size)];
+ * [foo writeSize:size];
+ * [foo appendData:data];
+ * ```
+ *
+ * @return The size of the message in it's binary representation.
+ **/
- (size_t)serializedSize;
-/// Return the descriptor for the message class.
+/**
+ * @return The descriptor for the message class.
+ **/
+ (GPBDescriptor *)descriptor;
-/// Return the descriptor for the message.
+
+/**
+ * Return the descriptor for the message.
+ **/
- (GPBDescriptor *)descriptor;
-/// Returns an array with the currently set GPBExtensionDescriptors.
+/**
+ * @return An array with the extension descriptors that are currently set on the
+ * message.
+ **/
- (NSArray *)extensionsCurrentlySet;
-/// Test to see if the given extension is set on the message.
+/**
+ * Checks whether there is an extension set on the message which matches the
+ * given extension descriptor.
+ *
+ * @param extension Extension descriptor to check if it's set on the message.
+ *
+ * @return Whether the extension is currently set on the message.
+ **/
- (BOOL)hasExtension:(GPBExtensionDescriptor *)extension;
-/// Fetches the given extension's value for this message.
-///
-/// Extensions use boxed values (NSNumbers) for PODs and NSMutableArrays for
-/// repeated fields. If the extension is a Message one will be auto created for you
-/// and returned similar to fields.
+/*
+ * Fetches the given extension's value for this message.
+ *
+ * Extensions use boxed values (NSNumbers) for PODs and NSMutableArrays for
+ * repeated fields. If the extension is a Message one will be auto created for
+ * you and returned similar to fields.
+ *
+ * @param extension The extension descriptor of the extension to fetch.
+ *
+ * @return The extension matching the given descriptor, or nil if none found.
+ **/
- (nullable id)getExtension:(GPBExtensionDescriptor *)extension;
-/// Sets the given extension's value for this message. This is only for single
-/// field extensions (i.e. - not repeated fields).
-///
-/// Extensions use boxed values (@c NSNumbers).
-- (void)setExtension:(GPBExtensionDescriptor *)extension value:(nullable id)value;
-
-/// Adds the given value to the extension for this message. This is only for
-/// repeated field extensions. If the field is a repeated POD type the @c value
-/// is a @c NSNumber.
+/**
+ * Sets the given extension's value for this message. This only applies for
+ * single field extensions (i.e. - not repeated fields).
+ *
+ * Extensions use boxed values (NSNumbers).
+ *
+ * @param extension The extension descriptor under which to set the value.
+ * @param value The value to be set as the extension.
+ **/
+- (void)setExtension:(GPBExtensionDescriptor *)extension
+ value:(nullable id)value;
+
+/**
+ * Adds the given value to the extension for this message. This only applies
+ * to repeated field extensions. If the field is a repeated POD type, the value
+ * should be an NSNumber.
+ *
+ * @param extension The extension descriptor under which to add the value.
+ * @param value The value to be added to the repeated extension.
+ **/
- (void)addExtension:(GPBExtensionDescriptor *)extension value:(id)value;
-/// Replaces the given value at an index for the extension on this message. This
-/// is only for repeated field extensions. If the field is a repeated POD type
-/// the @c value is a @c NSNumber.
+/**
+ * Replaces the value at the given index with the given value for the extension
+ * on this message. This only applies to repeated field extensions. If the field
+ * is a repeated POD type, the value is should be an NSNumber.
+ *
+ * @param extension The extension descriptor under which to replace the value.
+ * @param index The index of the extension to be replaced.
+ * @param value The value to be replaced in the repeated extension.
+ **/
- (void)setExtension:(GPBExtensionDescriptor *)extension
index:(NSUInteger)index
value:(id)value;
-/// Clears the given extension for this message.
+/**
+ * Clears the given extension for this message.
+ *
+ * @param extension The extension descriptor to be cleared from this message.
+ **/
- (void)clearExtension:(GPBExtensionDescriptor *)extension;
-/// Resets all of the fields of this message to their default values.
+/**
+ * Resets all of the fields of this message to their default values.
+ **/
- (void)clear;
-/// Parses a message of this type from the input and merges it with this
-/// message.
-///
-/// @note This will throw if there is an error parsing the data.
-- (void)mergeFromData:(NSData *)data
- extensionRegistry:(nullable GPBExtensionRegistry *)extensionRegistry;
-
-/// Merges the fields from another message (of the same type) into this
-/// message.
-- (void)mergeFrom:(GPBMessage *)other;
-
@end
NS_ASSUME_NONNULL_END
diff --git a/objectivec/GPBRootObject.h b/objectivec/GPBRootObject.h
index c05b5c62..d2e2aebf 100644
--- a/objectivec/GPBRootObject.h
+++ b/objectivec/GPBRootObject.h
@@ -34,12 +34,17 @@
NS_ASSUME_NONNULL_BEGIN
-/// Every generated proto file defines a local "Root" class that exposes a
-/// @c GPBExtensionRegistry for all the extensions defined by that file and
-/// the files it depends on.
+/**
+ * Every generated proto file defines a local "Root" class that exposes a
+ * GPBExtensionRegistry for all the extensions defined by that file and
+ * the files it depends on.
+ **/
@interface GPBRootObject : NSObject
-/// An extension registry for the given file and all the files it depends on.
+/**
+ * @return An extension registry for the given file and all the files it depends
+ * on.
+ **/
+ (GPBExtensionRegistry *)extensionRegistry;
@end
diff --git a/objectivec/GPBRuntimeTypes.h b/objectivec/GPBRuntimeTypes.h
index 0a38b110..4d552060 100644
--- a/objectivec/GPBRuntimeTypes.h
+++ b/objectivec/GPBRuntimeTypes.h
@@ -36,21 +36,28 @@
@class GPBMessage;
@class GPBInt32Array;
-// Function used to verify that a given value can be represented by an
-// enum type.
+/**
+ * Verifies that a given value can be represented by an enum type.
+ * */
typedef BOOL (*GPBEnumValidationFunc)(int32_t);
-// Function used to fetch an EnumDescriptor.
+/**
+ * Fetches an EnumDescriptor.
+ * */
typedef GPBEnumDescriptor *(*GPBEnumDescriptorFunc)(void);
-// Magic values used for when an the at runtime to indicate an enum value
-// that wasn't know at compile time.
+/**
+ * Magic value used at runtime to indicate an enum value that wasn't know at
+ * compile time.
+ * */
enum {
kGPBUnrecognizedEnumeratorValue = (int32_t)0xFBADBEEF,
};
-// A union for storing all possible Protobuf values.
-// Note that owner is responsible for memory management of object types.
+/**
+ * A union for storing all possible Protobuf values. Note that owner is
+ * responsible for memory management of object types.
+ * */
typedef union {
BOOL valueBool;
int32_t valueInt32;
@@ -65,38 +72,73 @@ typedef union {
int32_t valueEnum;
} GPBGenericValue;
-// Do not change the order of this enum (or add things to it) without thinking
-// about it very carefully. There are several things that depend on the order.
+/**
+ * Enum listing the possible data types that a field can contain.
+ *
+ * @note Do not change the order of this enum (or add things to it) without
+ * thinking about it very carefully. There are several things that depend
+ * on the order.
+ * */
typedef NS_ENUM(uint8_t, GPBDataType) {
+ /** Field contains boolean value(s). */
GPBDataTypeBool = 0,
+ /** Field contains unsigned 4 byte value(s). */
GPBDataTypeFixed32,
+ /** Field contains signed 4 byte value(s). */
GPBDataTypeSFixed32,
+ /** Field contains float value(s). */
GPBDataTypeFloat,
+ /** Field contains unsigned 8 byte value(s). */
GPBDataTypeFixed64,
+ /** Field contains signed 8 byte value(s). */
GPBDataTypeSFixed64,
+ /** Field contains double value(s). */
GPBDataTypeDouble,
+ /**
+ * Field contains variable length value(s). Inefficient for encoding negative
+ * numbers – if your field is likely to have negative values, use
+ * GPBDataTypeSInt32 instead.
+ **/
GPBDataTypeInt32,
+ /**
+ * Field contains variable length value(s). Inefficient for encoding negative
+ * numbers – if your field is likely to have negative values, use
+ * GPBDataTypeSInt64 instead.
+ **/
GPBDataTypeInt64,
+ /** Field contains signed variable length integer value(s). */
GPBDataTypeSInt32,
+ /** Field contains signed variable length integer value(s). */
GPBDataTypeSInt64,
+ /** Field contains unsigned variable length integer value(s). */
GPBDataTypeUInt32,
+ /** Field contains unsigned variable length integer value(s). */
GPBDataTypeUInt64,
+ /** Field contains an arbitrary sequence of bytes. */
GPBDataTypeBytes,
+ /** Field contains UTF-8 encoded or 7-bit ASCII text. */
GPBDataTypeString,
+ /** Field contains message type(s). */
GPBDataTypeMessage,
+ /** Field contains message type(s). */
GPBDataTypeGroup,
+ /** Field contains enum value(s). */
GPBDataTypeEnum,
};
enum {
- // A count of the number of types in GPBDataType. Separated out from the
- // GPBDataType enum to avoid warnings regarding not handling
- // GPBDataType_Count in switch statements.
+ /**
+ * A count of the number of types in GPBDataType. Separated out from the
+ * GPBDataType enum to avoid warnings regarding not handling GPBDataType_Count
+ * in switch statements.
+ **/
GPBDataType_Count = GPBDataTypeEnum + 1
};
-// An extension range.
+/** An extension range. */
typedef struct GPBExtensionRange {
- uint32_t start; // inclusive
- uint32_t end; // exclusive
+ /** Inclusive. */
+ uint32_t start;
+ /** Exclusive. */
+ uint32_t end;
} GPBExtensionRange;
diff --git a/objectivec/GPBUnknownField.h b/objectivec/GPBUnknownField.h
index 0f301e47..a135cc20 100644
--- a/objectivec/GPBUnknownField.h
+++ b/objectivec/GPBUnknownField.h
@@ -36,52 +36,59 @@
@class GPBUnknownFieldSet;
NS_ASSUME_NONNULL_BEGIN
-
-/// Store an unknown field. These are used in conjunction with @c GPBUnknownFieldSet
+/**
+ * Store an unknown field. These are used in conjunction with
+ * GPBUnknownFieldSet.
+ **/
@interface GPBUnknownField : NSObject<NSCopying>
-/// The field number the data is stored under.
+/** The field number the data is stored under. */
@property(nonatomic, readonly, assign) int32_t number;
-/// An array of varint values for this field.
+/** An array of varint values for this field. */
@property(nonatomic, readonly, strong) GPBUInt64Array *varintList;
-/// An array of fixed32 values for this field.
+/** An array of fixed32 values for this field. */
@property(nonatomic, readonly, strong) GPBUInt32Array *fixed32List;
-/// An array of fixed64 values for this field.
+/** An array of fixed64 values for this field. */
@property(nonatomic, readonly, strong) GPBUInt64Array *fixed64List;
-/// An array of data values for this field.
+/** An array of data values for this field. */
@property(nonatomic, readonly, strong) NSArray<NSData*> *lengthDelimitedList;
-/// An array of groups of values for this field.
+/** An array of groups of values for this field. */
@property(nonatomic, readonly, strong) NSArray<GPBUnknownFieldSet*> *groupList;
-
-/// Add a value to the varintList.
-///
-/// @param value The value to add.
+/**
+ * Add a value to the varintList.
+ *
+ * @param value The value to add.
+ **/
- (void)addVarint:(uint64_t)value;
-
-/// Add a value to the fixed32List.
-///
-/// @param value The value to add.
+/**
+ * Add a value to the fixed32List.
+ *
+ * @param value The value to add.
+ **/
- (void)addFixed32:(uint32_t)value;
-
-/// Add a value to the fixed64List.
-///
-/// @param value The value to add.
+/**
+ * Add a value to the fixed64List.
+ *
+ * @param value The value to add.
+ **/
- (void)addFixed64:(uint64_t)value;
-
-/// Add a value to the lengthDelimitedList.
-///
-/// @param value The value to add.
+/**
+ * Add a value to the lengthDelimitedList.
+ *
+ * @param value The value to add.
+ **/
- (void)addLengthDelimited:(NSData *)value;
-
-/// Add a value to the groupList.
-///
-/// @param value The value to add.
+/**
+ * Add a value to the groupList.
+ *
+ * @param value The value to add.
+ **/
- (void)addGroup:(GPBUnknownFieldSet *)value;
@end
diff --git a/objectivec/GPBUnknownFieldSet.h b/objectivec/GPBUnknownFieldSet.h
index cf612993..1b5f24f3 100644
--- a/objectivec/GPBUnknownFieldSet.h
+++ b/objectivec/GPBUnknownFieldSet.h
@@ -34,31 +34,48 @@
NS_ASSUME_NONNULL_BEGIN
-/// A collection of unknown fields.
+/**
+ * A collection of unknown fields. Fields parsed from the binary representation
+ * of a message that are unknown end up in an instance of this set. This only
+ * applies for files declared with the "proto2" syntax. Files declared with the
+ * "proto3" syntax discard the unknown values.
+ **/
@interface GPBUnknownFieldSet : NSObject<NSCopying>
-/// Tests to see if the given field number has a value.
-///
-/// @param number The field number to check.
-///
-/// @return YES if there is an unknown field for the given field number.
+/**
+ * Tests to see if the given field number has a value.
+ *
+ * @param number The field number to check.
+ *
+ * @return YES if there is an unknown field for the given field number.
+ **/
- (BOOL)hasField:(int32_t)number;
-/// Fetches the @c GPBUnknownField for the given field number.
-///
-/// @param number The field number to look up.
-///
-/// @return The @c GPBUnknownField or nil.
+/**
+ * Fetches the GPBUnknownField for the given field number.
+ *
+ * @param number The field number to look up.
+ *
+ * @return The GPBUnknownField or nil if none found.
+ **/
- (nullable GPBUnknownField *)getField:(int32_t)number;
-/// Returns the number of fields in this set.
+/**
+ * @return The number of fields in this set.
+ **/
- (NSUInteger)countOfFields;
-/// Adds the given field to the set.
+/**
+ * Adds the given field to the set.
+ *
+ * @param field The field to add to the set.
+ **/
- (void)addField:(GPBUnknownField *)field;
-/// Returns an NSArray of the @c GPBUnknownFields sorted by the field numbers.
-- (NSArray<GPBUnknownField*> *)sortedFields;
+/**
+ * @return An array of the GPBUnknownFields sorted by the field numbers.
+ **/
+- (NSArray<GPBUnknownField *> *)sortedFields;
@end
diff --git a/objectivec/GPBUtilities.h b/objectivec/GPBUtilities.h
index b7209324..52e7d2e0 100644
--- a/objectivec/GPBUtilities.h
+++ b/objectivec/GPBUtilities.h
@@ -38,34 +38,58 @@ CF_EXTERN_C_BEGIN
NS_ASSUME_NONNULL_BEGIN
-/// Generates a string that should be a valid "Text Format" for the C++ version
-/// of Protocol Buffers.
-///
-/// @param message The message to generate from.
-/// @param lineIndent A string to use as the prefix for all lines generated. Can
-/// be nil if no extra indent is needed.
-///
-/// @return A @c NSString with the Text Format of the message.
+/**
+ * Generates a string that should be a valid "TextFormat" for the C++ version
+ * of Protocol Buffers.
+ *
+ * @param message The message to generate from.
+ * @param lineIndent A string to use as the prefix for all lines generated. Can
+ * be nil if no extra indent is needed.
+ *
+ * @return An NSString with the TextFormat of the message.
+ **/
NSString *GPBTextFormatForMessage(GPBMessage *message,
NSString * __nullable lineIndent);
-/// Generates a string that should be a valid "Text Format" for the C++ version
-/// of Protocol Buffers.
-///
-/// @param unknownSet The unknown field set to generate from.
-/// @param lineIndent A string to use as the prefix for all lines generated. Can
-/// be nil if no extra indent is needed.
-///
-/// @return A @c NSString with the Text Format of the unknown field set.
+/**
+ * Generates a string that should be a valid "TextFormat" for the C++ version
+ * of Protocol Buffers.
+ *
+ * @param unknownSet The unknown field set to generate from.
+ * @param lineIndent A string to use as the prefix for all lines generated. Can
+ * be nil if no extra indent is needed.
+ *
+ * @return An NSString with the TextFormat of the unknown field set.
+ **/
NSString *GPBTextFormatForUnknownFieldSet(GPBUnknownFieldSet * __nullable unknownSet,
NSString * __nullable lineIndent);
-/// Test if the given field is set on a message.
+/**
+ * Checks if the given field number is set on a message.
+ *
+ * @param self The message to check.
+ * @param fieldNumber The field number to check.
+ *
+ * @return YES if the field number is set on the given message.
+ **/
BOOL GPBMessageHasFieldNumberSet(GPBMessage *self, uint32_t fieldNumber);
-/// Test if the given field is set on a message.
+
+/**
+ * Checks if the given field is set on a message.
+ *
+ * @param self The message to check.
+ * @param field The field to check.
+ *
+ * @return YES if the field is set on the given message.
+ **/
BOOL GPBMessageHasFieldSet(GPBMessage *self, GPBFieldDescriptor *field);
-/// Clear the given field of a message.
+/**
+ * Clears the given field for the given message.
+ *
+ * @param self The message for which to clear the field.
+ * @param field The field to clear.
+ **/
void GPBClearMessageField(GPBMessage *self, GPBFieldDescriptor *field);
//%PDDM-EXPAND GPB_ACCESSORS()
@@ -73,112 +97,299 @@ void GPBClearMessageField(GPBMessage *self, GPBFieldDescriptor *field);
//
-// Get/Set the given field of a message.
+// Get/Set a given field from/to a message.
//
// Single Fields
-/// Gets the value of a bytes field.
+/**
+ * Gets the value of a bytes field.
+ *
+ * @param self The message from which to get the field.
+ * @param field The field to get.
+ **/
NSData *GPBGetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field);
-/// Sets the value of a bytes field.
+
+/**
+ * Sets the value of a bytes field.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param value The to set in the field.
+ **/
void GPBSetMessageBytesField(GPBMessage *self, GPBFieldDescriptor *field, NSData *value);
-/// Gets the value of a string field.
+/**
+ * Gets the value of a string field.
+ *
+ * @param self The message from which to get the field.
+ * @param field The field to get.
+ **/
NSString *GPBGetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field);
-/// Sets the value of a string field.
+
+/**
+ * Sets the value of a string field.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param value The to set in the field.
+ **/
void GPBSetMessageStringField(GPBMessage *self, GPBFieldDescriptor *field, NSString *value);
-/// Gets the value of a message field.
+/**
+ * Gets the value of a message field.
+ *
+ * @param self The message from which to get the field.
+ * @param field The field to get.
+ **/
GPBMessage *GPBGetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *field);
-/// Sets the value of a message field.
+
+/**
+ * Sets the value of a message field.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param value The to set in the field.
+ **/
void GPBSetMessageMessageField(GPBMessage *self, GPBFieldDescriptor *field, GPBMessage *value);
-/// Gets the value of a group field.
+/**
+ * Gets the value of a group field.
+ *
+ * @param self The message from which to get the field.
+ * @param field The field to get.
+ **/
GPBMessage *GPBGetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field);
-/// Sets the value of a group field.
+
+/**
+ * Sets the value of a group field.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param value The to set in the field.
+ **/
void GPBSetMessageGroupField(GPBMessage *self, GPBFieldDescriptor *field, GPBMessage *value);
-/// Gets the value of a bool field.
+/**
+ * Gets the value of a bool field.
+ *
+ * @param self The message from which to get the field.
+ * @param field The field to get.
+ **/
BOOL GPBGetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field);
-/// Sets the value of a bool field.
+
+/**
+ * Sets the value of a bool field.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param value The to set in the field.
+ **/
void GPBSetMessageBoolField(GPBMessage *self, GPBFieldDescriptor *field, BOOL value);
-/// Gets the value of an int32 field.
+/**
+ * Gets the value of an int32 field.
+ *
+ * @param self The message from which to get the field.
+ * @param field The field to get.
+ **/
int32_t GPBGetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field);
-/// Sets the value of an int32 field.
+
+/**
+ * Sets the value of an int32 field.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param value The to set in the field.
+ **/
void GPBSetMessageInt32Field(GPBMessage *self, GPBFieldDescriptor *field, int32_t value);
-/// Gets the value of an uint32 field.
+/**
+ * Gets the value of an uint32 field.
+ *
+ * @param self The message from which to get the field.
+ * @param field The field to get.
+ **/
uint32_t GPBGetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field);
-/// Sets the value of an uint32 field.
+
+/**
+ * Sets the value of an uint32 field.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param value The to set in the field.
+ **/
void GPBSetMessageUInt32Field(GPBMessage *self, GPBFieldDescriptor *field, uint32_t value);
-/// Gets the value of an int64 field.
+/**
+ * Gets the value of an int64 field.
+ *
+ * @param self The message from which to get the field.
+ * @param field The field to get.
+ **/
int64_t GPBGetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field);
-/// Sets the value of an int64 field.
+
+/**
+ * Sets the value of an int64 field.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param value The to set in the field.
+ **/
void GPBSetMessageInt64Field(GPBMessage *self, GPBFieldDescriptor *field, int64_t value);
-/// Gets the value of an uint64 field.
+/**
+ * Gets the value of an uint64 field.
+ *
+ * @param self The message from which to get the field.
+ * @param field The field to get.
+ **/
uint64_t GPBGetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field);
-/// Sets the value of an uint64 field.
+
+/**
+ * Sets the value of an uint64 field.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param value The to set in the field.
+ **/
void GPBSetMessageUInt64Field(GPBMessage *self, GPBFieldDescriptor *field, uint64_t value);
-/// Gets the value of a float field.
+/**
+ * Gets the value of a float field.
+ *
+ * @param self The message from which to get the field.
+ * @param field The field to get.
+ **/
float GPBGetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field);
-/// Sets the value of a float field.
+
+/**
+ * Sets the value of a float field.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param value The to set in the field.
+ **/
void GPBSetMessageFloatField(GPBMessage *self, GPBFieldDescriptor *field, float value);
-/// Gets the value of a double field.
+/**
+ * Gets the value of a double field.
+ *
+ * @param self The message from which to get the field.
+ * @param field The field to get.
+ **/
double GPBGetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field);
-/// Sets the value of a double field.
+
+/**
+ * Sets the value of a double field.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param value The to set in the field.
+ **/
void GPBSetMessageDoubleField(GPBMessage *self, GPBFieldDescriptor *field, double value);
-/// Get the given enum field of a message. For proto3, if the value isn't a
-/// member of the enum, @c kGPBUnrecognizedEnumeratorValue will be returned.
-/// GPBGetMessageRawEnumField will bypass the check and return whatever value
-/// was set.
+/**
+ * Gets the given enum field of a message. For proto3, if the value isn't a
+ * member of the enum, @c kGPBUnrecognizedEnumeratorValue will be returned.
+ * GPBGetMessageRawEnumField will bypass the check and return whatever value
+ * was set.
+ *
+ * @param self The message from which to get the field.
+ * @param field The field to get.
+ *
+ * @return The enum value for the given field.
+ **/
int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field);
-/// Set the given enum field of a message. You can only set values that are
-/// members of the enum.
-void GPBSetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field, int32_t value);
-/// Get the given enum field of a message. No check is done to ensure the value
-/// was defined in the enum.
+
+/**
+ * Set the given enum field of a message. You can only set values that are
+ * members of the enum.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param value The enum value to set in the field.
+ **/
+void GPBSetMessageEnumField(GPBMessage *self,
+ GPBFieldDescriptor *field,
+ int32_t value);
+
+/**
+ * Get the given enum field of a message. No check is done to ensure the value
+ * was defined in the enum.
+ *
+ * @param self The message from which to get the field.
+ * @param field The field to get.
+ *
+ * @return The raw enum value for the given field.
+ **/
int32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field);
-/// Set the given enum field of a message. You can set the value to anything,
-/// even a value that is not a member of the enum.
-void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field, int32_t value);
+
+/**
+ * Set the given enum field of a message. You can set the value to anything,
+ * even a value that is not a member of the enum.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param value The raw enum value to set in the field.
+ **/
+void GPBSetMessageRawEnumField(GPBMessage *self,
+ GPBFieldDescriptor *field,
+ int32_t value);
// Repeated Fields
-/// Gets the value of a repeated field.
-///
-/// The result will be @c GPB*Array or @c NSMutableArray based on the
-/// field's type.
+/**
+ * Gets the value of a repeated field.
+ *
+ * @param self The message from which to get the field.
+ * @param field The repeated field to get.
+ *
+ * @return A GPB*Array or an NSMutableArray based on the field's type.
+ **/
id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field);
-/// Sets the value of a repeated field.
-///
-/// The value should be @c GPB*Array or @c NSMutableArray based on the
-/// field's type.
-void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id array);
+
+/**
+ * Sets the value of a repeated field.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param array A GPB*Array or NSMutableArray based on the field's type.
+ **/
+void GPBSetMessageRepeatedField(GPBMessage *self,
+ GPBFieldDescriptor *field,
+ id array);
// Map Fields
-/// Gets the value of a map<> field.
-///
-/// The result will be @c GPB*Dictionary or @c NSMutableDictionary based on
-/// the field's type.
+/**
+ * Gets the value of a map<> field.
+ *
+ * @param self The message from which to get the field.
+ * @param field The repeated field to get.
+ *
+ * @return A GPB*Dictionary or NSMutableDictionary based on the field's type.
+ **/
id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field);
-/// Sets the value of a map<> field.
-///
-/// The object should be @c GPB*Dictionary or @c NSMutableDictionary based
-/// on the field's type.
-void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field, id dictionary);
+
+/**
+ * Sets the value of a map<> field.
+ *
+ * @param self The message into which to set the field.
+ * @param field The field to set.
+ * @param dictionary A GPB*Dictionary or NSMutableDictionary based on the
+ * field's type.
+ **/
+void GPBSetMessageMapField(GPBMessage *self,
+ GPBFieldDescriptor *field,
+ id dictionary);
//%PDDM-EXPAND-END GPB_ACCESSORS()
-// Returns an empty NSData to assign to byte fields when you wish
-// to assign them to empty. Prevents allocating a lot of little [NSData data]
-// objects.
+/**
+ * Returns an empty NSData to assign to byte fields when you wish to assign them
+ * to empty. Prevents allocating a lot of little [NSData data] objects.
+ **/
NSData *GPBEmptyNSData(void) __attribute__((pure));
NS_ASSUME_NONNULL_END
@@ -189,7 +400,7 @@ CF_EXTERN_C_END
//%PDDM-DEFINE GPB_ACCESSORS()
//%
//%//
-//%// Get/Set the given field of a message.
+//%// Get/Set a given field from/to a message.
//%//
//%
//%// Single Fields
@@ -205,53 +416,119 @@ CF_EXTERN_C_END
//%GPB_ACCESSOR_SINGLE(UInt64, uint64_t, n)
//%GPB_ACCESSOR_SINGLE(Float, float, )
//%GPB_ACCESSOR_SINGLE(Double, double, )
-//%/// Get the given enum field of a message. For proto3, if the value isn't a
-//%/// member of the enum, @c kGPBUnrecognizedEnumeratorValue will be returned.
-//%/// GPBGetMessageRawEnumField will bypass the check and return whatever value
-//%/// was set.
+//%/**
+//% * Gets the given enum field of a message. For proto3, if the value isn't a
+//% * member of the enum, @c kGPBUnrecognizedEnumeratorValue will be returned.
+//% * GPBGetMessageRawEnumField will bypass the check and return whatever value
+//% * was set.
+//% *
+//% * @param self The message from which to get the field.
+//% * @param field The field to get.
+//% *
+//% * @return The enum value for the given field.
+//% **/
//%int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field);
-//%/// Set the given enum field of a message. You can only set values that are
-//%/// members of the enum.
-//%void GPBSetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field, int32_t value);
-//%/// Get the given enum field of a message. No check is done to ensure the value
-//%/// was defined in the enum.
+//%
+//%/**
+//% * Set the given enum field of a message. You can only set values that are
+//% * members of the enum.
+//% *
+//% * @param self The message into which to set the field.
+//% * @param field The field to set.
+//% * @param value The enum value to set in the field.
+//% **/
+//%void GPBSetMessageEnumField(GPBMessage *self,
+//% GPBFieldDescriptor *field,
+//% int32_t value);
+//%
+//%/**
+//% * Get the given enum field of a message. No check is done to ensure the value
+//% * was defined in the enum.
+//% *
+//% * @param self The message from which to get the field.
+//% * @param field The field to get.
+//% *
+//% * @return The raw enum value for the given field.
+//% **/
//%int32_t GPBGetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field);
-//%/// Set the given enum field of a message. You can set the value to anything,
-//%/// even a value that is not a member of the enum.
-//%void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field, int32_t value);
+//%
+//%/**
+//% * Set the given enum field of a message. You can set the value to anything,
+//% * even a value that is not a member of the enum.
+//% *
+//% * @param self The message into which to set the field.
+//% * @param field The field to set.
+//% * @param value The raw enum value to set in the field.
+//% **/
+//%void GPBSetMessageRawEnumField(GPBMessage *self,
+//% GPBFieldDescriptor *field,
+//% int32_t value);
//%
//%// Repeated Fields
//%
-//%/// Gets the value of a repeated field.
-//%///
-//%/// The result will be @c GPB*Array or @c NSMutableArray based on the
-//%/// field's type.
+//%/**
+//% * Gets the value of a repeated field.
+//% *
+//% * @param self The message from which to get the field.
+//% * @param field The repeated field to get.
+//% *
+//% * @return A GPB*Array or an NSMutableArray based on the field's type.
+//% **/
//%id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field);
-//%/// Sets the value of a repeated field.
-//%///
-//%/// The value should be @c GPB*Array or @c NSMutableArray based on the
-//%/// field's type.
-//%void GPBSetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field, id array);
+//%
+//%/**
+//% * Sets the value of a repeated field.
+//% *
+//% * @param self The message into which to set the field.
+//% * @param field The field to set.
+//% * @param array A GPB*Array or NSMutableArray based on the field's type.
+//% **/
+//%void GPBSetMessageRepeatedField(GPBMessage *self,
+//% GPBFieldDescriptor *field,
+//% id array);
//%
//%// Map Fields
//%
-//%/// Gets the value of a map<> field.
-//%///
-//%/// The result will be @c GPB*Dictionary or @c NSMutableDictionary based on
-//%/// the field's type.
+//%/**
+//% * Gets the value of a map<> field.
+//% *
+//% * @param self The message from which to get the field.
+//% * @param field The repeated field to get.
+//% *
+//% * @return A GPB*Dictionary or NSMutableDictionary based on the field's type.
+//% **/
//%id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field);
-//%/// Sets the value of a map<> field.
-//%///
-//%/// The object should be @c GPB*Dictionary or @c NSMutableDictionary based
-//%/// on the field's type.
-//%void GPBSetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field, id dictionary);
+//%
+//%/**
+//% * Sets the value of a map<> field.
+//% *
+//% * @param self The message into which to set the field.
+//% * @param field The field to set.
+//% * @param dictionary A GPB*Dictionary or NSMutableDictionary based on the
+//% * field's type.
+//% **/
+//%void GPBSetMessageMapField(GPBMessage *self,
+//% GPBFieldDescriptor *field,
+//% id dictionary);
//%
//%PDDM-DEFINE GPB_ACCESSOR_SINGLE(NAME, TYPE, AN)
//%GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, AN, )
//%PDDM-DEFINE GPB_ACCESSOR_SINGLE_FULL(NAME, TYPE, AN, TisP)
-//%/// Gets the value of a##AN NAME$L field.
+//%/**
+//% * Gets the value of a##AN NAME$L field.
+//% *
+//% * @param self The message from which to get the field.
+//% * @param field The field to get.
+//% **/
//%TYPE TisP##GPBGetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *field);
-//%/// Sets the value of a##AN NAME$L field.
+//%
+//%/**
+//% * Sets the value of a##AN NAME$L field.
+//% *
+//% * @param self The message into which to set the field.
+//% * @param field The field to set.
+//% * @param value The to set in the field.
+//% **/
//%void GPBSetMessage##NAME##Field(GPBMessage *self, GPBFieldDescriptor *field, TYPE TisP##value);
//%
diff --git a/objectivec/GPBWellKnownTypes.h b/objectivec/GPBWellKnownTypes.h
index 311ac58e..96d51d9e 100644
--- a/objectivec/GPBWellKnownTypes.h
+++ b/objectivec/GPBWellKnownTypes.h
@@ -46,18 +46,54 @@
NS_ASSUME_NONNULL_BEGIN
-// Extension to GPBTimestamp to work with standard Foundation time/date types.
+/**
+ * Category for GPBTimestamp to work with standard Foundation time/date types.
+ **/
@interface GPBTimestamp (GBPWellKnownTypes)
+
+/** The NSDate representation of this GPBTimestamp. */
@property(nonatomic, readwrite, strong) NSDate *date;
+
+/** The NSTimeInterval representation of this GPBTimestamp. */
@property(nonatomic, readwrite) NSTimeInterval timeIntervalSince1970;
+
+/**
+ * Initializes a GPBTimestamp with the given NSDate.
+ *
+ * @param date The date to configure the GPBTimestamp with.
+ *
+ * @return A newly initialized GPBTimestamp.
+ **/
- (instancetype)initWithDate:(NSDate *)date;
+
+/**
+ * Initializes a GPBTimestamp with the given NSTimeInterval.
+ *
+ * @param timeIntervalSince1970 Time interval to configure the GPBTimestamp with.
+ *
+ * @return A newly initialized GPBTimestamp.
+ **/
- (instancetype)initWithTimeIntervalSince1970:(NSTimeInterval)timeIntervalSince1970;
+
@end
-// Extension to GPBDuration to work with standard Foundation time type.
+/**
+ * Category for GPBDuration to work with standard Foundation time type.
+ **/
@interface GPBDuration (GBPWellKnownTypes)
+
+/** The NSTimeInterval representation of this GPBTimestamp. */
@property(nonatomic, readwrite) NSTimeInterval timeIntervalSince1970;
+
+/**
+ * Initializes a GPBDuration with the given NSTimeInterval.
+ *
+ * @param timeIntervalSince1970 Time interval to configure the GPBDuration with.
+ *
+ * @return A newly initialized GPBTimestamp.
+ **/
- (instancetype)initWithTimeIntervalSince1970:(NSTimeInterval)timeIntervalSince1970;
+
@end
NS_ASSUME_NONNULL_END