blob: 929a6d3f3d783bb85a97fdcecfc7e08f2eb90ae1 [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.
Thomas Van Lenten30650d82015-05-01 08:57:16 -04003//
Joshua Haberman44bd65b2023-09-08 17:43:14 -07004// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file or at
6// https://developers.google.com/open-source/licenses/bsd
Thomas Van Lenten30650d82015-05-01 08:57:16 -04007
8#import <Foundation/Foundation.h>
9
Thomas Van Lentend846b0b2015-06-08 16:24:57 -040010#import "GPBRuntimeTypes.h"
Thomas Van Lenten30650d82015-05-01 08:57:16 -040011
Thomas Van Lenten8c889572015-06-16 16:45:14 -040012NS_ASSUME_NONNULL_BEGIN
13
Thomas Van Lenten9e069b22022-09-19 13:34:01 -040014// Disable clang-format for the macros.
15// clang-format off
16
Thomas Van Lenten30650d82015-05-01 08:57:16 -040017//%PDDM-EXPAND DECLARE_ARRAYS()
18// This block of code is generated, do not edit it directly.
19
20#pragma mark - Int32
21
Sergio Campamá32fadc02016-08-08 07:15:02 -070022/**
23 * Class used for repeated fields of int32_t values. This performs better than
24 * boxing into NSNumbers in NSArrays.
25 *
26 * @note This class is not meant to be subclassed.
27 **/
Protobuf Team Bota185a6e2023-01-27 15:19:53 -080028__attribute__((objc_subclassing_restricted))
Thomas Van Lenten30650d82015-05-01 08:57:16 -040029@interface GPBInt32Array : NSObject <NSCopying>
30
Sergio Campamá32fadc02016-08-08 07:15:02 -070031/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -040032@property(nonatomic, readonly) NSUInteger count;
33
Sergio Campamá32fadc02016-08-08 07:15:02 -070034/**
35 * @return A newly instanced and empty GPBInt32Array.
36 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -040037+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -070038
39/**
40 * Creates and initializes a GPBInt32Array with the single element given.
41 *
42 * @param value The value to be placed in the array.
43 *
44 * @return A newly instanced GPBInt32Array with value in it.
45 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -040046+ (instancetype)arrayWithValue:(int32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -070047
48/**
49 * Creates and initializes a GPBInt32Array with the contents of the given
50 * array.
51 *
52 * @param array Array with the contents to be put into the new array.
53 *
54 * @return A newly instanced GPBInt32Array with the contents of array.
55 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -040056+ (instancetype)arrayWithValueArray:(GPBInt32Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -070057
58/**
59 * Creates and initializes a GPBInt32Array with the given capacity.
60 *
61 * @param count The capacity needed for the array.
62 *
63 * @return A newly instanced GPBInt32Array with a capacity of count.
64 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -040065+ (instancetype)arrayWithCapacity:(NSUInteger)count;
66
Sergio Campamá32fadc02016-08-08 07:15:02 -070067/**
68 * @return A newly initialized and empty GPBInt32Array.
69 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -040070- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -070071
72/**
73 * Initializes the array, copying the given values.
74 *
75 * @param values An array with the values to put inside this array.
76 * @param count The number of elements to copy into the array.
77 *
78 * @return A newly initialized GPBInt32Array with a copy of the values.
79 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -050080- (instancetype)initWithValues:(const int32_t [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -040081 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -070082
83/**
84 * Initializes the array, copying the given values.
85 *
86 * @param array An array with the values to put inside this array.
87 *
88 * @return A newly initialized GPBInt32Array with a copy of the values.
89 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -040090- (instancetype)initWithValueArray:(GPBInt32Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -070091
92/**
93 * Initializes the array with the given capacity.
94 *
95 * @param count The capacity needed for the array.
96 *
97 * @return A newly initialized GPBInt32Array with a capacity of count.
98 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -040099- (instancetype)initWithCapacity:(NSUInteger)count;
100
Sergio Campamá32fadc02016-08-08 07:15:02 -0700101/**
102 * Gets the value at the given index.
103 *
104 * @param index The index of the value to get.
105 *
106 * @return The value at the given index.
107 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400108- (int32_t)valueAtIndex:(NSUInteger)index;
109
Sergio Campamá32fadc02016-08-08 07:15:02 -0700110/**
111 * Enumerates the values on this array with the given block.
112 *
113 * @param block The block to enumerate with.
114 * **value**: The current value being enumerated.
115 * **idx**: The index of the current value.
116 * **stop**: A pointer to a boolean that when set stops the enumeration.
117 **/
Thomas Van Lenten9e069b22022-09-19 13:34:01 -0400118- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx,
119 BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700120
121/**
122 * Enumerates the values on this array with the given block.
123 *
124 * @param opts Options to control the enumeration.
125 * @param block The block to enumerate with.
126 * **value**: The current value being enumerated.
127 * **idx**: The index of the current value.
128 * **stop**: A pointer to a boolean that when set stops the enumeration.
129 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400130- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten9e069b22022-09-19 13:34:01 -0400131 usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx,
132 BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400133
Sergio Campamá32fadc02016-08-08 07:15:02 -0700134/**
135 * Adds a value to this array.
136 *
137 * @param value The value to add to this array.
138 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400139- (void)addValue:(int32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700140
141/**
142 * Adds values to this array.
143 *
144 * @param values The values to add to this array.
145 * @param count The number of elements to add.
146 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500147- (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700148
149/**
150 * Adds the values from the given array to this array.
151 *
152 * @param array The array containing the elements to add to this array.
153 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400154- (void)addValuesFromArray:(GPBInt32Array *)array;
155
Sergio Campamá32fadc02016-08-08 07:15:02 -0700156/**
157 * Inserts a value into the given position.
158 *
159 * @param value The value to add to this array.
160 * @param index The index into which to insert the value.
161 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400162- (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
163
Sergio Campamá32fadc02016-08-08 07:15:02 -0700164/**
165 * Replaces the value at the given index with the given value.
166 *
167 * @param index The index for which to replace the value.
168 * @param value The value to replace with.
169 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400170- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
171
Sergio Campamá32fadc02016-08-08 07:15:02 -0700172/**
173 * Removes the value at the given index.
174 *
175 * @param index The index of the value to remove.
176 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400177- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700178
179/**
180 * Removes all the values from this array.
181 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400182- (void)removeAll;
183
Sergio Campamá32fadc02016-08-08 07:15:02 -0700184/**
185 * Exchanges the values between the given indexes.
186 *
187 * @param idx1 The index of the first element to exchange.
188 * @param idx2 The index of the second element to exchange.
189 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400190- (void)exchangeValueAtIndex:(NSUInteger)idx1
191 withValueAtIndex:(NSUInteger)idx2;
192
193@end
194
195#pragma mark - UInt32
196
Sergio Campamá32fadc02016-08-08 07:15:02 -0700197/**
198 * Class used for repeated fields of uint32_t values. This performs better than
199 * boxing into NSNumbers in NSArrays.
200 *
201 * @note This class is not meant to be subclassed.
202 **/
Protobuf Team Bota185a6e2023-01-27 15:19:53 -0800203__attribute__((objc_subclassing_restricted))
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400204@interface GPBUInt32Array : NSObject <NSCopying>
205
Sergio Campamá32fadc02016-08-08 07:15:02 -0700206/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400207@property(nonatomic, readonly) NSUInteger count;
208
Sergio Campamá32fadc02016-08-08 07:15:02 -0700209/**
210 * @return A newly instanced and empty GPBUInt32Array.
211 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400212+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700213
214/**
215 * Creates and initializes a GPBUInt32Array with the single element given.
216 *
217 * @param value The value to be placed in the array.
218 *
219 * @return A newly instanced GPBUInt32Array with value in it.
220 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400221+ (instancetype)arrayWithValue:(uint32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700222
223/**
224 * Creates and initializes a GPBUInt32Array with the contents of the given
225 * array.
226 *
227 * @param array Array with the contents to be put into the new array.
228 *
229 * @return A newly instanced GPBUInt32Array with the contents of array.
230 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400231+ (instancetype)arrayWithValueArray:(GPBUInt32Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700232
233/**
234 * Creates and initializes a GPBUInt32Array with the given capacity.
235 *
236 * @param count The capacity needed for the array.
237 *
238 * @return A newly instanced GPBUInt32Array with a capacity of count.
239 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400240+ (instancetype)arrayWithCapacity:(NSUInteger)count;
241
Sergio Campamá32fadc02016-08-08 07:15:02 -0700242/**
243 * @return A newly initialized and empty GPBUInt32Array.
244 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400245- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700246
247/**
248 * Initializes the array, copying the given values.
249 *
250 * @param values An array with the values to put inside this array.
251 * @param count The number of elements to copy into the array.
252 *
253 * @return A newly initialized GPBUInt32Array with a copy of the values.
254 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500255- (instancetype)initWithValues:(const uint32_t [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400256 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700257
258/**
259 * Initializes the array, copying the given values.
260 *
261 * @param array An array with the values to put inside this array.
262 *
263 * @return A newly initialized GPBUInt32Array with a copy of the values.
264 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400265- (instancetype)initWithValueArray:(GPBUInt32Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700266
267/**
268 * Initializes the array with the given capacity.
269 *
270 * @param count The capacity needed for the array.
271 *
272 * @return A newly initialized GPBUInt32Array with a capacity of count.
273 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400274- (instancetype)initWithCapacity:(NSUInteger)count;
275
Sergio Campamá32fadc02016-08-08 07:15:02 -0700276/**
277 * Gets the value at the given index.
278 *
279 * @param index The index of the value to get.
280 *
281 * @return The value at the given index.
282 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400283- (uint32_t)valueAtIndex:(NSUInteger)index;
284
Sergio Campamá32fadc02016-08-08 07:15:02 -0700285/**
286 * Enumerates the values on this array with the given block.
287 *
288 * @param block The block to enumerate with.
289 * **value**: The current value being enumerated.
290 * **idx**: The index of the current value.
291 * **stop**: A pointer to a boolean that when set stops the enumeration.
292 **/
Thomas Van Lenten9e069b22022-09-19 13:34:01 -0400293- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx,
294 BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700295
296/**
297 * Enumerates the values on this array with the given block.
298 *
299 * @param opts Options to control the enumeration.
300 * @param block The block to enumerate with.
301 * **value**: The current value being enumerated.
302 * **idx**: The index of the current value.
303 * **stop**: A pointer to a boolean that when set stops the enumeration.
304 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400305- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten9e069b22022-09-19 13:34:01 -0400306 usingBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx,
307 BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400308
Sergio Campamá32fadc02016-08-08 07:15:02 -0700309/**
310 * Adds a value to this array.
311 *
312 * @param value The value to add to this array.
313 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400314- (void)addValue:(uint32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700315
316/**
317 * Adds values to this array.
318 *
319 * @param values The values to add to this array.
320 * @param count The number of elements to add.
321 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500322- (void)addValues:(const uint32_t [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700323
324/**
325 * Adds the values from the given array to this array.
326 *
327 * @param array The array containing the elements to add to this array.
328 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400329- (void)addValuesFromArray:(GPBUInt32Array *)array;
330
Sergio Campamá32fadc02016-08-08 07:15:02 -0700331/**
332 * Inserts a value into the given position.
333 *
334 * @param value The value to add to this array.
335 * @param index The index into which to insert the value.
336 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400337- (void)insertValue:(uint32_t)value atIndex:(NSUInteger)index;
338
Sergio Campamá32fadc02016-08-08 07:15:02 -0700339/**
340 * Replaces the value at the given index with the given value.
341 *
342 * @param index The index for which to replace the value.
343 * @param value The value to replace with.
344 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400345- (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint32_t)value;
346
Sergio Campamá32fadc02016-08-08 07:15:02 -0700347/**
348 * Removes the value at the given index.
349 *
350 * @param index The index of the value to remove.
351 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400352- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700353
354/**
355 * Removes all the values from this array.
356 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400357- (void)removeAll;
358
Sergio Campamá32fadc02016-08-08 07:15:02 -0700359/**
360 * Exchanges the values between the given indexes.
361 *
362 * @param idx1 The index of the first element to exchange.
363 * @param idx2 The index of the second element to exchange.
364 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400365- (void)exchangeValueAtIndex:(NSUInteger)idx1
366 withValueAtIndex:(NSUInteger)idx2;
367
368@end
369
370#pragma mark - Int64
371
Sergio Campamá32fadc02016-08-08 07:15:02 -0700372/**
373 * Class used for repeated fields of int64_t values. This performs better than
374 * boxing into NSNumbers in NSArrays.
375 *
376 * @note This class is not meant to be subclassed.
377 **/
Protobuf Team Bota185a6e2023-01-27 15:19:53 -0800378__attribute__((objc_subclassing_restricted))
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400379@interface GPBInt64Array : NSObject <NSCopying>
380
Sergio Campamá32fadc02016-08-08 07:15:02 -0700381/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400382@property(nonatomic, readonly) NSUInteger count;
383
Sergio Campamá32fadc02016-08-08 07:15:02 -0700384/**
385 * @return A newly instanced and empty GPBInt64Array.
386 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400387+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700388
389/**
390 * Creates and initializes a GPBInt64Array with the single element given.
391 *
392 * @param value The value to be placed in the array.
393 *
394 * @return A newly instanced GPBInt64Array with value in it.
395 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400396+ (instancetype)arrayWithValue:(int64_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700397
398/**
399 * Creates and initializes a GPBInt64Array with the contents of the given
400 * array.
401 *
402 * @param array Array with the contents to be put into the new array.
403 *
404 * @return A newly instanced GPBInt64Array with the contents of array.
405 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400406+ (instancetype)arrayWithValueArray:(GPBInt64Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700407
408/**
409 * Creates and initializes a GPBInt64Array with the given capacity.
410 *
411 * @param count The capacity needed for the array.
412 *
413 * @return A newly instanced GPBInt64Array with a capacity of count.
414 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400415+ (instancetype)arrayWithCapacity:(NSUInteger)count;
416
Sergio Campamá32fadc02016-08-08 07:15:02 -0700417/**
418 * @return A newly initialized and empty GPBInt64Array.
419 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400420- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700421
422/**
423 * Initializes the array, copying the given values.
424 *
425 * @param values An array with the values to put inside this array.
426 * @param count The number of elements to copy into the array.
427 *
428 * @return A newly initialized GPBInt64Array with a copy of the values.
429 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500430- (instancetype)initWithValues:(const int64_t [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400431 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700432
433/**
434 * Initializes the array, copying the given values.
435 *
436 * @param array An array with the values to put inside this array.
437 *
438 * @return A newly initialized GPBInt64Array with a copy of the values.
439 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400440- (instancetype)initWithValueArray:(GPBInt64Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700441
442/**
443 * Initializes the array with the given capacity.
444 *
445 * @param count The capacity needed for the array.
446 *
447 * @return A newly initialized GPBInt64Array with a capacity of count.
448 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400449- (instancetype)initWithCapacity:(NSUInteger)count;
450
Sergio Campamá32fadc02016-08-08 07:15:02 -0700451/**
452 * Gets the value at the given index.
453 *
454 * @param index The index of the value to get.
455 *
456 * @return The value at the given index.
457 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400458- (int64_t)valueAtIndex:(NSUInteger)index;
459
Sergio Campamá32fadc02016-08-08 07:15:02 -0700460/**
461 * Enumerates the values on this array with the given block.
462 *
463 * @param block The block to enumerate with.
464 * **value**: The current value being enumerated.
465 * **idx**: The index of the current value.
466 * **stop**: A pointer to a boolean that when set stops the enumeration.
467 **/
Thomas Van Lenten9e069b22022-09-19 13:34:01 -0400468- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx,
469 BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700470
471/**
472 * Enumerates the values on this array with the given block.
473 *
474 * @param opts Options to control the enumeration.
475 * @param block The block to enumerate with.
476 * **value**: The current value being enumerated.
477 * **idx**: The index of the current value.
478 * **stop**: A pointer to a boolean that when set stops the enumeration.
479 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400480- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten9e069b22022-09-19 13:34:01 -0400481 usingBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx,
482 BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400483
Sergio Campamá32fadc02016-08-08 07:15:02 -0700484/**
485 * Adds a value to this array.
486 *
487 * @param value The value to add to this array.
488 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400489- (void)addValue:(int64_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700490
491/**
492 * Adds values to this array.
493 *
494 * @param values The values to add to this array.
495 * @param count The number of elements to add.
496 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500497- (void)addValues:(const int64_t [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700498
499/**
500 * Adds the values from the given array to this array.
501 *
502 * @param array The array containing the elements to add to this array.
503 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400504- (void)addValuesFromArray:(GPBInt64Array *)array;
505
Sergio Campamá32fadc02016-08-08 07:15:02 -0700506/**
507 * Inserts a value into the given position.
508 *
509 * @param value The value to add to this array.
510 * @param index The index into which to insert the value.
511 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400512- (void)insertValue:(int64_t)value atIndex:(NSUInteger)index;
513
Sergio Campamá32fadc02016-08-08 07:15:02 -0700514/**
515 * Replaces the value at the given index with the given value.
516 *
517 * @param index The index for which to replace the value.
518 * @param value The value to replace with.
519 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400520- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int64_t)value;
521
Sergio Campamá32fadc02016-08-08 07:15:02 -0700522/**
523 * Removes the value at the given index.
524 *
525 * @param index The index of the value to remove.
526 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400527- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700528
529/**
530 * Removes all the values from this array.
531 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400532- (void)removeAll;
533
Sergio Campamá32fadc02016-08-08 07:15:02 -0700534/**
535 * Exchanges the values between the given indexes.
536 *
537 * @param idx1 The index of the first element to exchange.
538 * @param idx2 The index of the second element to exchange.
539 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400540- (void)exchangeValueAtIndex:(NSUInteger)idx1
541 withValueAtIndex:(NSUInteger)idx2;
542
543@end
544
545#pragma mark - UInt64
546
Sergio Campamá32fadc02016-08-08 07:15:02 -0700547/**
548 * Class used for repeated fields of uint64_t values. This performs better than
549 * boxing into NSNumbers in NSArrays.
550 *
551 * @note This class is not meant to be subclassed.
552 **/
Protobuf Team Bota185a6e2023-01-27 15:19:53 -0800553__attribute__((objc_subclassing_restricted))
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400554@interface GPBUInt64Array : NSObject <NSCopying>
555
Sergio Campamá32fadc02016-08-08 07:15:02 -0700556/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400557@property(nonatomic, readonly) NSUInteger count;
558
Sergio Campamá32fadc02016-08-08 07:15:02 -0700559/**
560 * @return A newly instanced and empty GPBUInt64Array.
561 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400562+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700563
564/**
565 * Creates and initializes a GPBUInt64Array with the single element given.
566 *
567 * @param value The value to be placed in the array.
568 *
569 * @return A newly instanced GPBUInt64Array with value in it.
570 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400571+ (instancetype)arrayWithValue:(uint64_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700572
573/**
574 * Creates and initializes a GPBUInt64Array with the contents of the given
575 * array.
576 *
577 * @param array Array with the contents to be put into the new array.
578 *
579 * @return A newly instanced GPBUInt64Array with the contents of array.
580 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400581+ (instancetype)arrayWithValueArray:(GPBUInt64Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700582
583/**
584 * Creates and initializes a GPBUInt64Array with the given capacity.
585 *
586 * @param count The capacity needed for the array.
587 *
588 * @return A newly instanced GPBUInt64Array with a capacity of count.
589 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400590+ (instancetype)arrayWithCapacity:(NSUInteger)count;
591
Sergio Campamá32fadc02016-08-08 07:15:02 -0700592/**
593 * @return A newly initialized and empty GPBUInt64Array.
594 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400595- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700596
597/**
598 * Initializes the array, copying the given values.
599 *
600 * @param values An array with the values to put inside this array.
601 * @param count The number of elements to copy into the array.
602 *
603 * @return A newly initialized GPBUInt64Array with a copy of the values.
604 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500605- (instancetype)initWithValues:(const uint64_t [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400606 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700607
608/**
609 * Initializes the array, copying the given values.
610 *
611 * @param array An array with the values to put inside this array.
612 *
613 * @return A newly initialized GPBUInt64Array with a copy of the values.
614 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400615- (instancetype)initWithValueArray:(GPBUInt64Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700616
617/**
618 * Initializes the array with the given capacity.
619 *
620 * @param count The capacity needed for the array.
621 *
622 * @return A newly initialized GPBUInt64Array with a capacity of count.
623 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400624- (instancetype)initWithCapacity:(NSUInteger)count;
625
Sergio Campamá32fadc02016-08-08 07:15:02 -0700626/**
627 * Gets the value at the given index.
628 *
629 * @param index The index of the value to get.
630 *
631 * @return The value at the given index.
632 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400633- (uint64_t)valueAtIndex:(NSUInteger)index;
634
Sergio Campamá32fadc02016-08-08 07:15:02 -0700635/**
636 * Enumerates the values on this array with the given block.
637 *
638 * @param block The block to enumerate with.
639 * **value**: The current value being enumerated.
640 * **idx**: The index of the current value.
641 * **stop**: A pointer to a boolean that when set stops the enumeration.
642 **/
Thomas Van Lenten9e069b22022-09-19 13:34:01 -0400643- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx,
644 BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700645
646/**
647 * Enumerates the values on this array with the given block.
648 *
649 * @param opts Options to control the enumeration.
650 * @param block The block to enumerate with.
651 * **value**: The current value being enumerated.
652 * **idx**: The index of the current value.
653 * **stop**: A pointer to a boolean that when set stops the enumeration.
654 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400655- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten9e069b22022-09-19 13:34:01 -0400656 usingBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx,
657 BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400658
Sergio Campamá32fadc02016-08-08 07:15:02 -0700659/**
660 * Adds a value to this array.
661 *
662 * @param value The value to add to this array.
663 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400664- (void)addValue:(uint64_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700665
666/**
667 * Adds values to this array.
668 *
669 * @param values The values to add to this array.
670 * @param count The number of elements to add.
671 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500672- (void)addValues:(const uint64_t [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700673
674/**
675 * Adds the values from the given array to this array.
676 *
677 * @param array The array containing the elements to add to this array.
678 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400679- (void)addValuesFromArray:(GPBUInt64Array *)array;
680
Sergio Campamá32fadc02016-08-08 07:15:02 -0700681/**
682 * Inserts a value into the given position.
683 *
684 * @param value The value to add to this array.
685 * @param index The index into which to insert the value.
686 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400687- (void)insertValue:(uint64_t)value atIndex:(NSUInteger)index;
688
Sergio Campamá32fadc02016-08-08 07:15:02 -0700689/**
690 * Replaces the value at the given index with the given value.
691 *
692 * @param index The index for which to replace the value.
693 * @param value The value to replace with.
694 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400695- (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint64_t)value;
696
Sergio Campamá32fadc02016-08-08 07:15:02 -0700697/**
698 * Removes the value at the given index.
699 *
700 * @param index The index of the value to remove.
701 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400702- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700703
704/**
705 * Removes all the values from this array.
706 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400707- (void)removeAll;
708
Sergio Campamá32fadc02016-08-08 07:15:02 -0700709/**
710 * Exchanges the values between the given indexes.
711 *
712 * @param idx1 The index of the first element to exchange.
713 * @param idx2 The index of the second element to exchange.
714 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400715- (void)exchangeValueAtIndex:(NSUInteger)idx1
716 withValueAtIndex:(NSUInteger)idx2;
717
718@end
719
720#pragma mark - Float
721
Sergio Campamá32fadc02016-08-08 07:15:02 -0700722/**
723 * Class used for repeated fields of float values. This performs better than
724 * boxing into NSNumbers in NSArrays.
725 *
726 * @note This class is not meant to be subclassed.
727 **/
Protobuf Team Bota185a6e2023-01-27 15:19:53 -0800728__attribute__((objc_subclassing_restricted))
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400729@interface GPBFloatArray : NSObject <NSCopying>
730
Sergio Campamá32fadc02016-08-08 07:15:02 -0700731/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400732@property(nonatomic, readonly) NSUInteger count;
733
Sergio Campamá32fadc02016-08-08 07:15:02 -0700734/**
735 * @return A newly instanced and empty GPBFloatArray.
736 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400737+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700738
739/**
740 * Creates and initializes a GPBFloatArray with the single element given.
741 *
742 * @param value The value to be placed in the array.
743 *
744 * @return A newly instanced GPBFloatArray with value in it.
745 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400746+ (instancetype)arrayWithValue:(float)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700747
748/**
749 * Creates and initializes a GPBFloatArray with the contents of the given
750 * array.
751 *
752 * @param array Array with the contents to be put into the new array.
753 *
754 * @return A newly instanced GPBFloatArray with the contents of array.
755 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400756+ (instancetype)arrayWithValueArray:(GPBFloatArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700757
758/**
759 * Creates and initializes a GPBFloatArray with the given capacity.
760 *
761 * @param count The capacity needed for the array.
762 *
763 * @return A newly instanced GPBFloatArray with a capacity of count.
764 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400765+ (instancetype)arrayWithCapacity:(NSUInteger)count;
766
Sergio Campamá32fadc02016-08-08 07:15:02 -0700767/**
768 * @return A newly initialized and empty GPBFloatArray.
769 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400770- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700771
772/**
773 * Initializes the array, copying the given values.
774 *
775 * @param values An array with the values to put inside this array.
776 * @param count The number of elements to copy into the array.
777 *
778 * @return A newly initialized GPBFloatArray with a copy of the values.
779 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500780- (instancetype)initWithValues:(const float [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400781 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700782
783/**
784 * Initializes the array, copying the given values.
785 *
786 * @param array An array with the values to put inside this array.
787 *
788 * @return A newly initialized GPBFloatArray with a copy of the values.
789 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400790- (instancetype)initWithValueArray:(GPBFloatArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700791
792/**
793 * Initializes the array with the given capacity.
794 *
795 * @param count The capacity needed for the array.
796 *
797 * @return A newly initialized GPBFloatArray with a capacity of count.
798 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400799- (instancetype)initWithCapacity:(NSUInteger)count;
800
Sergio Campamá32fadc02016-08-08 07:15:02 -0700801/**
802 * Gets the value at the given index.
803 *
804 * @param index The index of the value to get.
805 *
806 * @return The value at the given index.
807 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400808- (float)valueAtIndex:(NSUInteger)index;
809
Sergio Campamá32fadc02016-08-08 07:15:02 -0700810/**
811 * Enumerates the values on this array with the given block.
812 *
813 * @param block The block to enumerate with.
814 * **value**: The current value being enumerated.
815 * **idx**: The index of the current value.
816 * **stop**: A pointer to a boolean that when set stops the enumeration.
817 **/
Thomas Van Lenten9e069b22022-09-19 13:34:01 -0400818- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx,
819 BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700820
821/**
822 * Enumerates the values on this array with the given block.
823 *
824 * @param opts Options to control the enumeration.
825 * @param block The block to enumerate with.
826 * **value**: The current value being enumerated.
827 * **idx**: The index of the current value.
828 * **stop**: A pointer to a boolean that when set stops the enumeration.
829 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400830- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten9e069b22022-09-19 13:34:01 -0400831 usingBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx,
832 BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400833
Sergio Campamá32fadc02016-08-08 07:15:02 -0700834/**
835 * Adds a value to this array.
836 *
837 * @param value The value to add to this array.
838 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400839- (void)addValue:(float)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700840
841/**
842 * Adds values to this array.
843 *
844 * @param values The values to add to this array.
845 * @param count The number of elements to add.
846 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500847- (void)addValues:(const float [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700848
849/**
850 * Adds the values from the given array to this array.
851 *
852 * @param array The array containing the elements to add to this array.
853 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400854- (void)addValuesFromArray:(GPBFloatArray *)array;
855
Sergio Campamá32fadc02016-08-08 07:15:02 -0700856/**
857 * Inserts a value into the given position.
858 *
859 * @param value The value to add to this array.
860 * @param index The index into which to insert the value.
861 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400862- (void)insertValue:(float)value atIndex:(NSUInteger)index;
863
Sergio Campamá32fadc02016-08-08 07:15:02 -0700864/**
865 * Replaces the value at the given index with the given value.
866 *
867 * @param index The index for which to replace the value.
868 * @param value The value to replace with.
869 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400870- (void)replaceValueAtIndex:(NSUInteger)index withValue:(float)value;
871
Sergio Campamá32fadc02016-08-08 07:15:02 -0700872/**
873 * Removes the value at the given index.
874 *
875 * @param index The index of the value to remove.
876 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400877- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700878
879/**
880 * Removes all the values from this array.
881 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400882- (void)removeAll;
883
Sergio Campamá32fadc02016-08-08 07:15:02 -0700884/**
885 * Exchanges the values between the given indexes.
886 *
887 * @param idx1 The index of the first element to exchange.
888 * @param idx2 The index of the second element to exchange.
889 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400890- (void)exchangeValueAtIndex:(NSUInteger)idx1
891 withValueAtIndex:(NSUInteger)idx2;
892
893@end
894
895#pragma mark - Double
896
Sergio Campamá32fadc02016-08-08 07:15:02 -0700897/**
898 * Class used for repeated fields of double values. This performs better than
899 * boxing into NSNumbers in NSArrays.
900 *
901 * @note This class is not meant to be subclassed.
902 **/
Protobuf Team Bota185a6e2023-01-27 15:19:53 -0800903__attribute__((objc_subclassing_restricted))
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400904@interface GPBDoubleArray : NSObject <NSCopying>
905
Sergio Campamá32fadc02016-08-08 07:15:02 -0700906/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400907@property(nonatomic, readonly) NSUInteger count;
908
Sergio Campamá32fadc02016-08-08 07:15:02 -0700909/**
910 * @return A newly instanced and empty GPBDoubleArray.
911 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400912+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700913
914/**
915 * Creates and initializes a GPBDoubleArray with the single element given.
916 *
917 * @param value The value to be placed in the array.
918 *
919 * @return A newly instanced GPBDoubleArray with value in it.
920 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400921+ (instancetype)arrayWithValue:(double)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700922
923/**
924 * Creates and initializes a GPBDoubleArray with the contents of the given
925 * array.
926 *
927 * @param array Array with the contents to be put into the new array.
928 *
929 * @return A newly instanced GPBDoubleArray with the contents of array.
930 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400931+ (instancetype)arrayWithValueArray:(GPBDoubleArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700932
933/**
934 * Creates and initializes a GPBDoubleArray with the given capacity.
935 *
936 * @param count The capacity needed for the array.
937 *
938 * @return A newly instanced GPBDoubleArray with a capacity of count.
939 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400940+ (instancetype)arrayWithCapacity:(NSUInteger)count;
941
Sergio Campamá32fadc02016-08-08 07:15:02 -0700942/**
943 * @return A newly initialized and empty GPBDoubleArray.
944 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400945- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700946
947/**
948 * Initializes the array, copying the given values.
949 *
950 * @param values An array with the values to put inside this array.
951 * @param count The number of elements to copy into the array.
952 *
953 * @return A newly initialized GPBDoubleArray with a copy of the values.
954 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -0500955- (instancetype)initWithValues:(const double [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -0400956 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700957
958/**
959 * Initializes the array, copying the given values.
960 *
961 * @param array An array with the values to put inside this array.
962 *
963 * @return A newly initialized GPBDoubleArray with a copy of the values.
964 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400965- (instancetype)initWithValueArray:(GPBDoubleArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700966
967/**
968 * Initializes the array with the given capacity.
969 *
970 * @param count The capacity needed for the array.
971 *
972 * @return A newly initialized GPBDoubleArray with a capacity of count.
973 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400974- (instancetype)initWithCapacity:(NSUInteger)count;
975
Sergio Campamá32fadc02016-08-08 07:15:02 -0700976/**
977 * Gets the value at the given index.
978 *
979 * @param index The index of the value to get.
980 *
981 * @return The value at the given index.
982 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400983- (double)valueAtIndex:(NSUInteger)index;
984
Sergio Campamá32fadc02016-08-08 07:15:02 -0700985/**
986 * Enumerates the values on this array with the given block.
987 *
988 * @param block The block to enumerate with.
989 * **value**: The current value being enumerated.
990 * **idx**: The index of the current value.
991 * **stop**: A pointer to a boolean that when set stops the enumeration.
992 **/
Thomas Van Lenten9e069b22022-09-19 13:34:01 -0400993- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx,
994 BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -0700995
996/**
997 * Enumerates the values on this array with the given block.
998 *
999 * @param opts Options to control the enumeration.
1000 * @param block The block to enumerate with.
1001 * **value**: The current value being enumerated.
1002 * **idx**: The index of the current value.
1003 * **stop**: A pointer to a boolean that when set stops the enumeration.
1004 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001005- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten9e069b22022-09-19 13:34:01 -04001006 usingBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx,
1007 BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001008
Sergio Campamá32fadc02016-08-08 07:15:02 -07001009/**
1010 * Adds a value to this array.
1011 *
1012 * @param value The value to add to this array.
1013 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001014- (void)addValue:(double)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001015
1016/**
1017 * Adds values to this array.
1018 *
1019 * @param values The values to add to this array.
1020 * @param count The number of elements to add.
1021 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001022- (void)addValues:(const double [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001023
1024/**
1025 * Adds the values from the given array to this array.
1026 *
1027 * @param array The array containing the elements to add to this array.
1028 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001029- (void)addValuesFromArray:(GPBDoubleArray *)array;
1030
Sergio Campamá32fadc02016-08-08 07:15:02 -07001031/**
1032 * Inserts a value into the given position.
1033 *
1034 * @param value The value to add to this array.
1035 * @param index The index into which to insert the value.
1036 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001037- (void)insertValue:(double)value atIndex:(NSUInteger)index;
1038
Sergio Campamá32fadc02016-08-08 07:15:02 -07001039/**
1040 * Replaces the value at the given index with the given value.
1041 *
1042 * @param index The index for which to replace the value.
1043 * @param value The value to replace with.
1044 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001045- (void)replaceValueAtIndex:(NSUInteger)index withValue:(double)value;
1046
Sergio Campamá32fadc02016-08-08 07:15:02 -07001047/**
1048 * Removes the value at the given index.
1049 *
1050 * @param index The index of the value to remove.
1051 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001052- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001053
1054/**
1055 * Removes all the values from this array.
1056 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001057- (void)removeAll;
1058
Sergio Campamá32fadc02016-08-08 07:15:02 -07001059/**
1060 * Exchanges the values between the given indexes.
1061 *
1062 * @param idx1 The index of the first element to exchange.
1063 * @param idx2 The index of the second element to exchange.
1064 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001065- (void)exchangeValueAtIndex:(NSUInteger)idx1
1066 withValueAtIndex:(NSUInteger)idx2;
1067
1068@end
1069
1070#pragma mark - Bool
1071
Sergio Campamá32fadc02016-08-08 07:15:02 -07001072/**
1073 * Class used for repeated fields of BOOL values. This performs better than
1074 * boxing into NSNumbers in NSArrays.
1075 *
1076 * @note This class is not meant to be subclassed.
1077 **/
Protobuf Team Bota185a6e2023-01-27 15:19:53 -08001078__attribute__((objc_subclassing_restricted))
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001079@interface GPBBoolArray : NSObject <NSCopying>
1080
Sergio Campamá32fadc02016-08-08 07:15:02 -07001081/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001082@property(nonatomic, readonly) NSUInteger count;
1083
Sergio Campamá32fadc02016-08-08 07:15:02 -07001084/**
1085 * @return A newly instanced and empty GPBBoolArray.
1086 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001087+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001088
1089/**
1090 * Creates and initializes a GPBBoolArray with the single element given.
1091 *
1092 * @param value The value to be placed in the array.
1093 *
1094 * @return A newly instanced GPBBoolArray with value in it.
1095 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001096+ (instancetype)arrayWithValue:(BOOL)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001097
1098/**
1099 * Creates and initializes a GPBBoolArray with the contents of the given
1100 * array.
1101 *
1102 * @param array Array with the contents to be put into the new array.
1103 *
1104 * @return A newly instanced GPBBoolArray with the contents of array.
1105 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001106+ (instancetype)arrayWithValueArray:(GPBBoolArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001107
1108/**
1109 * Creates and initializes a GPBBoolArray with the given capacity.
1110 *
1111 * @param count The capacity needed for the array.
1112 *
1113 * @return A newly instanced GPBBoolArray with a capacity of count.
1114 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001115+ (instancetype)arrayWithCapacity:(NSUInteger)count;
1116
Sergio Campamá32fadc02016-08-08 07:15:02 -07001117/**
1118 * @return A newly initialized and empty GPBBoolArray.
1119 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001120- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001121
1122/**
1123 * Initializes the array, copying the given values.
1124 *
1125 * @param values An array with the values to put inside this array.
1126 * @param count The number of elements to copy into the array.
1127 *
1128 * @return A newly initialized GPBBoolArray with a copy of the values.
1129 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001130- (instancetype)initWithValues:(const BOOL [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001131 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001132
1133/**
1134 * Initializes the array, copying the given values.
1135 *
1136 * @param array An array with the values to put inside this array.
1137 *
1138 * @return A newly initialized GPBBoolArray with a copy of the values.
1139 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001140- (instancetype)initWithValueArray:(GPBBoolArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001141
1142/**
1143 * Initializes the array with the given capacity.
1144 *
1145 * @param count The capacity needed for the array.
1146 *
1147 * @return A newly initialized GPBBoolArray with a capacity of count.
1148 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001149- (instancetype)initWithCapacity:(NSUInteger)count;
1150
Sergio Campamá32fadc02016-08-08 07:15:02 -07001151/**
1152 * Gets the value at the given index.
1153 *
1154 * @param index The index of the value to get.
1155 *
1156 * @return The value at the given index.
1157 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001158- (BOOL)valueAtIndex:(NSUInteger)index;
1159
Sergio Campamá32fadc02016-08-08 07:15:02 -07001160/**
1161 * Enumerates the values on this array with the given block.
1162 *
1163 * @param block The block to enumerate with.
1164 * **value**: The current value being enumerated.
1165 * **idx**: The index of the current value.
1166 * **stop**: A pointer to a boolean that when set stops the enumeration.
1167 **/
Thomas Van Lenten9e069b22022-09-19 13:34:01 -04001168- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx,
1169 BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001170
1171/**
1172 * Enumerates the values on this array with the given block.
1173 *
1174 * @param opts Options to control the enumeration.
1175 * @param block The block to enumerate with.
1176 * **value**: The current value being enumerated.
1177 * **idx**: The index of the current value.
1178 * **stop**: A pointer to a boolean that when set stops the enumeration.
1179 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001180- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten9e069b22022-09-19 13:34:01 -04001181 usingBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx,
1182 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 **/
Protobuf Team Bota185a6e2023-01-27 15:19:53 -08001253__attribute__((objc_subclassing_restricted))
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001254@interface GPBEnumArray : NSObject <NSCopying>
1255
Sergio Campamá32fadc02016-08-08 07:15:02 -07001256/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001257@property(nonatomic, readonly) NSUInteger count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001258/** The validation function to check if the enums are valid. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001259@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
1260
Sergio Campamá32fadc02016-08-08 07:15:02 -07001261/**
1262 * @return A newly instanced and empty GPBEnumArray.
1263 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001264+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001265
1266/**
1267 * Creates and initializes a GPBEnumArray with the enum validation function
1268 * given.
1269 *
1270 * @param func The enum validation function for the array.
1271 *
1272 * @return A newly instanced GPBEnumArray.
1273 **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001274+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001275
1276/**
1277 * Creates and initializes a GPBEnumArray with the enum validation function
1278 * given and the single raw value given.
1279 *
1280 * @param func The enum validation function for the array.
1281 * @param value The raw value to add to this array.
1282 *
1283 * @return A newly instanced GPBEnumArray.
1284 **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001285+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001286 rawValue:(int32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001287
1288/**
1289 * Creates and initializes a GPBEnumArray that adds the elements from the
1290 * given array.
1291 *
1292 * @param array Array containing the values to add to the new array.
1293 *
1294 * @return A newly instanced GPBEnumArray.
1295 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001296+ (instancetype)arrayWithValueArray:(GPBEnumArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001297
1298/**
1299 * Creates and initializes a GPBEnumArray with the given enum validation
1300 * function and with the givencapacity.
1301 *
1302 * @param func The enum validation function for the array.
1303 * @param count The capacity needed for the array.
1304 *
1305 * @return A newly instanced GPBEnumArray with a capacity of count.
1306 **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001307+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001308 capacity:(NSUInteger)count;
1309
Sergio Campamá32fadc02016-08-08 07:15:02 -07001310/**
1311 * Initializes the array with the given enum validation function.
1312 *
1313 * @param func The enum validation function for the array.
1314 *
1315 * @return A newly initialized GPBEnumArray with a copy of the values.
1316 **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001317- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1318 NS_DESIGNATED_INITIALIZER;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001319
Sergio Campamá32fadc02016-08-08 07:15:02 -07001320/**
1321 * Initializes the array, copying the given values.
1322 *
1323 * @param func The enum validation function for the array.
1324 * @param values An array with the values to put inside this array.
1325 * @param count The number of elements to copy into the array.
1326 *
1327 * @return A newly initialized GPBEnumArray with a copy of the values.
1328 **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001329- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001330 rawValues:(const int32_t [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001331 count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001332
1333/**
1334 * Initializes the array, copying the given values.
1335 *
1336 * @param array An array with the values to put inside this array.
1337 *
1338 * @return A newly initialized GPBEnumArray with a copy of the values.
1339 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001340- (instancetype)initWithValueArray:(GPBEnumArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001341
1342/**
1343 * Initializes the array with the given capacity.
1344 *
1345 * @param func The enum validation function for the array.
1346 * @param count The capacity needed for the array.
1347 *
1348 * @return A newly initialized GPBEnumArray with a capacity of count.
1349 **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001350- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001351 capacity:(NSUInteger)count;
1352
1353// These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
1354// valid enumerator as defined by validationFunc. If the actual value is
1355// desired, use "raw" version of the method.
1356
Sergio Campamá32fadc02016-08-08 07:15:02 -07001357/**
1358 * Gets the value at the given index.
1359 *
1360 * @param index The index of the value to get.
1361 *
1362 * @return The value at the given index.
1363 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001364- (int32_t)valueAtIndex:(NSUInteger)index;
1365
Sergio Campamá32fadc02016-08-08 07:15:02 -07001366/**
1367 * Enumerates the values on this array with the given block.
1368 *
1369 * @param block The block to enumerate with.
1370 * **value**: The current value being enumerated.
1371 * **idx**: The index of the current value.
1372 * **stop**: A pointer to a boolean that when set stops the enumeration.
1373 **/
Thomas Van Lenten9e069b22022-09-19 13:34:01 -04001374- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx,
1375 BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001376
1377/**
1378 * Enumerates the values on this array with the given block.
1379 *
1380 * @param opts Options to control the enumeration.
1381 * @param block The block to enumerate with.
1382 * **value**: The current value being enumerated.
1383 * **idx**: The index of the current value.
1384 * **stop**: A pointer to a boolean that when set stops the enumeration.
1385 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001386- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten9e069b22022-09-19 13:34:01 -04001387 usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx,
1388 BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001389
1390// These methods bypass the validationFunc to provide access to values that were not
1391// known at the time the binary was compiled.
1392
Sergio Campamá32fadc02016-08-08 07:15:02 -07001393/**
1394 * Gets the raw enum value at the given index.
1395 *
1396 * @param index The index of the raw enum value to get.
1397 *
1398 * @return The raw enum value at the given index.
1399 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001400- (int32_t)rawValueAtIndex:(NSUInteger)index;
1401
Sergio Campamá32fadc02016-08-08 07:15:02 -07001402/**
1403 * Enumerates the values on this array with the given block.
1404 *
1405 * @param block The block to enumerate with.
1406 * **value**: The current value being enumerated.
1407 * **idx**: The index of the current value.
1408 * **stop**: A pointer to a boolean that when set stops the enumeration.
1409 **/
Thomas Van Lenten9e069b22022-09-19 13:34:01 -04001410- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx,
1411 BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001412
1413/**
1414 * Enumerates the values on this array with the given block.
1415 *
1416 * @param opts Options to control the enumeration.
1417 * @param block The block to enumerate with.
1418 * **value**: The current value being enumerated.
1419 * **idx**: The index of the current value.
1420 * **stop**: A pointer to a boolean that when set stops the enumeration.
1421 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001422- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten9e069b22022-09-19 13:34:01 -04001423 usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx,
1424 BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001425
1426// If value is not a valid enumerator as defined by validationFunc, these
1427// methods will assert in debug, and will log in release and assign the value
1428// to the default value. Use the rawValue methods below to assign non enumerator
1429// values.
1430
Sergio Campamá32fadc02016-08-08 07:15:02 -07001431/**
1432 * Adds a value to this array.
1433 *
1434 * @param value The value to add to this array.
1435 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001436- (void)addValue:(int32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001437
1438/**
1439 * Adds values to this array.
1440 *
1441 * @param values The values to add to this array.
1442 * @param count The number of elements to add.
1443 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001444- (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001445
Sergio Campamá32fadc02016-08-08 07:15:02 -07001446
1447/**
1448 * Inserts a value into the given position.
1449 *
1450 * @param value The value to add to this array.
1451 * @param index The index into which to insert the value.
1452 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001453- (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
1454
Sergio Campamá32fadc02016-08-08 07:15:02 -07001455/**
1456 * Replaces the value at the given index with the given value.
1457 *
1458 * @param index The index for which to replace the value.
1459 * @param value The value to replace with.
1460 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001461- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
1462
1463// These methods bypass the validationFunc to provide setting of values that were not
1464// known at the time the binary was compiled.
1465
Sergio Campamá32fadc02016-08-08 07:15:02 -07001466/**
1467 * Adds a raw enum value to this array.
1468 *
1469 * @note This method bypass the validationFunc to enable the setting of values that
1470 * were not known at the time the binary was compiled.
1471 *
1472 * @param value The raw enum value to add to the array.
1473 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001474- (void)addRawValue:(int32_t)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001475
1476/**
1477 * Adds raw enum values to this array.
1478 *
1479 * @note This method bypass the validationFunc to enable the setting of values that
1480 * were not known at the time the binary was compiled.
1481 *
1482 * @param array Array containing the raw enum values to add to this array.
1483 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001484- (void)addRawValuesFromArray:(GPBEnumArray *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001485
1486/**
1487 * Adds raw enum values to this array.
1488 *
1489 * @note This method bypass the validationFunc to enable the setting of values that
1490 * were not known at the time the binary was compiled.
1491 *
1492 * @param values Array containing the raw enum values to add to this array.
1493 * @param count The number of raw values to add.
1494 **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001495- (void)addRawValues:(const int32_t [__nullable])values count:(NSUInteger)count;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001496
Sergio Campamá32fadc02016-08-08 07:15:02 -07001497/**
1498 * Inserts a raw enum value at the given index.
1499 *
1500 * @note This method bypass the validationFunc to enable the setting of values that
1501 * were not known at the time the binary was compiled.
1502 *
1503 * @param value Raw enum value to add.
1504 * @param index The index into which to insert the value.
1505 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001506- (void)insertRawValue:(int32_t)value atIndex:(NSUInteger)index;
1507
Sergio Campamá32fadc02016-08-08 07:15:02 -07001508/**
1509 * Replaces the raw enum value at the given index with the given value.
1510 *
1511 * @note This method bypass the validationFunc to enable the setting of values that
1512 * were not known at the time the binary was compiled.
1513 *
1514 * @param index The index for which to replace the value.
1515 * @param value The raw enum value to replace with.
1516 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001517- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(int32_t)value;
1518
1519// No validation applies to these methods.
1520
Sergio Campamá32fadc02016-08-08 07:15:02 -07001521/**
1522 * Removes the value at the given index.
1523 *
1524 * @param index The index of the value to remove.
1525 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001526- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001527
1528/**
1529 * Removes all the values from this array.
1530 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001531- (void)removeAll;
1532
Sergio Campamá32fadc02016-08-08 07:15:02 -07001533/**
1534 * Exchanges the values between the given indexes.
1535 *
1536 * @param idx1 The index of the first element to exchange.
1537 * @param idx2 The index of the second element to exchange.
1538 **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001539- (void)exchangeValueAtIndex:(NSUInteger)idx1
1540 withValueAtIndex:(NSUInteger)idx2;
1541
1542@end
1543
1544//%PDDM-EXPAND-END DECLARE_ARRAYS()
1545
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001546NS_ASSUME_NONNULL_END
1547
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001548//%PDDM-DEFINE DECLARE_ARRAYS()
1549//%ARRAY_INTERFACE_SIMPLE(Int32, int32_t)
1550//%ARRAY_INTERFACE_SIMPLE(UInt32, uint32_t)
1551//%ARRAY_INTERFACE_SIMPLE(Int64, int64_t)
1552//%ARRAY_INTERFACE_SIMPLE(UInt64, uint64_t)
1553//%ARRAY_INTERFACE_SIMPLE(Float, float)
1554//%ARRAY_INTERFACE_SIMPLE(Double, double)
1555//%ARRAY_INTERFACE_SIMPLE(Bool, BOOL)
1556//%ARRAY_INTERFACE_ENUM(Enum, int32_t)
1557
1558//
1559// The common case (everything but Enum)
1560//
1561
1562//%PDDM-DEFINE ARRAY_INTERFACE_SIMPLE(NAME, TYPE)
1563//%#pragma mark - NAME
1564//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001565//%/**
1566//% * Class used for repeated fields of ##TYPE## values. This performs better than
1567//% * boxing into NSNumbers in NSArrays.
1568//% *
1569//% * @note This class is not meant to be subclassed.
1570//% **/
Protobuf Team Bota185a6e2023-01-27 15:19:53 -08001571//%__attribute__((objc_subclassing_restricted))
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001572//%@interface GPB##NAME##Array : NSObject <NSCopying>
1573//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001574//%/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001575//%@property(nonatomic, readonly) NSUInteger count;
1576//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001577//%/**
1578//% * @return A newly instanced and empty GPB##NAME##Array.
1579//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001580//%+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001581//%
1582//%/**
1583//% * Creates and initializes a GPB##NAME##Array with the single element given.
Sergio Campamae7f5c9d2017-02-07 11:57:53 -05001584//% *
Sergio Campamá32fadc02016-08-08 07:15:02 -07001585//% * @param value The value to be placed in the array.
1586//% *
1587//% * @return A newly instanced GPB##NAME##Array with value in it.
1588//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001589//%+ (instancetype)arrayWithValue:(TYPE)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001590//%
1591//%/**
1592//% * Creates and initializes a GPB##NAME##Array with the contents of the given
1593//% * array.
1594//% *
1595//% * @param array Array with the contents to be put into the new array.
1596//% *
1597//% * @return A newly instanced GPB##NAME##Array with the contents of array.
1598//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001599//%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001600//%
1601//%/**
1602//% * Creates and initializes a GPB##NAME##Array with the given capacity.
1603//% *
1604//% * @param count The capacity needed for the array.
1605//% *
1606//% * @return A newly instanced GPB##NAME##Array with a capacity of count.
1607//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001608//%+ (instancetype)arrayWithCapacity:(NSUInteger)count;
1609//%
Sergio Campamae7f5c9d2017-02-07 11:57:53 -05001610//%/**
Sergio Campamá32fadc02016-08-08 07:15:02 -07001611//% * @return A newly initialized and empty GPB##NAME##Array.
1612//% **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001613//%- (instancetype)init NS_DESIGNATED_INITIALIZER;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001614//%
1615//%/**
1616//% * Initializes the array, copying the given values.
1617//% *
1618//% * @param values An array with the values to put inside this array.
1619//% * @param count The number of elements to copy into the array.
1620//% *
1621//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1622//% **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001623//%- (instancetype)initWithValues:(const TYPE [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001624//% count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001625//%
1626//%/**
1627//% * Initializes the array, copying the given values.
1628//% *
1629//% * @param array An array with the values to put inside this array.
1630//% *
1631//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1632//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001633//%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001634//%
1635//%/**
1636//% * Initializes the array with the given capacity.
1637//% *
1638//% * @param count The capacity needed for the array.
1639//% *
1640//% * @return A newly initialized GPB##NAME##Array with a capacity of count.
1641//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001642//%- (instancetype)initWithCapacity:(NSUInteger)count;
1643//%
1644//%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, Basic)
1645//%
1646//%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, Basic)
1647//%
1648//%@end
1649//%
1650
1651//
1652// Macros specific to Enums (to tweak their interface).
1653//
1654
1655//%PDDM-DEFINE ARRAY_INTERFACE_ENUM(NAME, TYPE)
1656//%#pragma mark - NAME
1657//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001658//%/**
1659//% * This class is used for repeated fields of ##TYPE## values. This performs
1660//% * better than boxing into NSNumbers in NSArrays.
1661//% *
1662//% * @note This class is not meant to be subclassed.
1663//% **/
Protobuf Team Bota185a6e2023-01-27 15:19:53 -08001664//%__attribute__((objc_subclassing_restricted))
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001665//%@interface GPB##NAME##Array : NSObject <NSCopying>
1666//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001667//%/** The number of elements contained in the array. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001668//%@property(nonatomic, readonly) NSUInteger count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001669//%/** The validation function to check if the enums are valid. */
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001670//%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
1671//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001672//%/**
1673//% * @return A newly instanced and empty GPB##NAME##Array.
1674//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001675//%+ (instancetype)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001676//%
1677//%/**
1678//% * Creates and initializes a GPB##NAME##Array with the enum validation function
1679//% * given.
1680//% *
1681//% * @param func The enum validation function for the array.
1682//% *
1683//% * @return A newly instanced GPB##NAME##Array.
1684//% **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001685//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001686//%
1687//%/**
1688//% * Creates and initializes a GPB##NAME##Array with the enum validation function
1689//% * given and the single raw value given.
1690//% *
1691//% * @param func The enum validation function for the array.
1692//% * @param value The raw value to add to this array.
1693//% *
1694//% * @return A newly instanced GPB##NAME##Array.
1695//% **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001696//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001697//% rawValue:(TYPE)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001698//%
1699//%/**
1700//% * Creates and initializes a GPB##NAME##Array that adds the elements from the
1701//% * given array.
1702//% *
1703//% * @param array Array containing the values to add to the new array.
1704//% *
1705//% * @return A newly instanced GPB##NAME##Array.
1706//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001707//%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001708//%
1709//%/**
1710//% * Creates and initializes a GPB##NAME##Array with the given enum validation
1711//% * function and with the givencapacity.
1712//% *
1713//% * @param func The enum validation function for the array.
1714//% * @param count The capacity needed for the array.
1715//% *
1716//% * @return A newly instanced GPB##NAME##Array with a capacity of count.
1717//% **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001718//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001719//% capacity:(NSUInteger)count;
1720//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001721//%/**
1722//% * Initializes the array with the given enum validation function.
1723//% *
1724//% * @param func The enum validation function for the array.
1725//% *
1726//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1727//% **/
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001728//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1729//% NS_DESIGNATED_INITIALIZER;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001730//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001731//%/**
1732//% * Initializes the array, copying the given values.
1733//% *
1734//% * @param func The enum validation function for the array.
1735//% * @param values An array with the values to put inside this array.
1736//% * @param count The number of elements to copy into the array.
1737//% *
1738//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1739//% **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001740//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001741//% rawValues:(const TYPE [__nullable])values
Thomas Van Lenten4755bdc2016-05-10 10:28:09 -04001742//% count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001743//%
1744//%/**
1745//% * Initializes the array, copying the given values.
1746//% *
1747//% * @param array An array with the values to put inside this array.
1748//% *
1749//% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1750//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001751//%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001752//%
1753//%/**
1754//% * Initializes the array with the given capacity.
1755//% *
1756//% * @param func The enum validation function for the array.
1757//% * @param count The capacity needed for the array.
1758//% *
1759//% * @return A newly initialized GPB##NAME##Array with a capacity of count.
1760//% **/
Thomas Van Lenten8c889572015-06-16 16:45:14 -04001761//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001762//% capacity:(NSUInteger)count;
1763//%
1764//%// These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
1765//%// valid enumerator as defined by validationFunc. If the actual value is
1766//%// desired, use "raw" version of the method.
1767//%
1768//%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, NAME)
1769//%
1770//%// These methods bypass the validationFunc to provide access to values that were not
1771//%// known at the time the binary was compiled.
1772//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001773//%/**
1774//% * Gets the raw enum value at the given index.
1775//% *
1776//% * @param index The index of the raw enum value to get.
1777//% *
1778//% * @return The raw enum value at the given index.
1779//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001780//%- (TYPE)rawValueAtIndex:(NSUInteger)index;
1781//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001782//%/**
1783//% * Enumerates the values on this array with the given block.
Sergio Campamae7f5c9d2017-02-07 11:57:53 -05001784//% *
Sergio Campamá32fadc02016-08-08 07:15:02 -07001785//% * @param block The block to enumerate with.
1786//% * **value**: The current value being enumerated.
1787//% * **idx**: The index of the current value.
1788//% * **stop**: A pointer to a boolean that when set stops the enumeration.
1789//% **/
Thomas Van Lenten9e069b22022-09-19 13:34:01 -04001790//%- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx,
1791//% BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001792//%
1793//%/**
1794//% * Enumerates the values on this array with the given block.
1795//% *
1796//% * @param opts Options to control the enumeration.
1797//% * @param block The block to enumerate with.
1798//% * **value**: The current value being enumerated.
1799//% * **idx**: The index of the current value.
1800//% * **stop**: A pointer to a boolean that when set stops the enumeration.
1801//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001802//%- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten9e069b22022-09-19 13:34:01 -04001803//% usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx,
1804//% BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001805//%
1806//%// If value is not a valid enumerator as defined by validationFunc, these
1807//%// methods will assert in debug, and will log in release and assign the value
1808//%// to the default value. Use the rawValue methods below to assign non enumerator
1809//%// values.
1810//%
1811//%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, NAME)
1812//%
1813//%@end
1814//%
1815
1816//%PDDM-DEFINE ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
Sergio Campamá32fadc02016-08-08 07:15:02 -07001817//%/**
1818//% * Gets the value at the given index.
1819//% *
1820//% * @param index The index of the value to get.
1821//% *
1822//% * @return The value at the given index.
1823//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001824//%- (TYPE)valueAtIndex:(NSUInteger)index;
1825//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001826//%/**
1827//% * Enumerates the values on this array with the given block.
1828//% *
1829//% * @param block The block to enumerate with.
1830//% * **value**: The current value being enumerated.
1831//% * **idx**: The index of the current value.
1832//% * **stop**: A pointer to a boolean that when set stops the enumeration.
1833//% **/
Thomas Van Lenten9e069b22022-09-19 13:34:01 -04001834//%- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx,
1835//% BOOL *stop))block;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001836//%
1837//%/**
1838//% * Enumerates the values on this array with the given block.
1839//% *
1840//% * @param opts Options to control the enumeration.
Sergio Campamae7f5c9d2017-02-07 11:57:53 -05001841//% * @param block The block to enumerate with.
Sergio Campamá32fadc02016-08-08 07:15:02 -07001842//% * **value**: The current value being enumerated.
1843//% * **idx**: The index of the current value.
1844//% * **stop**: A pointer to a boolean that when set stops the enumeration.
1845//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001846//%- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
Thomas Van Lenten9e069b22022-09-19 13:34:01 -04001847//% usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx,
1848//% BOOL *stop))block;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001849
1850//%PDDM-DEFINE ARRAY_MUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
Sergio Campamá32fadc02016-08-08 07:15:02 -07001851//%/**
1852//% * Adds a value to this array.
1853//% *
1854//% * @param value The value to add to this array.
1855//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001856//%- (void)addValue:(TYPE)value;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001857//%
1858//%/**
1859//% * Adds values to this array.
1860//% *
1861//% * @param values The values to add to this array.
1862//% * @param count The number of elements to add.
1863//% **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001864//%- (void)addValues:(const TYPE [__nullable])values count:(NSUInteger)count;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001865//%
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001866//%ARRAY_EXTRA_MUTABLE_METHODS1_##HELPER_NAME(NAME, TYPE)
Sergio Campamá32fadc02016-08-08 07:15:02 -07001867//%/**
1868//% * Inserts a value into the given position.
1869//% *
1870//% * @param value The value to add to this array.
1871//% * @param index The index into which to insert the value.
1872//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001873//%- (void)insertValue:(TYPE)value atIndex:(NSUInteger)index;
1874//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001875//%/**
1876//% * Replaces the value at the given index with the given value.
1877//% *
1878//% * @param index The index for which to replace the value.
1879//% * @param value The value to replace with.
1880//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001881//%- (void)replaceValueAtIndex:(NSUInteger)index withValue:(TYPE)value;
1882//%ARRAY_EXTRA_MUTABLE_METHODS2_##HELPER_NAME(NAME, TYPE)
Sergio Campamá32fadc02016-08-08 07:15:02 -07001883//%/**
1884//% * Removes the value at the given index.
1885//% *
1886//% * @param index The index of the value to remove.
1887//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001888//%- (void)removeValueAtIndex:(NSUInteger)index;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001889//%
1890//%/**
1891//% * Removes all the values from this array.
1892//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001893//%- (void)removeAll;
1894//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001895//%/**
1896//% * Exchanges the values between the given indexes.
1897//% *
1898//% * @param idx1 The index of the first element to exchange.
1899//% * @param idx2 The index of the second element to exchange.
1900//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001901//%- (void)exchangeValueAtIndex:(NSUInteger)idx1
1902//% withValueAtIndex:(NSUInteger)idx2;
1903
1904//
1905// These are hooks invoked by the above to do insert as needed.
1906//
1907
1908//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Basic(NAME, TYPE)
Sergio Campamá32fadc02016-08-08 07:15:02 -07001909//%/**
1910//% * Adds the values from the given array to this array.
1911//% *
1912//% * @param array The array containing the elements to add to this array.
1913//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001914//%- (void)addValuesFromArray:(GPB##NAME##Array *)array;
1915//%
1916//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Basic(NAME, TYPE)
1917// Empty
1918//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Enum(NAME, TYPE)
1919// Empty
1920//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Enum(NAME, TYPE)
1921//%
1922//%// These methods bypass the validationFunc to provide setting of values that were not
1923//%// known at the time the binary was compiled.
1924//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001925//%/**
1926//% * Adds a raw enum value 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 value The raw enum value to add to the array.
1932//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001933//%- (void)addRawValue:(TYPE)value;
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 array Array containing the raw enum values to add to this array.
1942//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001943//%- (void)addRawValuesFromArray:(GPB##NAME##Array *)array;
Sergio Campamá32fadc02016-08-08 07:15:02 -07001944//%
1945//%/**
1946//% * Adds raw enum values to this array.
1947//% *
1948//% * @note This method bypass the validationFunc to enable the setting of values that
1949//% * were not known at the time the binary was compiled.
1950//% *
1951//% * @param values Array containing the raw enum values to add to this array.
1952//% * @param count The number of raw values to add.
1953//% **/
Sergio Campama3d7b42d2017-01-25 11:51:54 -05001954//%- (void)addRawValues:(const TYPE [__nullable])values count:(NSUInteger)count;
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001955//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001956//%/**
1957//% * Inserts a raw enum value at the given index.
1958//% *
1959//% * @note This method bypass the validationFunc to enable the setting of values that
1960//% * were not known at the time the binary was compiled.
1961//% *
1962//% * @param value Raw enum value to add.
1963//% * @param index The index into which to insert the value.
1964//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001965//%- (void)insertRawValue:(TYPE)value atIndex:(NSUInteger)index;
1966//%
Sergio Campamá32fadc02016-08-08 07:15:02 -07001967//%/**
1968//% * Replaces the raw enum value at the given index with the given value.
1969//% *
1970//% * @note This method bypass the validationFunc to enable the setting of values that
1971//% * were not known at the time the binary was compiled.
1972//% *
1973//% * @param index The index for which to replace the value.
1974//% * @param value The raw enum value to replace with.
1975//% **/
Thomas Van Lenten30650d82015-05-01 08:57:16 -04001976//%- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(TYPE)value;
1977//%
1978//%// No validation applies to these methods.
1979//%
Thomas Van Lenten9e069b22022-09-19 13:34:01 -04001980
1981// clang-format on