protobuf/objectivec/GPBArray.h
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2015 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 #import <Foundation/Foundation.h>
32 
33 #import "GPBRuntimeTypes.h"
34 
35 NS_ASSUME_NONNULL_BEGIN
36 
37 //%PDDM-EXPAND DECLARE_ARRAYS()
38 // This block of code is generated, do not edit it directly.
39 // clang-format off
40 
41 #pragma mark - Int32
42 
49 @interface GPBInt32Array : NSObject <NSCopying>
50 
52 @property(nonatomic, readonly) NSUInteger count;
53 
57 + (instancetype)array;
58 
66 + (instancetype)arrayWithValue:(int32_t)value;
67 
76 + (instancetype)arrayWithValueArray:(GPBInt32Array *)array;
77 
85 + (instancetype)arrayWithCapacity:(NSUInteger)count;
86 
90 - (instancetype)init NS_DESIGNATED_INITIALIZER;
91 
100 - (instancetype)initWithValues:(const int32_t [__nullable])values
101  count:(NSUInteger)count;
102 
110 - (instancetype)initWithValueArray:(GPBInt32Array *)array;
111 
119 - (instancetype)initWithCapacity:(NSUInteger)count;
120 
128 - (int32_t)valueAtIndex:(NSUInteger)index;
129 
138 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
139 
149 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
150  usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
151 
157 - (void)addValue:(int32_t)value;
158 
165 - (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
166 
172 - (void)addValuesFromArray:(GPBInt32Array *)array;
173 
180 - (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
181 
188 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
189 
195 - (void)removeValueAtIndex:(NSUInteger)index;
196 
200 - (void)removeAll;
201 
208 - (void)exchangeValueAtIndex:(NSUInteger)idx1
209  withValueAtIndex:(NSUInteger)idx2;
210 
211 @end
212 
213 #pragma mark - UInt32
214 
221 @interface GPBUInt32Array : NSObject <NSCopying>
222 
224 @property(nonatomic, readonly) NSUInteger count;
225 
229 + (instancetype)array;
230 
238 + (instancetype)arrayWithValue:(uint32_t)value;
239 
248 + (instancetype)arrayWithValueArray:(GPBUInt32Array *)array;
249 
257 + (instancetype)arrayWithCapacity:(NSUInteger)count;
258 
262 - (instancetype)init NS_DESIGNATED_INITIALIZER;
263 
272 - (instancetype)initWithValues:(const uint32_t [__nullable])values
273  count:(NSUInteger)count;
274 
282 - (instancetype)initWithValueArray:(GPBUInt32Array *)array;
283 
291 - (instancetype)initWithCapacity:(NSUInteger)count;
292 
300 - (uint32_t)valueAtIndex:(NSUInteger)index;
301 
310 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
311 
321 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
322  usingBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
323 
329 - (void)addValue:(uint32_t)value;
330 
337 - (void)addValues:(const uint32_t [__nullable])values count:(NSUInteger)count;
338 
344 - (void)addValuesFromArray:(GPBUInt32Array *)array;
345 
352 - (void)insertValue:(uint32_t)value atIndex:(NSUInteger)index;
353 
360 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint32_t)value;
361 
367 - (void)removeValueAtIndex:(NSUInteger)index;
368 
372 - (void)removeAll;
373 
380 - (void)exchangeValueAtIndex:(NSUInteger)idx1
381  withValueAtIndex:(NSUInteger)idx2;
382 
383 @end
384 
385 #pragma mark - Int64
386 
393 @interface GPBInt64Array : NSObject <NSCopying>
394 
396 @property(nonatomic, readonly) NSUInteger count;
397 
401 + (instancetype)array;
402 
410 + (instancetype)arrayWithValue:(int64_t)value;
411 
420 + (instancetype)arrayWithValueArray:(GPBInt64Array *)array;
421 
429 + (instancetype)arrayWithCapacity:(NSUInteger)count;
430 
434 - (instancetype)init NS_DESIGNATED_INITIALIZER;
435 
444 - (instancetype)initWithValues:(const int64_t [__nullable])values
445  count:(NSUInteger)count;
446 
454 - (instancetype)initWithValueArray:(GPBInt64Array *)array;
455 
463 - (instancetype)initWithCapacity:(NSUInteger)count;
464 
472 - (int64_t)valueAtIndex:(NSUInteger)index;
473 
482 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))block;
483 
493 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
494  usingBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))block;
495 
501 - (void)addValue:(int64_t)value;
502 
509 - (void)addValues:(const int64_t [__nullable])values count:(NSUInteger)count;
510 
516 - (void)addValuesFromArray:(GPBInt64Array *)array;
517 
524 - (void)insertValue:(int64_t)value atIndex:(NSUInteger)index;
525 
532 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int64_t)value;
533 
539 - (void)removeValueAtIndex:(NSUInteger)index;
540 
544 - (void)removeAll;
545 
552 - (void)exchangeValueAtIndex:(NSUInteger)idx1
553  withValueAtIndex:(NSUInteger)idx2;
554 
555 @end
556 
557 #pragma mark - UInt64
558 
565 @interface GPBUInt64Array : NSObject <NSCopying>
566 
568 @property(nonatomic, readonly) NSUInteger count;
569 
573 + (instancetype)array;
574 
582 + (instancetype)arrayWithValue:(uint64_t)value;
583 
592 + (instancetype)arrayWithValueArray:(GPBUInt64Array *)array;
593 
601 + (instancetype)arrayWithCapacity:(NSUInteger)count;
602 
606 - (instancetype)init NS_DESIGNATED_INITIALIZER;
607 
616 - (instancetype)initWithValues:(const uint64_t [__nullable])values
617  count:(NSUInteger)count;
618 
626 - (instancetype)initWithValueArray:(GPBUInt64Array *)array;
627 
635 - (instancetype)initWithCapacity:(NSUInteger)count;
636 
644 - (uint64_t)valueAtIndex:(NSUInteger)index;
645 
654 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
655 
665 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
666  usingBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
667 
673 - (void)addValue:(uint64_t)value;
674 
681 - (void)addValues:(const uint64_t [__nullable])values count:(NSUInteger)count;
682 
688 - (void)addValuesFromArray:(GPBUInt64Array *)array;
689 
696 - (void)insertValue:(uint64_t)value atIndex:(NSUInteger)index;
697 
704 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint64_t)value;
705 
711 - (void)removeValueAtIndex:(NSUInteger)index;
712 
716 - (void)removeAll;
717 
724 - (void)exchangeValueAtIndex:(NSUInteger)idx1
725  withValueAtIndex:(NSUInteger)idx2;
726 
727 @end
728 
729 #pragma mark - Float
730 
737 @interface GPBFloatArray : NSObject <NSCopying>
738 
740 @property(nonatomic, readonly) NSUInteger count;
741 
745 + (instancetype)array;
746 
754 + (instancetype)arrayWithValue:(float)value;
755 
764 + (instancetype)arrayWithValueArray:(GPBFloatArray *)array;
765 
773 + (instancetype)arrayWithCapacity:(NSUInteger)count;
774 
778 - (instancetype)init NS_DESIGNATED_INITIALIZER;
779 
788 - (instancetype)initWithValues:(const float [__nullable])values
789  count:(NSUInteger)count;
790 
798 - (instancetype)initWithValueArray:(GPBFloatArray *)array;
799 
807 - (instancetype)initWithCapacity:(NSUInteger)count;
808 
816 - (float)valueAtIndex:(NSUInteger)index;
817 
826 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block;
827 
837 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
838  usingBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block;
839 
845 - (void)addValue:(float)value;
846 
853 - (void)addValues:(const float [__nullable])values count:(NSUInteger)count;
854 
860 - (void)addValuesFromArray:(GPBFloatArray *)array;
861 
868 - (void)insertValue:(float)value atIndex:(NSUInteger)index;
869 
876 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(float)value;
877 
883 - (void)removeValueAtIndex:(NSUInteger)index;
884 
888 - (void)removeAll;
889 
896 - (void)exchangeValueAtIndex:(NSUInteger)idx1
897  withValueAtIndex:(NSUInteger)idx2;
898 
899 @end
900 
901 #pragma mark - Double
902 
909 @interface GPBDoubleArray : NSObject <NSCopying>
910 
912 @property(nonatomic, readonly) NSUInteger count;
913 
917 + (instancetype)array;
918 
926 + (instancetype)arrayWithValue:(double)value;
927 
936 + (instancetype)arrayWithValueArray:(GPBDoubleArray *)array;
937 
945 + (instancetype)arrayWithCapacity:(NSUInteger)count;
946 
950 - (instancetype)init NS_DESIGNATED_INITIALIZER;
951 
960 - (instancetype)initWithValues:(const double [__nullable])values
961  count:(NSUInteger)count;
962 
970 - (instancetype)initWithValueArray:(GPBDoubleArray *)array;
971 
979 - (instancetype)initWithCapacity:(NSUInteger)count;
980 
988 - (double)valueAtIndex:(NSUInteger)index;
989 
998 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block;
999 
1009 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1010  usingBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block;
1011 
1017 - (void)addValue:(double)value;
1018 
1025 - (void)addValues:(const double [__nullable])values count:(NSUInteger)count;
1026 
1032 - (void)addValuesFromArray:(GPBDoubleArray *)array;
1033 
1040 - (void)insertValue:(double)value atIndex:(NSUInteger)index;
1041 
1048 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(double)value;
1049 
1055 - (void)removeValueAtIndex:(NSUInteger)index;
1056 
1060 - (void)removeAll;
1061 
1068 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1069  withValueAtIndex:(NSUInteger)idx2;
1070 
1071 @end
1072 
1073 #pragma mark - Bool
1074 
1081 @interface GPBBoolArray : NSObject <NSCopying>
1082 
1084 @property(nonatomic, readonly) NSUInteger count;
1085 
1089 + (instancetype)array;
1090 
1098 + (instancetype)arrayWithValue:(BOOL)value;
1099 
1108 + (instancetype)arrayWithValueArray:(GPBBoolArray *)array;
1109 
1117 + (instancetype)arrayWithCapacity:(NSUInteger)count;
1118 
1122 - (instancetype)init NS_DESIGNATED_INITIALIZER;
1123 
1132 - (instancetype)initWithValues:(const BOOL [__nullable])values
1133  count:(NSUInteger)count;
1134 
1142 - (instancetype)initWithValueArray:(GPBBoolArray *)array;
1143 
1151 - (instancetype)initWithCapacity:(NSUInteger)count;
1152 
1160 - (BOOL)valueAtIndex:(NSUInteger)index;
1161 
1170 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block;
1171 
1181 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1182  usingBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block;
1183 
1189 - (void)addValue:(BOOL)value;
1190 
1197 - (void)addValues:(const BOOL [__nullable])values count:(NSUInteger)count;
1198 
1204 - (void)addValuesFromArray:(GPBBoolArray *)array;
1205 
1212 - (void)insertValue:(BOOL)value atIndex:(NSUInteger)index;
1213 
1220 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(BOOL)value;
1221 
1227 - (void)removeValueAtIndex:(NSUInteger)index;
1228 
1232 - (void)removeAll;
1233 
1240 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1241  withValueAtIndex:(NSUInteger)idx2;
1242 
1243 @end
1244 
1245 #pragma mark - Enum
1246 
1253 @interface GPBEnumArray : NSObject <NSCopying>
1254 
1256 @property(nonatomic, readonly) NSUInteger count;
1258 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
1259 
1263 + (instancetype)array;
1264 
1273 + (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
1274 
1284 + (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
1285  rawValue:(int32_t)value;
1286 
1295 + (instancetype)arrayWithValueArray:(GPBEnumArray *)array;
1296 
1306 + (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
1307  capacity:(NSUInteger)count;
1308 
1316 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1317  NS_DESIGNATED_INITIALIZER;
1318 
1328 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1329  rawValues:(const int32_t [__nullable])values
1330  count:(NSUInteger)count;
1331 
1339 - (instancetype)initWithValueArray:(GPBEnumArray *)array;
1340 
1349 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1350  capacity:(NSUInteger)count;
1351 
1352 // These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
1353 // valid enumerator as defined by validationFunc. If the actual value is
1354 // desired, use "raw" version of the method.
1355 
1363 - (int32_t)valueAtIndex:(NSUInteger)index;
1364 
1373 - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
1374 
1384 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1385  usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
1386 
1387 // These methods bypass the validationFunc to provide access to values that were not
1388 // known at the time the binary was compiled.
1389 
1397 - (int32_t)rawValueAtIndex:(NSUInteger)index;
1398 
1407 - (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
1408 
1418 - (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
1419  usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
1420 
1421 // If value is not a valid enumerator as defined by validationFunc, these
1422 // methods will assert in debug, and will log in release and assign the value
1423 // to the default value. Use the rawValue methods below to assign non enumerator
1424 // values.
1425 
1431 - (void)addValue:(int32_t)value;
1432 
1439 - (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
1440 
1441 
1448 - (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
1449 
1456 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
1457 
1458 // These methods bypass the validationFunc to provide setting of values that were not
1459 // known at the time the binary was compiled.
1460 
1469 - (void)addRawValue:(int32_t)value;
1470 
1479 - (void)addRawValuesFromArray:(GPBEnumArray *)array;
1480 
1490 - (void)addRawValues:(const int32_t [__nullable])values count:(NSUInteger)count;
1491 
1501 - (void)insertRawValue:(int32_t)value atIndex:(NSUInteger)index;
1502 
1512 - (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(int32_t)value;
1513 
1514 // No validation applies to these methods.
1515 
1521 - (void)removeValueAtIndex:(NSUInteger)index;
1522 
1526 - (void)removeAll;
1527 
1534 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1535  withValueAtIndex:(NSUInteger)idx2;
1536 
1537 @end
1538 
1539 // clang-format on
1540 //%PDDM-EXPAND-END DECLARE_ARRAYS()
1541 
1542 NS_ASSUME_NONNULL_END
1543 
1544 //%PDDM-DEFINE DECLARE_ARRAYS()
1545 //%ARRAY_INTERFACE_SIMPLE(Int32, int32_t)
1546 //%ARRAY_INTERFACE_SIMPLE(UInt32, uint32_t)
1547 //%ARRAY_INTERFACE_SIMPLE(Int64, int64_t)
1548 //%ARRAY_INTERFACE_SIMPLE(UInt64, uint64_t)
1549 //%ARRAY_INTERFACE_SIMPLE(Float, float)
1550 //%ARRAY_INTERFACE_SIMPLE(Double, double)
1551 //%ARRAY_INTERFACE_SIMPLE(Bool, BOOL)
1552 //%ARRAY_INTERFACE_ENUM(Enum, int32_t)
1553 
1554 //
1555 // The common case (everything but Enum)
1556 //
1557 
1558 //%PDDM-DEFINE ARRAY_INTERFACE_SIMPLE(NAME, TYPE)
1559 //%#pragma mark - NAME
1560 //%
1561 //%/**
1562 //% * Class used for repeated fields of ##TYPE## values. This performs better than
1563 //% * boxing into NSNumbers in NSArrays.
1564 //% *
1565 //% * @note This class is not meant to be subclassed.
1566 //% **/
1567 //%@interface GPB##NAME##Array : NSObject <NSCopying>
1568 //%
1569 //%/** The number of elements contained in the array. */
1570 //%@property(nonatomic, readonly) NSUInteger count;
1571 //%
1572 //%/**
1573 //% * @return A newly instanced and empty GPB##NAME##Array.
1574 //% **/
1575 //%+ (instancetype)array;
1576 //%
1577 //%/**
1578 //% * Creates and initializes a GPB##NAME##Array with the single element given.
1579 //% *
1580 //% * @param value The value to be placed in the array.
1581 //% *
1582 //% * @return A newly instanced GPB##NAME##Array with value in it.
1583 //% **/
1584 //%+ (instancetype)arrayWithValue:(TYPE)value;
1585 //%
1586 //%/**
1587 //% * Creates and initializes a GPB##NAME##Array with the contents of the given
1588 //% * array.
1589 //% *
1590 //% * @param array Array with the contents to be put into the new array.
1591 //% *
1592 //% * @return A newly instanced GPB##NAME##Array with the contents of array.
1593 //% **/
1594 //%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
1595 //%
1596 //%/**
1597 //% * Creates and initializes a GPB##NAME##Array with the given capacity.
1598 //% *
1599 //% * @param count The capacity needed for the array.
1600 //% *
1601 //% * @return A newly instanced GPB##NAME##Array with a capacity of count.
1602 //% **/
1603 //%+ (instancetype)arrayWithCapacity:(NSUInteger)count;
1604 //%
1605 //%/**
1606 //% * @return A newly initialized and empty GPB##NAME##Array.
1607 //% **/
1608 //%- (instancetype)init NS_DESIGNATED_INITIALIZER;
1609 //%
1610 //%/**
1611 //% * Initializes the array, copying the given values.
1612 //% *
1613 //% * @param values An array with the values to put inside this array.
1614 //% * @param count The number of elements to copy into the array.
1615 //% *
1616 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1617 //% **/
1618 //%- (instancetype)initWithValues:(const TYPE [__nullable])values
1619 //% count:(NSUInteger)count;
1620 //%
1621 //%/**
1622 //% * Initializes the array, copying the given values.
1623 //% *
1624 //% * @param array An array with the values to put inside this array.
1625 //% *
1626 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1627 //% **/
1628 //%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
1629 //%
1630 //%/**
1631 //% * Initializes the array with the given capacity.
1632 //% *
1633 //% * @param count The capacity needed for the array.
1634 //% *
1635 //% * @return A newly initialized GPB##NAME##Array with a capacity of count.
1636 //% **/
1637 //%- (instancetype)initWithCapacity:(NSUInteger)count;
1638 //%
1639 //%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, Basic)
1640 //%
1641 //%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, Basic)
1642 //%
1643 //%@end
1644 //%
1645 
1646 //
1647 // Macros specific to Enums (to tweak their interface).
1648 //
1649 
1650 //%PDDM-DEFINE ARRAY_INTERFACE_ENUM(NAME, TYPE)
1651 //%#pragma mark - NAME
1652 //%
1653 //%/**
1654 //% * This class is used for repeated fields of ##TYPE## values. This performs
1655 //% * better than boxing into NSNumbers in NSArrays.
1656 //% *
1657 //% * @note This class is not meant to be subclassed.
1658 //% **/
1659 //%@interface GPB##NAME##Array : NSObject <NSCopying>
1660 //%
1661 //%/** The number of elements contained in the array. */
1662 //%@property(nonatomic, readonly) NSUInteger count;
1663 //%/** The validation function to check if the enums are valid. */
1664 //%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
1665 //%
1666 //%/**
1667 //% * @return A newly instanced and empty GPB##NAME##Array.
1668 //% **/
1669 //%+ (instancetype)array;
1670 //%
1671 //%/**
1672 //% * Creates and initializes a GPB##NAME##Array with the enum validation function
1673 //% * given.
1674 //% *
1675 //% * @param func The enum validation function for the array.
1676 //% *
1677 //% * @return A newly instanced GPB##NAME##Array.
1678 //% **/
1679 //%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
1680 //%
1681 //%/**
1682 //% * Creates and initializes a GPB##NAME##Array with the enum validation function
1683 //% * given and the single raw value given.
1684 //% *
1685 //% * @param func The enum validation function for the array.
1686 //% * @param value The raw value to add to this array.
1687 //% *
1688 //% * @return A newly instanced GPB##NAME##Array.
1689 //% **/
1690 //%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
1691 //% rawValue:(TYPE)value;
1692 //%
1693 //%/**
1694 //% * Creates and initializes a GPB##NAME##Array that adds the elements from the
1695 //% * given array.
1696 //% *
1697 //% * @param array Array containing the values to add to the new array.
1698 //% *
1699 //% * @return A newly instanced GPB##NAME##Array.
1700 //% **/
1701 //%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
1702 //%
1703 //%/**
1704 //% * Creates and initializes a GPB##NAME##Array with the given enum validation
1705 //% * function and with the givencapacity.
1706 //% *
1707 //% * @param func The enum validation function for the array.
1708 //% * @param count The capacity needed for the array.
1709 //% *
1710 //% * @return A newly instanced GPB##NAME##Array with a capacity of count.
1711 //% **/
1712 //%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
1713 //% capacity:(NSUInteger)count;
1714 //%
1715 //%/**
1716 //% * Initializes the array with the given enum validation function.
1717 //% *
1718 //% * @param func The enum validation function for the array.
1719 //% *
1720 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1721 //% **/
1722 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1723 //% NS_DESIGNATED_INITIALIZER;
1724 //%
1725 //%/**
1726 //% * Initializes the array, copying the given values.
1727 //% *
1728 //% * @param func The enum validation function for the array.
1729 //% * @param values An array with the values to put inside this array.
1730 //% * @param count The number of elements to copy into the array.
1731 //% *
1732 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1733 //% **/
1734 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1735 //% rawValues:(const TYPE [__nullable])values
1736 //% count:(NSUInteger)count;
1737 //%
1738 //%/**
1739 //% * Initializes the array, copying the given values.
1740 //% *
1741 //% * @param array An array with the values to put inside this array.
1742 //% *
1743 //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
1744 //% **/
1745 //%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
1746 //%
1747 //%/**
1748 //% * Initializes the array with the given capacity.
1749 //% *
1750 //% * @param func The enum validation function for the array.
1751 //% * @param count The capacity needed for the array.
1752 //% *
1753 //% * @return A newly initialized GPB##NAME##Array with a capacity of count.
1754 //% **/
1755 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1756 //% capacity:(NSUInteger)count;
1757 //%
1758 //%// These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
1759 //%// valid enumerator as defined by validationFunc. If the actual value is
1760 //%// desired, use "raw" version of the method.
1761 //%
1762 //%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, NAME)
1763 //%
1764 //%// These methods bypass the validationFunc to provide access to values that were not
1765 //%// known at the time the binary was compiled.
1766 //%
1767 //%/**
1768 //% * Gets the raw enum value at the given index.
1769 //% *
1770 //% * @param index The index of the raw enum value to get.
1771 //% *
1772 //% * @return The raw enum value at the given index.
1773 //% **/
1774 //%- (TYPE)rawValueAtIndex:(NSUInteger)index;
1775 //%
1776 //%/**
1777 //% * Enumerates the values on this array with the given block.
1778 //% *
1779 //% * @param block The block to enumerate with.
1780 //% * **value**: The current value being enumerated.
1781 //% * **idx**: The index of the current value.
1782 //% * **stop**: A pointer to a boolean that when set stops the enumeration.
1783 //% **/
1784 //%- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
1785 //%
1786 //%/**
1787 //% * Enumerates the values on this array with the given block.
1788 //% *
1789 //% * @param opts Options to control the enumeration.
1790 //% * @param block The block to enumerate with.
1791 //% * **value**: The current value being enumerated.
1792 //% * **idx**: The index of the current value.
1793 //% * **stop**: A pointer to a boolean that when set stops the enumeration.
1794 //% **/
1795 //%- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
1796 //% usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
1797 //%
1798 //%// If value is not a valid enumerator as defined by validationFunc, these
1799 //%// methods will assert in debug, and will log in release and assign the value
1800 //%// to the default value. Use the rawValue methods below to assign non enumerator
1801 //%// values.
1802 //%
1803 //%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, NAME)
1804 //%
1805 //%@end
1806 //%
1807 
1808 //%PDDM-DEFINE ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
1809 //%/**
1810 //% * Gets the value at the given index.
1811 //% *
1812 //% * @param index The index of the value to get.
1813 //% *
1814 //% * @return The value at the given index.
1815 //% **/
1816 //%- (TYPE)valueAtIndex:(NSUInteger)index;
1817 //%
1818 //%/**
1819 //% * Enumerates the values on this array with the given block.
1820 //% *
1821 //% * @param block The block to enumerate with.
1822 //% * **value**: The current value being enumerated.
1823 //% * **idx**: The index of the current value.
1824 //% * **stop**: A pointer to a boolean that when set stops the enumeration.
1825 //% **/
1826 //%- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
1827 //%
1828 //%/**
1829 //% * Enumerates the values on this array with the given block.
1830 //% *
1831 //% * @param opts Options to control the enumeration.
1832 //% * @param block The block to enumerate with.
1833 //% * **value**: The current value being enumerated.
1834 //% * **idx**: The index of the current value.
1835 //% * **stop**: A pointer to a boolean that when set stops the enumeration.
1836 //% **/
1837 //%- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1838 //% usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
1839 
1840 //%PDDM-DEFINE ARRAY_MUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
1841 //%/**
1842 //% * Adds a value to this array.
1843 //% *
1844 //% * @param value The value to add to this array.
1845 //% **/
1846 //%- (void)addValue:(TYPE)value;
1847 //%
1848 //%/**
1849 //% * Adds values to this array.
1850 //% *
1851 //% * @param values The values to add to this array.
1852 //% * @param count The number of elements to add.
1853 //% **/
1854 //%- (void)addValues:(const TYPE [__nullable])values count:(NSUInteger)count;
1855 //%
1856 //%ARRAY_EXTRA_MUTABLE_METHODS1_##HELPER_NAME(NAME, TYPE)
1857 //%/**
1858 //% * Inserts a value into the given position.
1859 //% *
1860 //% * @param value The value to add to this array.
1861 //% * @param index The index into which to insert the value.
1862 //% **/
1863 //%- (void)insertValue:(TYPE)value atIndex:(NSUInteger)index;
1864 //%
1865 //%/**
1866 //% * Replaces the value at the given index with the given value.
1867 //% *
1868 //% * @param index The index for which to replace the value.
1869 //% * @param value The value to replace with.
1870 //% **/
1871 //%- (void)replaceValueAtIndex:(NSUInteger)index withValue:(TYPE)value;
1872 //%ARRAY_EXTRA_MUTABLE_METHODS2_##HELPER_NAME(NAME, TYPE)
1873 //%/**
1874 //% * Removes the value at the given index.
1875 //% *
1876 //% * @param index The index of the value to remove.
1877 //% **/
1878 //%- (void)removeValueAtIndex:(NSUInteger)index;
1879 //%
1880 //%/**
1881 //% * Removes all the values from this array.
1882 //% **/
1883 //%- (void)removeAll;
1884 //%
1885 //%/**
1886 //% * Exchanges the values between the given indexes.
1887 //% *
1888 //% * @param idx1 The index of the first element to exchange.
1889 //% * @param idx2 The index of the second element to exchange.
1890 //% **/
1891 //%- (void)exchangeValueAtIndex:(NSUInteger)idx1
1892 //% withValueAtIndex:(NSUInteger)idx2;
1893 
1894 //
1895 // These are hooks invoked by the above to do insert as needed.
1896 //
1897 
1898 //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Basic(NAME, TYPE)
1899 //%/**
1900 //% * Adds the values from the given array to this array.
1901 //% *
1902 //% * @param array The array containing the elements to add to this array.
1903 //% **/
1904 //%- (void)addValuesFromArray:(GPB##NAME##Array *)array;
1905 //%
1906 //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Basic(NAME, TYPE)
1907 // Empty
1908 //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Enum(NAME, TYPE)
1909 // Empty
1910 //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Enum(NAME, TYPE)
1911 //%
1912 //%// These methods bypass the validationFunc to provide setting of values that were not
1913 //%// known at the time the binary was compiled.
1914 //%
1915 //%/**
1916 //% * Adds a raw enum value to this array.
1917 //% *
1918 //% * @note This method bypass the validationFunc to enable the setting of values that
1919 //% * were not known at the time the binary was compiled.
1920 //% *
1921 //% * @param value The raw enum value to add to the array.
1922 //% **/
1923 //%- (void)addRawValue:(TYPE)value;
1924 //%
1925 //%/**
1926 //% * Adds raw enum values to this array.
1927 //% *
1928 //% * @note This method bypass the validationFunc to enable the setting of values that
1929 //% * were not known at the time the binary was compiled.
1930 //% *
1931 //% * @param array Array containing the raw enum values to add to this array.
1932 //% **/
1933 //%- (void)addRawValuesFromArray:(GPB##NAME##Array *)array;
1934 //%
1935 //%/**
1936 //% * Adds raw enum values to this array.
1937 //% *
1938 //% * @note This method bypass the validationFunc to enable the setting of values that
1939 //% * were not known at the time the binary was compiled.
1940 //% *
1941 //% * @param values Array containing the raw enum values to add to this array.
1942 //% * @param count The number of raw values to add.
1943 //% **/
1944 //%- (void)addRawValues:(const TYPE [__nullable])values count:(NSUInteger)count;
1945 //%
1946 //%/**
1947 //% * Inserts a raw enum value at the given index.
1948 //% *
1949 //% * @note This method bypass the validationFunc to enable the setting of values that
1950 //% * were not known at the time the binary was compiled.
1951 //% *
1952 //% * @param value Raw enum value to add.
1953 //% * @param index The index into which to insert the value.
1954 //% **/
1955 //%- (void)insertRawValue:(TYPE)value atIndex:(NSUInteger)index;
1956 //%
1957 //%/**
1958 //% * Replaces the raw enum value at the given index with the given value.
1959 //% *
1960 //% * @note This method bypass the validationFunc to enable the setting of values that
1961 //% * were not known at the time the binary was compiled.
1962 //% *
1963 //% * @param index The index for which to replace the value.
1964 //% * @param value The raw enum value to replace with.
1965 //% **/
1966 //%- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(TYPE)value;
1967 //%
1968 //%// No validation applies to these methods.
1969 //%
GPBInt64Array
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:392
GPBBoolArray
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:1080
init
const char * init
Definition: upb/upb/bindings/lua/main.c:49
const
#define const
Definition: bloaty/third_party/zlib/zconf.h:230
GPBRuntimeTypes.h
BOOL
int BOOL
Definition: undname.c:46
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
array
Definition: undname.c:101
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
GPBEnumArray
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:1252
-[GPBInt32Array removeAll]
void removeAll()
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
-[GPBInt32Array NS_DESIGNATED_INITIALIZER]
instancetype NS_DESIGNATED_INITIALIZER()
GPBFloatArray
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:736
GPBUInt32Array
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:220
setup.idx
idx
Definition: third_party/bloaty/third_party/capstone/bindings/python/setup.py:197
value
const char * value
Definition: hpack_parser_table.cc:165
GPBDoubleArray
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:908
GPBInt32Array::count
NSUInteger count
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:51
GPBEnumValidationFunc
BOOL(* GPBEnumValidationFunc)(int32_t)
Definition: bloaty/third_party/protobuf/objectivec/GPBRuntimeTypes.h:42
GPBUInt64Array
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:564
stop
static const char stop[]
Definition: benchmark-async-pummel.c:35
GPBInt32Array
Definition: bloaty/third_party/protobuf/objectivec/GPBArray.h:48
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:45