blob: 5aea75cd6e96791c205e2b1618c4b7cb230ca905 [file] [log] [blame]
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001// 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
Thomas Van Lentend846b0b2015-06-08 16:24:57 -040033#import "GPBRuntimeTypes.h"
Thomas Van Lenten30650d82015-05-01 08:57:16 -040034
Thomas Van Lenten8c889572015-06-16 16:45:14 -040035NS_ASSUME_NONNULL_BEGIN
36
Thomas Van Lenten30650d82015-05-01 08:57:16 -040037//%PDDM-EXPAND DECLARE_ARRAYS()
38// This block of code is generated, do not edit it directly.
Dave MacLachlanab48ecf2020-01-20 13:47:20 -080039// clang-format off
Thomas Van Lenten30650d82015-05-01 08:57:16 -040040
41#pragma mark - Int32
42
Sergio Campamá32fadc02016-08-08 07:15:02 -070043/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -040049@interface GPBInt32Array : NSObject <NSCopying>
50
Sergio Campamá32fadc02016-08-08 07:15:02 -070051/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -040052@property(nonatomic, readonly) NSUInteger count;
53
Sergio Campamá32fadc02016-08-08 07:15:02 -070054/**
55 * @return A newly instanced and empty GPBInt32Array.
56 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -040057+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -070058
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -040066+ (instancetype)arrayWithValue:(int32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -070067
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -040076+ (instancetype)arrayWithValueArray:(GPBInt32Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -070077
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -040085+ (instancetype)arrayWithCapacity:(NSUInteger)count;
86
Sergio Campamá32fadc02016-08-08 07:15:02 -070087/**
88 * @return A newly initialized and empty GPBInt32Array.
89 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -040090- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -070091
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500100- (instancetype)initWithValues:(const int32_t [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400101 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700102
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400110- (instancetype)initWithValueArray:(GPBInt32Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700111
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400119- (instancetype)initWithCapacity:(NSUInteger)count;
120
Sergio Campamá32fadc02016-08-08 07:15:02 -0700121/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400128- (int32_t)valueAtIndex:(NSUInteger)index;
129
Sergio Campamá32fadc02016-08-08 07:15:02 -0700130/**
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 **/
Thomas Van Lenten2af9c682018-12-04 10:47:35 -0500138- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700139
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400149- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten2af9c682018-12-04 10:47:35 -0500150 usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400151
Sergio Campamá32fadc02016-08-08 07:15:02 -0700152/**
153 * Adds a value to this array.
154 *
155 * @param value The value to add to this array.
156 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400157- (void)addValue:(int32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700158
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500165- (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700166
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400172- (void)addValuesFromArray:(GPBInt32Array *)array;
173
Sergio Campamá32fadc02016-08-08 07:15:02 -0700174/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400180- (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
181
Sergio Campamá32fadc02016-08-08 07:15:02 -0700182/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400188- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
189
Sergio Campamá32fadc02016-08-08 07:15:02 -0700190/**
191 * Removes the value at the given index.
192 *
193 * @param index The index of the value to remove.
194 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400195- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700196
197/**
198 * Removes all the values from this array.
199 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400200- (void)removeAll;
201
Sergio Campamá32fadc02016-08-08 07:15:02 -0700202/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400208- (void)exchangeValueAtIndex:(NSUInteger)idx1
209 withValueAtIndex:(NSUInteger)idx2;
210
211@end
212
213#pragma mark - UInt32
214
Sergio Campamá32fadc02016-08-08 07:15:02 -0700215/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400221@interface GPBUInt32Array : NSObject <NSCopying>
222
Sergio Campamá32fadc02016-08-08 07:15:02 -0700223/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400224@property(nonatomic, readonly) NSUInteger count;
225
Sergio Campamá32fadc02016-08-08 07:15:02 -0700226/**
227 * @return A newly instanced and empty GPBUInt32Array.
228 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400229+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700230
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400238+ (instancetype)arrayWithValue:(uint32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700239
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400248+ (instancetype)arrayWithValueArray:(GPBUInt32Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700249
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400257+ (instancetype)arrayWithCapacity:(NSUInteger)count;
258
Sergio Campamá32fadc02016-08-08 07:15:02 -0700259/**
260 * @return A newly initialized and empty GPBUInt32Array.
261 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400262- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700263
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500272- (instancetype)initWithValues:(const uint32_t [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400273 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700274
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400282- (instancetype)initWithValueArray:(GPBUInt32Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700283
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400291- (instancetype)initWithCapacity:(NSUInteger)count;
292
Sergio Campamá32fadc02016-08-08 07:15:02 -0700293/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400300- (uint32_t)valueAtIndex:(NSUInteger)index;
301
Sergio Campamá32fadc02016-08-08 07:15:02 -0700302/**
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 **/
Thomas Van Lenten2af9c682018-12-04 10:47:35 -0500310- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700311
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400321- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten2af9c682018-12-04 10:47:35 -0500322 usingBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400323
Sergio Campamá32fadc02016-08-08 07:15:02 -0700324/**
325 * Adds a value to this array.
326 *
327 * @param value The value to add to this array.
328 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400329- (void)addValue:(uint32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700330
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500337- (void)addValues:(const uint32_t [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700338
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400344- (void)addValuesFromArray:(GPBUInt32Array *)array;
345
Sergio Campamá32fadc02016-08-08 07:15:02 -0700346/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400352- (void)insertValue:(uint32_t)value atIndex:(NSUInteger)index;
353
Sergio Campamá32fadc02016-08-08 07:15:02 -0700354/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400360- (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint32_t)value;
361
Sergio Campamá32fadc02016-08-08 07:15:02 -0700362/**
363 * Removes the value at the given index.
364 *
365 * @param index The index of the value to remove.
366 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400367- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700368
369/**
370 * Removes all the values from this array.
371 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400372- (void)removeAll;
373
Sergio Campamá32fadc02016-08-08 07:15:02 -0700374/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400380- (void)exchangeValueAtIndex:(NSUInteger)idx1
381 withValueAtIndex:(NSUInteger)idx2;
382
383@end
384
385#pragma mark - Int64
386
Sergio Campamá32fadc02016-08-08 07:15:02 -0700387/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400393@interface GPBInt64Array : NSObject <NSCopying>
394
Sergio Campamá32fadc02016-08-08 07:15:02 -0700395/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400396@property(nonatomic, readonly) NSUInteger count;
397
Sergio Campamá32fadc02016-08-08 07:15:02 -0700398/**
399 * @return A newly instanced and empty GPBInt64Array.
400 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400401+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700402
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400410+ (instancetype)arrayWithValue:(int64_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700411
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400420+ (instancetype)arrayWithValueArray:(GPBInt64Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700421
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400429+ (instancetype)arrayWithCapacity:(NSUInteger)count;
430
Sergio Campamá32fadc02016-08-08 07:15:02 -0700431/**
432 * @return A newly initialized and empty GPBInt64Array.
433 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400434- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700435
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500444- (instancetype)initWithValues:(const int64_t [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400445 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700446
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400454- (instancetype)initWithValueArray:(GPBInt64Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700455
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400463- (instancetype)initWithCapacity:(NSUInteger)count;
464
Sergio Campamá32fadc02016-08-08 07:15:02 -0700465/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400472- (int64_t)valueAtIndex:(NSUInteger)index;
473
Sergio Campamá32fadc02016-08-08 07:15:02 -0700474/**
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 **/
Thomas Van Lenten2af9c682018-12-04 10:47:35 -0500482- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700483
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400493- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten2af9c682018-12-04 10:47:35 -0500494 usingBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400495
Sergio Campamá32fadc02016-08-08 07:15:02 -0700496/**
497 * Adds a value to this array.
498 *
499 * @param value The value to add to this array.
500 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400501- (void)addValue:(int64_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700502
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500509- (void)addValues:(const int64_t [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700510
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400516- (void)addValuesFromArray:(GPBInt64Array *)array;
517
Sergio Campamá32fadc02016-08-08 07:15:02 -0700518/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400524- (void)insertValue:(int64_t)value atIndex:(NSUInteger)index;
525
Sergio Campamá32fadc02016-08-08 07:15:02 -0700526/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400532- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int64_t)value;
533
Sergio Campamá32fadc02016-08-08 07:15:02 -0700534/**
535 * Removes the value at the given index.
536 *
537 * @param index The index of the value to remove.
538 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400539- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700540
541/**
542 * Removes all the values from this array.
543 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400544- (void)removeAll;
545
Sergio Campamá32fadc02016-08-08 07:15:02 -0700546/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400552- (void)exchangeValueAtIndex:(NSUInteger)idx1
553 withValueAtIndex:(NSUInteger)idx2;
554
555@end
556
557#pragma mark - UInt64
558
Sergio Campamá32fadc02016-08-08 07:15:02 -0700559/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400565@interface GPBUInt64Array : NSObject <NSCopying>
566
Sergio Campamá32fadc02016-08-08 07:15:02 -0700567/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400568@property(nonatomic, readonly) NSUInteger count;
569
Sergio Campamá32fadc02016-08-08 07:15:02 -0700570/**
571 * @return A newly instanced and empty GPBUInt64Array.
572 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400573+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700574
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400582+ (instancetype)arrayWithValue:(uint64_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700583
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400592+ (instancetype)arrayWithValueArray:(GPBUInt64Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700593
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400601+ (instancetype)arrayWithCapacity:(NSUInteger)count;
602
Sergio Campamá32fadc02016-08-08 07:15:02 -0700603/**
604 * @return A newly initialized and empty GPBUInt64Array.
605 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400606- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700607
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500616- (instancetype)initWithValues:(const uint64_t [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400617 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700618
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400626- (instancetype)initWithValueArray:(GPBUInt64Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700627
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400635- (instancetype)initWithCapacity:(NSUInteger)count;
636
Sergio Campamá32fadc02016-08-08 07:15:02 -0700637/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400644- (uint64_t)valueAtIndex:(NSUInteger)index;
645
Sergio Campamá32fadc02016-08-08 07:15:02 -0700646/**
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 **/
Thomas Van Lenten2af9c682018-12-04 10:47:35 -0500654- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700655
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400665- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten2af9c682018-12-04 10:47:35 -0500666 usingBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400667
Sergio Campamá32fadc02016-08-08 07:15:02 -0700668/**
669 * Adds a value to this array.
670 *
671 * @param value The value to add to this array.
672 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400673- (void)addValue:(uint64_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700674
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500681- (void)addValues:(const uint64_t [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700682
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400688- (void)addValuesFromArray:(GPBUInt64Array *)array;
689
Sergio Campamá32fadc02016-08-08 07:15:02 -0700690/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400696- (void)insertValue:(uint64_t)value atIndex:(NSUInteger)index;
697
Sergio Campamá32fadc02016-08-08 07:15:02 -0700698/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400704- (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint64_t)value;
705
Sergio Campamá32fadc02016-08-08 07:15:02 -0700706/**
707 * Removes the value at the given index.
708 *
709 * @param index The index of the value to remove.
710 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400711- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700712
713/**
714 * Removes all the values from this array.
715 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400716- (void)removeAll;
717
Sergio Campamá32fadc02016-08-08 07:15:02 -0700718/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400724- (void)exchangeValueAtIndex:(NSUInteger)idx1
725 withValueAtIndex:(NSUInteger)idx2;
726
727@end
728
729#pragma mark - Float
730
Sergio Campamá32fadc02016-08-08 07:15:02 -0700731/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400737@interface GPBFloatArray : NSObject <NSCopying>
738
Sergio Campamá32fadc02016-08-08 07:15:02 -0700739/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400740@property(nonatomic, readonly) NSUInteger count;
741
Sergio Campamá32fadc02016-08-08 07:15:02 -0700742/**
743 * @return A newly instanced and empty GPBFloatArray.
744 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400745+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700746
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400754+ (instancetype)arrayWithValue:(float)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700755
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400764+ (instancetype)arrayWithValueArray:(GPBFloatArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700765
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400773+ (instancetype)arrayWithCapacity:(NSUInteger)count;
774
Sergio Campamá32fadc02016-08-08 07:15:02 -0700775/**
776 * @return A newly initialized and empty GPBFloatArray.
777 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400778- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700779
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500788- (instancetype)initWithValues:(const float [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400789 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700790
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400798- (instancetype)initWithValueArray:(GPBFloatArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700799
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400807- (instancetype)initWithCapacity:(NSUInteger)count;
808
Sergio Campamá32fadc02016-08-08 07:15:02 -0700809/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400816- (float)valueAtIndex:(NSUInteger)index;
817
Sergio Campamá32fadc02016-08-08 07:15:02 -0700818/**
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 **/
Thomas Van Lenten2af9c682018-12-04 10:47:35 -0500826- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700827
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400837- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten2af9c682018-12-04 10:47:35 -0500838 usingBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400839
Sergio Campamá32fadc02016-08-08 07:15:02 -0700840/**
841 * Adds a value to this array.
842 *
843 * @param value The value to add to this array.
844 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400845- (void)addValue:(float)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700846
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500853- (void)addValues:(const float [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700854
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400860- (void)addValuesFromArray:(GPBFloatArray *)array;
861
Sergio Campamá32fadc02016-08-08 07:15:02 -0700862/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400868- (void)insertValue:(float)value atIndex:(NSUInteger)index;
869
Sergio Campamá32fadc02016-08-08 07:15:02 -0700870/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400876- (void)replaceValueAtIndex:(NSUInteger)index withValue:(float)value;
877
Sergio Campamá32fadc02016-08-08 07:15:02 -0700878/**
879 * Removes the value at the given index.
880 *
881 * @param index The index of the value to remove.
882 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400883- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700884
885/**
886 * Removes all the values from this array.
887 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400888- (void)removeAll;
889
Sergio Campamá32fadc02016-08-08 07:15:02 -0700890/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400896- (void)exchangeValueAtIndex:(NSUInteger)idx1
897 withValueAtIndex:(NSUInteger)idx2;
898
899@end
900
901#pragma mark - Double
902
Sergio Campamá32fadc02016-08-08 07:15:02 -0700903/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400909@interface GPBDoubleArray : NSObject <NSCopying>
910
Sergio Campamá32fadc02016-08-08 07:15:02 -0700911/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400912@property(nonatomic, readonly) NSUInteger count;
913
Sergio Campamá32fadc02016-08-08 07:15:02 -0700914/**
915 * @return A newly instanced and empty GPBDoubleArray.
916 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400917+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700918
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400926+ (instancetype)arrayWithValue:(double)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700927
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400936+ (instancetype)arrayWithValueArray:(GPBDoubleArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700937
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400945+ (instancetype)arrayWithCapacity:(NSUInteger)count;
946
Sergio Campamá32fadc02016-08-08 07:15:02 -0700947/**
948 * @return A newly initialized and empty GPBDoubleArray.
949 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400950- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700951
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500960- (instancetype)initWithValues:(const double [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400961 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700962
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400970- (instancetype)initWithValueArray:(GPBDoubleArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700971
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400979- (instancetype)initWithCapacity:(NSUInteger)count;
980
Sergio Campamá32fadc02016-08-08 07:15:02 -0700981/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400988- (double)valueAtIndex:(NSUInteger)index;
989
Sergio Campamá32fadc02016-08-08 07:15:02 -0700990/**
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 **/
Thomas Van Lenten2af9c682018-12-04 10:47:35 -0500998- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700999
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001009- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten2af9c682018-12-04 10:47:35 -05001010 usingBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001011
Sergio Campamá32fadc02016-08-08 07:15:02 -07001012/**
1013 * Adds a value to this array.
1014 *
1015 * @param value The value to add to this array.
1016 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001017- (void)addValue:(double)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001018
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001025- (void)addValues:(const double [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001026
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001032- (void)addValuesFromArray:(GPBDoubleArray *)array;
1033
Sergio Campamá32fadc02016-08-08 07:15:02 -07001034/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001040- (void)insertValue:(double)value atIndex:(NSUInteger)index;
1041
Sergio Campamá32fadc02016-08-08 07:15:02 -07001042/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001048- (void)replaceValueAtIndex:(NSUInteger)index withValue:(double)value;
1049
Sergio Campamá32fadc02016-08-08 07:15:02 -07001050/**
1051 * Removes the value at the given index.
1052 *
1053 * @param index The index of the value to remove.
1054 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001055- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001056
1057/**
1058 * Removes all the values from this array.
1059 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001060- (void)removeAll;
1061
Sergio Campamá32fadc02016-08-08 07:15:02 -07001062/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001068- (void)exchangeValueAtIndex:(NSUInteger)idx1
1069 withValueAtIndex:(NSUInteger)idx2;
1070
1071@end
1072
1073#pragma mark - Bool
1074
Sergio Campamá32fadc02016-08-08 07:15:02 -07001075/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001081@interface GPBBoolArray : NSObject <NSCopying>
1082
Sergio Campamá32fadc02016-08-08 07:15:02 -07001083/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001084@property(nonatomic, readonly) NSUInteger count;
1085
Sergio Campamá32fadc02016-08-08 07:15:02 -07001086/**
1087 * @return A newly instanced and empty GPBBoolArray.
1088 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001089+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001090
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001098+ (instancetype)arrayWithValue:(BOOL)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001099
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001108+ (instancetype)arrayWithValueArray:(GPBBoolArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001109
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001117+ (instancetype)arrayWithCapacity:(NSUInteger)count;
1118
Sergio Campamá32fadc02016-08-08 07:15:02 -07001119/**
1120 * @return A newly initialized and empty GPBBoolArray.
1121 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001122- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001123
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001132- (instancetype)initWithValues:(const BOOL [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001133 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001134
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001142- (instancetype)initWithValueArray:(GPBBoolArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001143
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001151- (instancetype)initWithCapacity:(NSUInteger)count;
1152
Sergio Campamá32fadc02016-08-08 07:15:02 -07001153/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001160- (BOOL)valueAtIndex:(NSUInteger)index;
1161
Sergio Campamá32fadc02016-08-08 07:15:02 -07001162/**
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 **/
Thomas Van Lenten2af9c682018-12-04 10:47:35 -05001170- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001171
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001181- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten2af9c682018-12-04 10:47:35 -05001182 usingBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001183
Sergio Campamá32fadc02016-08-08 07:15:02 -07001184/**
1185 * Adds a value to this array.
1186 *
1187 * @param value The value to add to this array.
1188 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001189- (void)addValue:(BOOL)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001190
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001197- (void)addValues:(const BOOL [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001198
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001204- (void)addValuesFromArray:(GPBBoolArray *)array;
1205
Sergio Campamá32fadc02016-08-08 07:15:02 -07001206/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001212- (void)insertValue:(BOOL)value atIndex:(NSUInteger)index;
1213
Sergio Campamá32fadc02016-08-08 07:15:02 -07001214/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001220- (void)replaceValueAtIndex:(NSUInteger)index withValue:(BOOL)value;
1221
Sergio Campamá32fadc02016-08-08 07:15:02 -07001222/**
1223 * Removes the value at the given index.
1224 *
1225 * @param index The index of the value to remove.
1226 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001227- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001228
1229/**
1230 * Removes all the values from this array.
1231 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001232- (void)removeAll;
1233
Sergio Campamá32fadc02016-08-08 07:15:02 -07001234/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001240- (void)exchangeValueAtIndex:(NSUInteger)idx1
1241 withValueAtIndex:(NSUInteger)idx2;
1242
1243@end
1244
1245#pragma mark - Enum
1246
Sergio Campamá32fadc02016-08-08 07:15:02 -07001247/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001253@interface GPBEnumArray : NSObject <NSCopying>
1254
Sergio Campamá32fadc02016-08-08 07:15:02 -07001255/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001256@property(nonatomic, readonly) NSUInteger count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001257/** The validation function to check if the enums are valid. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001258@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
1259
Sergio Campamá32fadc02016-08-08 07:15:02 -07001260/**
1261 * @return A newly instanced and empty GPBEnumArray.
1262 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001263+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001264
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 **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001273+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001274
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 **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001284+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001285 rawValue:(int32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001286
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001295+ (instancetype)arrayWithValueArray:(GPBEnumArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001296
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 **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001306+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001307 capacity:(NSUInteger)count;
1308
Sergio Campamá32fadc02016-08-08 07:15:02 -07001309/**
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 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001316- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1317 NS_DESIGNATED_INITIALIZER;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001318
Sergio Campamá32fadc02016-08-08 07:15:02 -07001319/**
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 **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001328- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001329 rawValues:(const int32_t [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001330 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001331
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001339- (instancetype)initWithValueArray:(GPBEnumArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001340
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 **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001349- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001350 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
Sergio Campamá32fadc02016-08-08 07:15:02 -07001356/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001363- (int32_t)valueAtIndex:(NSUInteger)index;
1364
Sergio Campamá32fadc02016-08-08 07:15:02 -07001365/**
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 **/
Thomas Van Lenten2af9c682018-12-04 10:47:35 -05001373- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001374
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001384- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten2af9c682018-12-04 10:47:35 -05001385 usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001386
1387// These methods bypass the validationFunc to provide access to values that were not
1388// known at the time the binary was compiled.
1389
Sergio Campamá32fadc02016-08-08 07:15:02 -07001390/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001397- (int32_t)rawValueAtIndex:(NSUInteger)index;
1398
Sergio Campamá32fadc02016-08-08 07:15:02 -07001399/**
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 **/
Thomas Van Lenten2af9c682018-12-04 10:47:35 -05001407- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001408
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001418- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten2af9c682018-12-04 10:47:35 -05001419 usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001420
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
Sergio Campamá32fadc02016-08-08 07:15:02 -07001426/**
1427 * Adds a value to this array.
1428 *
1429 * @param value The value to add to this array.
1430 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001431- (void)addValue:(int32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001432
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001439- (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001440
Sergio Campamá32fadc02016-08-08 07:15:02 -07001441
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001448- (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
1449
Sergio Campamá32fadc02016-08-08 07:15:02 -07001450/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001456- (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
Sergio Campamá32fadc02016-08-08 07:15:02 -07001461/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001469- (void)addRawValue:(int32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001470
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001479- (void)addRawValuesFromArray:(GPBEnumArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001480
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 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001490- (void)addRawValues:(const int32_t [__nullable])values count:(NSUInteger)count;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001491
Sergio Campamá32fadc02016-08-08 07:15:02 -07001492/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001501- (void)insertRawValue:(int32_t)value atIndex:(NSUInteger)index;
1502
Sergio Campamá32fadc02016-08-08 07:15:02 -07001503/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001512- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(int32_t)value;
1513
1514// No validation applies to these methods.
1515
Sergio Campamá32fadc02016-08-08 07:15:02 -07001516/**
1517 * Removes the value at the given index.
1518 *
1519 * @param index The index of the value to remove.
1520 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001521- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001522
1523/**
1524 * Removes all the values from this array.
1525 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001526- (void)removeAll;
1527
Sergio Campamá32fadc02016-08-08 07:15:02 -07001528/**
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 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001534- (void)exchangeValueAtIndex:(NSUInteger)idx1
1535 withValueAtIndex:(NSUInteger)idx2;
1536
1537@end
1538
Dave MacLachlanab48ecf2020-01-20 13:47:20 -08001539// clang-format on
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001540//%PDDM-EXPAND-END DECLARE_ARRAYS()
1541
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001542NS_ASSUME_NONNULL_END
1543
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001544//%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//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001561//%/**
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001567//%@interface GPB##NAME##Array : NSObject <NSCopying>
1568//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001569//%/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001570//%@property(nonatomic, readonly) NSUInteger count;
1571//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001572//%/**
1573//% * @return A newly instanced and empty GPB##NAME##Array.
1574//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001575//%+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001576//%
1577//%/**
1578//% * Creates and initializes a GPB##NAME##Array with the single element given.
Sergio Campamae7f5c9d2017-02-07 11:57:53 -05001579//% *
Sergio Campamá32fadc02016-08-08 07:15:02 -07001580//% * @param value The value to be placed in the array.
1581//% *
1582//% * @return A newly instanced GPB##NAME##Array with value in it.
1583//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001584//%+ (instancetype)arrayWithValue:(TYPE)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001585//%
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001594//%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001595//%
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001603//%+ (instancetype)arrayWithCapacity:(NSUInteger)count;
1604//%
Sergio Campamae7f5c9d2017-02-07 11:57:53 -05001605//%/**
Sergio Campamá32fadc02016-08-08 07:15:02 -07001606//% * @return A newly initialized and empty GPB##NAME##Array.
1607//% **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001608//%- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001609//%
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//% **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001618//%- (instancetype)initWithValues:(const TYPE [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001619//% count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001620//%
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001628//%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001629//%
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001637//%- (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//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001653//%/**
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001659//%@interface GPB##NAME##Array : NSObject <NSCopying>
1660//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001661//%/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001662//%@property(nonatomic, readonly) NSUInteger count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001663//%/** The validation function to check if the enums are valid. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001664//%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
1665//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001666//%/**
1667//% * @return A newly instanced and empty GPB##NAME##Array.
1668//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001669//%+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001670//%
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//% **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001679//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001680//%
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//% **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001690//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001691//% rawValue:(TYPE)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001692//%
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001701//%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001702//%
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//% **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001712//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001713//% capacity:(NSUInteger)count;
1714//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001715//%/**
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//% **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001722//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1723//% NS_DESIGNATED_INITIALIZER;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001724//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001725//%/**
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//% **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001734//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001735//% rawValues:(const TYPE [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001736//% count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001737//%
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001745//%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001746//%
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//% **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001755//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001756//% 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//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001767//%/**
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001774//%- (TYPE)rawValueAtIndex:(NSUInteger)index;
1775//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001776//%/**
1777//% * Enumerates the values on this array with the given block.
Sergio Campamae7f5c9d2017-02-07 11:57:53 -05001778//% *
Sergio Campamá32fadc02016-08-08 07:15:02 -07001779//% * @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//% **/
Thomas Van Lenten2af9c682018-12-04 10:47:35 -05001784//%- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001785//%
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001795//%- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten2af9c682018-12-04 10:47:35 -05001796//% usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001797//%
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)
Sergio Campamá32fadc02016-08-08 07:15:02 -07001809//%/**
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001816//%- (TYPE)valueAtIndex:(NSUInteger)index;
1817//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001818//%/**
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//% **/
Thomas Van Lenten2af9c682018-12-04 10:47:35 -05001826//%- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001827//%
1828//%/**
1829//% * Enumerates the values on this array with the given block.
1830//% *
1831//% * @param opts Options to control the enumeration.
Sergio Campamae7f5c9d2017-02-07 11:57:53 -05001832//% * @param block The block to enumerate with.
Sergio Campamá32fadc02016-08-08 07:15:02 -07001833//% * **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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001837//%- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten2af9c682018-12-04 10:47:35 -05001838//% usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001839
1840//%PDDM-DEFINE ARRAY_MUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
Sergio Campamá32fadc02016-08-08 07:15:02 -07001841//%/**
1842//% * Adds a value to this array.
1843//% *
1844//% * @param value The value to add to this array.
1845//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001846//%- (void)addValue:(TYPE)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001847//%
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//% **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001854//%- (void)addValues:(const TYPE [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001855//%
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001856//%ARRAY_EXTRA_MUTABLE_METHODS1_##HELPER_NAME(NAME, TYPE)
Sergio Campamá32fadc02016-08-08 07:15:02 -07001857//%/**
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001863//%- (void)insertValue:(TYPE)value atIndex:(NSUInteger)index;
1864//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001865//%/**
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001871//%- (void)replaceValueAtIndex:(NSUInteger)index withValue:(TYPE)value;
1872//%ARRAY_EXTRA_MUTABLE_METHODS2_##HELPER_NAME(NAME, TYPE)
Sergio Campamá32fadc02016-08-08 07:15:02 -07001873//%/**
1874//% * Removes the value at the given index.
1875//% *
1876//% * @param index The index of the value to remove.
1877//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001878//%- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001879//%
1880//%/**
1881//% * Removes all the values from this array.
1882//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001883//%- (void)removeAll;
1884//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001885//%/**
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001891//%- (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)
Sergio Campamá32fadc02016-08-08 07:15:02 -07001899//%/**
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001904//%- (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//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001915//%/**
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001923//%- (void)addRawValue:(TYPE)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001924//%
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001933//%- (void)addRawValuesFromArray:(GPB##NAME##Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001934//%
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//% **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001944//%- (void)addRawValues:(const TYPE [__nullable])values count:(NSUInteger)count;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001945//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001946//%/**
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001955//%- (void)insertRawValue:(TYPE)value atIndex:(NSUInteger)index;
1956//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001957//%/**
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//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001966//%- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(TYPE)value;
1967//%
1968//%// No validation applies to these methods.
1969//%