• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2015 Google Inc.  All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 //     * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //     * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 //     * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 #import <Foundation/Foundation.h>
32 
33 #import "GPBRuntimeTypes.h"
34 
35 NS_ASSUME_NONNULL_BEGIN
36 
37 //%PDDM-EXPAND DECLARE_ARRAYS()
38 // This block of code is generated, do not edit it directly.
39 // clang-format off
40 
41 #pragma mark - Int32
42 
43 /**
44  * Class used for repeated fields of int32_t values. This performs better than
45  * boxing into NSNumbers in NSArrays.
46  *
47  * @note This class is not meant to be subclassed.
48  **/
49 @interface GPBInt32Array : NSObject <NSCopying>
50 
51 /** The number of elements contained in the array. */
52 @property(nonatomic, readonly) NSUInteger count;
53 
54 /**
55  * @return A newly instanced and empty GPBInt32Array.
56  **/
57 + (instancetype)array;
58 
59 /**
60  * Creates and initializes a GPBInt32Array with the single element given.
61  *
62  * @param value The value to be placed in the array.
63  *
64  * @return A newly instanced GPBInt32Array with value in it.
65  **/
66 + (instancetype)arrayWithValue:(int32_t)value;
67 
68 /**
69  * Creates and initializes a GPBInt32Array with the contents of the given
70  * array.
71  *
72  * @param array Array with the contents to be put into the new array.
73  *
74  * @return A newly instanced GPBInt32Array with the contents of array.
75  **/
76 + (instancetype)arrayWithValueArray:(GPBInt32Array *)array;
77 
78 /**
79  * Creates and initializes a GPBInt32Array with the given capacity.
80  *
81  * @param count The capacity needed for the array.
82  *
83  * @return A newly instanced GPBInt32Array with a capacity of count.
84  **/
85 + (instancetype)arrayWithCapacity:(NSUInteger)count;
86 
87 /**
88  * @return A newly initialized and empty GPBInt32Array.
89  **/
90 - (instancetype)init NS_DESIGNATED_INITIALIZER;
91 
92 /**
93  * Initializes the array, copying the given values.
94  *
95  * @param values An array with the values to put inside this array.
96  * @param count  The number of elements to copy into the array.
97  *
98  * @return A newly initialized GPBInt32Array with a copy of the values.
99  **/
100 - (instancetype)initWithValues:(const int32_t [__nullable])values
101                          count:(NSUInteger)count;
102 
103 /**
104  * Initializes the array, copying the given values.
105  *
106  * @param array An array with the values to put inside this array.
107  *
108  * @return A newly initialized GPBInt32Array with a copy of the values.
109  **/
110 - (instancetype)initWithValueArray:(GPBInt32Array *)array;
111 
112 /**
113  * Initializes the array with the given capacity.
114  *
115  * @param count The capacity needed for the array.
116  *
117  * @return A newly initialized GPBInt32Array with a capacity of count.
118  **/
119 - (instancetype)initWithCapacity:(NSUInteger)count;
120 
121 /**
122  * Gets the value at the given index.
123  *
124  * @param index The index of the value to get.
125  *
126  * @return The value at the given index.
127  **/
128 - (int32_t)valueAtIndex:(NSUInteger)index;
129 
130 /**
131  * Enumerates the values on this array with the given block.
132  *
133  * @param block The block to enumerate with.
134  *   **value**: The current value being enumerated.
135  *   **idx**:   The index of the current value.
136  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
137  **/
138 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
139 
140 /**
141  * Enumerates the values on this array with the given block.
142  *
143  * @param opts  Options to control the enumeration.
144  * @param block The block to enumerate with.
145  *   **value**: The current value being enumerated.
146  *   **idx**:   The index of the current value.
147  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
148  **/
149 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
150                         usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
151 
152 /**
153  * Adds a value to this array.
154  *
155  * @param value The value to add to this array.
156  **/
157 - (void)addValue:(int32_t)value;
158 
159 /**
160  * Adds values to this array.
161  *
162  * @param values The values to add to this array.
163  * @param count  The number of elements to add.
164  **/
165 - (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
166 
167 /**
168  * Adds the values from the given array to this array.
169  *
170  * @param array The array containing the elements to add to this array.
171  **/
172 - (void)addValuesFromArray:(GPBInt32Array *)array;
173 
174 /**
175  * Inserts a value into the given position.
176  *
177  * @param value The value to add to this array.
178  * @param index The index into which to insert the value.
179  **/
180 - (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
181 
182 /**
183  * Replaces the value at the given index with the given value.
184  *
185  * @param index The index for which to replace the value.
186  * @param value The value to replace with.
187  **/
188 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
189 
190 /**
191  * Removes the value at the given index.
192  *
193  * @param index The index of the value to remove.
194  **/
195 - (void)removeValueAtIndex:(NSUInteger)index;
196 
197 /**
198  * Removes all the values from this array.
199  **/
200 - (void)removeAll;
201 
202 /**
203  * Exchanges the values between the given indexes.
204  *
205  * @param idx1 The index of the first element to exchange.
206  * @param idx2 The index of the second element to exchange.
207  **/
208 - (void)exchangeValueAtIndex:(NSUInteger)idx1
209             withValueAtIndex:(NSUInteger)idx2;
210 
211 @end
212 
213 #pragma mark - UInt32
214 
215 /**
216  * Class used for repeated fields of uint32_t values. This performs better than
217  * boxing into NSNumbers in NSArrays.
218  *
219  * @note This class is not meant to be subclassed.
220  **/
221 @interface GPBUInt32Array : NSObject <NSCopying>
222 
223 /** The number of elements contained in the array. */
224 @property(nonatomic, readonly) NSUInteger count;
225 
226 /**
227  * @return A newly instanced and empty GPBUInt32Array.
228  **/
229 + (instancetype)array;
230 
231 /**
232  * Creates and initializes a GPBUInt32Array with the single element given.
233  *
234  * @param value The value to be placed in the array.
235  *
236  * @return A newly instanced GPBUInt32Array with value in it.
237  **/
238 + (instancetype)arrayWithValue:(uint32_t)value;
239 
240 /**
241  * Creates and initializes a GPBUInt32Array with the contents of the given
242  * array.
243  *
244  * @param array Array with the contents to be put into the new array.
245  *
246  * @return A newly instanced GPBUInt32Array with the contents of array.
247  **/
248 + (instancetype)arrayWithValueArray:(GPBUInt32Array *)array;
249 
250 /**
251  * Creates and initializes a GPBUInt32Array with the given capacity.
252  *
253  * @param count The capacity needed for the array.
254  *
255  * @return A newly instanced GPBUInt32Array with a capacity of count.
256  **/
257 + (instancetype)arrayWithCapacity:(NSUInteger)count;
258 
259 /**
260  * @return A newly initialized and empty GPBUInt32Array.
261  **/
262 - (instancetype)init NS_DESIGNATED_INITIALIZER;
263 
264 /**
265  * Initializes the array, copying the given values.
266  *
267  * @param values An array with the values to put inside this array.
268  * @param count  The number of elements to copy into the array.
269  *
270  * @return A newly initialized GPBUInt32Array with a copy of the values.
271  **/
272 - (instancetype)initWithValues:(const uint32_t [__nullable])values
273                          count:(NSUInteger)count;
274 
275 /**
276  * Initializes the array, copying the given values.
277  *
278  * @param array An array with the values to put inside this array.
279  *
280  * @return A newly initialized GPBUInt32Array with a copy of the values.
281  **/
282 - (instancetype)initWithValueArray:(GPBUInt32Array *)array;
283 
284 /**
285  * Initializes the array with the given capacity.
286  *
287  * @param count The capacity needed for the array.
288  *
289  * @return A newly initialized GPBUInt32Array with a capacity of count.
290  **/
291 - (instancetype)initWithCapacity:(NSUInteger)count;
292 
293 /**
294  * Gets the value at the given index.
295  *
296  * @param index The index of the value to get.
297  *
298  * @return The value at the given index.
299  **/
300 - (uint32_t)valueAtIndex:(NSUInteger)index;
301 
302 /**
303  * Enumerates the values on this array with the given block.
304  *
305  * @param block The block to enumerate with.
306  *   **value**: The current value being enumerated.
307  *   **idx**:   The index of the current value.
308  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
309  **/
310 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
311 
312 /**
313  * Enumerates the values on this array with the given block.
314  *
315  * @param opts  Options to control the enumeration.
316  * @param block The block to enumerate with.
317  *   **value**: The current value being enumerated.
318  *   **idx**:   The index of the current value.
319  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
320  **/
321 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
322                         usingBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
323 
324 /**
325  * Adds a value to this array.
326  *
327  * @param value The value to add to this array.
328  **/
329 - (void)addValue:(uint32_t)value;
330 
331 /**
332  * Adds values to this array.
333  *
334  * @param values The values to add to this array.
335  * @param count  The number of elements to add.
336  **/
337 - (void)addValues:(const uint32_t [__nullable])values count:(NSUInteger)count;
338 
339 /**
340  * Adds the values from the given array to this array.
341  *
342  * @param array The array containing the elements to add to this array.
343  **/
344 - (void)addValuesFromArray:(GPBUInt32Array *)array;
345 
346 /**
347  * Inserts a value into the given position.
348  *
349  * @param value The value to add to this array.
350  * @param index The index into which to insert the value.
351  **/
352 - (void)insertValue:(uint32_t)value atIndex:(NSUInteger)index;
353 
354 /**
355  * Replaces the value at the given index with the given value.
356  *
357  * @param index The index for which to replace the value.
358  * @param value The value to replace with.
359  **/
360 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint32_t)value;
361 
362 /**
363  * Removes the value at the given index.
364  *
365  * @param index The index of the value to remove.
366  **/
367 - (void)removeValueAtIndex:(NSUInteger)index;
368 
369 /**
370  * Removes all the values from this array.
371  **/
372 - (void)removeAll;
373 
374 /**
375  * Exchanges the values between the given indexes.
376  *
377  * @param idx1 The index of the first element to exchange.
378  * @param idx2 The index of the second element to exchange.
379  **/
380 - (void)exchangeValueAtIndex:(NSUInteger)idx1
381             withValueAtIndex:(NSUInteger)idx2;
382 
383 @end
384 
385 #pragma mark - Int64
386 
387 /**
388  * Class used for repeated fields of int64_t values. This performs better than
389  * boxing into NSNumbers in NSArrays.
390  *
391  * @note This class is not meant to be subclassed.
392  **/
393 @interface GPBInt64Array : NSObject <NSCopying>
394 
395 /** The number of elements contained in the array. */
396 @property(nonatomic, readonly) NSUInteger count;
397 
398 /**
399  * @return A newly instanced and empty GPBInt64Array.
400  **/
401 + (instancetype)array;
402 
403 /**
404  * Creates and initializes a GPBInt64Array with the single element given.
405  *
406  * @param value The value to be placed in the array.
407  *
408  * @return A newly instanced GPBInt64Array with value in it.
409  **/
410 + (instancetype)arrayWithValue:(int64_t)value;
411 
412 /**
413  * Creates and initializes a GPBInt64Array with the contents of the given
414  * array.
415  *
416  * @param array Array with the contents to be put into the new array.
417  *
418  * @return A newly instanced GPBInt64Array with the contents of array.
419  **/
420 + (instancetype)arrayWithValueArray:(GPBInt64Array *)array;
421 
422 /**
423  * Creates and initializes a GPBInt64Array with the given capacity.
424  *
425  * @param count The capacity needed for the array.
426  *
427  * @return A newly instanced GPBInt64Array with a capacity of count.
428  **/
429 + (instancetype)arrayWithCapacity:(NSUInteger)count;
430 
431 /**
432  * @return A newly initialized and empty GPBInt64Array.
433  **/
434 - (instancetype)init NS_DESIGNATED_INITIALIZER;
435 
436 /**
437  * Initializes the array, copying the given values.
438  *
439  * @param values An array with the values to put inside this array.
440  * @param count  The number of elements to copy into the array.
441  *
442  * @return A newly initialized GPBInt64Array with a copy of the values.
443  **/
444 - (instancetype)initWithValues:(const int64_t [__nullable])values
445                          count:(NSUInteger)count;
446 
447 /**
448  * Initializes the array, copying the given values.
449  *
450  * @param array An array with the values to put inside this array.
451  *
452  * @return A newly initialized GPBInt64Array with a copy of the values.
453  **/
454 - (instancetype)initWithValueArray:(GPBInt64Array *)array;
455 
456 /**
457  * Initializes the array with the given capacity.
458  *
459  * @param count The capacity needed for the array.
460  *
461  * @return A newly initialized GPBInt64Array with a capacity of count.
462  **/
463 - (instancetype)initWithCapacity:(NSUInteger)count;
464 
465 /**
466  * Gets the value at the given index.
467  *
468  * @param index The index of the value to get.
469  *
470  * @return The value at the given index.
471  **/
472 - (int64_t)valueAtIndex:(NSUInteger)index;
473 
474 /**
475  * Enumerates the values on this array with the given block.
476  *
477  * @param block The block to enumerate with.
478  *   **value**: The current value being enumerated.
479  *   **idx**:   The index of the current value.
480  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
481  **/
482 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))block;
483 
484 /**
485  * Enumerates the values on this array with the given block.
486  *
487  * @param opts  Options to control the enumeration.
488  * @param block The block to enumerate with.
489  *   **value**: The current value being enumerated.
490  *   **idx**:   The index of the current value.
491  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
492  **/
493 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
494                         usingBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))block;
495 
496 /**
497  * Adds a value to this array.
498  *
499  * @param value The value to add to this array.
500  **/
501 - (void)addValue:(int64_t)value;
502 
503 /**
504  * Adds values to this array.
505  *
506  * @param values The values to add to this array.
507  * @param count  The number of elements to add.
508  **/
509 - (void)addValues:(const int64_t [__nullable])values count:(NSUInteger)count;
510 
511 /**
512  * Adds the values from the given array to this array.
513  *
514  * @param array The array containing the elements to add to this array.
515  **/
516 - (void)addValuesFromArray:(GPBInt64Array *)array;
517 
518 /**
519  * Inserts a value into the given position.
520  *
521  * @param value The value to add to this array.
522  * @param index The index into which to insert the value.
523  **/
524 - (void)insertValue:(int64_t)value atIndex:(NSUInteger)index;
525 
526 /**
527  * Replaces the value at the given index with the given value.
528  *
529  * @param index The index for which to replace the value.
530  * @param value The value to replace with.
531  **/
532 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int64_t)value;
533 
534 /**
535  * Removes the value at the given index.
536  *
537  * @param index The index of the value to remove.
538  **/
539 - (void)removeValueAtIndex:(NSUInteger)index;
540 
541 /**
542  * Removes all the values from this array.
543  **/
544 - (void)removeAll;
545 
546 /**
547  * Exchanges the values between the given indexes.
548  *
549  * @param idx1 The index of the first element to exchange.
550  * @param idx2 The index of the second element to exchange.
551  **/
552 - (void)exchangeValueAtIndex:(NSUInteger)idx1
553             withValueAtIndex:(NSUInteger)idx2;
554 
555 @end
556 
557 #pragma mark - UInt64
558 
559 /**
560  * Class used for repeated fields of uint64_t values. This performs better than
561  * boxing into NSNumbers in NSArrays.
562  *
563  * @note This class is not meant to be subclassed.
564  **/
565 @interface GPBUInt64Array : NSObject <NSCopying>
566 
567 /** The number of elements contained in the array. */
568 @property(nonatomic, readonly) NSUInteger count;
569 
570 /**
571  * @return A newly instanced and empty GPBUInt64Array.
572  **/
573 + (instancetype)array;
574 
575 /**
576  * Creates and initializes a GPBUInt64Array with the single element given.
577  *
578  * @param value The value to be placed in the array.
579  *
580  * @return A newly instanced GPBUInt64Array with value in it.
581  **/
582 + (instancetype)arrayWithValue:(uint64_t)value;
583 
584 /**
585  * Creates and initializes a GPBUInt64Array with the contents of the given
586  * array.
587  *
588  * @param array Array with the contents to be put into the new array.
589  *
590  * @return A newly instanced GPBUInt64Array with the contents of array.
591  **/
592 + (instancetype)arrayWithValueArray:(GPBUInt64Array *)array;
593 
594 /**
595  * Creates and initializes a GPBUInt64Array with the given capacity.
596  *
597  * @param count The capacity needed for the array.
598  *
599  * @return A newly instanced GPBUInt64Array with a capacity of count.
600  **/
601 + (instancetype)arrayWithCapacity:(NSUInteger)count;
602 
603 /**
604  * @return A newly initialized and empty GPBUInt64Array.
605  **/
606 - (instancetype)init NS_DESIGNATED_INITIALIZER;
607 
608 /**
609  * Initializes the array, copying the given values.
610  *
611  * @param values An array with the values to put inside this array.
612  * @param count  The number of elements to copy into the array.
613  *
614  * @return A newly initialized GPBUInt64Array with a copy of the values.
615  **/
616 - (instancetype)initWithValues:(const uint64_t [__nullable])values
617                          count:(NSUInteger)count;
618 
619 /**
620  * Initializes the array, copying the given values.
621  *
622  * @param array An array with the values to put inside this array.
623  *
624  * @return A newly initialized GPBUInt64Array with a copy of the values.
625  **/
626 - (instancetype)initWithValueArray:(GPBUInt64Array *)array;
627 
628 /**
629  * Initializes the array with the given capacity.
630  *
631  * @param count The capacity needed for the array.
632  *
633  * @return A newly initialized GPBUInt64Array with a capacity of count.
634  **/
635 - (instancetype)initWithCapacity:(NSUInteger)count;
636 
637 /**
638  * Gets the value at the given index.
639  *
640  * @param index The index of the value to get.
641  *
642  * @return The value at the given index.
643  **/
644 - (uint64_t)valueAtIndex:(NSUInteger)index;
645 
646 /**
647  * Enumerates the values on this array with the given block.
648  *
649  * @param block The block to enumerate with.
650  *   **value**: The current value being enumerated.
651  *   **idx**:   The index of the current value.
652  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
653  **/
654 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
655 
656 /**
657  * Enumerates the values on this array with the given block.
658  *
659  * @param opts  Options to control the enumeration.
660  * @param block The block to enumerate with.
661  *   **value**: The current value being enumerated.
662  *   **idx**:   The index of the current value.
663  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
664  **/
665 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
666                         usingBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
667 
668 /**
669  * Adds a value to this array.
670  *
671  * @param value The value to add to this array.
672  **/
673 - (void)addValue:(uint64_t)value;
674 
675 /**
676  * Adds values to this array.
677  *
678  * @param values The values to add to this array.
679  * @param count  The number of elements to add.
680  **/
681 - (void)addValues:(const uint64_t [__nullable])values count:(NSUInteger)count;
682 
683 /**
684  * Adds the values from the given array to this array.
685  *
686  * @param array The array containing the elements to add to this array.
687  **/
688 - (void)addValuesFromArray:(GPBUInt64Array *)array;
689 
690 /**
691  * Inserts a value into the given position.
692  *
693  * @param value The value to add to this array.
694  * @param index The index into which to insert the value.
695  **/
696 - (void)insertValue:(uint64_t)value atIndex:(NSUInteger)index;
697 
698 /**
699  * Replaces the value at the given index with the given value.
700  *
701  * @param index The index for which to replace the value.
702  * @param value The value to replace with.
703  **/
704 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint64_t)value;
705 
706 /**
707  * Removes the value at the given index.
708  *
709  * @param index The index of the value to remove.
710  **/
711 - (void)removeValueAtIndex:(NSUInteger)index;
712 
713 /**
714  * Removes all the values from this array.
715  **/
716 - (void)removeAll;
717 
718 /**
719  * Exchanges the values between the given indexes.
720  *
721  * @param idx1 The index of the first element to exchange.
722  * @param idx2 The index of the second element to exchange.
723  **/
724 - (void)exchangeValueAtIndex:(NSUInteger)idx1
725             withValueAtIndex:(NSUInteger)idx2;
726 
727 @end
728 
729 #pragma mark - Float
730 
731 /**
732  * Class used for repeated fields of float values. This performs better than
733  * boxing into NSNumbers in NSArrays.
734  *
735  * @note This class is not meant to be subclassed.
736  **/
737 @interface GPBFloatArray : NSObject <NSCopying>
738 
739 /** The number of elements contained in the array. */
740 @property(nonatomic, readonly) NSUInteger count;
741 
742 /**
743  * @return A newly instanced and empty GPBFloatArray.
744  **/
745 + (instancetype)array;
746 
747 /**
748  * Creates and initializes a GPBFloatArray with the single element given.
749  *
750  * @param value The value to be placed in the array.
751  *
752  * @return A newly instanced GPBFloatArray with value in it.
753  **/
754 + (instancetype)arrayWithValue:(float)value;
755 
756 /**
757  * Creates and initializes a GPBFloatArray with the contents of the given
758  * array.
759  *
760  * @param array Array with the contents to be put into the new array.
761  *
762  * @return A newly instanced GPBFloatArray with the contents of array.
763  **/
764 + (instancetype)arrayWithValueArray:(GPBFloatArray *)array;
765 
766 /**
767  * Creates and initializes a GPBFloatArray with the given capacity.
768  *
769  * @param count The capacity needed for the array.
770  *
771  * @return A newly instanced GPBFloatArray with a capacity of count.
772  **/
773 + (instancetype)arrayWithCapacity:(NSUInteger)count;
774 
775 /**
776  * @return A newly initialized and empty GPBFloatArray.
777  **/
778 - (instancetype)init NS_DESIGNATED_INITIALIZER;
779 
780 /**
781  * Initializes the array, copying the given values.
782  *
783  * @param values An array with the values to put inside this array.
784  * @param count  The number of elements to copy into the array.
785  *
786  * @return A newly initialized GPBFloatArray with a copy of the values.
787  **/
788 - (instancetype)initWithValues:(const float [__nullable])values
789                          count:(NSUInteger)count;
790 
791 /**
792  * Initializes the array, copying the given values.
793  *
794  * @param array An array with the values to put inside this array.
795  *
796  * @return A newly initialized GPBFloatArray with a copy of the values.
797  **/
798 - (instancetype)initWithValueArray:(GPBFloatArray *)array;
799 
800 /**
801  * Initializes the array with the given capacity.
802  *
803  * @param count The capacity needed for the array.
804  *
805  * @return A newly initialized GPBFloatArray with a capacity of count.
806  **/
807 - (instancetype)initWithCapacity:(NSUInteger)count;
808 
809 /**
810  * Gets the value at the given index.
811  *
812  * @param index The index of the value to get.
813  *
814  * @return The value at the given index.
815  **/
816 - (float)valueAtIndex:(NSUInteger)index;
817 
818 /**
819  * Enumerates the values on this array with the given block.
820  *
821  * @param block The block to enumerate with.
822  *   **value**: The current value being enumerated.
823  *   **idx**:   The index of the current value.
824  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
825  **/
826 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block;
827 
828 /**
829  * Enumerates the values on this array with the given block.
830  *
831  * @param opts  Options to control the enumeration.
832  * @param block The block to enumerate with.
833  *   **value**: The current value being enumerated.
834  *   **idx**:   The index of the current value.
835  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
836  **/
837 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
838                         usingBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block;
839 
840 /**
841  * Adds a value to this array.
842  *
843  * @param value The value to add to this array.
844  **/
845 - (void)addValue:(float)value;
846 
847 /**
848  * Adds values to this array.
849  *
850  * @param values The values to add to this array.
851  * @param count  The number of elements to add.
852  **/
853 - (void)addValues:(const float [__nullable])values count:(NSUInteger)count;
854 
855 /**
856  * Adds the values from the given array to this array.
857  *
858  * @param array The array containing the elements to add to this array.
859  **/
860 - (void)addValuesFromArray:(GPBFloatArray *)array;
861 
862 /**
863  * Inserts a value into the given position.
864  *
865  * @param value The value to add to this array.
866  * @param index The index into which to insert the value.
867  **/
868 - (void)insertValue:(float)value atIndex:(NSUInteger)index;
869 
870 /**
871  * Replaces the value at the given index with the given value.
872  *
873  * @param index The index for which to replace the value.
874  * @param value The value to replace with.
875  **/
876 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(float)value;
877 
878 /**
879  * Removes the value at the given index.
880  *
881  * @param index The index of the value to remove.
882  **/
883 - (void)removeValueAtIndex:(NSUInteger)index;
884 
885 /**
886  * Removes all the values from this array.
887  **/
888 - (void)removeAll;
889 
890 /**
891  * Exchanges the values between the given indexes.
892  *
893  * @param idx1 The index of the first element to exchange.
894  * @param idx2 The index of the second element to exchange.
895  **/
896 - (void)exchangeValueAtIndex:(NSUInteger)idx1
897             withValueAtIndex:(NSUInteger)idx2;
898 
899 @end
900 
901 #pragma mark - Double
902 
903 /**
904  * Class used for repeated fields of double values. This performs better than
905  * boxing into NSNumbers in NSArrays.
906  *
907  * @note This class is not meant to be subclassed.
908  **/
909 @interface GPBDoubleArray : NSObject <NSCopying>
910 
911 /** The number of elements contained in the array. */
912 @property(nonatomic, readonly) NSUInteger count;
913 
914 /**
915  * @return A newly instanced and empty GPBDoubleArray.
916  **/
917 + (instancetype)array;
918 
919 /**
920  * Creates and initializes a GPBDoubleArray with the single element given.
921  *
922  * @param value The value to be placed in the array.
923  *
924  * @return A newly instanced GPBDoubleArray with value in it.
925  **/
926 + (instancetype)arrayWithValue:(double)value;
927 
928 /**
929  * Creates and initializes a GPBDoubleArray with the contents of the given
930  * array.
931  *
932  * @param array Array with the contents to be put into the new array.
933  *
934  * @return A newly instanced GPBDoubleArray with the contents of array.
935  **/
936 + (instancetype)arrayWithValueArray:(GPBDoubleArray *)array;
937 
938 /**
939  * Creates and initializes a GPBDoubleArray with the given capacity.
940  *
941  * @param count The capacity needed for the array.
942  *
943  * @return A newly instanced GPBDoubleArray with a capacity of count.
944  **/
945 + (instancetype)arrayWithCapacity:(NSUInteger)count;
946 
947 /**
948  * @return A newly initialized and empty GPBDoubleArray.
949  **/
950 - (instancetype)init NS_DESIGNATED_INITIALIZER;
951 
952 /**
953  * Initializes the array, copying the given values.
954  *
955  * @param values An array with the values to put inside this array.
956  * @param count  The number of elements to copy into the array.
957  *
958  * @return A newly initialized GPBDoubleArray with a copy of the values.
959  **/
960 - (instancetype)initWithValues:(const double [__nullable])values
961                          count:(NSUInteger)count;
962 
963 /**
964  * Initializes the array, copying the given values.
965  *
966  * @param array An array with the values to put inside this array.
967  *
968  * @return A newly initialized GPBDoubleArray with a copy of the values.
969  **/
970 - (instancetype)initWithValueArray:(GPBDoubleArray *)array;
971 
972 /**
973  * Initializes the array with the given capacity.
974  *
975  * @param count The capacity needed for the array.
976  *
977  * @return A newly initialized GPBDoubleArray with a capacity of count.
978  **/
979 - (instancetype)initWithCapacity:(NSUInteger)count;
980 
981 /**
982  * Gets the value at the given index.
983  *
984  * @param index The index of the value to get.
985  *
986  * @return The value at the given index.
987  **/
988 - (double)valueAtIndex:(NSUInteger)index;
989 
990 /**
991  * Enumerates the values on this array with the given block.
992  *
993  * @param block The block to enumerate with.
994  *   **value**: The current value being enumerated.
995  *   **idx**:   The index of the current value.
996  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
997  **/
998 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block;
999 
1000 /**
1001  * Enumerates the values on this array with the given block.
1002  *
1003  * @param opts  Options to control the enumeration.
1004  * @param block The block to enumerate with.
1005  *   **value**: The current value being enumerated.
1006  *   **idx**:   The index of the current value.
1007  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
1008  **/
1009 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1010                         usingBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block;
1011 
1012 /**
1013  * Adds a value to this array.
1014  *
1015  * @param value The value to add to this array.
1016  **/
1017 - (void)addValue:(double)value;
1018 
1019 /**
1020  * Adds values to this array.
1021  *
1022  * @param values The values to add to this array.
1023  * @param count  The number of elements to add.
1024  **/
1025 - (void)addValues:(const double [__nullable])values count:(NSUInteger)count;
1026 
1027 /**
1028  * Adds the values from the given array to this array.
1029  *
1030  * @param array The array containing the elements to add to this array.
1031  **/
1032 - (void)addValuesFromArray:(GPBDoubleArray *)array;
1033 
1034 /**
1035  * Inserts a value into the given position.
1036  *
1037  * @param value The value to add to this array.
1038  * @param index The index into which to insert the value.
1039  **/
1040 - (void)insertValue:(double)value atIndex:(NSUInteger)index;
1041 
1042 /**
1043  * Replaces the value at the given index with the given value.
1044  *
1045  * @param index The index for which to replace the value.
1046  * @param value The value to replace with.
1047  **/
1048 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(double)value;
1049 
1050 /**
1051  * Removes the value at the given index.
1052  *
1053  * @param index The index of the value to remove.
1054  **/
1055 - (void)removeValueAtIndex:(NSUInteger)index;
1056 
1057 /**
1058  * Removes all the values from this array.
1059  **/
1060 - (void)removeAll;
1061 
1062 /**
1063  * Exchanges the values between the given indexes.
1064  *
1065  * @param idx1 The index of the first element to exchange.
1066  * @param idx2 The index of the second element to exchange.
1067  **/
1068 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1069             withValueAtIndex:(NSUInteger)idx2;
1070 
1071 @end
1072 
1073 #pragma mark - Bool
1074 
1075 /**
1076  * Class used for repeated fields of BOOL values. This performs better than
1077  * boxing into NSNumbers in NSArrays.
1078  *
1079  * @note This class is not meant to be subclassed.
1080  **/
1081 @interface GPBBoolArray : NSObject <NSCopying>
1082 
1083 /** The number of elements contained in the array. */
1084 @property(nonatomic, readonly) NSUInteger count;
1085 
1086 /**
1087  * @return A newly instanced and empty GPBBoolArray.
1088  **/
1089 + (instancetype)array;
1090 
1091 /**
1092  * Creates and initializes a GPBBoolArray with the single element given.
1093  *
1094  * @param value The value to be placed in the array.
1095  *
1096  * @return A newly instanced GPBBoolArray with value in it.
1097  **/
1098 + (instancetype)arrayWithValue:(BOOL)value;
1099 
1100 /**
1101  * Creates and initializes a GPBBoolArray with the contents of the given
1102  * array.
1103  *
1104  * @param array Array with the contents to be put into the new array.
1105  *
1106  * @return A newly instanced GPBBoolArray with the contents of array.
1107  **/
1108 + (instancetype)arrayWithValueArray:(GPBBoolArray *)array;
1109 
1110 /**
1111  * Creates and initializes a GPBBoolArray with the given capacity.
1112  *
1113  * @param count The capacity needed for the array.
1114  *
1115  * @return A newly instanced GPBBoolArray with a capacity of count.
1116  **/
1117 + (instancetype)arrayWithCapacity:(NSUInteger)count;
1118 
1119 /**
1120  * @return A newly initialized and empty GPBBoolArray.
1121  **/
1122 - (instancetype)init NS_DESIGNATED_INITIALIZER;
1123 
1124 /**
1125  * Initializes the array, copying the given values.
1126  *
1127  * @param values An array with the values to put inside this array.
1128  * @param count  The number of elements to copy into the array.
1129  *
1130  * @return A newly initialized GPBBoolArray with a copy of the values.
1131  **/
1132 - (instancetype)initWithValues:(const BOOL [__nullable])values
1133                          count:(NSUInteger)count;
1134 
1135 /**
1136  * Initializes the array, copying the given values.
1137  *
1138  * @param array An array with the values to put inside this array.
1139  *
1140  * @return A newly initialized GPBBoolArray with a copy of the values.
1141  **/
1142 - (instancetype)initWithValueArray:(GPBBoolArray *)array;
1143 
1144 /**
1145  * Initializes the array with the given capacity.
1146  *
1147  * @param count The capacity needed for the array.
1148  *
1149  * @return A newly initialized GPBBoolArray with a capacity of count.
1150  **/
1151 - (instancetype)initWithCapacity:(NSUInteger)count;
1152 
1153 /**
1154  * Gets the value at the given index.
1155  *
1156  * @param index The index of the value to get.
1157  *
1158  * @return The value at the given index.
1159  **/
1160 - (BOOL)valueAtIndex:(NSUInteger)index;
1161 
1162 /**
1163  * Enumerates the values on this array with the given block.
1164  *
1165  * @param block The block to enumerate with.
1166  *   **value**: The current value being enumerated.
1167  *   **idx**:   The index of the current value.
1168  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
1169  **/
1170 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block;
1171 
1172 /**
1173  * Enumerates the values on this array with the given block.
1174  *
1175  * @param opts  Options to control the enumeration.
1176  * @param block The block to enumerate with.
1177  *   **value**: The current value being enumerated.
1178  *   **idx**:   The index of the current value.
1179  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
1180  **/
1181 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1182                         usingBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block;
1183 
1184 /**
1185  * Adds a value to this array.
1186  *
1187  * @param value The value to add to this array.
1188  **/
1189 - (void)addValue:(BOOL)value;
1190 
1191 /**
1192  * Adds values to this array.
1193  *
1194  * @param values The values to add to this array.
1195  * @param count  The number of elements to add.
1196  **/
1197 - (void)addValues:(const BOOL [__nullable])values count:(NSUInteger)count;
1198 
1199 /**
1200  * Adds the values from the given array to this array.
1201  *
1202  * @param array The array containing the elements to add to this array.
1203  **/
1204 - (void)addValuesFromArray:(GPBBoolArray *)array;
1205 
1206 /**
1207  * Inserts a value into the given position.
1208  *
1209  * @param value The value to add to this array.
1210  * @param index The index into which to insert the value.
1211  **/
1212 - (void)insertValue:(BOOL)value atIndex:(NSUInteger)index;
1213 
1214 /**
1215  * Replaces the value at the given index with the given value.
1216  *
1217  * @param index The index for which to replace the value.
1218  * @param value The value to replace with.
1219  **/
1220 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(BOOL)value;
1221 
1222 /**
1223  * Removes the value at the given index.
1224  *
1225  * @param index The index of the value to remove.
1226  **/
1227 - (void)removeValueAtIndex:(NSUInteger)index;
1228 
1229 /**
1230  * Removes all the values from this array.
1231  **/
1232 - (void)removeAll;
1233 
1234 /**
1235  * Exchanges the values between the given indexes.
1236  *
1237  * @param idx1 The index of the first element to exchange.
1238  * @param idx2 The index of the second element to exchange.
1239  **/
1240 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1241             withValueAtIndex:(NSUInteger)idx2;
1242 
1243 @end
1244 
1245 #pragma mark - Enum
1246 
1247 /**
1248  * This class is used for repeated fields of int32_t values. This performs
1249  * better than boxing into NSNumbers in NSArrays.
1250  *
1251  * @note This class is not meant to be subclassed.
1252  **/
1253 @interface GPBEnumArray : NSObject <NSCopying>
1254 
1255 /** The number of elements contained in the array. */
1256 @property(nonatomic, readonly) NSUInteger count;
1257 /** The validation function to check if the enums are valid. */
1258 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
1259 
1260 /**
1261  * @return A newly instanced and empty GPBEnumArray.
1262  **/
1263 + (instancetype)array;
1264 
1265 /**
1266  * Creates and initializes a GPBEnumArray with the enum validation function
1267  * given.
1268  *
1269  * @param func The enum validation function for the array.
1270  *
1271  * @return A newly instanced GPBEnumArray.
1272  **/
1273 + (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
1274 
1275 /**
1276  * Creates and initializes a GPBEnumArray with the enum validation function
1277  * given and the single raw value given.
1278  *
1279  * @param func  The enum validation function for the array.
1280  * @param value The raw value to add to this array.
1281  *
1282  * @return A newly instanced GPBEnumArray.
1283  **/
1284 + (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
1285                                    rawValue:(int32_t)value;
1286 
1287 /**
1288  * Creates and initializes a GPBEnumArray that adds the elements from the
1289  * given array.
1290  *
1291  * @param array Array containing the values to add to the new array.
1292  *
1293  * @return A newly instanced GPBEnumArray.
1294  **/
1295 + (instancetype)arrayWithValueArray:(GPBEnumArray *)array;
1296 
1297 /**
1298  * Creates and initializes a GPBEnumArray with the given enum validation
1299  * function and with the givencapacity.
1300  *
1301  * @param func  The enum validation function for the array.
1302  * @param count The capacity needed for the array.
1303  *
1304  * @return A newly instanced GPBEnumArray with a capacity of count.
1305  **/
1306 + (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
1307                                    capacity:(NSUInteger)count;
1308 
1309 /**
1310  * Initializes the array with the given enum validation function.
1311  *
1312  * @param func The enum validation function for the array.
1313  *
1314  * @return A newly initialized GPBEnumArray with a copy of the values.
1315  **/
1316 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1317     NS_DESIGNATED_INITIALIZER;
1318 
1319 /**
1320  * Initializes the array, copying the given values.
1321  *
1322  * @param func   The enum validation function for the array.
1323  * @param values An array with the values to put inside this array.
1324  * @param count  The number of elements to copy into the array.
1325  *
1326  * @return A newly initialized GPBEnumArray with a copy of the values.
1327  **/
1328 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1329                                  rawValues:(const int32_t [__nullable])values
1330                                      count:(NSUInteger)count;
1331 
1332 /**
1333  * Initializes the array, copying the given values.
1334  *
1335  * @param array An array with the values to put inside this array.
1336  *
1337  * @return A newly initialized GPBEnumArray with a copy of the values.
1338  **/
1339 - (instancetype)initWithValueArray:(GPBEnumArray *)array;
1340 
1341 /**
1342  * Initializes the array with the given capacity.
1343  *
1344  * @param func  The enum validation function for the array.
1345  * @param count The capacity needed for the array.
1346  *
1347  * @return A newly initialized GPBEnumArray with a capacity of count.
1348  **/
1349 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1350                                   capacity:(NSUInteger)count;
1351 
1352 // These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
1353 // valid enumerator as defined by validationFunc. If the actual value is
1354 // desired, use "raw" version of the method.
1355 
1356 /**
1357  * Gets the value at the given index.
1358  *
1359  * @param index The index of the value to get.
1360  *
1361  * @return The value at the given index.
1362  **/
1363 - (int32_t)valueAtIndex:(NSUInteger)index;
1364 
1365 /**
1366  * Enumerates the values on this array with the given block.
1367  *
1368  * @param block The block to enumerate with.
1369  *   **value**: The current value being enumerated.
1370  *   **idx**:   The index of the current value.
1371  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
1372  **/
1373 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
1374 
1375 /**
1376  * Enumerates the values on this array with the given block.
1377  *
1378  * @param opts  Options to control the enumeration.
1379  * @param block The block to enumerate with.
1380  *   **value**: The current value being enumerated.
1381  *   **idx**:   The index of the current value.
1382  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
1383  **/
1384 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1385                         usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
1386 
1387 // These methods bypass the validationFunc to provide access to values that were not
1388 // known at the time the binary was compiled.
1389 
1390 /**
1391  * Gets the raw enum value at the given index.
1392  *
1393  * @param index The index of the raw enum value to get.
1394  *
1395  * @return The raw enum value at the given index.
1396  **/
1397 - (int32_t)rawValueAtIndex:(NSUInteger)index;
1398 
1399 /**
1400  * Enumerates the values on this array with the given block.
1401  *
1402  * @param block The block to enumerate with.
1403  *   **value**: The current value being enumerated.
1404  *   **idx**:   The index of the current value.
1405  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
1406  **/
1407 - (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
1408 
1409 /**
1410  * Enumerates the values on this array with the given block.
1411  *
1412  * @param opts  Options to control the enumeration.
1413  * @param block The block to enumerate with.
1414  *   **value**: The current value being enumerated.
1415  *   **idx**:   The index of the current value.
1416  *   **stop**:  A pointer to a boolean that when set stops the enumeration.
1417  **/
1418 - (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
1419                            usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
1420 
1421 // If value is not a valid enumerator as defined by validationFunc, these
1422 // methods will assert in debug, and will log in release and assign the value
1423 // to the default value. Use the rawValue methods below to assign non enumerator
1424 // values.
1425 
1426 /**
1427  * Adds a value to this array.
1428  *
1429  * @param value The value to add to this array.
1430  **/
1431 - (void)addValue:(int32_t)value;
1432 
1433 /**
1434  * Adds values to this array.
1435  *
1436  * @param values The values to add to this array.
1437  * @param count  The number of elements to add.
1438  **/
1439 - (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
1440 
1441 
1442 /**
1443  * Inserts a value into the given position.
1444  *
1445  * @param value The value to add to this array.
1446  * @param index The index into which to insert the value.
1447  **/
1448 - (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
1449 
1450 /**
1451  * Replaces the value at the given index with the given value.
1452  *
1453  * @param index The index for which to replace the value.
1454  * @param value The value to replace with.
1455  **/
1456 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
1457 
1458 // These methods bypass the validationFunc to provide setting of values that were not
1459 // known at the time the binary was compiled.
1460 
1461 /**
1462  * Adds a raw enum value to this array.
1463  *
1464  * @note This method bypass the validationFunc to enable the setting of values that
1465  *       were not known at the time the binary was compiled.
1466  *
1467  * @param value The raw enum value to add to the array.
1468  **/
1469 - (void)addRawValue:(int32_t)value;
1470 
1471 /**
1472  * Adds raw enum values to this array.
1473  *
1474  * @note This method bypass the validationFunc to enable the setting of values that
1475  *       were not known at the time the binary was compiled.
1476  *
1477  * @param array Array containing the raw enum values to add to this array.
1478  **/
1479 - (void)addRawValuesFromArray:(GPBEnumArray *)array;
1480 
1481 /**
1482  * Adds raw enum values to this array.
1483  *
1484  * @note This method bypass the validationFunc to enable the setting of values that
1485  *       were not known at the time the binary was compiled.
1486  *
1487  * @param values Array containing the raw enum values to add to this array.
1488  * @param count  The number of raw values to add.
1489  **/
1490 - (void)addRawValues:(const int32_t [__nullable])values count:(NSUInteger)count;
1491 
1492 /**
1493  * Inserts a raw enum value at the given index.
1494  *
1495  * @note This method bypass the validationFunc to enable the setting of values that
1496  *       were not known at the time the binary was compiled.
1497  *
1498  * @param value Raw enum value to add.
1499  * @param index The index into which to insert the value.
1500  **/
1501 - (void)insertRawValue:(int32_t)value atIndex:(NSUInteger)index;
1502 
1503 /**
1504  * Replaces the raw enum value at the given index with the given value.
1505  *
1506  * @note This method bypass the validationFunc to enable the setting of values that
1507  *       were not known at the time the binary was compiled.
1508  *
1509  * @param index The index for which to replace the value.
1510  * @param value The raw enum value to replace with.
1511  **/
1512 - (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(int32_t)value;
1513 
1514 // No validation applies to these methods.
1515 
1516 /**
1517  * Removes the value at the given index.
1518  *
1519  * @param index The index of the value to remove.
1520  **/
1521 - (void)removeValueAtIndex:(NSUInteger)index;
1522 
1523 /**
1524  * Removes all the values from this array.
1525  **/
1526 - (void)removeAll;
1527 
1528 /**
1529  * Exchanges the values between the given indexes.
1530  *
1531  * @param idx1 The index of the first element to exchange.
1532  * @param idx2 The index of the second element to exchange.
1533  **/
1534 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1535             withValueAtIndex:(NSUInteger)idx2;
1536 
1537 @end
1538 
1539 // clang-format on
1540 //%PDDM-EXPAND-END DECLARE_ARRAYS()
1541 
1542 NS_ASSUME_NONNULL_END
1543 
1544 //%PDDM-DEFINE DECLARE_ARRAYS()
1545 //%ARRAY_INTERFACE_SIMPLE(Int32, int32_t)
1546 //%ARRAY_INTERFACE_SIMPLE(UInt32, uint32_t)
1547 //%ARRAY_INTERFACE_SIMPLE(Int64, int64_t)
1548 //%ARRAY_INTERFACE_SIMPLE(UInt64, uint64_t)
1549 //%ARRAY_INTERFACE_SIMPLE(Float, float)
1550 //%ARRAY_INTERFACE_SIMPLE(Double, double)
1551 //%ARRAY_INTERFACE_SIMPLE(Bool, BOOL)
1552 //%ARRAY_INTERFACE_ENUM(Enum, int32_t)
1553 
1554 //
1555 // The common case (everything but Enum)
1556 //
1557 
1558 //%PDDM-DEFINE ARRAY_INTERFACE_SIMPLE(NAME, TYPE)
1559 //%#pragma mark - NAME
1560 //%
1561 //%/**
1562 //% * Class used for repeated fields of ##TYPE## values. This performs better than
1563 //% * boxing into NSNumbers in NSArrays.
1564 //% *
1565 //% * @note This class is not meant to be subclassed.
1566 //% **/
1567 //%@interface GPB##NAME##Array : NSObject <NSCopying>
1568 //%
1569 //%/** The number of elements contained in the array. */
1570 //%@property(nonatomic, readonly) NSUInteger count;
1571 //%
1572 //%/**
1573 //% * @return A newly instanced and empty GPB##NAME##Array.
1574 //% **/
1575 //%+ (instancetype)array;
1576 //%
1577 //%/**
1578 //% * Creates and initializes a GPB##NAME##Array with the single element given.
1579 //% *
1580 //% * @param value The value to be placed in the array.
1581 //% *
1582 //% * @return A newly instanced GPB##NAME##Array with value in it.
1583 //% **/
1584 //%+ (instancetype)arrayWithValue:(TYPE)value;
1585 //%
1586 //%/**
1587 //% * Creates and initializes a GPB##NAME##Array with the contents of the given
1588 //% * array.
1589 //% *
1590 //% * @param array Array with the contents to be put into the new array.
1591 //% *
1592 //% * @return A newly instanced GPB##NAME##Array with the contents of array.
1593 //% **/
1594 //%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
1595 //%
1596 //%/**
1597 //% * Creates and initializes a GPB##NAME##Array with the given capacity.
1598 //% *
1599 //% * @param count The capacity needed for the array.
1600 //% *
1601 //% * @return A newly instanced GPB##NAME##Array with a capacity of count.
1602 //% **/
1603 //%+ (instancetype)arrayWithCapacity:(NSUInteger)count;
1604 //%
1605 //%/**
1606 //% * @return A newly initialized and empty GPB##NAME##Array.
1607 //% **/
1608 //%- (instancetype)init NS_DESIGNATED_INITIALIZER;
1609 //%
1610 //%/**
1611 //% * Initializes the array, copying the given values.
1612 //% *
1613 //% * @param values An array with the values to put inside this array.
1614 //% * @param count  The number of elements to copy into the array.
1615 //% *
1616 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1617 //% **/
1618 //%- (instancetype)initWithValues:(const TYPE [__nullable])values
1619 //%                         count:(NSUInteger)count;
1620 //%
1621 //%/**
1622 //% * Initializes the array, copying the given values.
1623 //% *
1624 //% * @param array An array with the values to put inside this array.
1625 //% *
1626 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1627 //% **/
1628 //%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
1629 //%
1630 //%/**
1631 //% * Initializes the array with the given capacity.
1632 //% *
1633 //% * @param count The capacity needed for the array.
1634 //% *
1635 //% * @return A newly initialized GPB##NAME##Array with a capacity of count.
1636 //% **/
1637 //%- (instancetype)initWithCapacity:(NSUInteger)count;
1638 //%
1639 //%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, Basic)
1640 //%
1641 //%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, Basic)
1642 //%
1643 //%@end
1644 //%
1645 
1646 //
1647 // Macros specific to Enums (to tweak their interface).
1648 //
1649 
1650 //%PDDM-DEFINE ARRAY_INTERFACE_ENUM(NAME, TYPE)
1651 //%#pragma mark - NAME
1652 //%
1653 //%/**
1654 //% * This class is used for repeated fields of ##TYPE## values. This performs
1655 //% * better than boxing into NSNumbers in NSArrays.
1656 //% *
1657 //% * @note This class is not meant to be subclassed.
1658 //% **/
1659 //%@interface GPB##NAME##Array : NSObject <NSCopying>
1660 //%
1661 //%/** The number of elements contained in the array. */
1662 //%@property(nonatomic, readonly) NSUInteger count;
1663 //%/** The validation function to check if the enums are valid. */
1664 //%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
1665 //%
1666 //%/**
1667 //% * @return A newly instanced and empty GPB##NAME##Array.
1668 //% **/
1669 //%+ (instancetype)array;
1670 //%
1671 //%/**
1672 //% * Creates and initializes a GPB##NAME##Array with the enum validation function
1673 //% * given.
1674 //% *
1675 //% * @param func The enum validation function for the array.
1676 //% *
1677 //% * @return A newly instanced GPB##NAME##Array.
1678 //% **/
1679 //%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
1680 //%
1681 //%/**
1682 //% * Creates and initializes a GPB##NAME##Array with the enum validation function
1683 //% * given and the single raw value given.
1684 //% *
1685 //% * @param func  The enum validation function for the array.
1686 //% * @param value The raw value to add to this array.
1687 //% *
1688 //% * @return A newly instanced GPB##NAME##Array.
1689 //% **/
1690 //%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
1691 //%                                   rawValue:(TYPE)value;
1692 //%
1693 //%/**
1694 //% * Creates and initializes a GPB##NAME##Array that adds the elements from the
1695 //% * given array.
1696 //% *
1697 //% * @param array Array containing the values to add to the new array.
1698 //% *
1699 //% * @return A newly instanced GPB##NAME##Array.
1700 //% **/
1701 //%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
1702 //%
1703 //%/**
1704 //% * Creates and initializes a GPB##NAME##Array with the given enum validation
1705 //% * function and with the givencapacity.
1706 //% *
1707 //% * @param func  The enum validation function for the array.
1708 //% * @param count The capacity needed for the array.
1709 //% *
1710 //% * @return A newly instanced GPB##NAME##Array with a capacity of count.
1711 //% **/
1712 //%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
1713 //%                                   capacity:(NSUInteger)count;
1714 //%
1715 //%/**
1716 //% * Initializes the array with the given enum validation function.
1717 //% *
1718 //% * @param func The enum validation function for the array.
1719 //% *
1720 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1721 //% **/
1722 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1723 //%    NS_DESIGNATED_INITIALIZER;
1724 //%
1725 //%/**
1726 //% * Initializes the array, copying the given values.
1727 //% *
1728 //% * @param func   The enum validation function for the array.
1729 //% * @param values An array with the values to put inside this array.
1730 //% * @param count  The number of elements to copy into the array.
1731 //% *
1732 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1733 //% **/
1734 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1735 //%                                 rawValues:(const TYPE [__nullable])values
1736 //%                                     count:(NSUInteger)count;
1737 //%
1738 //%/**
1739 //% * Initializes the array, copying the given values.
1740 //% *
1741 //% * @param array An array with the values to put inside this array.
1742 //% *
1743 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1744 //% **/
1745 //%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
1746 //%
1747 //%/**
1748 //% * Initializes the array with the given capacity.
1749 //% *
1750 //% * @param func  The enum validation function for the array.
1751 //% * @param count The capacity needed for the array.
1752 //% *
1753 //% * @return A newly initialized GPB##NAME##Array with a capacity of count.
1754 //% **/
1755 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1756 //%                                  capacity:(NSUInteger)count;
1757 //%
1758 //%// These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
1759 //%// valid enumerator as defined by validationFunc. If the actual value is
1760 //%// desired, use "raw" version of the method.
1761 //%
1762 //%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, NAME)
1763 //%
1764 //%// These methods bypass the validationFunc to provide access to values that were not
1765 //%// known at the time the binary was compiled.
1766 //%
1767 //%/**
1768 //% * Gets the raw enum value at the given index.
1769 //% *
1770 //% * @param index The index of the raw enum value to get.
1771 //% *
1772 //% * @return The raw enum value at the given index.
1773 //% **/
1774 //%- (TYPE)rawValueAtIndex:(NSUInteger)index;
1775 //%
1776 //%/**
1777 //% * Enumerates the values on this array with the given block.
1778 //% *
1779 //% * @param block The block to enumerate with.
1780 //% *   **value**: The current value being enumerated.
1781 //% *   **idx**:   The index of the current value.
1782 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
1783 //% **/
1784 //%- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
1785 //%
1786 //%/**
1787 //% * Enumerates the values on this array with the given block.
1788 //% *
1789 //% * @param opts  Options to control the enumeration.
1790 //% * @param block The block to enumerate with.
1791 //% *   **value**: The current value being enumerated.
1792 //% *   **idx**:   The index of the current value.
1793 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
1794 //% **/
1795 //%- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
1796 //%                           usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
1797 //%
1798 //%// If value is not a valid enumerator as defined by validationFunc, these
1799 //%// methods will assert in debug, and will log in release and assign the value
1800 //%// to the default value. Use the rawValue methods below to assign non enumerator
1801 //%// values.
1802 //%
1803 //%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, NAME)
1804 //%
1805 //%@end
1806 //%
1807 
1808 //%PDDM-DEFINE ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
1809 //%/**
1810 //% * Gets the value at the given index.
1811 //% *
1812 //% * @param index The index of the value to get.
1813 //% *
1814 //% * @return The value at the given index.
1815 //% **/
1816 //%- (TYPE)valueAtIndex:(NSUInteger)index;
1817 //%
1818 //%/**
1819 //% * Enumerates the values on this array with the given block.
1820 //% *
1821 //% * @param block The block to enumerate with.
1822 //% *   **value**: The current value being enumerated.
1823 //% *   **idx**:   The index of the current value.
1824 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
1825 //% **/
1826 //%- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
1827 //%
1828 //%/**
1829 //% * Enumerates the values on this array with the given block.
1830 //% *
1831 //% * @param opts  Options to control the enumeration.
1832 //% * @param block The block to enumerate with.
1833 //% *   **value**: The current value being enumerated.
1834 //% *   **idx**:   The index of the current value.
1835 //% *   **stop**:  A pointer to a boolean that when set stops the enumeration.
1836 //% **/
1837 //%- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1838 //%                        usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
1839 
1840 //%PDDM-DEFINE ARRAY_MUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
1841 //%/**
1842 //% * Adds a value to this array.
1843 //% *
1844 //% * @param value The value to add to this array.
1845 //% **/
1846 //%- (void)addValue:(TYPE)value;
1847 //%
1848 //%/**
1849 //% * Adds values to this array.
1850 //% *
1851 //% * @param values The values to add to this array.
1852 //% * @param count  The number of elements to add.
1853 //% **/
1854 //%- (void)addValues:(const TYPE [__nullable])values count:(NSUInteger)count;
1855 //%
1856 //%ARRAY_EXTRA_MUTABLE_METHODS1_##HELPER_NAME(NAME, TYPE)
1857 //%/**
1858 //% * Inserts a value into the given position.
1859 //% *
1860 //% * @param value The value to add to this array.
1861 //% * @param index The index into which to insert the value.
1862 //% **/
1863 //%- (void)insertValue:(TYPE)value atIndex:(NSUInteger)index;
1864 //%
1865 //%/**
1866 //% * Replaces the value at the given index with the given value.
1867 //% *
1868 //% * @param index The index for which to replace the value.
1869 //% * @param value The value to replace with.
1870 //% **/
1871 //%- (void)replaceValueAtIndex:(NSUInteger)index withValue:(TYPE)value;
1872 //%ARRAY_EXTRA_MUTABLE_METHODS2_##HELPER_NAME(NAME, TYPE)
1873 //%/**
1874 //% * Removes the value at the given index.
1875 //% *
1876 //% * @param index The index of the value to remove.
1877 //% **/
1878 //%- (void)removeValueAtIndex:(NSUInteger)index;
1879 //%
1880 //%/**
1881 //% * Removes all the values from this array.
1882 //% **/
1883 //%- (void)removeAll;
1884 //%
1885 //%/**
1886 //% * Exchanges the values between the given indexes.
1887 //% *
1888 //% * @param idx1 The index of the first element to exchange.
1889 //% * @param idx2 The index of the second element to exchange.
1890 //% **/
1891 //%- (void)exchangeValueAtIndex:(NSUInteger)idx1
1892 //%            withValueAtIndex:(NSUInteger)idx2;
1893 
1894 //
1895 // These are hooks invoked by the above to do insert as needed.
1896 //
1897 
1898 //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Basic(NAME, TYPE)
1899 //%/**
1900 //% * Adds the values from the given array to this array.
1901 //% *
1902 //% * @param array The array containing the elements to add to this array.
1903 //% **/
1904 //%- (void)addValuesFromArray:(GPB##NAME##Array *)array;
1905 //%
1906 //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Basic(NAME, TYPE)
1907 // Empty
1908 //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Enum(NAME, TYPE)
1909 // Empty
1910 //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Enum(NAME, TYPE)
1911 //%
1912 //%// These methods bypass the validationFunc to provide setting of values that were not
1913 //%// known at the time the binary was compiled.
1914 //%
1915 //%/**
1916 //% * Adds a raw enum value to this array.
1917 //% *
1918 //% * @note This method bypass the validationFunc to enable the setting of values that
1919 //% *       were not known at the time the binary was compiled.
1920 //% *
1921 //% * @param value The raw enum value to add to the array.
1922 //% **/
1923 //%- (void)addRawValue:(TYPE)value;
1924 //%
1925 //%/**
1926 //% * Adds raw enum values to this array.
1927 //% *
1928 //% * @note This method bypass the validationFunc to enable the setting of values that
1929 //% *       were not known at the time the binary was compiled.
1930 //% *
1931 //% * @param array Array containing the raw enum values to add to this array.
1932 //% **/
1933 //%- (void)addRawValuesFromArray:(GPB##NAME##Array *)array;
1934 //%
1935 //%/**
1936 //% * Adds raw enum values to this array.
1937 //% *
1938 //% * @note This method bypass the validationFunc to enable the setting of values that
1939 //% *       were not known at the time the binary was compiled.
1940 //% *
1941 //% * @param values Array containing the raw enum values to add to this array.
1942 //% * @param count  The number of raw values to add.
1943 //% **/
1944 //%- (void)addRawValues:(const TYPE [__nullable])values count:(NSUInteger)count;
1945 //%
1946 //%/**
1947 //% * Inserts a raw enum value at the given index.
1948 //% *
1949 //% * @note This method bypass the validationFunc to enable the setting of values that
1950 //% *       were not known at the time the binary was compiled.
1951 //% *
1952 //% * @param value Raw enum value to add.
1953 //% * @param index The index into which to insert the value.
1954 //% **/
1955 //%- (void)insertRawValue:(TYPE)value atIndex:(NSUInteger)index;
1956 //%
1957 //%/**
1958 //% * Replaces the raw enum value at the given index with the given value.
1959 //% *
1960 //% * @note This method bypass the validationFunc to enable the setting of values that
1961 //% *       were not known at the time the binary was compiled.
1962 //% *
1963 //% * @param index The index for which to replace the value.
1964 //% * @param value The raw enum value to replace with.
1965 //% **/
1966 //%- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(TYPE)value;
1967 //%
1968 //%// No validation applies to these methods.
1969 //%
1970