1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2015 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #import <Foundation/Foundation.h>
33 #import "GPBRuntimeTypes.h"
35 NS_ASSUME_NONNULL_BEGIN
37 //%PDDM-EXPAND DECLARE_ARRAYS()
38 // This block of code is generated, do not edit it directly.
43 * Class used for repeated fields of int32_t values. This performs better than
44 * boxing into NSNumbers in NSArrays.
46 * @note This class is not meant to be subclassed.
48 @interface GPBInt32Array : NSObject <NSCopying>
50 /** The number of elements contained in the array. */
51 @property(nonatomic, readonly) NSUInteger count;
54 * @return A newly instanced and empty GPBInt32Array.
56 + (instancetype)array;
59 * Creates and initializes a GPBInt32Array with the single element given.
61 * @param value The value to be placed in the array.
63 * @return A newly instanced GPBInt32Array with value in it.
65 + (instancetype)arrayWithValue:(int32_t)value;
68 * Creates and initializes a GPBInt32Array with the contents of the given
71 * @param array Array with the contents to be put into the new array.
73 * @return A newly instanced GPBInt32Array with the contents of array.
75 + (instancetype)arrayWithValueArray:(GPBInt32Array *)array;
78 * Creates and initializes a GPBInt32Array with the given capacity.
80 * @param count The capacity needed for the array.
82 * @return A newly instanced GPBInt32Array with a capacity of count.
84 + (instancetype)arrayWithCapacity:(NSUInteger)count;
87 * @return A newly initialized and empty GPBInt32Array.
89 - (instancetype)init NS_DESIGNATED_INITIALIZER;
92 * Initializes the array, copying the given values.
94 * @param values An array with the values to put inside this array.
95 * @param count The number of elements to copy into the array.
97 * @return A newly initialized GPBInt32Array with a copy of the values.
99 - (instancetype)initWithValues:(const int32_t [__nullable])values
100 count:(NSUInteger)count;
103 * Initializes the array, copying the given values.
105 * @param array An array with the values to put inside this array.
107 * @return A newly initialized GPBInt32Array with a copy of the values.
109 - (instancetype)initWithValueArray:(GPBInt32Array *)array;
112 * Initializes the array with the given capacity.
114 * @param count The capacity needed for the array.
116 * @return A newly initialized GPBInt32Array with a capacity of count.
118 - (instancetype)initWithCapacity:(NSUInteger)count;
121 * Gets the value at the given index.
123 * @param index The index of the value to get.
125 * @return The value at the given index.
127 - (int32_t)valueAtIndex:(NSUInteger)index;
130 * Enumerates the values on this array with the given block.
132 * @param block The block to enumerate with.
133 * **value**: The current value being enumerated.
134 * **idx**: The index of the current value.
135 * **stop**: A pointer to a boolean that when set stops the enumeration.
137 - (void)enumerateValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
140 * Enumerates the values on this array with the given block.
142 * @param opts Options to control the enumeration.
143 * @param block The block to enumerate with.
144 * **value**: The current value being enumerated.
145 * **idx**: The index of the current value.
146 * **stop**: A pointer to a boolean that when set stops the enumeration.
148 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
149 usingBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
152 * Adds a value to this array.
154 * @param value The value to add to this array.
156 - (void)addValue:(int32_t)value;
159 * Adds values to this array.
161 * @param values The values to add to this array.
162 * @param count The number of elements to add.
164 - (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
167 * Adds the values from the given array to this array.
169 * @param array The array containing the elements to add to this array.
171 - (void)addValuesFromArray:(GPBInt32Array *)array;
174 * Inserts a value into the given position.
176 * @param value The value to add to this array.
177 * @param index The index into which to insert the value.
179 - (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
182 * Replaces the value at the given index with the given value.
184 * @param index The index for which to replace the value.
185 * @param value The value to replace with.
187 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
190 * Removes the value at the given index.
192 * @param index The index of the value to remove.
194 - (void)removeValueAtIndex:(NSUInteger)index;
197 * Removes all the values from this array.
202 * Exchanges the values between the given indexes.
204 * @param idx1 The index of the first element to exchange.
205 * @param idx2 The index of the second element to exchange.
207 - (void)exchangeValueAtIndex:(NSUInteger)idx1
208 withValueAtIndex:(NSUInteger)idx2;
212 #pragma mark - UInt32
215 * Class used for repeated fields of uint32_t values. This performs better than
216 * boxing into NSNumbers in NSArrays.
218 * @note This class is not meant to be subclassed.
220 @interface GPBUInt32Array : NSObject <NSCopying>
222 /** The number of elements contained in the array. */
223 @property(nonatomic, readonly) NSUInteger count;
226 * @return A newly instanced and empty GPBUInt32Array.
228 + (instancetype)array;
231 * Creates and initializes a GPBUInt32Array with the single element given.
233 * @param value The value to be placed in the array.
235 * @return A newly instanced GPBUInt32Array with value in it.
237 + (instancetype)arrayWithValue:(uint32_t)value;
240 * Creates and initializes a GPBUInt32Array with the contents of the given
243 * @param array Array with the contents to be put into the new array.
245 * @return A newly instanced GPBUInt32Array with the contents of array.
247 + (instancetype)arrayWithValueArray:(GPBUInt32Array *)array;
250 * Creates and initializes a GPBUInt32Array with the given capacity.
252 * @param count The capacity needed for the array.
254 * @return A newly instanced GPBUInt32Array with a capacity of count.
256 + (instancetype)arrayWithCapacity:(NSUInteger)count;
259 * @return A newly initialized and empty GPBUInt32Array.
261 - (instancetype)init NS_DESIGNATED_INITIALIZER;
264 * Initializes the array, copying the given values.
266 * @param values An array with the values to put inside this array.
267 * @param count The number of elements to copy into the array.
269 * @return A newly initialized GPBUInt32Array with a copy of the values.
271 - (instancetype)initWithValues:(const uint32_t [__nullable])values
272 count:(NSUInteger)count;
275 * Initializes the array, copying the given values.
277 * @param array An array with the values to put inside this array.
279 * @return A newly initialized GPBUInt32Array with a copy of the values.
281 - (instancetype)initWithValueArray:(GPBUInt32Array *)array;
284 * Initializes the array with the given capacity.
286 * @param count The capacity needed for the array.
288 * @return A newly initialized GPBUInt32Array with a capacity of count.
290 - (instancetype)initWithCapacity:(NSUInteger)count;
293 * Gets the value at the given index.
295 * @param index The index of the value to get.
297 * @return The value at the given index.
299 - (uint32_t)valueAtIndex:(NSUInteger)index;
302 * Enumerates the values on this array with the given block.
304 * @param block The block to enumerate with.
305 * **value**: The current value being enumerated.
306 * **idx**: The index of the current value.
307 * **stop**: A pointer to a boolean that when set stops the enumeration.
309 - (void)enumerateValuesWithBlock:(void (^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
312 * Enumerates the values on this array with the given block.
314 * @param opts Options to control the enumeration.
315 * @param block The block to enumerate with.
316 * **value**: The current value being enumerated.
317 * **idx**: The index of the current value.
318 * **stop**: A pointer to a boolean that when set stops the enumeration.
320 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
321 usingBlock:(void (^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
324 * Adds a value to this array.
326 * @param value The value to add to this array.
328 - (void)addValue:(uint32_t)value;
331 * Adds values to this array.
333 * @param values The values to add to this array.
334 * @param count The number of elements to add.
336 - (void)addValues:(const uint32_t [__nullable])values count:(NSUInteger)count;
339 * Adds the values from the given array to this array.
341 * @param array The array containing the elements to add to this array.
343 - (void)addValuesFromArray:(GPBUInt32Array *)array;
346 * Inserts a value into the given position.
348 * @param value The value to add to this array.
349 * @param index The index into which to insert the value.
351 - (void)insertValue:(uint32_t)value atIndex:(NSUInteger)index;
354 * Replaces the value at the given index with the given value.
356 * @param index The index for which to replace the value.
357 * @param value The value to replace with.
359 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint32_t)value;
362 * Removes the value at the given index.
364 * @param index The index of the value to remove.
366 - (void)removeValueAtIndex:(NSUInteger)index;
369 * Removes all the values from this array.
374 * Exchanges the values between the given indexes.
376 * @param idx1 The index of the first element to exchange.
377 * @param idx2 The index of the second element to exchange.
379 - (void)exchangeValueAtIndex:(NSUInteger)idx1
380 withValueAtIndex:(NSUInteger)idx2;
387 * Class used for repeated fields of int64_t values. This performs better than
388 * boxing into NSNumbers in NSArrays.
390 * @note This class is not meant to be subclassed.
392 @interface GPBInt64Array : NSObject <NSCopying>
394 /** The number of elements contained in the array. */
395 @property(nonatomic, readonly) NSUInteger count;
398 * @return A newly instanced and empty GPBInt64Array.
400 + (instancetype)array;
403 * Creates and initializes a GPBInt64Array with the single element given.
405 * @param value The value to be placed in the array.
407 * @return A newly instanced GPBInt64Array with value in it.
409 + (instancetype)arrayWithValue:(int64_t)value;
412 * Creates and initializes a GPBInt64Array with the contents of the given
415 * @param array Array with the contents to be put into the new array.
417 * @return A newly instanced GPBInt64Array with the contents of array.
419 + (instancetype)arrayWithValueArray:(GPBInt64Array *)array;
422 * Creates and initializes a GPBInt64Array with the given capacity.
424 * @param count The capacity needed for the array.
426 * @return A newly instanced GPBInt64Array with a capacity of count.
428 + (instancetype)arrayWithCapacity:(NSUInteger)count;
431 * @return A newly initialized and empty GPBInt64Array.
433 - (instancetype)init NS_DESIGNATED_INITIALIZER;
436 * Initializes the array, copying the given values.
438 * @param values An array with the values to put inside this array.
439 * @param count The number of elements to copy into the array.
441 * @return A newly initialized GPBInt64Array with a copy of the values.
443 - (instancetype)initWithValues:(const int64_t [__nullable])values
444 count:(NSUInteger)count;
447 * Initializes the array, copying the given values.
449 * @param array An array with the values to put inside this array.
451 * @return A newly initialized GPBInt64Array with a copy of the values.
453 - (instancetype)initWithValueArray:(GPBInt64Array *)array;
456 * Initializes the array with the given capacity.
458 * @param count The capacity needed for the array.
460 * @return A newly initialized GPBInt64Array with a capacity of count.
462 - (instancetype)initWithCapacity:(NSUInteger)count;
465 * Gets the value at the given index.
467 * @param index The index of the value to get.
469 * @return The value at the given index.
471 - (int64_t)valueAtIndex:(NSUInteger)index;
474 * Enumerates the values on this array with the given block.
476 * @param block The block to enumerate with.
477 * **value**: The current value being enumerated.
478 * **idx**: The index of the current value.
479 * **stop**: A pointer to a boolean that when set stops the enumeration.
481 - (void)enumerateValuesWithBlock:(void (^)(int64_t value, NSUInteger idx, BOOL *stop))block;
484 * Enumerates the values on this array with the given block.
486 * @param opts Options to control the enumeration.
487 * @param block The block to enumerate with.
488 * **value**: The current value being enumerated.
489 * **idx**: The index of the current value.
490 * **stop**: A pointer to a boolean that when set stops the enumeration.
492 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
493 usingBlock:(void (^)(int64_t value, NSUInteger idx, BOOL *stop))block;
496 * Adds a value to this array.
498 * @param value The value to add to this array.
500 - (void)addValue:(int64_t)value;
503 * Adds values to this array.
505 * @param values The values to add to this array.
506 * @param count The number of elements to add.
508 - (void)addValues:(const int64_t [__nullable])values count:(NSUInteger)count;
511 * Adds the values from the given array to this array.
513 * @param array The array containing the elements to add to this array.
515 - (void)addValuesFromArray:(GPBInt64Array *)array;
518 * Inserts a value into the given position.
520 * @param value The value to add to this array.
521 * @param index The index into which to insert the value.
523 - (void)insertValue:(int64_t)value atIndex:(NSUInteger)index;
526 * Replaces the value at the given index with the given value.
528 * @param index The index for which to replace the value.
529 * @param value The value to replace with.
531 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int64_t)value;
534 * Removes the value at the given index.
536 * @param index The index of the value to remove.
538 - (void)removeValueAtIndex:(NSUInteger)index;
541 * Removes all the values from this array.
546 * Exchanges the values between the given indexes.
548 * @param idx1 The index of the first element to exchange.
549 * @param idx2 The index of the second element to exchange.
551 - (void)exchangeValueAtIndex:(NSUInteger)idx1
552 withValueAtIndex:(NSUInteger)idx2;
556 #pragma mark - UInt64
559 * Class used for repeated fields of uint64_t values. This performs better than
560 * boxing into NSNumbers in NSArrays.
562 * @note This class is not meant to be subclassed.
564 @interface GPBUInt64Array : NSObject <NSCopying>
566 /** The number of elements contained in the array. */
567 @property(nonatomic, readonly) NSUInteger count;
570 * @return A newly instanced and empty GPBUInt64Array.
572 + (instancetype)array;
575 * Creates and initializes a GPBUInt64Array with the single element given.
577 * @param value The value to be placed in the array.
579 * @return A newly instanced GPBUInt64Array with value in it.
581 + (instancetype)arrayWithValue:(uint64_t)value;
584 * Creates and initializes a GPBUInt64Array with the contents of the given
587 * @param array Array with the contents to be put into the new array.
589 * @return A newly instanced GPBUInt64Array with the contents of array.
591 + (instancetype)arrayWithValueArray:(GPBUInt64Array *)array;
594 * Creates and initializes a GPBUInt64Array with the given capacity.
596 * @param count The capacity needed for the array.
598 * @return A newly instanced GPBUInt64Array with a capacity of count.
600 + (instancetype)arrayWithCapacity:(NSUInteger)count;
603 * @return A newly initialized and empty GPBUInt64Array.
605 - (instancetype)init NS_DESIGNATED_INITIALIZER;
608 * Initializes the array, copying the given values.
610 * @param values An array with the values to put inside this array.
611 * @param count The number of elements to copy into the array.
613 * @return A newly initialized GPBUInt64Array with a copy of the values.
615 - (instancetype)initWithValues:(const uint64_t [__nullable])values
616 count:(NSUInteger)count;
619 * Initializes the array, copying the given values.
621 * @param array An array with the values to put inside this array.
623 * @return A newly initialized GPBUInt64Array with a copy of the values.
625 - (instancetype)initWithValueArray:(GPBUInt64Array *)array;
628 * Initializes the array with the given capacity.
630 * @param count The capacity needed for the array.
632 * @return A newly initialized GPBUInt64Array with a capacity of count.
634 - (instancetype)initWithCapacity:(NSUInteger)count;
637 * Gets the value at the given index.
639 * @param index The index of the value to get.
641 * @return The value at the given index.
643 - (uint64_t)valueAtIndex:(NSUInteger)index;
646 * Enumerates the values on this array with the given block.
648 * @param block The block to enumerate with.
649 * **value**: The current value being enumerated.
650 * **idx**: The index of the current value.
651 * **stop**: A pointer to a boolean that when set stops the enumeration.
653 - (void)enumerateValuesWithBlock:(void (^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
656 * Enumerates the values on this array with the given block.
658 * @param opts Options to control the enumeration.
659 * @param block The block to enumerate with.
660 * **value**: The current value being enumerated.
661 * **idx**: The index of the current value.
662 * **stop**: A pointer to a boolean that when set stops the enumeration.
664 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
665 usingBlock:(void (^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
668 * Adds a value to this array.
670 * @param value The value to add to this array.
672 - (void)addValue:(uint64_t)value;
675 * Adds values to this array.
677 * @param values The values to add to this array.
678 * @param count The number of elements to add.
680 - (void)addValues:(const uint64_t [__nullable])values count:(NSUInteger)count;
683 * Adds the values from the given array to this array.
685 * @param array The array containing the elements to add to this array.
687 - (void)addValuesFromArray:(GPBUInt64Array *)array;
690 * Inserts a value into the given position.
692 * @param value The value to add to this array.
693 * @param index The index into which to insert the value.
695 - (void)insertValue:(uint64_t)value atIndex:(NSUInteger)index;
698 * Replaces the value at the given index with the given value.
700 * @param index The index for which to replace the value.
701 * @param value The value to replace with.
703 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint64_t)value;
706 * Removes the value at the given index.
708 * @param index The index of the value to remove.
710 - (void)removeValueAtIndex:(NSUInteger)index;
713 * Removes all the values from this array.
718 * Exchanges the values between the given indexes.
720 * @param idx1 The index of the first element to exchange.
721 * @param idx2 The index of the second element to exchange.
723 - (void)exchangeValueAtIndex:(NSUInteger)idx1
724 withValueAtIndex:(NSUInteger)idx2;
731 * Class used for repeated fields of float values. This performs better than
732 * boxing into NSNumbers in NSArrays.
734 * @note This class is not meant to be subclassed.
736 @interface GPBFloatArray : NSObject <NSCopying>
738 /** The number of elements contained in the array. */
739 @property(nonatomic, readonly) NSUInteger count;
742 * @return A newly instanced and empty GPBFloatArray.
744 + (instancetype)array;
747 * Creates and initializes a GPBFloatArray with the single element given.
749 * @param value The value to be placed in the array.
751 * @return A newly instanced GPBFloatArray with value in it.
753 + (instancetype)arrayWithValue:(float)value;
756 * Creates and initializes a GPBFloatArray with the contents of the given
759 * @param array Array with the contents to be put into the new array.
761 * @return A newly instanced GPBFloatArray with the contents of array.
763 + (instancetype)arrayWithValueArray:(GPBFloatArray *)array;
766 * Creates and initializes a GPBFloatArray with the given capacity.
768 * @param count The capacity needed for the array.
770 * @return A newly instanced GPBFloatArray with a capacity of count.
772 + (instancetype)arrayWithCapacity:(NSUInteger)count;
775 * @return A newly initialized and empty GPBFloatArray.
777 - (instancetype)init NS_DESIGNATED_INITIALIZER;
780 * Initializes the array, copying the given values.
782 * @param values An array with the values to put inside this array.
783 * @param count The number of elements to copy into the array.
785 * @return A newly initialized GPBFloatArray with a copy of the values.
787 - (instancetype)initWithValues:(const float [__nullable])values
788 count:(NSUInteger)count;
791 * Initializes the array, copying the given values.
793 * @param array An array with the values to put inside this array.
795 * @return A newly initialized GPBFloatArray with a copy of the values.
797 - (instancetype)initWithValueArray:(GPBFloatArray *)array;
800 * Initializes the array with the given capacity.
802 * @param count The capacity needed for the array.
804 * @return A newly initialized GPBFloatArray with a capacity of count.
806 - (instancetype)initWithCapacity:(NSUInteger)count;
809 * Gets the value at the given index.
811 * @param index The index of the value to get.
813 * @return The value at the given index.
815 - (float)valueAtIndex:(NSUInteger)index;
818 * Enumerates the values on this array with the given block.
820 * @param block The block to enumerate with.
821 * **value**: The current value being enumerated.
822 * **idx**: The index of the current value.
823 * **stop**: A pointer to a boolean that when set stops the enumeration.
825 - (void)enumerateValuesWithBlock:(void (^)(float value, NSUInteger idx, BOOL *stop))block;
828 * Enumerates the values on this array with the given block.
830 * @param opts Options to control the enumeration.
831 * @param block The block to enumerate with.
832 * **value**: The current value being enumerated.
833 * **idx**: The index of the current value.
834 * **stop**: A pointer to a boolean that when set stops the enumeration.
836 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
837 usingBlock:(void (^)(float value, NSUInteger idx, BOOL *stop))block;
840 * Adds a value to this array.
842 * @param value The value to add to this array.
844 - (void)addValue:(float)value;
847 * Adds values to this array.
849 * @param values The values to add to this array.
850 * @param count The number of elements to add.
852 - (void)addValues:(const float [__nullable])values count:(NSUInteger)count;
855 * Adds the values from the given array to this array.
857 * @param array The array containing the elements to add to this array.
859 - (void)addValuesFromArray:(GPBFloatArray *)array;
862 * Inserts a value into the given position.
864 * @param value The value to add to this array.
865 * @param index The index into which to insert the value.
867 - (void)insertValue:(float)value atIndex:(NSUInteger)index;
870 * Replaces the value at the given index with the given value.
872 * @param index The index for which to replace the value.
873 * @param value The value to replace with.
875 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(float)value;
878 * Removes the value at the given index.
880 * @param index The index of the value to remove.
882 - (void)removeValueAtIndex:(NSUInteger)index;
885 * Removes all the values from this array.
890 * Exchanges the values between the given indexes.
892 * @param idx1 The index of the first element to exchange.
893 * @param idx2 The index of the second element to exchange.
895 - (void)exchangeValueAtIndex:(NSUInteger)idx1
896 withValueAtIndex:(NSUInteger)idx2;
900 #pragma mark - Double
903 * Class used for repeated fields of double values. This performs better than
904 * boxing into NSNumbers in NSArrays.
906 * @note This class is not meant to be subclassed.
908 @interface GPBDoubleArray : NSObject <NSCopying>
910 /** The number of elements contained in the array. */
911 @property(nonatomic, readonly) NSUInteger count;
914 * @return A newly instanced and empty GPBDoubleArray.
916 + (instancetype)array;
919 * Creates and initializes a GPBDoubleArray with the single element given.
921 * @param value The value to be placed in the array.
923 * @return A newly instanced GPBDoubleArray with value in it.
925 + (instancetype)arrayWithValue:(double)value;
928 * Creates and initializes a GPBDoubleArray with the contents of the given
931 * @param array Array with the contents to be put into the new array.
933 * @return A newly instanced GPBDoubleArray with the contents of array.
935 + (instancetype)arrayWithValueArray:(GPBDoubleArray *)array;
938 * Creates and initializes a GPBDoubleArray with the given capacity.
940 * @param count The capacity needed for the array.
942 * @return A newly instanced GPBDoubleArray with a capacity of count.
944 + (instancetype)arrayWithCapacity:(NSUInteger)count;
947 * @return A newly initialized and empty GPBDoubleArray.
949 - (instancetype)init NS_DESIGNATED_INITIALIZER;
952 * Initializes the array, copying the given values.
954 * @param values An array with the values to put inside this array.
955 * @param count The number of elements to copy into the array.
957 * @return A newly initialized GPBDoubleArray with a copy of the values.
959 - (instancetype)initWithValues:(const double [__nullable])values
960 count:(NSUInteger)count;
963 * Initializes the array, copying the given values.
965 * @param array An array with the values to put inside this array.
967 * @return A newly initialized GPBDoubleArray with a copy of the values.
969 - (instancetype)initWithValueArray:(GPBDoubleArray *)array;
972 * Initializes the array with the given capacity.
974 * @param count The capacity needed for the array.
976 * @return A newly initialized GPBDoubleArray with a capacity of count.
978 - (instancetype)initWithCapacity:(NSUInteger)count;
981 * Gets the value at the given index.
983 * @param index The index of the value to get.
985 * @return The value at the given index.
987 - (double)valueAtIndex:(NSUInteger)index;
990 * Enumerates the values on this array with the given block.
992 * @param block The block to enumerate with.
993 * **value**: The current value being enumerated.
994 * **idx**: The index of the current value.
995 * **stop**: A pointer to a boolean that when set stops the enumeration.
997 - (void)enumerateValuesWithBlock:(void (^)(double value, NSUInteger idx, BOOL *stop))block;
1000 * Enumerates the values on this array with the given block.
1002 * @param opts Options to control the enumeration.
1003 * @param block The block to enumerate with.
1004 * **value**: The current value being enumerated.
1005 * **idx**: The index of the current value.
1006 * **stop**: A pointer to a boolean that when set stops the enumeration.
1008 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1009 usingBlock:(void (^)(double value, NSUInteger idx, BOOL *stop))block;
1012 * Adds a value to this array.
1014 * @param value The value to add to this array.
1016 - (void)addValue:(double)value;
1019 * Adds values to this array.
1021 * @param values The values to add to this array.
1022 * @param count The number of elements to add.
1024 - (void)addValues:(const double [__nullable])values count:(NSUInteger)count;
1027 * Adds the values from the given array to this array.
1029 * @param array The array containing the elements to add to this array.
1031 - (void)addValuesFromArray:(GPBDoubleArray *)array;
1034 * Inserts a value into the given position.
1036 * @param value The value to add to this array.
1037 * @param index The index into which to insert the value.
1039 - (void)insertValue:(double)value atIndex:(NSUInteger)index;
1042 * Replaces the value at the given index with the given value.
1044 * @param index The index for which to replace the value.
1045 * @param value The value to replace with.
1047 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(double)value;
1050 * Removes the value at the given index.
1052 * @param index The index of the value to remove.
1054 - (void)removeValueAtIndex:(NSUInteger)index;
1057 * Removes all the values from this array.
1062 * Exchanges the values between the given indexes.
1064 * @param idx1 The index of the first element to exchange.
1065 * @param idx2 The index of the second element to exchange.
1067 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1068 withValueAtIndex:(NSUInteger)idx2;
1075 * Class used for repeated fields of BOOL values. This performs better than
1076 * boxing into NSNumbers in NSArrays.
1078 * @note This class is not meant to be subclassed.
1080 @interface GPBBoolArray : NSObject <NSCopying>
1082 /** The number of elements contained in the array. */
1083 @property(nonatomic, readonly) NSUInteger count;
1086 * @return A newly instanced and empty GPBBoolArray.
1088 + (instancetype)array;
1091 * Creates and initializes a GPBBoolArray with the single element given.
1093 * @param value The value to be placed in the array.
1095 * @return A newly instanced GPBBoolArray with value in it.
1097 + (instancetype)arrayWithValue:(BOOL)value;
1100 * Creates and initializes a GPBBoolArray with the contents of the given
1103 * @param array Array with the contents to be put into the new array.
1105 * @return A newly instanced GPBBoolArray with the contents of array.
1107 + (instancetype)arrayWithValueArray:(GPBBoolArray *)array;
1110 * Creates and initializes a GPBBoolArray with the given capacity.
1112 * @param count The capacity needed for the array.
1114 * @return A newly instanced GPBBoolArray with a capacity of count.
1116 + (instancetype)arrayWithCapacity:(NSUInteger)count;
1119 * @return A newly initialized and empty GPBBoolArray.
1121 - (instancetype)init NS_DESIGNATED_INITIALIZER;
1124 * Initializes the array, copying the given values.
1126 * @param values An array with the values to put inside this array.
1127 * @param count The number of elements to copy into the array.
1129 * @return A newly initialized GPBBoolArray with a copy of the values.
1131 - (instancetype)initWithValues:(const BOOL [__nullable])values
1132 count:(NSUInteger)count;
1135 * Initializes the array, copying the given values.
1137 * @param array An array with the values to put inside this array.
1139 * @return A newly initialized GPBBoolArray with a copy of the values.
1141 - (instancetype)initWithValueArray:(GPBBoolArray *)array;
1144 * Initializes the array with the given capacity.
1146 * @param count The capacity needed for the array.
1148 * @return A newly initialized GPBBoolArray with a capacity of count.
1150 - (instancetype)initWithCapacity:(NSUInteger)count;
1153 * Gets the value at the given index.
1155 * @param index The index of the value to get.
1157 * @return The value at the given index.
1159 - (BOOL)valueAtIndex:(NSUInteger)index;
1162 * Enumerates the values on this array with the given block.
1164 * @param block The block to enumerate with.
1165 * **value**: The current value being enumerated.
1166 * **idx**: The index of the current value.
1167 * **stop**: A pointer to a boolean that when set stops the enumeration.
1169 - (void)enumerateValuesWithBlock:(void (^)(BOOL value, NSUInteger idx, BOOL *stop))block;
1172 * Enumerates the values on this array with the given block.
1174 * @param opts Options to control the enumeration.
1175 * @param block The block to enumerate with.
1176 * **value**: The current value being enumerated.
1177 * **idx**: The index of the current value.
1178 * **stop**: A pointer to a boolean that when set stops the enumeration.
1180 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1181 usingBlock:(void (^)(BOOL value, NSUInteger idx, BOOL *stop))block;
1184 * Adds a value to this array.
1186 * @param value The value to add to this array.
1188 - (void)addValue:(BOOL)value;
1191 * Adds values to this array.
1193 * @param values The values to add to this array.
1194 * @param count The number of elements to add.
1196 - (void)addValues:(const BOOL [__nullable])values count:(NSUInteger)count;
1199 * Adds the values from the given array to this array.
1201 * @param array The array containing the elements to add to this array.
1203 - (void)addValuesFromArray:(GPBBoolArray *)array;
1206 * Inserts a value into the given position.
1208 * @param value The value to add to this array.
1209 * @param index The index into which to insert the value.
1211 - (void)insertValue:(BOOL)value atIndex:(NSUInteger)index;
1214 * Replaces the value at the given index with the given value.
1216 * @param index The index for which to replace the value.
1217 * @param value The value to replace with.
1219 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(BOOL)value;
1222 * Removes the value at the given index.
1224 * @param index The index of the value to remove.
1226 - (void)removeValueAtIndex:(NSUInteger)index;
1229 * Removes all the values from this array.
1234 * Exchanges the values between the given indexes.
1236 * @param idx1 The index of the first element to exchange.
1237 * @param idx2 The index of the second element to exchange.
1239 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1240 withValueAtIndex:(NSUInteger)idx2;
1247 * This class is used for repeated fields of int32_t values. This performs
1248 * better than boxing into NSNumbers in NSArrays.
1250 * @note This class is not meant to be subclassed.
1252 @interface GPBEnumArray : NSObject <NSCopying>
1254 /** The number of elements contained in the array. */
1255 @property(nonatomic, readonly) NSUInteger count;
1256 /** The validation function to check if the enums are valid. */
1257 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
1260 * @return A newly instanced and empty GPBEnumArray.
1262 + (instancetype)array;
1265 * Creates and initializes a GPBEnumArray with the enum validation function
1268 * @param func The enum validation function for the array.
1270 * @return A newly instanced GPBEnumArray.
1272 + (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
1275 * Creates and initializes a GPBEnumArray with the enum validation function
1276 * given and the single raw value given.
1278 * @param func The enum validation function for the array.
1279 * @param value The raw value to add to this array.
1281 * @return A newly instanced GPBEnumArray.
1283 + (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
1284 rawValue:(int32_t)value;
1287 * Creates and initializes a GPBEnumArray that adds the elements from the
1290 * @param array Array containing the values to add to the new array.
1292 * @return A newly instanced GPBEnumArray.
1294 + (instancetype)arrayWithValueArray:(GPBEnumArray *)array;
1297 * Creates and initializes a GPBEnumArray with the given enum validation
1298 * function and with the givencapacity.
1300 * @param func The enum validation function for the array.
1301 * @param count The capacity needed for the array.
1303 * @return A newly instanced GPBEnumArray with a capacity of count.
1305 + (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
1306 capacity:(NSUInteger)count;
1309 * Initializes the array with the given enum validation function.
1311 * @param func The enum validation function for the array.
1313 * @return A newly initialized GPBEnumArray with a copy of the values.
1315 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1316 NS_DESIGNATED_INITIALIZER;
1319 * Initializes the array, copying the given values.
1321 * @param func The enum validation function for the array.
1322 * @param values An array with the values to put inside this array.
1323 * @param count The number of elements to copy into the array.
1325 * @return A newly initialized GPBEnumArray with a copy of the values.
1327 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1328 rawValues:(const int32_t [__nullable])values
1329 count:(NSUInteger)count;
1332 * Initializes the array, copying the given values.
1334 * @param array An array with the values to put inside this array.
1336 * @return A newly initialized GPBEnumArray with a copy of the values.
1338 - (instancetype)initWithValueArray:(GPBEnumArray *)array;
1341 * Initializes the array with the given capacity.
1343 * @param func The enum validation function for the array.
1344 * @param count The capacity needed for the array.
1346 * @return A newly initialized GPBEnumArray with a capacity of count.
1348 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1349 capacity:(NSUInteger)count;
1351 // These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
1352 // valid enumerator as defined by validationFunc. If the actual value is
1353 // desired, use "raw" version of the method.
1356 * Gets the value at the given index.
1358 * @param index The index of the value to get.
1360 * @return The value at the given index.
1362 - (int32_t)valueAtIndex:(NSUInteger)index;
1365 * Enumerates the values on this array with the given block.
1367 * @param block The block to enumerate with.
1368 * **value**: The current value being enumerated.
1369 * **idx**: The index of the current value.
1370 * **stop**: A pointer to a boolean that when set stops the enumeration.
1372 - (void)enumerateValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
1375 * Enumerates the values on this array with the given block.
1377 * @param opts Options to control the enumeration.
1378 * @param block The block to enumerate with.
1379 * **value**: The current value being enumerated.
1380 * **idx**: The index of the current value.
1381 * **stop**: A pointer to a boolean that when set stops the enumeration.
1383 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1384 usingBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
1386 // These methods bypass the validationFunc to provide access to values that were not
1387 // known at the time the binary was compiled.
1390 * Gets the raw enum value at the given index.
1392 * @param index The index of the raw enum value to get.
1394 * @return The raw enum value at the given index.
1396 - (int32_t)rawValueAtIndex:(NSUInteger)index;
1399 * Enumerates the values on this array with the given block.
1401 * @param block The block to enumerate with.
1402 * **value**: The current value being enumerated.
1403 * **idx**: The index of the current value.
1404 * **stop**: A pointer to a boolean that when set stops the enumeration.
1406 - (void)enumerateRawValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
1409 * Enumerates the values on this array with the given block.
1411 * @param opts Options to control the enumeration.
1412 * @param block The block to enumerate with.
1413 * **value**: The current value being enumerated.
1414 * **idx**: The index of the current value.
1415 * **stop**: A pointer to a boolean that when set stops the enumeration.
1417 - (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
1418 usingBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
1420 // If value is not a valid enumerator as defined by validationFunc, these
1421 // methods will assert in debug, and will log in release and assign the value
1422 // to the default value. Use the rawValue methods below to assign non enumerator
1426 * Adds a value to this array.
1428 * @param value The value to add to this array.
1430 - (void)addValue:(int32_t)value;
1433 * Adds values to this array.
1435 * @param values The values to add to this array.
1436 * @param count The number of elements to add.
1438 - (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
1442 * Inserts a value into the given position.
1444 * @param value The value to add to this array.
1445 * @param index The index into which to insert the value.
1447 - (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
1450 * Replaces the value at the given index with the given value.
1452 * @param index The index for which to replace the value.
1453 * @param value The value to replace with.
1455 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
1457 // These methods bypass the validationFunc to provide setting of values that were not
1458 // known at the time the binary was compiled.
1461 * Adds a raw enum value to this array.
1463 * @note This method bypass the validationFunc to enable the setting of values that
1464 * were not known at the time the binary was compiled.
1466 * @param value The raw enum value to add to the array.
1468 - (void)addRawValue:(int32_t)value;
1471 * Adds raw enum values to this array.
1473 * @note This method bypass the validationFunc to enable the setting of values that
1474 * were not known at the time the binary was compiled.
1476 * @param array Array containing the raw enum values to add to this array.
1478 - (void)addRawValuesFromArray:(GPBEnumArray *)array;
1481 * Adds raw enum values to this array.
1483 * @note This method bypass the validationFunc to enable the setting of values that
1484 * were not known at the time the binary was compiled.
1486 * @param values Array containing the raw enum values to add to this array.
1487 * @param count The number of raw values to add.
1489 - (void)addRawValues:(const int32_t [__nullable])values count:(NSUInteger)count;
1492 * Inserts a raw enum value at the given index.
1494 * @note This method bypass the validationFunc to enable the setting of values that
1495 * were not known at the time the binary was compiled.
1497 * @param value Raw enum value to add.
1498 * @param index The index into which to insert the value.
1500 - (void)insertRawValue:(int32_t)value atIndex:(NSUInteger)index;
1503 * Replaces the raw enum value at the given index with the given value.
1505 * @note This method bypass the validationFunc to enable the setting of values that
1506 * were not known at the time the binary was compiled.
1508 * @param index The index for which to replace the value.
1509 * @param value The raw enum value to replace with.
1511 - (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(int32_t)value;
1513 // No validation applies to these methods.
1516 * Removes the value at the given index.
1518 * @param index The index of the value to remove.
1520 - (void)removeValueAtIndex:(NSUInteger)index;
1523 * Removes all the values from this array.
1528 * Exchanges the values between the given indexes.
1530 * @param idx1 The index of the first element to exchange.
1531 * @param idx2 The index of the second element to exchange.
1533 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1534 withValueAtIndex:(NSUInteger)idx2;
1538 //%PDDM-EXPAND-END DECLARE_ARRAYS()
1540 NS_ASSUME_NONNULL_END
1542 //%PDDM-DEFINE DECLARE_ARRAYS()
1543 //%ARRAY_INTERFACE_SIMPLE(Int32, int32_t)
1544 //%ARRAY_INTERFACE_SIMPLE(UInt32, uint32_t)
1545 //%ARRAY_INTERFACE_SIMPLE(Int64, int64_t)
1546 //%ARRAY_INTERFACE_SIMPLE(UInt64, uint64_t)
1547 //%ARRAY_INTERFACE_SIMPLE(Float, float)
1548 //%ARRAY_INTERFACE_SIMPLE(Double, double)
1549 //%ARRAY_INTERFACE_SIMPLE(Bool, BOOL)
1550 //%ARRAY_INTERFACE_ENUM(Enum, int32_t)
1553 // The common case (everything but Enum)
1556 //%PDDM-DEFINE ARRAY_INTERFACE_SIMPLE(NAME, TYPE)
1557 //%#pragma mark - NAME
1560 //% * Class used for repeated fields of ##TYPE## values. This performs better than
1561 //% * boxing into NSNumbers in NSArrays.
1563 //% * @note This class is not meant to be subclassed.
1565 //%@interface GPB##NAME##Array : NSObject <NSCopying>
1567 //%/** The number of elements contained in the array. */
1568 //%@property(nonatomic, readonly) NSUInteger count;
1571 //% * @return A newly instanced and empty GPB##NAME##Array.
1573 //%+ (instancetype)array;
1576 //% * Creates and initializes a GPB##NAME##Array with the single element given.
1578 //% * @param value The value to be placed in the array.
1580 //% * @return A newly instanced GPB##NAME##Array with value in it.
1582 //%+ (instancetype)arrayWithValue:(TYPE)value;
1585 //% * Creates and initializes a GPB##NAME##Array with the contents of the given
1588 //% * @param array Array with the contents to be put into the new array.
1590 //% * @return A newly instanced GPB##NAME##Array with the contents of array.
1592 //%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
1595 //% * Creates and initializes a GPB##NAME##Array with the given capacity.
1597 //% * @param count The capacity needed for the array.
1599 //% * @return A newly instanced GPB##NAME##Array with a capacity of count.
1601 //%+ (instancetype)arrayWithCapacity:(NSUInteger)count;
1604 //% * @return A newly initialized and empty GPB##NAME##Array.
1606 //%- (instancetype)init NS_DESIGNATED_INITIALIZER;
1609 //% * Initializes the array, copying the given values.
1611 //% * @param values An array with the values to put inside this array.
1612 //% * @param count The number of elements to copy into the array.
1614 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1616 //%- (instancetype)initWithValues:(const TYPE [__nullable])values
1617 //% count:(NSUInteger)count;
1620 //% * Initializes the array, copying the given values.
1622 //% * @param array An array with the values to put inside this array.
1624 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1626 //%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
1629 //% * Initializes the array with the given capacity.
1631 //% * @param count The capacity needed for the array.
1633 //% * @return A newly initialized GPB##NAME##Array with a capacity of count.
1635 //%- (instancetype)initWithCapacity:(NSUInteger)count;
1637 //%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, Basic)
1639 //%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, Basic)
1645 // Macros specific to Enums (to tweak their interface).
1648 //%PDDM-DEFINE ARRAY_INTERFACE_ENUM(NAME, TYPE)
1649 //%#pragma mark - NAME
1652 //% * This class is used for repeated fields of ##TYPE## values. This performs
1653 //% * better than boxing into NSNumbers in NSArrays.
1655 //% * @note This class is not meant to be subclassed.
1657 //%@interface GPB##NAME##Array : NSObject <NSCopying>
1659 //%/** The number of elements contained in the array. */
1660 //%@property(nonatomic, readonly) NSUInteger count;
1661 //%/** The validation function to check if the enums are valid. */
1662 //%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
1665 //% * @return A newly instanced and empty GPB##NAME##Array.
1667 //%+ (instancetype)array;
1670 //% * Creates and initializes a GPB##NAME##Array with the enum validation function
1673 //% * @param func The enum validation function for the array.
1675 //% * @return A newly instanced GPB##NAME##Array.
1677 //%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
1680 //% * Creates and initializes a GPB##NAME##Array with the enum validation function
1681 //% * given and the single raw value given.
1683 //% * @param func The enum validation function for the array.
1684 //% * @param value The raw value to add to this array.
1686 //% * @return A newly instanced GPB##NAME##Array.
1688 //%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
1689 //% rawValue:(TYPE)value;
1692 //% * Creates and initializes a GPB##NAME##Array that adds the elements from the
1695 //% * @param array Array containing the values to add to the new array.
1697 //% * @return A newly instanced GPB##NAME##Array.
1699 //%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
1702 //% * Creates and initializes a GPB##NAME##Array with the given enum validation
1703 //% * function and with the givencapacity.
1705 //% * @param func The enum validation function for the array.
1706 //% * @param count The capacity needed for the array.
1708 //% * @return A newly instanced GPB##NAME##Array with a capacity of count.
1710 //%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
1711 //% capacity:(NSUInteger)count;
1714 //% * Initializes the array with the given enum validation function.
1716 //% * @param func The enum validation function for the array.
1718 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1720 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1721 //% NS_DESIGNATED_INITIALIZER;
1724 //% * Initializes the array, copying the given values.
1726 //% * @param func The enum validation function for the array.
1727 //% * @param values An array with the values to put inside this array.
1728 //% * @param count The number of elements to copy into the array.
1730 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1732 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1733 //% rawValues:(const TYPE [__nullable])values
1734 //% count:(NSUInteger)count;
1737 //% * Initializes the array, copying the given values.
1739 //% * @param array An array with the values to put inside this array.
1741 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1743 //%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
1746 //% * Initializes the array with the given capacity.
1748 //% * @param func The enum validation function for the array.
1749 //% * @param count The capacity needed for the array.
1751 //% * @return A newly initialized GPB##NAME##Array with a capacity of count.
1753 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1754 //% capacity:(NSUInteger)count;
1756 //%// These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
1757 //%// valid enumerator as defined by validationFunc. If the actual value is
1758 //%// desired, use "raw" version of the method.
1760 //%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, NAME)
1762 //%// These methods bypass the validationFunc to provide access to values that were not
1763 //%// known at the time the binary was compiled.
1766 //% * Gets the raw enum value at the given index.
1768 //% * @param index The index of the raw enum value to get.
1770 //% * @return The raw enum value at the given index.
1772 //%- (TYPE)rawValueAtIndex:(NSUInteger)index;
1775 //% * Enumerates the values on this array with the given block.
1777 //% * @param block The block to enumerate with.
1778 //% * **value**: The current value being enumerated.
1779 //% * **idx**: The index of the current value.
1780 //% * **stop**: A pointer to a boolean that when set stops the enumeration.
1782 //%- (void)enumerateRawValuesWithBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
1785 //% * Enumerates the values on this array with the given block.
1787 //% * @param opts Options to control the enumeration.
1788 //% * @param block The block to enumerate with.
1789 //% * **value**: The current value being enumerated.
1790 //% * **idx**: The index of the current value.
1791 //% * **stop**: A pointer to a boolean that when set stops the enumeration.
1793 //%- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
1794 //% usingBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
1796 //%// If value is not a valid enumerator as defined by validationFunc, these
1797 //%// methods will assert in debug, and will log in release and assign the value
1798 //%// to the default value. Use the rawValue methods below to assign non enumerator
1801 //%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, NAME)
1806 //%PDDM-DEFINE ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
1808 //% * Gets the value at the given index.
1810 //% * @param index The index of the value to get.
1812 //% * @return The value at the given index.
1814 //%- (TYPE)valueAtIndex:(NSUInteger)index;
1817 //% * Enumerates the values on this array with the given block.
1819 //% * @param block The block to enumerate with.
1820 //% * **value**: The current value being enumerated.
1821 //% * **idx**: The index of the current value.
1822 //% * **stop**: A pointer to a boolean that when set stops the enumeration.
1824 //%- (void)enumerateValuesWithBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
1827 //% * Enumerates the values on this array with the given block.
1829 //% * @param opts Options to control the enumeration.
1830 //% * @param block The block to enumerate with.
1831 //% * **value**: The current value being enumerated.
1832 //% * **idx**: The index of the current value.
1833 //% * **stop**: A pointer to a boolean that when set stops the enumeration.
1835 //%- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1836 //% usingBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
1838 //%PDDM-DEFINE ARRAY_MUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
1840 //% * Adds a value to this array.
1842 //% * @param value The value to add to this array.
1844 //%- (void)addValue:(TYPE)value;
1847 //% * Adds values to this array.
1849 //% * @param values The values to add to this array.
1850 //% * @param count The number of elements to add.
1852 //%- (void)addValues:(const TYPE [__nullable])values count:(NSUInteger)count;
1854 //%ARRAY_EXTRA_MUTABLE_METHODS1_##HELPER_NAME(NAME, TYPE)
1856 //% * Inserts a value into the given position.
1858 //% * @param value The value to add to this array.
1859 //% * @param index The index into which to insert the value.
1861 //%- (void)insertValue:(TYPE)value atIndex:(NSUInteger)index;
1864 //% * Replaces the value at the given index with the given value.
1866 //% * @param index The index for which to replace the value.
1867 //% * @param value The value to replace with.
1869 //%- (void)replaceValueAtIndex:(NSUInteger)index withValue:(TYPE)value;
1870 //%ARRAY_EXTRA_MUTABLE_METHODS2_##HELPER_NAME(NAME, TYPE)
1872 //% * Removes the value at the given index.
1874 //% * @param index The index of the value to remove.
1876 //%- (void)removeValueAtIndex:(NSUInteger)index;
1879 //% * Removes all the values from this array.
1881 //%- (void)removeAll;
1884 //% * Exchanges the values between the given indexes.
1886 //% * @param idx1 The index of the first element to exchange.
1887 //% * @param idx2 The index of the second element to exchange.
1889 //%- (void)exchangeValueAtIndex:(NSUInteger)idx1
1890 //% withValueAtIndex:(NSUInteger)idx2;
1893 // These are hooks invoked by the above to do insert as needed.
1896 //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Basic(NAME, TYPE)
1898 //% * Adds the values from the given array to this array.
1900 //% * @param array The array containing the elements to add to this array.
1902 //%- (void)addValuesFromArray:(GPB##NAME##Array *)array;
1904 //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Basic(NAME, TYPE)
1906 //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Enum(NAME, TYPE)
1908 //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Enum(NAME, TYPE)
1910 //%// These methods bypass the validationFunc to provide setting of values that were not
1911 //%// known at the time the binary was compiled.
1914 //% * Adds a raw enum value to this array.
1916 //% * @note This method bypass the validationFunc to enable the setting of values that
1917 //% * were not known at the time the binary was compiled.
1919 //% * @param value The raw enum value to add to the array.
1921 //%- (void)addRawValue:(TYPE)value;
1924 //% * Adds raw enum values to this array.
1926 //% * @note This method bypass the validationFunc to enable the setting of values that
1927 //% * were not known at the time the binary was compiled.
1929 //% * @param array Array containing the raw enum values to add to this array.
1931 //%- (void)addRawValuesFromArray:(GPB##NAME##Array *)array;
1934 //% * Adds raw enum values to this array.
1936 //% * @note This method bypass the validationFunc to enable the setting of values that
1937 //% * were not known at the time the binary was compiled.
1939 //% * @param values Array containing the raw enum values to add to this array.
1940 //% * @param count The number of raw values to add.
1942 //%- (void)addRawValues:(const TYPE [__nullable])values count:(NSUInteger)count;
1945 //% * Inserts a raw enum value at the given index.
1947 //% * @note This method bypass the validationFunc to enable the setting of values that
1948 //% * were not known at the time the binary was compiled.
1950 //% * @param value Raw enum value to add.
1951 //% * @param index The index into which to insert the value.
1953 //%- (void)insertRawValue:(TYPE)value atIndex:(NSUInteger)index;
1956 //% * Replaces the raw enum value at the given index with the given value.
1958 //% * @note This method bypass the validationFunc to enable the setting of values that
1959 //% * were not known at the time the binary was compiled.
1961 //% * @param index The index for which to replace the value.
1962 //% * @param value The raw enum value to replace with.
1964 //%- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(TYPE)value;
1966 //%// No validation applies to these methods.