• Home
  • Raw
  • Download

Lines Matching +full:array +full:- +full:bounds

1 // Protocol Buffers - Google's data interchange format
4 // Use of this source code is governed by a BSD-style
6 // https://developers.google.com/open-source/licenses/bsd
16 // protos can turn on -Wdirect-ivar-access without issues.
18 #pragma clang diagnostic ignored "-Wdirect-ivar-access"
29 // Disable clang-format for the macros.
30 // clang-format off
32 //%PDDM-DEFINE VALIDATE_RANGE(INDEX, COUNT)
35 //% format:@"Index (%lu) beyond bounds (%lu)",
38 //%PDDM-DEFINE MAYBE_GROW_TO_SET_COUNT(NEW_COUNT)
43 //%PDDM-DEFINE SET_COUNT_AND_MAYBE_SHRINK(NEW_COUNT)
53 //%PDDM-DEFINE ARRAY_INTERFACE_SIMPLE(NAME, TYPE, FORMAT)
54 //%#pragma mark - NAME
56 //%@implementation GPB##NAME##Array {
65 //%+ (instancetype)array {
72 //% return [[(GPB##NAME##Array*)[self alloc] initWithValues:&value count:1] autorelease];
75 //%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array {
76 //% return [[(GPB##NAME##Array*)[self alloc] initWithValueArray:array] autorelease];
83 //%- (instancetype)init {
89 //%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array {
90 //% return [self initWithValues:array->_values count:array->_count];
93 //%- (instancetype)initWithValues:(const TYPE [])values count:(NSUInteger)count {
113 //%- (instancetype)initWithCapacity:(NSUInteger)count {
121 //%- (instancetype)copyWithZone:(NSZone *)zone {
122 //% return [[GPB##NAME##Array allocWithZone:zone] initWithValues:_values count:_count];
127 //%- (TYPE)valueAtIndex:(NSUInteger)index {
140 //%PDDM-DEFINE ARRAY_IMMUTABLE_CORE(NAME, TYPE, ACCESSOR_NAME, FORMAT)
141 //%- (void)dealloc {
149 //%- (BOOL)isEqual:(id)other {
153 //% if (![other isKindOfClass:[GPB##NAME##Array class]]) {
156 //% GPB##NAME##Array *otherArray = other;
157 //% return (_count == otherArray->_count
158 //% && memcmp(_values, otherArray->_values, (_count * sizeof(TYPE))) == 0);
161 //%- (NSUInteger)hash {
166 //%- (NSString *)description {
179 //%- (void)enumerate##ACCESSOR_NAME##ValuesWithBlock:(void(NS_NOESCAPE ^)(TYPE value, NSUInteger id…
183 //%- (void)enumerate##ACCESSOR_NAME##ValuesWithOptions:(NSEnumerationOptions)opts
193 //% for (NSUInteger i = _count; i > 0; --i) {
194 //% block(_values[i - 1], (i - 1), &stop);
200 //%PDDM-DEFINE MUTATION_HOOK_None()
201 //%PDDM-DEFINE MUTATION_METHODS(NAME, TYPE, ACCESSOR_NAME, HOOK_1, HOOK_2)
202 //%- (void)add##ACCESSOR_NAME##Value:(TYPE)value {
206 //%- (void)add##ACCESSOR_NAME##Values:(const TYPE [])values count:(NSUInteger)count {
217 //%- (void)insert##ACCESSOR_NAME##Value:(TYPE)value atIndex:(NSUInteger)index {
223 //% memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(TYPE));
231 //%- (void)replaceValueAtIndex:(NSUInteger)index with##ACCESSOR_NAME##Value:(TYPE)value {
236 //%PDDM-DEFINE ARRAY_MUTABLE_CORE(NAME, TYPE, ACCESSOR_NAME, FORMAT)
237 //%- (void)internalResizeToCapacity:(NSUInteger)newCapacity {
251 //%- (void)add##ACCESSOR_NAME##ValuesFromArray:(GPB##NAME##Array *)array {
252 //% [self add##ACCESSOR_NAME##Values:array->_values count:array->_count];
255 //%- (void)removeValueAtIndex:(NSUInteger)index {
257 //% NSUInteger newCount = _count - 1;
259 //% memmove(&_values[index], &_values[index + 1], (newCount - index) * sizeof(TYPE));
264 //%- (void)removeAll {
268 //%- (void)exchangeValueAtIndex:(NSUInteger)idx1
277 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(Int32, int32_t, %d)
280 #pragma mark - Int32
291 + (instancetype)array { class
301 + (instancetype)arrayWithValueArray:(GPBInt32Array *)array {
302 return [[(GPBInt32Array*)[self alloc] initWithValueArray:array] autorelease];
309 - (instancetype)init {
315 - (instancetype)initWithValueArray:(GPBInt32Array *)array {
316 return [self initWithValues:array->_values count:array->_count];
319 - (instancetype)initWithValues:(const int32_t [])values count:(NSUInteger)count {
339 - (instancetype)initWithCapacity:(NSUInteger)count {
347 - (instancetype)copyWithZone:(NSZone *)zone {
351 - (void)dealloc {
359 - (BOOL)isEqual:(id)other {
367 return (_count == otherArray->_count
368 && memcmp(_values, otherArray->_values, (_count * sizeof(int32_t))) == 0);
371 - (NSUInteger)hash {
376 - (NSString *)description {
389 - (void)enumerateValuesWithBlock:(void(NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))bl…
393 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
403 for (NSUInteger i = _count; i > 0; --i) {
404 block(_values[i - 1], (i - 1), &stop);
410 - (int32_t)valueAtIndex:(NSUInteger)index {
413 format:@"Index (%lu) beyond bounds (%lu)",
419 - (void)internalResizeToCapacity:(NSUInteger)newCapacity {
431 - (void)addValue:(int32_t)value {
435 - (void)addValues:(const int32_t [])values count:(NSUInteger)count {
449 - (void)insertValue:(int32_t)value atIndex:(NSUInteger)index {
452 format:@"Index (%lu) beyond bounds (%lu)",
462 memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(int32_t));
470 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value {
473 format:@"Index (%lu) beyond bounds (%lu)",
479 - (void)addValuesFromArray:(GPBInt32Array *)array {
480 [self addValues:array->_values count:array->_count];
483 - (void)removeValueAtIndex:(NSUInteger)index {
486 format:@"Index (%lu) beyond bounds (%lu)",
489 NSUInteger newCount = _count - 1;
491 memmove(&_values[index], &_values[index + 1], (newCount - index) * sizeof(int32_t));
499 - (void)removeAll {
506 - (void)exchangeValueAtIndex:(NSUInteger)idx1
510 format:@"Index (%lu) beyond bounds (%lu)",
515 format:@"Index (%lu) beyond bounds (%lu)",
525 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(UInt32, uint32_t, %u)
528 #pragma mark - UInt32
539 + (instancetype)array { class
549 + (instancetype)arrayWithValueArray:(GPBUInt32Array *)array {
550 return [[(GPBUInt32Array*)[self alloc] initWithValueArray:array] autorelease];
557 - (instancetype)init {
563 - (instancetype)initWithValueArray:(GPBUInt32Array *)array {
564 return [self initWithValues:array->_values count:array->_count];
567 - (instancetype)initWithValues:(const uint32_t [])values count:(NSUInteger)count {
587 - (instancetype)initWithCapacity:(NSUInteger)count {
595 - (instancetype)copyWithZone:(NSZone *)zone {
599 - (void)dealloc {
607 - (BOOL)isEqual:(id)other {
615 return (_count == otherArray->_count
616 && memcmp(_values, otherArray->_values, (_count * sizeof(uint32_t))) == 0);
619 - (NSUInteger)hash {
624 - (NSString *)description {
637 - (void)enumerateValuesWithBlock:(void(NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))b…
641 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
651 for (NSUInteger i = _count; i > 0; --i) {
652 block(_values[i - 1], (i - 1), &stop);
658 - (uint32_t)valueAtIndex:(NSUInteger)index {
661 format:@"Index (%lu) beyond bounds (%lu)",
667 - (void)internalResizeToCapacity:(NSUInteger)newCapacity {
679 - (void)addValue:(uint32_t)value {
683 - (void)addValues:(const uint32_t [])values count:(NSUInteger)count {
697 - (void)insertValue:(uint32_t)value atIndex:(NSUInteger)index {
700 format:@"Index (%lu) beyond bounds (%lu)",
710 memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(uint32_t));
718 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint32_t)value {
721 format:@"Index (%lu) beyond bounds (%lu)",
727 - (void)addValuesFromArray:(GPBUInt32Array *)array {
728 [self addValues:array->_values count:array->_count];
731 - (void)removeValueAtIndex:(NSUInteger)index {
734 format:@"Index (%lu) beyond bounds (%lu)",
737 NSUInteger newCount = _count - 1;
739 memmove(&_values[index], &_values[index + 1], (newCount - index) * sizeof(uint32_t));
747 - (void)removeAll {
754 - (void)exchangeValueAtIndex:(NSUInteger)idx1
758 format:@"Index (%lu) beyond bounds (%lu)",
763 format:@"Index (%lu) beyond bounds (%lu)",
773 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(Int64, int64_t, %lld)
776 #pragma mark - Int64
787 + (instancetype)array { class
797 + (instancetype)arrayWithValueArray:(GPBInt64Array *)array {
798 return [[(GPBInt64Array*)[self alloc] initWithValueArray:array] autorelease];
805 - (instancetype)init {
811 - (instancetype)initWithValueArray:(GPBInt64Array *)array {
812 return [self initWithValues:array->_values count:array->_count];
815 - (instancetype)initWithValues:(const int64_t [])values count:(NSUInteger)count {
835 - (instancetype)initWithCapacity:(NSUInteger)count {
843 - (instancetype)copyWithZone:(NSZone *)zone {
847 - (void)dealloc {
855 - (BOOL)isEqual:(id)other {
863 return (_count == otherArray->_count
864 && memcmp(_values, otherArray->_values, (_count * sizeof(int64_t))) == 0);
867 - (NSUInteger)hash {
872 - (NSString *)description {
885 - (void)enumerateValuesWithBlock:(void(NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))bl…
889 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
899 for (NSUInteger i = _count; i > 0; --i) {
900 block(_values[i - 1], (i - 1), &stop);
906 - (int64_t)valueAtIndex:(NSUInteger)index {
909 format:@"Index (%lu) beyond bounds (%lu)",
915 - (void)internalResizeToCapacity:(NSUInteger)newCapacity {
927 - (void)addValue:(int64_t)value {
931 - (void)addValues:(const int64_t [])values count:(NSUInteger)count {
945 - (void)insertValue:(int64_t)value atIndex:(NSUInteger)index {
948 format:@"Index (%lu) beyond bounds (%lu)",
958 memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(int64_t));
966 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int64_t)value {
969 format:@"Index (%lu) beyond bounds (%lu)",
975 - (void)addValuesFromArray:(GPBInt64Array *)array {
976 [self addValues:array->_values count:array->_count];
979 - (void)removeValueAtIndex:(NSUInteger)index {
982 format:@"Index (%lu) beyond bounds (%lu)",
985 NSUInteger newCount = _count - 1;
987 memmove(&_values[index], &_values[index + 1], (newCount - index) * sizeof(int64_t));
995 - (void)removeAll {
1002 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1006 format:@"Index (%lu) beyond bounds (%lu)",
1011 format:@"Index (%lu) beyond bounds (%lu)",
1021 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(UInt64, uint64_t, %llu)
1024 #pragma mark - UInt64
1035 + (instancetype)array { class
1045 + (instancetype)arrayWithValueArray:(GPBUInt64Array *)array {
1046 return [[(GPBUInt64Array*)[self alloc] initWithValueArray:array] autorelease];
1053 - (instancetype)init {
1059 - (instancetype)initWithValueArray:(GPBUInt64Array *)array {
1060 return [self initWithValues:array->_values count:array->_count];
1063 - (instancetype)initWithValues:(const uint64_t [])values count:(NSUInteger)count {
1083 - (instancetype)initWithCapacity:(NSUInteger)count {
1091 - (instancetype)copyWithZone:(NSZone *)zone {
1095 - (void)dealloc {
1103 - (BOOL)isEqual:(id)other {
1111 return (_count == otherArray->_count
1112 && memcmp(_values, otherArray->_values, (_count * sizeof(uint64_t))) == 0);
1115 - (NSUInteger)hash {
1120 - (NSString *)description {
1133 - (void)enumerateValuesWithBlock:(void(NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))b…
1137 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1147 for (NSUInteger i = _count; i > 0; --i) {
1148 block(_values[i - 1], (i - 1), &stop);
1154 - (uint64_t)valueAtIndex:(NSUInteger)index {
1157 format:@"Index (%lu) beyond bounds (%lu)",
1163 - (void)internalResizeToCapacity:(NSUInteger)newCapacity {
1175 - (void)addValue:(uint64_t)value {
1179 - (void)addValues:(const uint64_t [])values count:(NSUInteger)count {
1193 - (void)insertValue:(uint64_t)value atIndex:(NSUInteger)index {
1196 format:@"Index (%lu) beyond bounds (%lu)",
1206 memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(uint64_t));
1214 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint64_t)value {
1217 format:@"Index (%lu) beyond bounds (%lu)",
1223 - (void)addValuesFromArray:(GPBUInt64Array *)array {
1224 [self addValues:array->_values count:array->_count];
1227 - (void)removeValueAtIndex:(NSUInteger)index {
1230 format:@"Index (%lu) beyond bounds (%lu)",
1233 NSUInteger newCount = _count - 1;
1235 memmove(&_values[index], &_values[index + 1], (newCount - index) * sizeof(uint64_t));
1243 - (void)removeAll {
1250 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1254 format:@"Index (%lu) beyond bounds (%lu)",
1259 format:@"Index (%lu) beyond bounds (%lu)",
1269 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(Float, float, %f)
1272 #pragma mark - Float
1283 + (instancetype)array { class
1293 + (instancetype)arrayWithValueArray:(GPBFloatArray *)array {
1294 return [[(GPBFloatArray*)[self alloc] initWithValueArray:array] autorelease];
1301 - (instancetype)init {
1307 - (instancetype)initWithValueArray:(GPBFloatArray *)array {
1308 return [self initWithValues:array->_values count:array->_count];
1311 - (instancetype)initWithValues:(const float [])values count:(NSUInteger)count {
1331 - (instancetype)initWithCapacity:(NSUInteger)count {
1339 - (instancetype)copyWithZone:(NSZone *)zone {
1343 - (void)dealloc {
1351 - (BOOL)isEqual:(id)other {
1359 return (_count == otherArray->_count
1360 && memcmp(_values, otherArray->_values, (_count * sizeof(float))) == 0);
1363 - (NSUInteger)hash {
1368 - (NSString *)description {
1381 - (void)enumerateValuesWithBlock:(void(NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))bloc…
1385 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1395 for (NSUInteger i = _count; i > 0; --i) {
1396 block(_values[i - 1], (i - 1), &stop);
1402 - (float)valueAtIndex:(NSUInteger)index {
1405 format:@"Index (%lu) beyond bounds (%lu)",
1411 - (void)internalResizeToCapacity:(NSUInteger)newCapacity {
1423 - (void)addValue:(float)value {
1427 - (void)addValues:(const float [])values count:(NSUInteger)count {
1441 - (void)insertValue:(float)value atIndex:(NSUInteger)index {
1444 format:@"Index (%lu) beyond bounds (%lu)",
1454 memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(float));
1462 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(float)value {
1465 format:@"Index (%lu) beyond bounds (%lu)",
1471 - (void)addValuesFromArray:(GPBFloatArray *)array {
1472 [self addValues:array->_values count:array->_count];
1475 - (void)removeValueAtIndex:(NSUInteger)index {
1478 format:@"Index (%lu) beyond bounds (%lu)",
1481 NSUInteger newCount = _count - 1;
1483 memmove(&_values[index], &_values[index + 1], (newCount - index) * sizeof(float));
1491 - (void)removeAll {
1498 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1502 format:@"Index (%lu) beyond bounds (%lu)",
1507 format:@"Index (%lu) beyond bounds (%lu)",
1517 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(Double, double, %lf)
1520 #pragma mark - Double
1531 + (instancetype)array { class
1541 + (instancetype)arrayWithValueArray:(GPBDoubleArray *)array {
1542 return [[(GPBDoubleArray*)[self alloc] initWithValueArray:array] autorelease];
1549 - (instancetype)init {
1555 - (instancetype)initWithValueArray:(GPBDoubleArray *)array {
1556 return [self initWithValues:array->_values count:array->_count];
1559 - (instancetype)initWithValues:(const double [])values count:(NSUInteger)count {
1579 - (instancetype)initWithCapacity:(NSUInteger)count {
1587 - (instancetype)copyWithZone:(NSZone *)zone {
1591 - (void)dealloc {
1599 - (BOOL)isEqual:(id)other {
1607 return (_count == otherArray->_count
1608 && memcmp(_values, otherArray->_values, (_count * sizeof(double))) == 0);
1611 - (NSUInteger)hash {
1616 - (NSString *)description {
1629 - (void)enumerateValuesWithBlock:(void(NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))blo…
1633 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1643 for (NSUInteger i = _count; i > 0; --i) {
1644 block(_values[i - 1], (i - 1), &stop);
1650 - (double)valueAtIndex:(NSUInteger)index {
1653 format:@"Index (%lu) beyond bounds (%lu)",
1659 - (void)internalResizeToCapacity:(NSUInteger)newCapacity {
1671 - (void)addValue:(double)value {
1675 - (void)addValues:(const double [])values count:(NSUInteger)count {
1689 - (void)insertValue:(double)value atIndex:(NSUInteger)index {
1692 format:@"Index (%lu) beyond bounds (%lu)",
1702 memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(double));
1710 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(double)value {
1713 format:@"Index (%lu) beyond bounds (%lu)",
1719 - (void)addValuesFromArray:(GPBDoubleArray *)array {
1720 [self addValues:array->_values count:array->_count];
1723 - (void)removeValueAtIndex:(NSUInteger)index {
1726 format:@"Index (%lu) beyond bounds (%lu)",
1729 NSUInteger newCount = _count - 1;
1731 memmove(&_values[index], &_values[index + 1], (newCount - index) * sizeof(double));
1739 - (void)removeAll {
1746 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1750 format:@"Index (%lu) beyond bounds (%lu)",
1755 format:@"Index (%lu) beyond bounds (%lu)",
1765 //%PDDM-EXPAND ARRAY_INTERFACE_SIMPLE(Bool, BOOL, %d)
1768 #pragma mark - Bool
1779 + (instancetype)array { class
1789 + (instancetype)arrayWithValueArray:(GPBBoolArray *)array {
1790 return [[(GPBBoolArray*)[self alloc] initWithValueArray:array] autorelease];
1797 - (instancetype)init {
1803 - (instancetype)initWithValueArray:(GPBBoolArray *)array {
1804 return [self initWithValues:array->_values count:array->_count];
1807 - (instancetype)initWithValues:(const BOOL [])values count:(NSUInteger)count {
1827 - (instancetype)initWithCapacity:(NSUInteger)count {
1835 - (instancetype)copyWithZone:(NSZone *)zone {
1839 - (void)dealloc {
1847 - (BOOL)isEqual:(id)other {
1855 return (_count == otherArray->_count
1856 && memcmp(_values, otherArray->_values, (_count * sizeof(BOOL))) == 0);
1859 - (NSUInteger)hash {
1864 - (NSString *)description {
1877 - (void)enumerateValuesWithBlock:(void(NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block…
1881 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
1891 for (NSUInteger i = _count; i > 0; --i) {
1892 block(_values[i - 1], (i - 1), &stop);
1898 - (BOOL)valueAtIndex:(NSUInteger)index {
1901 format:@"Index (%lu) beyond bounds (%lu)",
1907 - (void)internalResizeToCapacity:(NSUInteger)newCapacity {
1919 - (void)addValue:(BOOL)value {
1923 - (void)addValues:(const BOOL [])values count:(NSUInteger)count {
1937 - (void)insertValue:(BOOL)value atIndex:(NSUInteger)index {
1940 format:@"Index (%lu) beyond bounds (%lu)",
1950 memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(BOOL));
1958 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(BOOL)value {
1961 format:@"Index (%lu) beyond bounds (%lu)",
1967 - (void)addValuesFromArray:(GPBBoolArray *)array {
1968 [self addValues:array->_values count:array->_count];
1971 - (void)removeValueAtIndex:(NSUInteger)index {
1974 format:@"Index (%lu) beyond bounds (%lu)",
1977 NSUInteger newCount = _count - 1;
1979 memmove(&_values[index], &_values[index + 1], (newCount - index) * sizeof(BOOL));
1987 - (void)removeAll {
1994 - (void)exchangeValueAtIndex:(NSUInteger)idx1
1998 format:@"Index (%lu) beyond bounds (%lu)",
2003 format:@"Index (%lu) beyond bounds (%lu)",
2013 //%PDDM-EXPAND-END (7 expansions)
2015 // clang-format on
2017 #pragma mark - Enum
2030 + (instancetype)array { class
2042 + (instancetype)arrayWithValueArray:(GPBEnumArray *)array {
2043 return [[(GPBEnumArray *)[self alloc] initWithValueArray:array] autorelease];
2050 - (instancetype)init {
2054 - (instancetype)initWithValueArray:(GPBEnumArray *)array {
2055 return [self initWithValidationFunction:array->_validationFunc
2056 rawValues:array->_values
2057 count:array->_count];
2060 - (instancetype)initWithValidationFunction:(GPBEnumValidationFunc)func {
2068 - (instancetype)initWithValidationFunction:(GPBEnumValidationFunc)func
2090 - (instancetype)initWithValidationFunction:(GPBEnumValidationFunc)func capacity:(NSUInteger)count {
2098 - (instancetype)copyWithZone:(NSZone *)zone {
2104 // Disable clang-format for the macros.
2105 // clang-format off
2107 //%PDDM-EXPAND ARRAY_IMMUTABLE_CORE(Enum, int32_t, Raw, %d)
2110 - (void)dealloc {
2118 - (BOOL)isEqual:(id)other {
2126 return (_count == otherArray->_count
2127 && memcmp(_values, otherArray->_values, (_count * sizeof(int32_t))) == 0);
2130 - (NSUInteger)hash {
2135 - (NSString *)description {
2148 - (void)enumerateRawValuesWithBlock:(void(NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop)…
2152 - (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
2162 for (NSUInteger i = _count; i > 0; --i) {
2163 block(_values[i - 1], (i - 1), &stop);
2168 //%PDDM-EXPAND-END ARRAY_IMMUTABLE_CORE(Enum, int32_t, Raw, %d)
2170 // clang-format on
2172 - (int32_t)valueAtIndex:(NSUInteger)index {
2173 // clang-format off
2174 //%PDDM-EXPAND VALIDATE_RANGE(index, _count)
2179 format:@"Index (%lu) beyond bounds (%lu)",
2182 //%PDDM-EXPAND-END VALIDATE_RANGE(index, _count)
2183 // clang-format on
2191 - (int32_t)rawValueAtIndex:(NSUInteger)index {
2192 // clang-format off
2193 //%PDDM-EXPAND VALIDATE_RANGE(index, _count)
2198 format:@"Index (%lu) beyond bounds (%lu)",
2201 //%PDDM-EXPAND-END VALIDATE_RANGE(index, _count)
2202 // clang-format on
2206 - (void)enumerateValuesWithBlock:(void(NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))
2211 - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
2230 int32_t *scan = end + (_count - 1);
2231 for (NSUInteger i = (_count - 1); scan >= end; --i, --scan) {
2242 // clang-format off
2244 //%PDDM-EXPAND ARRAY_MUTABLE_CORE(Enum, int32_t, Raw, %d)
2247 - (void)internalResizeToCapacity:(NSUInteger)newCapacity {
2259 - (void)addRawValue:(int32_t)value {
2263 - (void)addRawValues:(const int32_t [])values count:(NSUInteger)count {
2277 - (void)insertRawValue:(int32_t)value atIndex:(NSUInteger)index {
2280 format:@"Index (%lu) beyond bounds (%lu)",
2290 memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(int32_t));
2298 - (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(int32_t)value {
2301 format:@"Index (%lu) beyond bounds (%lu)",
2307 - (void)addRawValuesFromArray:(GPBEnumArray *)array {
2308 [self addRawValues:array->_values count:array->_count];
2311 - (void)removeValueAtIndex:(NSUInteger)index {
2314 format:@"Index (%lu) beyond bounds (%lu)",
2317 NSUInteger newCount = _count - 1;
2319 memmove(&_values[index], &_values[index + 1], (newCount - index) * sizeof(int32_t));
2327 - (void)removeAll {
2334 - (void)exchangeValueAtIndex:(NSUInteger)idx1
2338 format:@"Index (%lu) beyond bounds (%lu)",
2343 format:@"Index (%lu) beyond bounds (%lu)",
2351 //%PDDM-EXPAND MUTATION_METHODS(Enum, int32_t, , EnumValidationList, EnumValidationOne)
2354 - (void)addValue:(int32_t)value {
2358 - (void)addValues:(const int32_t [])values count:(NSUInteger)count {
2380 - (void)insertValue:(int32_t)value atIndex:(NSUInteger)index {
2383 format:@"Index (%lu) beyond bounds (%lu)",
2398 memmove(&_values[index + 1], &_values[index], (initialCount - index) * sizeof(int32_t));
2406 - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value {
2409 format:@"Index (%lu) beyond bounds (%lu)",
2419 //%PDDM-EXPAND-END (2 expansions)
2421 //%PDDM-DEFINE MUTATION_HOOK_EnumValidationList()
2431 //%PDDM-DEFINE MUTATION_HOOK_EnumValidationOne()
2439 // clang-format on
2443 #pragma mark - NSArray Subclass
2449 - (void)dealloc {
2458 - (NSUInteger)count {
2462 - (id)objectAtIndex:(NSUInteger)idx {
2471 - (void)insertObject:(id)anObject atIndex:(NSUInteger)idx {
2482 - (void)removeObject:(id)anObject {
2486 - (void)removeObjectAtIndex:(NSUInteger)idx {
2490 - (void)addObject:(id)anObject {
2501 - (void)removeLastObject {
2505 - (void)replaceObjectAtIndex:(NSUInteger)idx withObject:(id)anObject {
2511 - (id)copyWithZone:(NSZone *)zone {
2518 - (id)mutableCopyWithZone:(NSZone *)zone {
2525 - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
2531 - (void)enumerateObjectsUsingBlock:(void(NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))block {
2535 - (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts