blob: 8c6396a903a57f1c3f9ada147a6788b983f2b9b8 [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
35// These classes are used for repeated fields of basic data types. They are used because
36// they perform better than boxing into NSNumbers in NSArrays.
37
38// Note: These are not meant to be subclassed.
39
Thomas Van Lenten8c889572015-06-16 16:45:14 -040040NS_ASSUME_NONNULL_BEGIN
41
Thomas Van Lenten30650d82015-05-01 08:57:16 -040042//%PDDM-EXPAND DECLARE_ARRAYS()
43// This block of code is generated, do not edit it directly.
44
45#pragma mark - Int32
46
47@interface GPBInt32Array : NSObject <NSCopying>
48
49@property(nonatomic, readonly) NSUInteger count;
50
51+ (instancetype)array;
52+ (instancetype)arrayWithValue:(int32_t)value;
53+ (instancetype)arrayWithValueArray:(GPBInt32Array *)array;
54+ (instancetype)arrayWithCapacity:(NSUInteger)count;
55
56// Initializes the array, copying the values.
57- (instancetype)initWithValues:(const int32_t [])values
58 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
59- (instancetype)initWithValueArray:(GPBInt32Array *)array;
60- (instancetype)initWithCapacity:(NSUInteger)count;
61
62- (int32_t)valueAtIndex:(NSUInteger)index;
63
64- (void)enumerateValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
65- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
66 usingBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
67
68- (void)addValue:(int32_t)value;
69- (void)addValues:(const int32_t [])values count:(NSUInteger)count;
70- (void)addValuesFromArray:(GPBInt32Array *)array;
71
72- (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
73
74- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
75
76- (void)removeValueAtIndex:(NSUInteger)index;
77- (void)removeAll;
78
79- (void)exchangeValueAtIndex:(NSUInteger)idx1
80 withValueAtIndex:(NSUInteger)idx2;
81
82@end
83
84#pragma mark - UInt32
85
86@interface GPBUInt32Array : NSObject <NSCopying>
87
88@property(nonatomic, readonly) NSUInteger count;
89
90+ (instancetype)array;
91+ (instancetype)arrayWithValue:(uint32_t)value;
92+ (instancetype)arrayWithValueArray:(GPBUInt32Array *)array;
93+ (instancetype)arrayWithCapacity:(NSUInteger)count;
94
95// Initializes the array, copying the values.
96- (instancetype)initWithValues:(const uint32_t [])values
97 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
98- (instancetype)initWithValueArray:(GPBUInt32Array *)array;
99- (instancetype)initWithCapacity:(NSUInteger)count;
100
101- (uint32_t)valueAtIndex:(NSUInteger)index;
102
103- (void)enumerateValuesWithBlock:(void (^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
104- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
105 usingBlock:(void (^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
106
107- (void)addValue:(uint32_t)value;
108- (void)addValues:(const uint32_t [])values count:(NSUInteger)count;
109- (void)addValuesFromArray:(GPBUInt32Array *)array;
110
111- (void)insertValue:(uint32_t)value atIndex:(NSUInteger)index;
112
113- (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint32_t)value;
114
115- (void)removeValueAtIndex:(NSUInteger)index;
116- (void)removeAll;
117
118- (void)exchangeValueAtIndex:(NSUInteger)idx1
119 withValueAtIndex:(NSUInteger)idx2;
120
121@end
122
123#pragma mark - Int64
124
125@interface GPBInt64Array : NSObject <NSCopying>
126
127@property(nonatomic, readonly) NSUInteger count;
128
129+ (instancetype)array;
130+ (instancetype)arrayWithValue:(int64_t)value;
131+ (instancetype)arrayWithValueArray:(GPBInt64Array *)array;
132+ (instancetype)arrayWithCapacity:(NSUInteger)count;
133
134// Initializes the array, copying the values.
135- (instancetype)initWithValues:(const int64_t [])values
136 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
137- (instancetype)initWithValueArray:(GPBInt64Array *)array;
138- (instancetype)initWithCapacity:(NSUInteger)count;
139
140- (int64_t)valueAtIndex:(NSUInteger)index;
141
142- (void)enumerateValuesWithBlock:(void (^)(int64_t value, NSUInteger idx, BOOL *stop))block;
143- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
144 usingBlock:(void (^)(int64_t value, NSUInteger idx, BOOL *stop))block;
145
146- (void)addValue:(int64_t)value;
147- (void)addValues:(const int64_t [])values count:(NSUInteger)count;
148- (void)addValuesFromArray:(GPBInt64Array *)array;
149
150- (void)insertValue:(int64_t)value atIndex:(NSUInteger)index;
151
152- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int64_t)value;
153
154- (void)removeValueAtIndex:(NSUInteger)index;
155- (void)removeAll;
156
157- (void)exchangeValueAtIndex:(NSUInteger)idx1
158 withValueAtIndex:(NSUInteger)idx2;
159
160@end
161
162#pragma mark - UInt64
163
164@interface GPBUInt64Array : NSObject <NSCopying>
165
166@property(nonatomic, readonly) NSUInteger count;
167
168+ (instancetype)array;
169+ (instancetype)arrayWithValue:(uint64_t)value;
170+ (instancetype)arrayWithValueArray:(GPBUInt64Array *)array;
171+ (instancetype)arrayWithCapacity:(NSUInteger)count;
172
173// Initializes the array, copying the values.
174- (instancetype)initWithValues:(const uint64_t [])values
175 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
176- (instancetype)initWithValueArray:(GPBUInt64Array *)array;
177- (instancetype)initWithCapacity:(NSUInteger)count;
178
179- (uint64_t)valueAtIndex:(NSUInteger)index;
180
181- (void)enumerateValuesWithBlock:(void (^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
182- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
183 usingBlock:(void (^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
184
185- (void)addValue:(uint64_t)value;
186- (void)addValues:(const uint64_t [])values count:(NSUInteger)count;
187- (void)addValuesFromArray:(GPBUInt64Array *)array;
188
189- (void)insertValue:(uint64_t)value atIndex:(NSUInteger)index;
190
191- (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint64_t)value;
192
193- (void)removeValueAtIndex:(NSUInteger)index;
194- (void)removeAll;
195
196- (void)exchangeValueAtIndex:(NSUInteger)idx1
197 withValueAtIndex:(NSUInteger)idx2;
198
199@end
200
201#pragma mark - Float
202
203@interface GPBFloatArray : NSObject <NSCopying>
204
205@property(nonatomic, readonly) NSUInteger count;
206
207+ (instancetype)array;
208+ (instancetype)arrayWithValue:(float)value;
209+ (instancetype)arrayWithValueArray:(GPBFloatArray *)array;
210+ (instancetype)arrayWithCapacity:(NSUInteger)count;
211
212// Initializes the array, copying the values.
213- (instancetype)initWithValues:(const float [])values
214 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
215- (instancetype)initWithValueArray:(GPBFloatArray *)array;
216- (instancetype)initWithCapacity:(NSUInteger)count;
217
218- (float)valueAtIndex:(NSUInteger)index;
219
220- (void)enumerateValuesWithBlock:(void (^)(float value, NSUInteger idx, BOOL *stop))block;
221- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
222 usingBlock:(void (^)(float value, NSUInteger idx, BOOL *stop))block;
223
224- (void)addValue:(float)value;
225- (void)addValues:(const float [])values count:(NSUInteger)count;
226- (void)addValuesFromArray:(GPBFloatArray *)array;
227
228- (void)insertValue:(float)value atIndex:(NSUInteger)index;
229
230- (void)replaceValueAtIndex:(NSUInteger)index withValue:(float)value;
231
232- (void)removeValueAtIndex:(NSUInteger)index;
233- (void)removeAll;
234
235- (void)exchangeValueAtIndex:(NSUInteger)idx1
236 withValueAtIndex:(NSUInteger)idx2;
237
238@end
239
240#pragma mark - Double
241
242@interface GPBDoubleArray : NSObject <NSCopying>
243
244@property(nonatomic, readonly) NSUInteger count;
245
246+ (instancetype)array;
247+ (instancetype)arrayWithValue:(double)value;
248+ (instancetype)arrayWithValueArray:(GPBDoubleArray *)array;
249+ (instancetype)arrayWithCapacity:(NSUInteger)count;
250
251// Initializes the array, copying the values.
252- (instancetype)initWithValues:(const double [])values
253 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
254- (instancetype)initWithValueArray:(GPBDoubleArray *)array;
255- (instancetype)initWithCapacity:(NSUInteger)count;
256
257- (double)valueAtIndex:(NSUInteger)index;
258
259- (void)enumerateValuesWithBlock:(void (^)(double value, NSUInteger idx, BOOL *stop))block;
260- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
261 usingBlock:(void (^)(double value, NSUInteger idx, BOOL *stop))block;
262
263- (void)addValue:(double)value;
264- (void)addValues:(const double [])values count:(NSUInteger)count;
265- (void)addValuesFromArray:(GPBDoubleArray *)array;
266
267- (void)insertValue:(double)value atIndex:(NSUInteger)index;
268
269- (void)replaceValueAtIndex:(NSUInteger)index withValue:(double)value;
270
271- (void)removeValueAtIndex:(NSUInteger)index;
272- (void)removeAll;
273
274- (void)exchangeValueAtIndex:(NSUInteger)idx1
275 withValueAtIndex:(NSUInteger)idx2;
276
277@end
278
279#pragma mark - Bool
280
281@interface GPBBoolArray : NSObject <NSCopying>
282
283@property(nonatomic, readonly) NSUInteger count;
284
285+ (instancetype)array;
286+ (instancetype)arrayWithValue:(BOOL)value;
287+ (instancetype)arrayWithValueArray:(GPBBoolArray *)array;
288+ (instancetype)arrayWithCapacity:(NSUInteger)count;
289
290// Initializes the array, copying the values.
291- (instancetype)initWithValues:(const BOOL [])values
292 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
293- (instancetype)initWithValueArray:(GPBBoolArray *)array;
294- (instancetype)initWithCapacity:(NSUInteger)count;
295
296- (BOOL)valueAtIndex:(NSUInteger)index;
297
298- (void)enumerateValuesWithBlock:(void (^)(BOOL value, NSUInteger idx, BOOL *stop))block;
299- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
300 usingBlock:(void (^)(BOOL value, NSUInteger idx, BOOL *stop))block;
301
302- (void)addValue:(BOOL)value;
303- (void)addValues:(const BOOL [])values count:(NSUInteger)count;
304- (void)addValuesFromArray:(GPBBoolArray *)array;
305
306- (void)insertValue:(BOOL)value atIndex:(NSUInteger)index;
307
308- (void)replaceValueAtIndex:(NSUInteger)index withValue:(BOOL)value;
309
310- (void)removeValueAtIndex:(NSUInteger)index;
311- (void)removeAll;
312
313- (void)exchangeValueAtIndex:(NSUInteger)idx1
314 withValueAtIndex:(NSUInteger)idx2;
315
316@end
317
318#pragma mark - Enum
319
320@interface GPBEnumArray : NSObject <NSCopying>
321
322@property(nonatomic, readonly) NSUInteger count;
323@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
324
325+ (instancetype)array;
Thomas Van Lenten8c889572015-06-16 16:45:14 -0400326+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
327+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400328 rawValue:(int32_t)value;
329+ (instancetype)arrayWithValueArray:(GPBEnumArray *)array;
Thomas Van Lenten8c889572015-06-16 16:45:14 -0400330+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400331 capacity:(NSUInteger)count;
332
Thomas Van Lenten8c889572015-06-16 16:45:14 -0400333- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400334
335// Initializes the array, copying the values.
Thomas Van Lenten8c889572015-06-16 16:45:14 -0400336- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400337 rawValues:(const int32_t [])values
338 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
339- (instancetype)initWithValueArray:(GPBEnumArray *)array;
Thomas Van Lenten8c889572015-06-16 16:45:14 -0400340- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400341 capacity:(NSUInteger)count;
342
343// These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
344// valid enumerator as defined by validationFunc. If the actual value is
345// desired, use "raw" version of the method.
346
347- (int32_t)valueAtIndex:(NSUInteger)index;
348
349- (void)enumerateValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
350- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
351 usingBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
352
353// These methods bypass the validationFunc to provide access to values that were not
354// known at the time the binary was compiled.
355
356- (int32_t)rawValueAtIndex:(NSUInteger)index;
357
358- (void)enumerateRawValuesWithBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
359- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
360 usingBlock:(void (^)(int32_t value, NSUInteger idx, BOOL *stop))block;
361
362// If value is not a valid enumerator as defined by validationFunc, these
363// methods will assert in debug, and will log in release and assign the value
364// to the default value. Use the rawValue methods below to assign non enumerator
365// values.
366
367- (void)addValue:(int32_t)value;
368- (void)addValues:(const int32_t [])values count:(NSUInteger)count;
369
370- (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
371
372- (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
373
374// These methods bypass the validationFunc to provide setting of values that were not
375// known at the time the binary was compiled.
376
377- (void)addRawValue:(int32_t)value;
378- (void)addRawValuesFromArray:(GPBEnumArray *)array;
379- (void)addRawValues:(const int32_t [])values count:(NSUInteger)count;
380
381- (void)insertRawValue:(int32_t)value atIndex:(NSUInteger)index;
382
383- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(int32_t)value;
384
385// No validation applies to these methods.
386
387- (void)removeValueAtIndex:(NSUInteger)index;
388- (void)removeAll;
389
390- (void)exchangeValueAtIndex:(NSUInteger)idx1
391 withValueAtIndex:(NSUInteger)idx2;
392
393@end
394
395//%PDDM-EXPAND-END DECLARE_ARRAYS()
396
Thomas Van Lenten8c889572015-06-16 16:45:14 -0400397NS_ASSUME_NONNULL_END
398
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400399//%PDDM-DEFINE DECLARE_ARRAYS()
400//%ARRAY_INTERFACE_SIMPLE(Int32, int32_t)
401//%ARRAY_INTERFACE_SIMPLE(UInt32, uint32_t)
402//%ARRAY_INTERFACE_SIMPLE(Int64, int64_t)
403//%ARRAY_INTERFACE_SIMPLE(UInt64, uint64_t)
404//%ARRAY_INTERFACE_SIMPLE(Float, float)
405//%ARRAY_INTERFACE_SIMPLE(Double, double)
406//%ARRAY_INTERFACE_SIMPLE(Bool, BOOL)
407//%ARRAY_INTERFACE_ENUM(Enum, int32_t)
408
409//
410// The common case (everything but Enum)
411//
412
413//%PDDM-DEFINE ARRAY_INTERFACE_SIMPLE(NAME, TYPE)
414//%#pragma mark - NAME
415//%
416//%@interface GPB##NAME##Array : NSObject <NSCopying>
417//%
418//%@property(nonatomic, readonly) NSUInteger count;
419//%
420//%+ (instancetype)array;
421//%+ (instancetype)arrayWithValue:(TYPE)value;
422//%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
423//%+ (instancetype)arrayWithCapacity:(NSUInteger)count;
424//%
425//%// Initializes the array, copying the values.
426//%- (instancetype)initWithValues:(const TYPE [])values
427//% count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
428//%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
429//%- (instancetype)initWithCapacity:(NSUInteger)count;
430//%
431//%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, Basic)
432//%
433//%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, Basic)
434//%
435//%@end
436//%
437
438//
439// Macros specific to Enums (to tweak their interface).
440//
441
442//%PDDM-DEFINE ARRAY_INTERFACE_ENUM(NAME, TYPE)
443//%#pragma mark - NAME
444//%
445//%@interface GPB##NAME##Array : NSObject <NSCopying>
446//%
447//%@property(nonatomic, readonly) NSUInteger count;
448//%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
449//%
450//%+ (instancetype)array;
Thomas Van Lenten8c889572015-06-16 16:45:14 -0400451//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
452//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400453//% rawValue:(TYPE)value;
454//%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
Thomas Van Lenten8c889572015-06-16 16:45:14 -0400455//%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400456//% capacity:(NSUInteger)count;
457//%
Thomas Van Lenten8c889572015-06-16 16:45:14 -0400458//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400459//%
460//%// Initializes the array, copying the values.
Thomas Van Lenten8c889572015-06-16 16:45:14 -0400461//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400462//% rawValues:(const TYPE [])values
463//% count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
464//%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
Thomas Van Lenten8c889572015-06-16 16:45:14 -0400465//%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
Thomas Van Lenten30650d82015-05-01 08:57:16 -0400466//% capacity:(NSUInteger)count;
467//%
468//%// These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
469//%// valid enumerator as defined by validationFunc. If the actual value is
470//%// desired, use "raw" version of the method.
471//%
472//%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, NAME)
473//%
474//%// These methods bypass the validationFunc to provide access to values that were not
475//%// known at the time the binary was compiled.
476//%
477//%- (TYPE)rawValueAtIndex:(NSUInteger)index;
478//%
479//%- (void)enumerateRawValuesWithBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
480//%- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
481//% usingBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
482//%
483//%// If value is not a valid enumerator as defined by validationFunc, these
484//%// methods will assert in debug, and will log in release and assign the value
485//%// to the default value. Use the rawValue methods below to assign non enumerator
486//%// values.
487//%
488//%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, NAME)
489//%
490//%@end
491//%
492
493//%PDDM-DEFINE ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
494//%- (TYPE)valueAtIndex:(NSUInteger)index;
495//%
496//%- (void)enumerateValuesWithBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
497//%- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
498//% usingBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block;
499
500//%PDDM-DEFINE ARRAY_MUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
501//%- (void)addValue:(TYPE)value;
502//%- (void)addValues:(const TYPE [])values count:(NSUInteger)count;
503//%ARRAY_EXTRA_MUTABLE_METHODS1_##HELPER_NAME(NAME, TYPE)
504//%- (void)insertValue:(TYPE)value atIndex:(NSUInteger)index;
505//%
506//%- (void)replaceValueAtIndex:(NSUInteger)index withValue:(TYPE)value;
507//%ARRAY_EXTRA_MUTABLE_METHODS2_##HELPER_NAME(NAME, TYPE)
508//%- (void)removeValueAtIndex:(NSUInteger)index;
509//%- (void)removeAll;
510//%
511//%- (void)exchangeValueAtIndex:(NSUInteger)idx1
512//% withValueAtIndex:(NSUInteger)idx2;
513
514//
515// These are hooks invoked by the above to do insert as needed.
516//
517
518//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Basic(NAME, TYPE)
519//%- (void)addValuesFromArray:(GPB##NAME##Array *)array;
520//%
521//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Basic(NAME, TYPE)
522// Empty
523//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Enum(NAME, TYPE)
524// Empty
525//%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Enum(NAME, TYPE)
526//%
527//%// These methods bypass the validationFunc to provide setting of values that were not
528//%// known at the time the binary was compiled.
529//%
530//%- (void)addRawValue:(TYPE)value;
531//%- (void)addRawValuesFromArray:(GPB##NAME##Array *)array;
532//%- (void)addRawValues:(const TYPE [])values count:(NSUInteger)count;
533//%
534//%- (void)insertRawValue:(TYPE)value atIndex:(NSUInteger)index;
535//%
536//%- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(TYPE)value;
537//%
538//%// No validation applies to these methods.
539//%