From a230b5d20949d9ba5b31f4d762ae88af4c5ee8f5 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Tue, 21 Jun 2016 08:25:28 -0400 Subject: Rename methods to avoid ObjC KVC collisions. (#1699) Note: Breaking API change on the Dictionary classes. The numeric value classes were using "Value" in the naming, but this silently collided with the KVC category on NSObject; meaning KVC code could break up a keypath and call these selectors with the wrong types leading to crashes (even though the code all would compile cleanly). - Rename the methods to use the "type" instead of literal "Value". - Update all the impls and tests. - Enable the warning that will catch issues like this in the future. Fixes https://github.com/google/protobuf/issues/1616 --- objectivec/GPBDictionary.m | 1876 ++++++++++++++++++++++---------------------- 1 file changed, 939 insertions(+), 937 deletions(-) (limited to 'objectivec/GPBDictionary.m') diff --git a/objectivec/GPBDictionary.m b/objectivec/GPBDictionary.m index bceb3a99..fd8bd1ce 100644 --- a/objectivec/GPBDictionary.m +++ b/objectivec/GPBDictionary.m @@ -577,12 +577,12 @@ void GPBDictionaryReadEntry(id mapDictionary, //%DICTIONARY_KEY_TO_ENUM_IMPL(KEY_NAME, KEY_TYPE, KisP, Enum, int32_t, KHELPER) //%PDDM-DEFINE DICTIONARY_KEY_TO_POD_IMPL(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER) -//%DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, POD, value) +//%DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, POD, VALUE_NAME, value) //%PDDM-DEFINE DICTIONARY_POD_KEY_TO_OBJECT_IMPL(KEY_NAME, KEY_TYPE, VALUE_NAME, VALUE_TYPE) -//%DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, , VALUE_NAME, VALUE_TYPE, POD, OBJECT, object) +//%DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, , VALUE_NAME, VALUE_TYPE, POD, OBJECT, Object, object) -//%PDDM-DEFINE DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME) +//%PDDM-DEFINE DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, VNAME_VAR) //%#pragma mark - KEY_NAME -> VALUE_NAME //% //%@implementation GPB##KEY_NAME##VALUE_NAME##Dictionary { @@ -591,24 +591,24 @@ void GPBDictionaryReadEntry(id mapDictionary, //%} //% //%+ (instancetype)dictionary { -//% return [[[self alloc] initWith##VNAME$u##s:NULL forKeys:NULL count:0] autorelease]; +//% return [[[self alloc] initWith##VNAME##s:NULL forKeys:NULL count:0] autorelease]; //%} //% -//%+ (instancetype)dictionaryWith##VNAME$u##:(VALUE_TYPE)##VNAME +//%+ (instancetype)dictionaryWith##VNAME##:(VALUE_TYPE)##VNAME_VAR //% ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key { -//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME$u##s:forKeys:count: +//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME##s:forKeys:count: //% // on to get the type correct. -//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME$u##s:&##VNAME +//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME##s:&##VNAME_VAR //% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:&key //% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:1] autorelease]; //%} //% -//%+ (instancetype)dictionaryWith##VNAME$u##s:(const VALUE_TYPE [])##VNAME##s +//%+ (instancetype)dictionaryWith##VNAME##s:(const VALUE_TYPE [])##VNAME_VAR##s //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP [])keys //% ##VNAME$S## count:(NSUInteger)count { -//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME$u##s:forKeys:count: +//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME##s:forKeys:count: //% // on to get the type correct. -//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME$u##s:##VNAME##s +//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME##s:##VNAME_VAR##s //% KEY_NAME$S VALUE_NAME$S forKeys:keys //% KEY_NAME$S VALUE_NAME$S count:count] autorelease]; //%} @@ -624,18 +624,18 @@ void GPBDictionaryReadEntry(id mapDictionary, //%} //% //%- (instancetype)init { -//% return [self initWith##VNAME$u##s:NULL forKeys:NULL count:0]; +//% return [self initWith##VNAME##s:NULL forKeys:NULL count:0]; //%} //% -//%- (instancetype)initWith##VNAME$u##s:(const VALUE_TYPE [])##VNAME##s +//%- (instancetype)initWith##VNAME##s:(const VALUE_TYPE [])##VNAME_VAR##s //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP [])keys //% ##VNAME$S## count:(NSUInteger)count { //% self = [super init]; //% if (self) { //% _dictionary = [[NSMutableDictionary alloc] init]; -//% if (count && VNAME##s && keys) { +//% if (count && VNAME_VAR##s && keys) { //% for (NSUInteger i = 0; i < count; ++i) { -//%DICTIONARY_VALIDATE_VALUE_##VHELPER(VNAME##s[i], ______)##DICTIONARY_VALIDATE_KEY_##KHELPER(keys[i], ______) [_dictionary setObject:WRAPPED##VHELPER(VNAME##s[i]) forKey:WRAPPED##KHELPER(keys[i])]; +//%DICTIONARY_VALIDATE_VALUE_##VHELPER(VNAME_VAR##s[i], ______)##DICTIONARY_VALIDATE_KEY_##KHELPER(keys[i], ______) [_dictionary setObject:WRAPPED##VHELPER(VNAME_VAR##s[i]) forKey:WRAPPED##KHELPER(keys[i])]; //% } //% } //% } @@ -643,7 +643,7 @@ void GPBDictionaryReadEntry(id mapDictionary, //%} //% //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary { -//% self = [self initWith##VNAME$u##s:NULL forKeys:NULL count:0]; +//% self = [self initWith##VNAME##s:NULL forKeys:NULL count:0]; //% if (self) { //% if (dictionary) { //% [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -654,14 +654,14 @@ void GPBDictionaryReadEntry(id mapDictionary, //% //%- (instancetype)initWithCapacity:(NSUInteger)numItems { //% #pragma unused(numItems) -//% return [self initWith##VNAME$u##s:NULL forKeys:NULL count:0]; +//% return [self initWith##VNAME##s:NULL forKeys:NULL count:0]; //%} //% -//%DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, ) +//%DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, VNAME_VAR, ) //% //%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_NAME, VALUE_TYPE, KHELPER) //% -//%DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, ) +//%DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, VNAME_VAR, ) //% //%@end //% @@ -771,9 +771,9 @@ void GPBDictionaryReadEntry(id mapDictionary, //% return [self initWithValidationFunction:func rawValues:NULL forKeys:NULL count:0]; //%} //% -//%DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, value, Raw) +//%DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, Value, value, Raw) //% -//%- (BOOL)valueForKey:(KEY_TYPE##KisP$S##KisP)key value:(VALUE_TYPE *)value { +//%- (BOOL)getEnum:(VALUE_TYPE *)value forKey:(KEY_TYPE##KisP$S##KisP)key { //% NSNumber *wrapped = [_dictionary objectForKey:WRAPPED##KHELPER(key)]; //% if (wrapped && value) { //% VALUE_TYPE result = UNWRAP##VALUE_NAME(wrapped); @@ -785,7 +785,7 @@ void GPBDictionaryReadEntry(id mapDictionary, //% return (wrapped != NULL); //%} //% -//%- (BOOL)valueForKey:(KEY_TYPE##KisP$S##KisP)key rawValue:(VALUE_TYPE *)rawValue { +//%- (BOOL)getRawValue:(VALUE_TYPE *)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key { //% NSNumber *wrapped = [_dictionary objectForKey:WRAPPED##KHELPER(key)]; //% if (wrapped && rawValue) { //% *rawValue = UNWRAP##VALUE_NAME(wrapped); @@ -793,7 +793,7 @@ void GPBDictionaryReadEntry(id mapDictionary, //% return (wrapped != NULL); //%} //% -//%- (void)enumerateKeysAndValuesUsingBlock: +//%- (void)enumerateKeysAndEnumsUsingBlock: //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE value, BOOL *stop))block { //% GPBEnumValidationFunc func = _validationFunc; //% [_dictionary enumerateKeysAndObjectsUsingBlock:^(ENUM_TYPE##KHELPER(KEY_TYPE)##aKey, @@ -807,9 +807,9 @@ void GPBDictionaryReadEntry(id mapDictionary, //% }]; //%} //% -//%DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, value, Raw) +//%DICTIONARY_MUTABLE_CORE2(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, Value, Enum, value, Raw) //% -//%- (void)setValue:(VALUE_TYPE)value forKey:(KEY_TYPE##KisP$S##KisP)key { +//%- (void)setEnum:(VALUE_TYPE)value forKey:(KEY_TYPE##KisP$S##KisP)key { //%DICTIONARY_VALIDATE_KEY_##KHELPER(key, ) if (!_validationFunc(value)) { //% [NSException raise:NSInvalidArgumentException //% format:@"GPB##KEY_NAME##VALUE_NAME##Dictionary: Attempt to set an unknown enum value (%d)", @@ -825,7 +825,7 @@ void GPBDictionaryReadEntry(id mapDictionary, //%@end //% -//%PDDM-DEFINE DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, ACCESSOR_NAME) +//%PDDM-DEFINE DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, VNAME_VAR, ACCESSOR_NAME) //%- (void)dealloc { //% NSAssert(!_autocreator, //% @"%@: Autocreator must be cleared before release, autocreator: %@", @@ -861,12 +861,12 @@ void GPBDictionaryReadEntry(id mapDictionary, //% return _dictionary.count; //%} //% -//%- (void)enumerateKeysAnd##ACCESSOR_NAME##VNAME$u##sUsingBlock: -//% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME, BOOL *stop))block { +//%- (void)enumerateKeysAnd##ACCESSOR_NAME##VNAME##sUsingBlock: +//% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME_VAR, BOOL *stop))block { //% [_dictionary enumerateKeysAndObjectsUsingBlock:^(ENUM_TYPE##KHELPER(KEY_TYPE)##aKey, -//% ENUM_TYPE##VHELPER(VALUE_TYPE)##a##VNAME$u, +//% ENUM_TYPE##VHELPER(VALUE_TYPE)##a##VNAME_VAR$u, //% BOOL *stop) { -//% block(UNWRAP##KEY_NAME(aKey), UNWRAP##VALUE_NAME(a##VNAME$u), stop); +//% block(UNWRAP##KEY_NAME(aKey), UNWRAP##VALUE_NAME(a##VNAME_VAR$u), stop); //% }]; //%} //% @@ -880,11 +880,11 @@ void GPBDictionaryReadEntry(id mapDictionary, //% GPBDataType keyDataType = field.mapKeyDataType; //% __block size_t result = 0; //% [_dictionary enumerateKeysAndObjectsUsingBlock:^(ENUM_TYPE##KHELPER(KEY_TYPE)##aKey, -//% ENUM_TYPE##VHELPER(VALUE_TYPE)##a##VNAME$u##, +//% ENUM_TYPE##VHELPER(VALUE_TYPE)##a##VNAME_VAR$u##, //% BOOL *stop) { //% #pragma unused(stop) //% size_t msgSize = ComputeDict##KEY_NAME##FieldSize(UNWRAP##KEY_NAME(aKey), kMapKeyFieldNumber, keyDataType); -//% msgSize += ComputeDict##VALUE_NAME##FieldSize(UNWRAP##VALUE_NAME(a##VNAME$u), kMapValueFieldNumber, valueDataType); +//% msgSize += ComputeDict##VALUE_NAME##FieldSize(UNWRAP##VALUE_NAME(a##VNAME_VAR$u), kMapValueFieldNumber, valueDataType); //% result += GPBComputeRawVarint32SizeForInteger(msgSize) + msgSize; //% }]; //% size_t tagSize = GPBComputeWireFormatTagSize(GPBFieldNumber(field), GPBDataTypeMessage); @@ -898,18 +898,18 @@ void GPBDictionaryReadEntry(id mapDictionary, //% GPBDataType keyDataType = field.mapKeyDataType; //% uint32_t tag = GPBWireFormatMakeTag(GPBFieldNumber(field), GPBWireFormatLengthDelimited); //% [_dictionary enumerateKeysAndObjectsUsingBlock:^(ENUM_TYPE##KHELPER(KEY_TYPE)##aKey, -//% ENUM_TYPE##VHELPER(VALUE_TYPE)##a##VNAME$u, +//% ENUM_TYPE##VHELPER(VALUE_TYPE)##a##VNAME_VAR$u, //% BOOL *stop) { //% #pragma unused(stop) //% // Write the tag. //% [outputStream writeInt32NoTag:tag]; //% // Write the size of the message. //% size_t msgSize = ComputeDict##KEY_NAME##FieldSize(UNWRAP##KEY_NAME(aKey), kMapKeyFieldNumber, keyDataType); -//% msgSize += ComputeDict##VALUE_NAME##FieldSize(UNWRAP##VALUE_NAME(a##VNAME$u), kMapValueFieldNumber, valueDataType); +//% msgSize += ComputeDict##VALUE_NAME##FieldSize(UNWRAP##VALUE_NAME(a##VNAME_VAR$u), kMapValueFieldNumber, valueDataType); //% [outputStream writeInt32NoTag:(int32_t)msgSize]; //% // Write the fields. //% WriteDict##KEY_NAME##Field(outputStream, UNWRAP##KEY_NAME(aKey), kMapKeyFieldNumber, keyDataType); -//% WriteDict##VALUE_NAME##Field(outputStream, UNWRAP##VALUE_NAME(a##VNAME$u), kMapValueFieldNumber, valueDataType); +//% WriteDict##VALUE_NAME##Field(outputStream, UNWRAP##VALUE_NAME(a##VNAME_VAR$u), kMapValueFieldNumber, valueDataType); //% }]; //%} //% @@ -919,12 +919,14 @@ void GPBDictionaryReadEntry(id mapDictionary, //%} //% //%- (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { -//% [self enumerateKeysAnd##ACCESSOR_NAME##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##key, VALUE_TYPE VNAME, BOOL *stop) { +//% [self enumerateKeysAnd##ACCESSOR_NAME##VNAME##sUsingBlock:^(KEY_TYPE KisP##key, VALUE_TYPE VNAME_VAR, BOOL *stop) { //% #pragma unused(stop) -//% block(TEXT_FORMAT_OBJ##KEY_NAME(key), TEXT_FORMAT_OBJ##VALUE_NAME(VNAME)); +//% block(TEXT_FORMAT_OBJ##KEY_NAME(key), TEXT_FORMAT_OBJ##VALUE_NAME(VNAME_VAR)); //% }]; //%} -//%PDDM-DEFINE DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, ACCESSOR_NAME) +//%PDDM-DEFINE DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, VNAME_VAR, ACCESSOR_NAME) +//%DICTIONARY_MUTABLE_CORE2(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, VNAME, VNAME_VAR, ACCESSOR_NAME) +//%PDDM-DEFINE DICTIONARY_MUTABLE_CORE2(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, VNAME_REMOVE, VNAME_VAR, ACCESSOR_NAME) //%- (void)add##ACCESSOR_NAME##EntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary { //% if (otherDictionary) { //% [_dictionary addEntriesFromDictionary:otherDictionary->_dictionary]; @@ -934,14 +936,14 @@ void GPBDictionaryReadEntry(id mapDictionary, //% } //%} //% -//%- (void)set##ACCESSOR_NAME##VNAME$u##:(VALUE_TYPE)VNAME forKey:(KEY_TYPE##KisP$S##KisP)key { -//%DICTIONARY_VALIDATE_VALUE_##VHELPER(VNAME, )##DICTIONARY_VALIDATE_KEY_##KHELPER(key, ) [_dictionary setObject:WRAPPED##VHELPER(VNAME) forKey:WRAPPED##KHELPER(key)]; +//%- (void)set##ACCESSOR_NAME##VNAME##:(VALUE_TYPE)VNAME_VAR forKey:(KEY_TYPE##KisP$S##KisP)key { +//%DICTIONARY_VALIDATE_VALUE_##VHELPER(VNAME_VAR, )##DICTIONARY_VALIDATE_KEY_##KHELPER(key, ) [_dictionary setObject:WRAPPED##VHELPER(VNAME_VAR) forKey:WRAPPED##KHELPER(key)]; //% if (_autocreator) { //% GPBAutocreatedDictionaryModified(_autocreator, self); //% } //%} //% -//%- (void)remove##VNAME$u##ForKey:(KEY_TYPE##KisP$S##KisP)aKey { +//%- (void)remove##VNAME_REMOVE##ForKey:(KEY_TYPE##KisP$S##KisP)aKey { //% [_dictionary removeObjectForKey:WRAPPED##KHELPER(aKey)]; //%} //% @@ -954,11 +956,11 @@ void GPBDictionaryReadEntry(id mapDictionary, // //%PDDM-DEFINE DICTIONARY_BOOL_KEY_TO_POD_IMPL(VALUE_NAME, VALUE_TYPE) -//%DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, POD, value) +//%DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, POD, VALUE_NAME, value) //%PDDM-DEFINE DICTIONARY_BOOL_KEY_TO_OBJECT_IMPL(VALUE_NAME, VALUE_TYPE) -//%DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, OBJECT, object) +//%DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, OBJECT, Object, object) -//%PDDM-DEFINE DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, HELPER, VNAME) +//%PDDM-DEFINE DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, HELPER, VNAME, VNAME_VAR) //%#pragma mark - Bool -> VALUE_NAME //% //%@implementation GPBBool##VALUE_NAME##Dictionary { @@ -967,24 +969,24 @@ void GPBDictionaryReadEntry(id mapDictionary, //%BOOL_DICT_HAS_STORAGE_##HELPER()} //% //%+ (instancetype)dictionary { -//% return [[[self alloc] initWith##VNAME$u##s:NULL forKeys:NULL count:0] autorelease]; +//% return [[[self alloc] initWith##VNAME##s:NULL forKeys:NULL count:0] autorelease]; //%} //% -//%+ (instancetype)dictionaryWith##VNAME$u##:(VALUE_TYPE)VNAME +//%+ (instancetype)dictionaryWith##VNAME##:(VALUE_TYPE)VNAME_VAR //% ##VNAME$S## forKey:(BOOL)key { -//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME$u##s:forKeys:count: +//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME##s:forKeys:count: //% // on to get the type correct. -//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME$u##s:&##VNAME +//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME##s:&##VNAME_VAR //% VALUE_NAME$S ##VNAME$S## forKeys:&key //% VALUE_NAME$S ##VNAME$S## count:1] autorelease]; //%} //% -//%+ (instancetype)dictionaryWith##VNAME$u##s:(const VALUE_TYPE [])##VNAME##s +//%+ (instancetype)dictionaryWith##VNAME##s:(const VALUE_TYPE [])##VNAME_VAR##s //% ##VNAME$S## forKeys:(const BOOL [])keys //% ##VNAME$S## count:(NSUInteger)count { -//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME$u##s:forKeys:count: +//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME##s:forKeys:count: //% // on to get the type correct. -//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME$u##s:##VNAME##s +//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME##s:##VNAME_VAR##s //% VALUE_NAME$S ##VNAME$S## forKeys:keys //% VALUE_NAME$S ##VNAME$S## count:count] autorelease]; //%} @@ -1000,14 +1002,14 @@ void GPBDictionaryReadEntry(id mapDictionary, //%} //% //%- (instancetype)init { -//% return [self initWith##VNAME$u##s:NULL forKeys:NULL count:0]; +//% return [self initWith##VNAME##s:NULL forKeys:NULL count:0]; //%} //% //%BOOL_DICT_INITS_##HELPER(VALUE_NAME, VALUE_TYPE) //% //%- (instancetype)initWithCapacity:(NSUInteger)numItems { //% #pragma unused(numItems) -//% return [self initWith##VNAME$u##s:NULL forKeys:NULL count:0]; +//% return [self initWith##VNAME##s:NULL forKeys:NULL count:0]; //%} //% //%BOOL_DICT_DEALLOC##HELPER() @@ -1055,7 +1057,7 @@ void GPBDictionaryReadEntry(id mapDictionary, //% return (BOOL_DICT_W_HAS##HELPER(0, ) ? 1 : 0) + (BOOL_DICT_W_HAS##HELPER(1, ) ? 1 : 0); //%} //% -//%BOOL_VALUE_FOR_KEY_##HELPER(VALUE_TYPE) +//%BOOL_VALUE_FOR_KEY_##HELPER(VALUE_NAME, VALUE_TYPE) //% //%BOOL_SET_GPBVALUE_FOR_KEY_##HELPER(VALUE_NAME, VALUE_TYPE, VisP) //% @@ -1068,8 +1070,8 @@ void GPBDictionaryReadEntry(id mapDictionary, //% } //%} //% -//%- (void)enumerateKeysAnd##VNAME$u##sUsingBlock: -//% (void (^)(BOOL key, VALUE_TYPE VNAME, BOOL *stop))block { +//%- (void)enumerateKeysAnd##VNAME##sUsingBlock: +//% (void (^)(BOOL key, VALUE_TYPE VNAME_VAR, BOOL *stop))block { //% BOOL stop = NO; //% if (BOOL_DICT_HAS##HELPER(0, )) { //% block(NO, _values[0], &stop); @@ -1126,7 +1128,7 @@ void GPBDictionaryReadEntry(id mapDictionary, // //%PDDM-DEFINE VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_NAME, VALUE_TYPE, KHELPER) -//%- (BOOL)valueForKey:(KEY_TYPE)key value:(VALUE_TYPE *)value { +//%- (BOOL)get##VALUE_NAME##:(nullable VALUE_TYPE *)value forKey:(KEY_TYPE)key { //% NSNumber *wrapped = [_dictionary objectForKey:WRAPPED##KHELPER(key)]; //% if (wrapped && value) { //% *value = UNWRAP##VALUE_NAME(wrapped); @@ -1216,9 +1218,9 @@ void GPBDictionaryReadEntry(id mapDictionary, //% BOOL _valueSet[2]; //% //%PDDM-DEFINE BOOL_DICT_INITS_POD(VALUE_NAME, VALUE_TYPE) -//%- (instancetype)initWithValues:(const VALUE_TYPE [])values -//% forKeys:(const BOOL [])keys -//% count:(NSUInteger)count { +//%- (instancetype)initWith##VALUE_NAME##s:(const VALUE_TYPE [])values +//% ##VALUE_NAME$S## forKeys:(const BOOL [])keys +//% ##VALUE_NAME$S## count:(NSUInteger)count { //% self = [super init]; //% if (self) { //% for (NSUInteger i = 0; i < count; ++i) { @@ -1231,7 +1233,7 @@ void GPBDictionaryReadEntry(id mapDictionary, //%} //% //%- (instancetype)initWithDictionary:(GPBBool##VALUE_NAME##Dictionary *)dictionary { -//% self = [self initWithValues:NULL forKeys:NULL count:0]; +//% self = [self initWith##VALUE_NAME##s:NULL forKeys:NULL count:0]; //% if (self) { //% if (dictionary) { //% for (int i = 0; i < 2; ++i) { @@ -1257,8 +1259,8 @@ void GPBDictionaryReadEntry(id mapDictionary, //%BOOL_DICT_HASPOD(IDX, REF) //%PDDM-DEFINE BOOL_DICT_HASPOD(IDX, REF) //%REF##_valueSet[IDX] -//%PDDM-DEFINE BOOL_VALUE_FOR_KEY_POD(VALUE_TYPE) -//%- (BOOL)valueForKey:(BOOL)key value:(VALUE_TYPE *)value { +//%PDDM-DEFINE BOOL_VALUE_FOR_KEY_POD(VALUE_NAME, VALUE_TYPE) +//%- (BOOL)get##VALUE_NAME##:(VALUE_TYPE *)value forKey:(BOOL)key { //% int idx = (key ? 1 : 0); //% if (_valueSet[idx]) { //% if (value) { @@ -1290,7 +1292,7 @@ void GPBDictionaryReadEntry(id mapDictionary, //% } //%} //% -//%- (void)setValue:(VALUE_TYPE)value forKey:(BOOL)key { +//%- (void)set##VALUE_NAME:(VALUE_TYPE)value forKey:(BOOL)key { //% int idx = (key ? 1 : 0); //% _values[idx] = value; //% _valueSet[idx] = YES; @@ -1299,7 +1301,7 @@ void GPBDictionaryReadEntry(id mapDictionary, //% } //%} //% -//%- (void)removeValueForKey:(BOOL)aKey { +//%- (void)remove##VALUE_NAME##ForKey:(BOOL)aKey { //% _valueSet[aKey ? 1 : 0] = NO; //%} //% @@ -1460,7 +1462,7 @@ void GPBDictionaryReadEntry(id mapDictionary, //%(BOOL_DICT_HASOBJECT(IDX, REF)) //%PDDM-DEFINE BOOL_DICT_HASOBJECT(IDX, REF) //%REF##_values[IDX] != nil -//%PDDM-DEFINE BOOL_VALUE_FOR_KEY_OBJECT(VALUE_TYPE) +//%PDDM-DEFINE BOOL_VALUE_FOR_KEY_OBJECT(VALUE_NAME, VALUE_TYPE) //%- (VALUE_TYPE)objectForKey:(BOOL)key { //% return _values[key ? 1 : 0]; //%} @@ -1527,24 +1529,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithUInt32s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(uint32_t)value - forKey:(uint32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt32:(uint32_t)value + forKey:(uint32_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count: // on to get the type correct. - return [[(GPBUInt32UInt32Dictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBUInt32UInt32Dictionary*)[self alloc] initWithUInt32s:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const uint32_t [])values - forKeys:(const uint32_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values + forKeys:(const uint32_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count: // on to get the type correct. - return [[(GPBUInt32UInt32Dictionary*)[self alloc] initWithValues:values + return [[(GPBUInt32UInt32Dictionary*)[self alloc] initWithUInt32s:values forKeys:keys count:count] autorelease]; } @@ -1560,12 +1562,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt32s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const uint32_t [])values - forKeys:(const uint32_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithUInt32s:(const uint32_t [])values + forKeys:(const uint32_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -1579,7 +1581,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithUInt32s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -1590,7 +1592,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt32s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -1628,7 +1630,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndUInt32sUsingBlock: (void (^)(uint32_t key, uint32_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -1686,13 +1688,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint32_t key, uint32_t value, BOOL *stop) { + [self enumerateKeysAndUInt32sUsingBlock:^(uint32_t key, uint32_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%u", key], [NSString stringWithFormat:@"%u", value]); }]; } -- (BOOL)valueForKey:(uint32_t)key value:(uint32_t *)value { +- (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped unsignedIntValue]; @@ -1709,14 +1711,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(uint32_t)value forKey:(uint32_t)key { +- (void)setUInt32:(uint32_t)value forKey:(uint32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint32_t)aKey { +- (void)removeUInt32ForKey:(uint32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -1734,24 +1736,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithInt32s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(int32_t)value ++ (instancetype)dictionaryWithInt32:(int32_t)value forKey:(uint32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count: // on to get the type correct. - return [[(GPBUInt32Int32Dictionary*)[self alloc] initWithValues:&value + return [[(GPBUInt32Int32Dictionary*)[self alloc] initWithInt32s:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const int32_t [])values ++ (instancetype)dictionaryWithInt32s:(const int32_t [])values forKeys:(const uint32_t [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count: // on to get the type correct. - return [[(GPBUInt32Int32Dictionary*)[self alloc] initWithValues:values + return [[(GPBUInt32Int32Dictionary*)[self alloc] initWithInt32s:values forKeys:keys count:count] autorelease]; } @@ -1767,10 +1769,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt32s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const int32_t [])values +- (instancetype)initWithInt32s:(const int32_t [])values forKeys:(const uint32_t [])keys count:(NSUInteger)count { self = [super init]; @@ -1786,7 +1788,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt32Int32Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithInt32s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -1797,7 +1799,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt32s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -1835,7 +1837,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndInt32sUsingBlock: (void (^)(uint32_t key, int32_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -1893,13 +1895,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint32_t key, int32_t value, BOOL *stop) { + [self enumerateKeysAndInt32sUsingBlock:^(uint32_t key, int32_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%u", key], [NSString stringWithFormat:@"%d", value]); }]; } -- (BOOL)valueForKey:(uint32_t)key value:(int32_t *)value { +- (BOOL)getInt32:(nullable int32_t *)value forKey:(uint32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped intValue]; @@ -1916,14 +1918,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(int32_t)value forKey:(uint32_t)key { +- (void)setInt32:(int32_t)value forKey:(uint32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint32_t)aKey { +- (void)removeInt32ForKey:(uint32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -1941,24 +1943,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithUInt64s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(uint64_t)value - forKey:(uint32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt64:(uint64_t)value + forKey:(uint32_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count: // on to get the type correct. - return [[(GPBUInt32UInt64Dictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBUInt32UInt64Dictionary*)[self alloc] initWithUInt64s:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const uint64_t [])values - forKeys:(const uint32_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values + forKeys:(const uint32_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count: // on to get the type correct. - return [[(GPBUInt32UInt64Dictionary*)[self alloc] initWithValues:values + return [[(GPBUInt32UInt64Dictionary*)[self alloc] initWithUInt64s:values forKeys:keys count:count] autorelease]; } @@ -1974,12 +1976,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt64s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const uint64_t [])values - forKeys:(const uint32_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithUInt64s:(const uint64_t [])values + forKeys:(const uint32_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -1993,7 +1995,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithUInt64s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -2004,7 +2006,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt64s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -2042,7 +2044,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndUInt64sUsingBlock: (void (^)(uint32_t key, uint64_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -2100,13 +2102,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint32_t key, uint64_t value, BOOL *stop) { + [self enumerateKeysAndUInt64sUsingBlock:^(uint32_t key, uint64_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%u", key], [NSString stringWithFormat:@"%llu", value]); }]; } -- (BOOL)valueForKey:(uint32_t)key value:(uint64_t *)value { +- (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped unsignedLongLongValue]; @@ -2123,14 +2125,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(uint64_t)value forKey:(uint32_t)key { +- (void)setUInt64:(uint64_t)value forKey:(uint32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint32_t)aKey { +- (void)removeUInt64ForKey:(uint32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -2148,24 +2150,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithInt64s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(int64_t)value ++ (instancetype)dictionaryWithInt64:(int64_t)value forKey:(uint32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count: // on to get the type correct. - return [[(GPBUInt32Int64Dictionary*)[self alloc] initWithValues:&value + return [[(GPBUInt32Int64Dictionary*)[self alloc] initWithInt64s:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const int64_t [])values ++ (instancetype)dictionaryWithInt64s:(const int64_t [])values forKeys:(const uint32_t [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count: // on to get the type correct. - return [[(GPBUInt32Int64Dictionary*)[self alloc] initWithValues:values + return [[(GPBUInt32Int64Dictionary*)[self alloc] initWithInt64s:values forKeys:keys count:count] autorelease]; } @@ -2181,10 +2183,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt64s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const int64_t [])values +- (instancetype)initWithInt64s:(const int64_t [])values forKeys:(const uint32_t [])keys count:(NSUInteger)count { self = [super init]; @@ -2200,7 +2202,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt32Int64Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithInt64s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -2211,7 +2213,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt64s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -2249,7 +2251,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndInt64sUsingBlock: (void (^)(uint32_t key, int64_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -2307,13 +2309,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint32_t key, int64_t value, BOOL *stop) { + [self enumerateKeysAndInt64sUsingBlock:^(uint32_t key, int64_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%u", key], [NSString stringWithFormat:@"%lld", value]); }]; } -- (BOOL)valueForKey:(uint32_t)key value:(int64_t *)value { +- (BOOL)getInt64:(nullable int64_t *)value forKey:(uint32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped longLongValue]; @@ -2330,14 +2332,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(int64_t)value forKey:(uint32_t)key { +- (void)setInt64:(int64_t)value forKey:(uint32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint32_t)aKey { +- (void)removeInt64ForKey:(uint32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -2355,24 +2357,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithBools:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(BOOL)value - forKey:(uint32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithBool:(BOOL)value + forKey:(uint32_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count: // on to get the type correct. - return [[(GPBUInt32BoolDictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBUInt32BoolDictionary*)[self alloc] initWithBools:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const BOOL [])values - forKeys:(const uint32_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithBools:(const BOOL [])values + forKeys:(const uint32_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count: // on to get the type correct. - return [[(GPBUInt32BoolDictionary*)[self alloc] initWithValues:values + return [[(GPBUInt32BoolDictionary*)[self alloc] initWithBools:values forKeys:keys count:count] autorelease]; } @@ -2388,12 +2390,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithBools:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const BOOL [])values - forKeys:(const uint32_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithBools:(const BOOL [])values + forKeys:(const uint32_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -2407,7 +2409,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt32BoolDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithBools:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -2418,7 +2420,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithBools:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -2456,7 +2458,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndBoolsUsingBlock: (void (^)(uint32_t key, BOOL value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -2514,13 +2516,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint32_t key, BOOL value, BOOL *stop) { + [self enumerateKeysAndBoolsUsingBlock:^(uint32_t key, BOOL value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%u", key], (value ? @"true" : @"false")); }]; } -- (BOOL)valueForKey:(uint32_t)key value:(BOOL *)value { +- (BOOL)getBool:(nullable BOOL *)value forKey:(uint32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped boolValue]; @@ -2537,14 +2539,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(BOOL)value forKey:(uint32_t)key { +- (void)setBool:(BOOL)value forKey:(uint32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint32_t)aKey { +- (void)removeBoolForKey:(uint32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -2562,24 +2564,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithFloats:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(float)value ++ (instancetype)dictionaryWithFloat:(float)value forKey:(uint32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count: // on to get the type correct. - return [[(GPBUInt32FloatDictionary*)[self alloc] initWithValues:&value + return [[(GPBUInt32FloatDictionary*)[self alloc] initWithFloats:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const float [])values ++ (instancetype)dictionaryWithFloats:(const float [])values forKeys:(const uint32_t [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count: // on to get the type correct. - return [[(GPBUInt32FloatDictionary*)[self alloc] initWithValues:values + return [[(GPBUInt32FloatDictionary*)[self alloc] initWithFloats:values forKeys:keys count:count] autorelease]; } @@ -2595,10 +2597,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithFloats:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const float [])values +- (instancetype)initWithFloats:(const float [])values forKeys:(const uint32_t [])keys count:(NSUInteger)count { self = [super init]; @@ -2614,7 +2616,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt32FloatDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithFloats:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -2625,7 +2627,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithFloats:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -2663,7 +2665,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndFloatsUsingBlock: (void (^)(uint32_t key, float value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -2721,13 +2723,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint32_t key, float value, BOOL *stop) { + [self enumerateKeysAndFloatsUsingBlock:^(uint32_t key, float value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%u", key], [NSString stringWithFormat:@"%.*g", FLT_DIG, value]); }]; } -- (BOOL)valueForKey:(uint32_t)key value:(float *)value { +- (BOOL)getFloat:(nullable float *)value forKey:(uint32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped floatValue]; @@ -2744,14 +2746,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(float)value forKey:(uint32_t)key { +- (void)setFloat:(float)value forKey:(uint32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint32_t)aKey { +- (void)removeFloatForKey:(uint32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -2769,24 +2771,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithDoubles:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(double)value - forKey:(uint32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithDouble:(double)value + forKey:(uint32_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count: // on to get the type correct. - return [[(GPBUInt32DoubleDictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBUInt32DoubleDictionary*)[self alloc] initWithDoubles:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const double [])values - forKeys:(const uint32_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithDoubles:(const double [])values + forKeys:(const uint32_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count: // on to get the type correct. - return [[(GPBUInt32DoubleDictionary*)[self alloc] initWithValues:values + return [[(GPBUInt32DoubleDictionary*)[self alloc] initWithDoubles:values forKeys:keys count:count] autorelease]; } @@ -2802,12 +2804,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithDoubles:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const double [])values - forKeys:(const uint32_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithDoubles:(const double [])values + forKeys:(const uint32_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -2821,7 +2823,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt32DoubleDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithDoubles:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -2832,7 +2834,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithDoubles:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -2870,7 +2872,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndDoublesUsingBlock: (void (^)(uint32_t key, double value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -2928,13 +2930,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint32_t key, double value, BOOL *stop) { + [self enumerateKeysAndDoublesUsingBlock:^(uint32_t key, double value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%u", key], [NSString stringWithFormat:@"%.*lg", DBL_DIG, value]); }]; } -- (BOOL)valueForKey:(uint32_t)key value:(double *)value { +- (BOOL)getDouble:(nullable double *)value forKey:(uint32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped doubleValue]; @@ -2951,14 +2953,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(double)value forKey:(uint32_t)key { +- (void)setDouble:(double)value forKey:(uint32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint32_t)aKey { +- (void)removeDoubleForKey:(uint32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -3181,7 +3183,7 @@ void GPBDictionaryReadEntry(id mapDictionary, }]; } -- (BOOL)valueForKey:(uint32_t)key value:(int32_t *)value { +- (BOOL)getEnum:(int32_t *)value forKey:(uint32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { int32_t result = [wrapped intValue]; @@ -3193,7 +3195,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (wrapped != NULL); } -- (BOOL)valueForKey:(uint32_t)key rawValue:(int32_t *)rawValue { +- (BOOL)getRawValue:(int32_t *)rawValue forKey:(uint32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && rawValue) { *rawValue = [wrapped intValue]; @@ -3201,7 +3203,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (wrapped != NULL); } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndEnumsUsingBlock: (void (^)(uint32_t key, int32_t value, BOOL *stop))block { GPBEnumValidationFunc func = _validationFunc; [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, @@ -3231,7 +3233,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(uint32_t)aKey { +- (void)removeEnumForKey:(uint32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -3239,7 +3241,7 @@ void GPBDictionaryReadEntry(id mapDictionary, [_dictionary removeAllObjects]; } -- (void)setValue:(int32_t)value forKey:(uint32_t)key { +- (void)setEnum:(int32_t)value forKey:(uint32_t)key { if (!_validationFunc(value)) { [NSException raise:NSInvalidArgumentException format:@"GPBUInt32EnumDictionary: Attempt to set an unknown enum value (%d)", @@ -3500,24 +3502,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithUInt32s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(uint32_t)value - forKey:(int32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt32:(uint32_t)value + forKey:(int32_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count: // on to get the type correct. - return [[(GPBInt32UInt32Dictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBInt32UInt32Dictionary*)[self alloc] initWithUInt32s:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const uint32_t [])values - forKeys:(const int32_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values + forKeys:(const int32_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count: // on to get the type correct. - return [[(GPBInt32UInt32Dictionary*)[self alloc] initWithValues:values + return [[(GPBInt32UInt32Dictionary*)[self alloc] initWithUInt32s:values forKeys:keys count:count] autorelease]; } @@ -3533,12 +3535,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt32s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const uint32_t [])values - forKeys:(const int32_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithUInt32s:(const uint32_t [])values + forKeys:(const int32_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -3552,7 +3554,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt32UInt32Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithUInt32s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -3563,7 +3565,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt32s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -3601,7 +3603,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndUInt32sUsingBlock: (void (^)(int32_t key, uint32_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -3659,13 +3661,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int32_t key, uint32_t value, BOOL *stop) { + [self enumerateKeysAndUInt32sUsingBlock:^(int32_t key, uint32_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%d", key], [NSString stringWithFormat:@"%u", value]); }]; } -- (BOOL)valueForKey:(int32_t)key value:(uint32_t *)value { +- (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped unsignedIntValue]; @@ -3682,14 +3684,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(uint32_t)value forKey:(int32_t)key { +- (void)setUInt32:(uint32_t)value forKey:(int32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int32_t)aKey { +- (void)removeUInt32ForKey:(int32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -3707,24 +3709,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithInt32s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(int32_t)value ++ (instancetype)dictionaryWithInt32:(int32_t)value forKey:(int32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count: // on to get the type correct. - return [[(GPBInt32Int32Dictionary*)[self alloc] initWithValues:&value + return [[(GPBInt32Int32Dictionary*)[self alloc] initWithInt32s:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const int32_t [])values ++ (instancetype)dictionaryWithInt32s:(const int32_t [])values forKeys:(const int32_t [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count: // on to get the type correct. - return [[(GPBInt32Int32Dictionary*)[self alloc] initWithValues:values + return [[(GPBInt32Int32Dictionary*)[self alloc] initWithInt32s:values forKeys:keys count:count] autorelease]; } @@ -3740,10 +3742,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt32s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const int32_t [])values +- (instancetype)initWithInt32s:(const int32_t [])values forKeys:(const int32_t [])keys count:(NSUInteger)count { self = [super init]; @@ -3759,7 +3761,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt32Int32Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithInt32s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -3770,7 +3772,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt32s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -3808,7 +3810,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndInt32sUsingBlock: (void (^)(int32_t key, int32_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -3866,13 +3868,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int32_t key, int32_t value, BOOL *stop) { + [self enumerateKeysAndInt32sUsingBlock:^(int32_t key, int32_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%d", key], [NSString stringWithFormat:@"%d", value]); }]; } -- (BOOL)valueForKey:(int32_t)key value:(int32_t *)value { +- (BOOL)getInt32:(nullable int32_t *)value forKey:(int32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped intValue]; @@ -3889,14 +3891,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(int32_t)value forKey:(int32_t)key { +- (void)setInt32:(int32_t)value forKey:(int32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int32_t)aKey { +- (void)removeInt32ForKey:(int32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -3914,24 +3916,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithUInt64s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(uint64_t)value - forKey:(int32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt64:(uint64_t)value + forKey:(int32_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count: // on to get the type correct. - return [[(GPBInt32UInt64Dictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBInt32UInt64Dictionary*)[self alloc] initWithUInt64s:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const uint64_t [])values - forKeys:(const int32_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values + forKeys:(const int32_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count: // on to get the type correct. - return [[(GPBInt32UInt64Dictionary*)[self alloc] initWithValues:values + return [[(GPBInt32UInt64Dictionary*)[self alloc] initWithUInt64s:values forKeys:keys count:count] autorelease]; } @@ -3947,12 +3949,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt64s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const uint64_t [])values - forKeys:(const int32_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithUInt64s:(const uint64_t [])values + forKeys:(const int32_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -3966,7 +3968,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt32UInt64Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithUInt64s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -3977,7 +3979,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt64s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -4015,7 +4017,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndUInt64sUsingBlock: (void (^)(int32_t key, uint64_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -4073,13 +4075,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int32_t key, uint64_t value, BOOL *stop) { + [self enumerateKeysAndUInt64sUsingBlock:^(int32_t key, uint64_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%d", key], [NSString stringWithFormat:@"%llu", value]); }]; } -- (BOOL)valueForKey:(int32_t)key value:(uint64_t *)value { +- (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped unsignedLongLongValue]; @@ -4096,14 +4098,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(uint64_t)value forKey:(int32_t)key { +- (void)setUInt64:(uint64_t)value forKey:(int32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int32_t)aKey { +- (void)removeUInt64ForKey:(int32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -4121,24 +4123,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithInt64s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(int64_t)value ++ (instancetype)dictionaryWithInt64:(int64_t)value forKey:(int32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count: // on to get the type correct. - return [[(GPBInt32Int64Dictionary*)[self alloc] initWithValues:&value + return [[(GPBInt32Int64Dictionary*)[self alloc] initWithInt64s:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const int64_t [])values ++ (instancetype)dictionaryWithInt64s:(const int64_t [])values forKeys:(const int32_t [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count: // on to get the type correct. - return [[(GPBInt32Int64Dictionary*)[self alloc] initWithValues:values + return [[(GPBInt32Int64Dictionary*)[self alloc] initWithInt64s:values forKeys:keys count:count] autorelease]; } @@ -4154,10 +4156,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt64s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const int64_t [])values +- (instancetype)initWithInt64s:(const int64_t [])values forKeys:(const int32_t [])keys count:(NSUInteger)count { self = [super init]; @@ -4173,7 +4175,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt32Int64Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithInt64s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -4184,7 +4186,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt64s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -4222,7 +4224,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndInt64sUsingBlock: (void (^)(int32_t key, int64_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -4280,13 +4282,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int32_t key, int64_t value, BOOL *stop) { + [self enumerateKeysAndInt64sUsingBlock:^(int32_t key, int64_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%d", key], [NSString stringWithFormat:@"%lld", value]); }]; } -- (BOOL)valueForKey:(int32_t)key value:(int64_t *)value { +- (BOOL)getInt64:(nullable int64_t *)value forKey:(int32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped longLongValue]; @@ -4303,14 +4305,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(int64_t)value forKey:(int32_t)key { +- (void)setInt64:(int64_t)value forKey:(int32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int32_t)aKey { +- (void)removeInt64ForKey:(int32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -4328,24 +4330,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithBools:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(BOOL)value - forKey:(int32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithBool:(BOOL)value + forKey:(int32_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count: // on to get the type correct. - return [[(GPBInt32BoolDictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBInt32BoolDictionary*)[self alloc] initWithBools:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const BOOL [])values - forKeys:(const int32_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithBools:(const BOOL [])values + forKeys:(const int32_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count: // on to get the type correct. - return [[(GPBInt32BoolDictionary*)[self alloc] initWithValues:values + return [[(GPBInt32BoolDictionary*)[self alloc] initWithBools:values forKeys:keys count:count] autorelease]; } @@ -4361,12 +4363,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithBools:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const BOOL [])values - forKeys:(const int32_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithBools:(const BOOL [])values + forKeys:(const int32_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -4380,7 +4382,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt32BoolDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithBools:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -4391,7 +4393,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithBools:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -4429,7 +4431,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndBoolsUsingBlock: (void (^)(int32_t key, BOOL value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -4487,13 +4489,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int32_t key, BOOL value, BOOL *stop) { + [self enumerateKeysAndBoolsUsingBlock:^(int32_t key, BOOL value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%d", key], (value ? @"true" : @"false")); }]; } -- (BOOL)valueForKey:(int32_t)key value:(BOOL *)value { +- (BOOL)getBool:(nullable BOOL *)value forKey:(int32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped boolValue]; @@ -4510,14 +4512,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(BOOL)value forKey:(int32_t)key { +- (void)setBool:(BOOL)value forKey:(int32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int32_t)aKey { +- (void)removeBoolForKey:(int32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -4535,24 +4537,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithFloats:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(float)value ++ (instancetype)dictionaryWithFloat:(float)value forKey:(int32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count: // on to get the type correct. - return [[(GPBInt32FloatDictionary*)[self alloc] initWithValues:&value + return [[(GPBInt32FloatDictionary*)[self alloc] initWithFloats:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const float [])values ++ (instancetype)dictionaryWithFloats:(const float [])values forKeys:(const int32_t [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count: // on to get the type correct. - return [[(GPBInt32FloatDictionary*)[self alloc] initWithValues:values + return [[(GPBInt32FloatDictionary*)[self alloc] initWithFloats:values forKeys:keys count:count] autorelease]; } @@ -4568,10 +4570,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithFloats:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const float [])values +- (instancetype)initWithFloats:(const float [])values forKeys:(const int32_t [])keys count:(NSUInteger)count { self = [super init]; @@ -4587,7 +4589,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt32FloatDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithFloats:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -4598,7 +4600,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithFloats:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -4636,7 +4638,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndFloatsUsingBlock: (void (^)(int32_t key, float value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -4694,13 +4696,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int32_t key, float value, BOOL *stop) { + [self enumerateKeysAndFloatsUsingBlock:^(int32_t key, float value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%d", key], [NSString stringWithFormat:@"%.*g", FLT_DIG, value]); }]; } -- (BOOL)valueForKey:(int32_t)key value:(float *)value { +- (BOOL)getFloat:(nullable float *)value forKey:(int32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped floatValue]; @@ -4717,14 +4719,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(float)value forKey:(int32_t)key { +- (void)setFloat:(float)value forKey:(int32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int32_t)aKey { +- (void)removeFloatForKey:(int32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -4742,24 +4744,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithDoubles:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(double)value - forKey:(int32_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithDouble:(double)value + forKey:(int32_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count: // on to get the type correct. - return [[(GPBInt32DoubleDictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBInt32DoubleDictionary*)[self alloc] initWithDoubles:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const double [])values - forKeys:(const int32_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithDoubles:(const double [])values + forKeys:(const int32_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count: // on to get the type correct. - return [[(GPBInt32DoubleDictionary*)[self alloc] initWithValues:values + return [[(GPBInt32DoubleDictionary*)[self alloc] initWithDoubles:values forKeys:keys count:count] autorelease]; } @@ -4775,12 +4777,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithDoubles:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const double [])values - forKeys:(const int32_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithDoubles:(const double [])values + forKeys:(const int32_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -4794,7 +4796,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt32DoubleDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithDoubles:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -4805,7 +4807,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithDoubles:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -4843,7 +4845,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndDoublesUsingBlock: (void (^)(int32_t key, double value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -4901,13 +4903,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int32_t key, double value, BOOL *stop) { + [self enumerateKeysAndDoublesUsingBlock:^(int32_t key, double value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%d", key], [NSString stringWithFormat:@"%.*lg", DBL_DIG, value]); }]; } -- (BOOL)valueForKey:(int32_t)key value:(double *)value { +- (BOOL)getDouble:(nullable double *)value forKey:(int32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped doubleValue]; @@ -4924,14 +4926,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(double)value forKey:(int32_t)key { +- (void)setDouble:(double)value forKey:(int32_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int32_t)aKey { +- (void)removeDoubleForKey:(int32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -5154,7 +5156,7 @@ void GPBDictionaryReadEntry(id mapDictionary, }]; } -- (BOOL)valueForKey:(int32_t)key value:(int32_t *)value { +- (BOOL)getEnum:(int32_t *)value forKey:(int32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { int32_t result = [wrapped intValue]; @@ -5166,7 +5168,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (wrapped != NULL); } -- (BOOL)valueForKey:(int32_t)key rawValue:(int32_t *)rawValue { +- (BOOL)getRawValue:(int32_t *)rawValue forKey:(int32_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && rawValue) { *rawValue = [wrapped intValue]; @@ -5174,7 +5176,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (wrapped != NULL); } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndEnumsUsingBlock: (void (^)(int32_t key, int32_t value, BOOL *stop))block { GPBEnumValidationFunc func = _validationFunc; [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, @@ -5204,7 +5206,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(int32_t)aKey { +- (void)removeEnumForKey:(int32_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -5212,7 +5214,7 @@ void GPBDictionaryReadEntry(id mapDictionary, [_dictionary removeAllObjects]; } -- (void)setValue:(int32_t)value forKey:(int32_t)key { +- (void)setEnum:(int32_t)value forKey:(int32_t)key { if (!_validationFunc(value)) { [NSException raise:NSInvalidArgumentException format:@"GPBInt32EnumDictionary: Attempt to set an unknown enum value (%d)", @@ -5473,24 +5475,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithUInt32s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(uint32_t)value - forKey:(uint64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt32:(uint32_t)value + forKey:(uint64_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count: // on to get the type correct. - return [[(GPBUInt64UInt32Dictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBUInt64UInt32Dictionary*)[self alloc] initWithUInt32s:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const uint32_t [])values - forKeys:(const uint64_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values + forKeys:(const uint64_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count: // on to get the type correct. - return [[(GPBUInt64UInt32Dictionary*)[self alloc] initWithValues:values + return [[(GPBUInt64UInt32Dictionary*)[self alloc] initWithUInt32s:values forKeys:keys count:count] autorelease]; } @@ -5506,12 +5508,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt32s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const uint32_t [])values - forKeys:(const uint64_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithUInt32s:(const uint32_t [])values + forKeys:(const uint64_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -5525,7 +5527,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithUInt32s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -5536,7 +5538,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt32s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -5574,7 +5576,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndUInt32sUsingBlock: (void (^)(uint64_t key, uint32_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -5632,13 +5634,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint64_t key, uint32_t value, BOOL *stop) { + [self enumerateKeysAndUInt32sUsingBlock:^(uint64_t key, uint32_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%llu", key], [NSString stringWithFormat:@"%u", value]); }]; } -- (BOOL)valueForKey:(uint64_t)key value:(uint32_t *)value { +- (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped unsignedIntValue]; @@ -5655,14 +5657,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(uint32_t)value forKey:(uint64_t)key { +- (void)setUInt32:(uint32_t)value forKey:(uint64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint64_t)aKey { +- (void)removeUInt32ForKey:(uint64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -5680,24 +5682,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithInt32s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(int32_t)value ++ (instancetype)dictionaryWithInt32:(int32_t)value forKey:(uint64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count: // on to get the type correct. - return [[(GPBUInt64Int32Dictionary*)[self alloc] initWithValues:&value + return [[(GPBUInt64Int32Dictionary*)[self alloc] initWithInt32s:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const int32_t [])values ++ (instancetype)dictionaryWithInt32s:(const int32_t [])values forKeys:(const uint64_t [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count: // on to get the type correct. - return [[(GPBUInt64Int32Dictionary*)[self alloc] initWithValues:values + return [[(GPBUInt64Int32Dictionary*)[self alloc] initWithInt32s:values forKeys:keys count:count] autorelease]; } @@ -5713,10 +5715,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt32s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const int32_t [])values +- (instancetype)initWithInt32s:(const int32_t [])values forKeys:(const uint64_t [])keys count:(NSUInteger)count { self = [super init]; @@ -5732,7 +5734,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt64Int32Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithInt32s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -5743,7 +5745,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt32s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -5781,7 +5783,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndInt32sUsingBlock: (void (^)(uint64_t key, int32_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -5839,13 +5841,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint64_t key, int32_t value, BOOL *stop) { + [self enumerateKeysAndInt32sUsingBlock:^(uint64_t key, int32_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%llu", key], [NSString stringWithFormat:@"%d", value]); }]; } -- (BOOL)valueForKey:(uint64_t)key value:(int32_t *)value { +- (BOOL)getInt32:(nullable int32_t *)value forKey:(uint64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped intValue]; @@ -5862,14 +5864,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(int32_t)value forKey:(uint64_t)key { +- (void)setInt32:(int32_t)value forKey:(uint64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint64_t)aKey { +- (void)removeInt32ForKey:(uint64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -5887,24 +5889,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithUInt64s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(uint64_t)value - forKey:(uint64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt64:(uint64_t)value + forKey:(uint64_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count: // on to get the type correct. - return [[(GPBUInt64UInt64Dictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBUInt64UInt64Dictionary*)[self alloc] initWithUInt64s:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const uint64_t [])values - forKeys:(const uint64_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values + forKeys:(const uint64_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count: // on to get the type correct. - return [[(GPBUInt64UInt64Dictionary*)[self alloc] initWithValues:values + return [[(GPBUInt64UInt64Dictionary*)[self alloc] initWithUInt64s:values forKeys:keys count:count] autorelease]; } @@ -5920,12 +5922,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt64s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const uint64_t [])values - forKeys:(const uint64_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithUInt64s:(const uint64_t [])values + forKeys:(const uint64_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -5939,7 +5941,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithUInt64s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -5950,7 +5952,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt64s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -5988,7 +5990,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndUInt64sUsingBlock: (void (^)(uint64_t key, uint64_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -6046,13 +6048,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint64_t key, uint64_t value, BOOL *stop) { + [self enumerateKeysAndUInt64sUsingBlock:^(uint64_t key, uint64_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%llu", key], [NSString stringWithFormat:@"%llu", value]); }]; } -- (BOOL)valueForKey:(uint64_t)key value:(uint64_t *)value { +- (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped unsignedLongLongValue]; @@ -6069,14 +6071,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(uint64_t)value forKey:(uint64_t)key { +- (void)setUInt64:(uint64_t)value forKey:(uint64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint64_t)aKey { +- (void)removeUInt64ForKey:(uint64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -6094,24 +6096,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithInt64s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(int64_t)value ++ (instancetype)dictionaryWithInt64:(int64_t)value forKey:(uint64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count: // on to get the type correct. - return [[(GPBUInt64Int64Dictionary*)[self alloc] initWithValues:&value + return [[(GPBUInt64Int64Dictionary*)[self alloc] initWithInt64s:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const int64_t [])values ++ (instancetype)dictionaryWithInt64s:(const int64_t [])values forKeys:(const uint64_t [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count: // on to get the type correct. - return [[(GPBUInt64Int64Dictionary*)[self alloc] initWithValues:values + return [[(GPBUInt64Int64Dictionary*)[self alloc] initWithInt64s:values forKeys:keys count:count] autorelease]; } @@ -6127,10 +6129,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt64s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const int64_t [])values +- (instancetype)initWithInt64s:(const int64_t [])values forKeys:(const uint64_t [])keys count:(NSUInteger)count { self = [super init]; @@ -6146,7 +6148,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt64Int64Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithInt64s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -6157,7 +6159,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt64s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -6195,7 +6197,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndInt64sUsingBlock: (void (^)(uint64_t key, int64_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -6253,13 +6255,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint64_t key, int64_t value, BOOL *stop) { + [self enumerateKeysAndInt64sUsingBlock:^(uint64_t key, int64_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%llu", key], [NSString stringWithFormat:@"%lld", value]); }]; } -- (BOOL)valueForKey:(uint64_t)key value:(int64_t *)value { +- (BOOL)getInt64:(nullable int64_t *)value forKey:(uint64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped longLongValue]; @@ -6276,14 +6278,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(int64_t)value forKey:(uint64_t)key { +- (void)setInt64:(int64_t)value forKey:(uint64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint64_t)aKey { +- (void)removeInt64ForKey:(uint64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -6301,24 +6303,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithBools:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(BOOL)value - forKey:(uint64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithBool:(BOOL)value + forKey:(uint64_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count: // on to get the type correct. - return [[(GPBUInt64BoolDictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBUInt64BoolDictionary*)[self alloc] initWithBools:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const BOOL [])values - forKeys:(const uint64_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithBools:(const BOOL [])values + forKeys:(const uint64_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count: // on to get the type correct. - return [[(GPBUInt64BoolDictionary*)[self alloc] initWithValues:values + return [[(GPBUInt64BoolDictionary*)[self alloc] initWithBools:values forKeys:keys count:count] autorelease]; } @@ -6334,12 +6336,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithBools:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const BOOL [])values - forKeys:(const uint64_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithBools:(const BOOL [])values + forKeys:(const uint64_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -6353,7 +6355,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt64BoolDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithBools:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -6364,7 +6366,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithBools:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -6402,7 +6404,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndBoolsUsingBlock: (void (^)(uint64_t key, BOOL value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -6460,13 +6462,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint64_t key, BOOL value, BOOL *stop) { + [self enumerateKeysAndBoolsUsingBlock:^(uint64_t key, BOOL value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%llu", key], (value ? @"true" : @"false")); }]; } -- (BOOL)valueForKey:(uint64_t)key value:(BOOL *)value { +- (BOOL)getBool:(nullable BOOL *)value forKey:(uint64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped boolValue]; @@ -6483,14 +6485,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(BOOL)value forKey:(uint64_t)key { +- (void)setBool:(BOOL)value forKey:(uint64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint64_t)aKey { +- (void)removeBoolForKey:(uint64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -6508,24 +6510,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithFloats:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(float)value ++ (instancetype)dictionaryWithFloat:(float)value forKey:(uint64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count: // on to get the type correct. - return [[(GPBUInt64FloatDictionary*)[self alloc] initWithValues:&value + return [[(GPBUInt64FloatDictionary*)[self alloc] initWithFloats:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const float [])values ++ (instancetype)dictionaryWithFloats:(const float [])values forKeys:(const uint64_t [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count: // on to get the type correct. - return [[(GPBUInt64FloatDictionary*)[self alloc] initWithValues:values + return [[(GPBUInt64FloatDictionary*)[self alloc] initWithFloats:values forKeys:keys count:count] autorelease]; } @@ -6541,10 +6543,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithFloats:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const float [])values +- (instancetype)initWithFloats:(const float [])values forKeys:(const uint64_t [])keys count:(NSUInteger)count { self = [super init]; @@ -6560,7 +6562,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt64FloatDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithFloats:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -6571,7 +6573,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithFloats:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -6609,7 +6611,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndFloatsUsingBlock: (void (^)(uint64_t key, float value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -6667,13 +6669,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint64_t key, float value, BOOL *stop) { + [self enumerateKeysAndFloatsUsingBlock:^(uint64_t key, float value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%llu", key], [NSString stringWithFormat:@"%.*g", FLT_DIG, value]); }]; } -- (BOOL)valueForKey:(uint64_t)key value:(float *)value { +- (BOOL)getFloat:(nullable float *)value forKey:(uint64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped floatValue]; @@ -6690,14 +6692,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(float)value forKey:(uint64_t)key { +- (void)setFloat:(float)value forKey:(uint64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint64_t)aKey { +- (void)removeFloatForKey:(uint64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -6715,24 +6717,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithDoubles:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(double)value - forKey:(uint64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithDouble:(double)value + forKey:(uint64_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count: // on to get the type correct. - return [[(GPBUInt64DoubleDictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBUInt64DoubleDictionary*)[self alloc] initWithDoubles:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const double [])values - forKeys:(const uint64_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithDoubles:(const double [])values + forKeys:(const uint64_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count: // on to get the type correct. - return [[(GPBUInt64DoubleDictionary*)[self alloc] initWithValues:values + return [[(GPBUInt64DoubleDictionary*)[self alloc] initWithDoubles:values forKeys:keys count:count] autorelease]; } @@ -6748,12 +6750,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithDoubles:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const double [])values - forKeys:(const uint64_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithDoubles:(const double [])values + forKeys:(const uint64_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -6767,7 +6769,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBUInt64DoubleDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithDoubles:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -6778,7 +6780,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithDoubles:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -6816,7 +6818,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndDoublesUsingBlock: (void (^)(uint64_t key, double value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -6874,13 +6876,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(uint64_t key, double value, BOOL *stop) { + [self enumerateKeysAndDoublesUsingBlock:^(uint64_t key, double value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%llu", key], [NSString stringWithFormat:@"%.*lg", DBL_DIG, value]); }]; } -- (BOOL)valueForKey:(uint64_t)key value:(double *)value { +- (BOOL)getDouble:(nullable double *)value forKey:(uint64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped doubleValue]; @@ -6897,14 +6899,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(double)value forKey:(uint64_t)key { +- (void)setDouble:(double)value forKey:(uint64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(uint64_t)aKey { +- (void)removeDoubleForKey:(uint64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -7127,7 +7129,7 @@ void GPBDictionaryReadEntry(id mapDictionary, }]; } -- (BOOL)valueForKey:(uint64_t)key value:(int32_t *)value { +- (BOOL)getEnum:(int32_t *)value forKey:(uint64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { int32_t result = [wrapped intValue]; @@ -7139,7 +7141,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (wrapped != NULL); } -- (BOOL)valueForKey:(uint64_t)key rawValue:(int32_t *)rawValue { +- (BOOL)getRawValue:(int32_t *)rawValue forKey:(uint64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && rawValue) { *rawValue = [wrapped intValue]; @@ -7147,7 +7149,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (wrapped != NULL); } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndEnumsUsingBlock: (void (^)(uint64_t key, int32_t value, BOOL *stop))block { GPBEnumValidationFunc func = _validationFunc; [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, @@ -7177,7 +7179,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(uint64_t)aKey { +- (void)removeEnumForKey:(uint64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -7185,7 +7187,7 @@ void GPBDictionaryReadEntry(id mapDictionary, [_dictionary removeAllObjects]; } -- (void)setValue:(int32_t)value forKey:(uint64_t)key { +- (void)setEnum:(int32_t)value forKey:(uint64_t)key { if (!_validationFunc(value)) { [NSException raise:NSInvalidArgumentException format:@"GPBUInt64EnumDictionary: Attempt to set an unknown enum value (%d)", @@ -7446,24 +7448,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithUInt32s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(uint32_t)value - forKey:(int64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt32:(uint32_t)value + forKey:(int64_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count: // on to get the type correct. - return [[(GPBInt64UInt32Dictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBInt64UInt32Dictionary*)[self alloc] initWithUInt32s:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const uint32_t [])values - forKeys:(const int64_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values + forKeys:(const int64_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count: // on to get the type correct. - return [[(GPBInt64UInt32Dictionary*)[self alloc] initWithValues:values + return [[(GPBInt64UInt32Dictionary*)[self alloc] initWithUInt32s:values forKeys:keys count:count] autorelease]; } @@ -7479,12 +7481,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt32s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const uint32_t [])values - forKeys:(const int64_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithUInt32s:(const uint32_t [])values + forKeys:(const int64_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -7498,7 +7500,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt64UInt32Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithUInt32s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -7509,7 +7511,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt32s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -7547,7 +7549,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndUInt32sUsingBlock: (void (^)(int64_t key, uint32_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -7605,13 +7607,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int64_t key, uint32_t value, BOOL *stop) { + [self enumerateKeysAndUInt32sUsingBlock:^(int64_t key, uint32_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%lld", key], [NSString stringWithFormat:@"%u", value]); }]; } -- (BOOL)valueForKey:(int64_t)key value:(uint32_t *)value { +- (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped unsignedIntValue]; @@ -7628,14 +7630,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(uint32_t)value forKey:(int64_t)key { +- (void)setUInt32:(uint32_t)value forKey:(int64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int64_t)aKey { +- (void)removeUInt32ForKey:(int64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -7653,24 +7655,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithInt32s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(int32_t)value ++ (instancetype)dictionaryWithInt32:(int32_t)value forKey:(int64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count: // on to get the type correct. - return [[(GPBInt64Int32Dictionary*)[self alloc] initWithValues:&value + return [[(GPBInt64Int32Dictionary*)[self alloc] initWithInt32s:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const int32_t [])values ++ (instancetype)dictionaryWithInt32s:(const int32_t [])values forKeys:(const int64_t [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count: // on to get the type correct. - return [[(GPBInt64Int32Dictionary*)[self alloc] initWithValues:values + return [[(GPBInt64Int32Dictionary*)[self alloc] initWithInt32s:values forKeys:keys count:count] autorelease]; } @@ -7686,10 +7688,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt32s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const int32_t [])values +- (instancetype)initWithInt32s:(const int32_t [])values forKeys:(const int64_t [])keys count:(NSUInteger)count { self = [super init]; @@ -7705,7 +7707,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt64Int32Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithInt32s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -7716,7 +7718,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt32s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -7754,7 +7756,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndInt32sUsingBlock: (void (^)(int64_t key, int32_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -7812,13 +7814,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int64_t key, int32_t value, BOOL *stop) { + [self enumerateKeysAndInt32sUsingBlock:^(int64_t key, int32_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%lld", key], [NSString stringWithFormat:@"%d", value]); }]; } -- (BOOL)valueForKey:(int64_t)key value:(int32_t *)value { +- (BOOL)getInt32:(nullable int32_t *)value forKey:(int64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped intValue]; @@ -7835,14 +7837,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(int32_t)value forKey:(int64_t)key { +- (void)setInt32:(int32_t)value forKey:(int64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int64_t)aKey { +- (void)removeInt32ForKey:(int64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -7860,24 +7862,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithUInt64s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(uint64_t)value - forKey:(int64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt64:(uint64_t)value + forKey:(int64_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count: // on to get the type correct. - return [[(GPBInt64UInt64Dictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBInt64UInt64Dictionary*)[self alloc] initWithUInt64s:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const uint64_t [])values - forKeys:(const int64_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values + forKeys:(const int64_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count: // on to get the type correct. - return [[(GPBInt64UInt64Dictionary*)[self alloc] initWithValues:values + return [[(GPBInt64UInt64Dictionary*)[self alloc] initWithUInt64s:values forKeys:keys count:count] autorelease]; } @@ -7893,12 +7895,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt64s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const uint64_t [])values - forKeys:(const int64_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithUInt64s:(const uint64_t [])values + forKeys:(const int64_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -7912,7 +7914,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt64UInt64Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithUInt64s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -7923,7 +7925,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt64s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -7961,7 +7963,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndUInt64sUsingBlock: (void (^)(int64_t key, uint64_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -8019,13 +8021,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int64_t key, uint64_t value, BOOL *stop) { + [self enumerateKeysAndUInt64sUsingBlock:^(int64_t key, uint64_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%lld", key], [NSString stringWithFormat:@"%llu", value]); }]; } -- (BOOL)valueForKey:(int64_t)key value:(uint64_t *)value { +- (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped unsignedLongLongValue]; @@ -8042,14 +8044,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(uint64_t)value forKey:(int64_t)key { +- (void)setUInt64:(uint64_t)value forKey:(int64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int64_t)aKey { +- (void)removeUInt64ForKey:(int64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -8067,24 +8069,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithInt64s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(int64_t)value ++ (instancetype)dictionaryWithInt64:(int64_t)value forKey:(int64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count: // on to get the type correct. - return [[(GPBInt64Int64Dictionary*)[self alloc] initWithValues:&value + return [[(GPBInt64Int64Dictionary*)[self alloc] initWithInt64s:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const int64_t [])values ++ (instancetype)dictionaryWithInt64s:(const int64_t [])values forKeys:(const int64_t [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count: // on to get the type correct. - return [[(GPBInt64Int64Dictionary*)[self alloc] initWithValues:values + return [[(GPBInt64Int64Dictionary*)[self alloc] initWithInt64s:values forKeys:keys count:count] autorelease]; } @@ -8100,10 +8102,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt64s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const int64_t [])values +- (instancetype)initWithInt64s:(const int64_t [])values forKeys:(const int64_t [])keys count:(NSUInteger)count { self = [super init]; @@ -8119,7 +8121,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt64Int64Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithInt64s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -8130,7 +8132,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt64s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -8168,7 +8170,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndInt64sUsingBlock: (void (^)(int64_t key, int64_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -8226,13 +8228,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int64_t key, int64_t value, BOOL *stop) { + [self enumerateKeysAndInt64sUsingBlock:^(int64_t key, int64_t value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%lld", key], [NSString stringWithFormat:@"%lld", value]); }]; } -- (BOOL)valueForKey:(int64_t)key value:(int64_t *)value { +- (BOOL)getInt64:(nullable int64_t *)value forKey:(int64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped longLongValue]; @@ -8249,14 +8251,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(int64_t)value forKey:(int64_t)key { +- (void)setInt64:(int64_t)value forKey:(int64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int64_t)aKey { +- (void)removeInt64ForKey:(int64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -8274,24 +8276,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithBools:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(BOOL)value - forKey:(int64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithBool:(BOOL)value + forKey:(int64_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count: // on to get the type correct. - return [[(GPBInt64BoolDictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBInt64BoolDictionary*)[self alloc] initWithBools:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const BOOL [])values - forKeys:(const int64_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithBools:(const BOOL [])values + forKeys:(const int64_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count: // on to get the type correct. - return [[(GPBInt64BoolDictionary*)[self alloc] initWithValues:values + return [[(GPBInt64BoolDictionary*)[self alloc] initWithBools:values forKeys:keys count:count] autorelease]; } @@ -8307,12 +8309,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithBools:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const BOOL [])values - forKeys:(const int64_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithBools:(const BOOL [])values + forKeys:(const int64_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -8326,7 +8328,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt64BoolDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithBools:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -8337,7 +8339,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithBools:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -8375,7 +8377,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndBoolsUsingBlock: (void (^)(int64_t key, BOOL value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -8433,13 +8435,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int64_t key, BOOL value, BOOL *stop) { + [self enumerateKeysAndBoolsUsingBlock:^(int64_t key, BOOL value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%lld", key], (value ? @"true" : @"false")); }]; } -- (BOOL)valueForKey:(int64_t)key value:(BOOL *)value { +- (BOOL)getBool:(nullable BOOL *)value forKey:(int64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped boolValue]; @@ -8456,14 +8458,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(BOOL)value forKey:(int64_t)key { +- (void)setBool:(BOOL)value forKey:(int64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int64_t)aKey { +- (void)removeBoolForKey:(int64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -8481,24 +8483,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithFloats:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(float)value ++ (instancetype)dictionaryWithFloat:(float)value forKey:(int64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count: // on to get the type correct. - return [[(GPBInt64FloatDictionary*)[self alloc] initWithValues:&value + return [[(GPBInt64FloatDictionary*)[self alloc] initWithFloats:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const float [])values ++ (instancetype)dictionaryWithFloats:(const float [])values forKeys:(const int64_t [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count: // on to get the type correct. - return [[(GPBInt64FloatDictionary*)[self alloc] initWithValues:values + return [[(GPBInt64FloatDictionary*)[self alloc] initWithFloats:values forKeys:keys count:count] autorelease]; } @@ -8514,10 +8516,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithFloats:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const float [])values +- (instancetype)initWithFloats:(const float [])values forKeys:(const int64_t [])keys count:(NSUInteger)count { self = [super init]; @@ -8533,7 +8535,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt64FloatDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithFloats:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -8544,7 +8546,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithFloats:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -8582,7 +8584,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndFloatsUsingBlock: (void (^)(int64_t key, float value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -8640,13 +8642,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int64_t key, float value, BOOL *stop) { + [self enumerateKeysAndFloatsUsingBlock:^(int64_t key, float value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%lld", key], [NSString stringWithFormat:@"%.*g", FLT_DIG, value]); }]; } -- (BOOL)valueForKey:(int64_t)key value:(float *)value { +- (BOOL)getFloat:(nullable float *)value forKey:(int64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped floatValue]; @@ -8663,14 +8665,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(float)value forKey:(int64_t)key { +- (void)setFloat:(float)value forKey:(int64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int64_t)aKey { +- (void)removeFloatForKey:(int64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -8688,24 +8690,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithDoubles:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(double)value - forKey:(int64_t)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithDouble:(double)value + forKey:(int64_t)key { + // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count: // on to get the type correct. - return [[(GPBInt64DoubleDictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBInt64DoubleDictionary*)[self alloc] initWithDoubles:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const double [])values - forKeys:(const int64_t [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithDoubles:(const double [])values + forKeys:(const int64_t [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count: // on to get the type correct. - return [[(GPBInt64DoubleDictionary*)[self alloc] initWithValues:values + return [[(GPBInt64DoubleDictionary*)[self alloc] initWithDoubles:values forKeys:keys count:count] autorelease]; } @@ -8721,12 +8723,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithDoubles:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const double [])values - forKeys:(const int64_t [])keys - count:(NSUInteger)count { +- (instancetype)initWithDoubles:(const double [])values + forKeys:(const int64_t [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -8740,7 +8742,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBInt64DoubleDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithDoubles:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -8751,7 +8753,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithDoubles:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -8789,7 +8791,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndDoublesUsingBlock: (void (^)(int64_t key, double value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, NSNumber *aValue, @@ -8847,13 +8849,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(int64_t key, double value, BOOL *stop) { + [self enumerateKeysAndDoublesUsingBlock:^(int64_t key, double value, BOOL *stop) { #pragma unused(stop) block([NSString stringWithFormat:@"%lld", key], [NSString stringWithFormat:@"%.*lg", DBL_DIG, value]); }]; } -- (BOOL)valueForKey:(int64_t)key value:(double *)value { +- (BOOL)getDouble:(nullable double *)value forKey:(int64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { *value = [wrapped doubleValue]; @@ -8870,14 +8872,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(double)value forKey:(int64_t)key { +- (void)setDouble:(double)value forKey:(int64_t)key { [_dictionary setObject:@(value) forKey:@(key)]; if (_autocreator) { GPBAutocreatedDictionaryModified(_autocreator, self); } } -- (void)removeValueForKey:(int64_t)aKey { +- (void)removeDoubleForKey:(int64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -9100,7 +9102,7 @@ void GPBDictionaryReadEntry(id mapDictionary, }]; } -- (BOOL)valueForKey:(int64_t)key value:(int32_t *)value { +- (BOOL)getEnum:(int32_t *)value forKey:(int64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && value) { int32_t result = [wrapped intValue]; @@ -9112,7 +9114,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (wrapped != NULL); } -- (BOOL)valueForKey:(int64_t)key rawValue:(int32_t *)rawValue { +- (BOOL)getRawValue:(int32_t *)rawValue forKey:(int64_t)key { NSNumber *wrapped = [_dictionary objectForKey:@(key)]; if (wrapped && rawValue) { *rawValue = [wrapped intValue]; @@ -9120,7 +9122,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (wrapped != NULL); } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndEnumsUsingBlock: (void (^)(int64_t key, int32_t value, BOOL *stop))block { GPBEnumValidationFunc func = _validationFunc; [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey, @@ -9150,7 +9152,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(int64_t)aKey { +- (void)removeEnumForKey:(int64_t)aKey { [_dictionary removeObjectForKey:@(aKey)]; } @@ -9158,7 +9160,7 @@ void GPBDictionaryReadEntry(id mapDictionary, [_dictionary removeAllObjects]; } -- (void)setValue:(int32_t)value forKey:(int64_t)key { +- (void)setEnum:(int32_t)value forKey:(int64_t)key { if (!_validationFunc(value)) { [NSException raise:NSInvalidArgumentException format:@"GPBInt64EnumDictionary: Attempt to set an unknown enum value (%d)", @@ -9419,24 +9421,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithUInt32s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(uint32_t)value - forKey:(NSString *)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt32:(uint32_t)value + forKey:(NSString *)key { + // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count: // on to get the type correct. - return [[(GPBStringUInt32Dictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBStringUInt32Dictionary*)[self alloc] initWithUInt32s:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const uint32_t [])values - forKeys:(const NSString * [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values + forKeys:(const NSString * [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count: // on to get the type correct. - return [[(GPBStringUInt32Dictionary*)[self alloc] initWithValues:values + return [[(GPBStringUInt32Dictionary*)[self alloc] initWithUInt32s:values forKeys:keys count:count] autorelease]; } @@ -9452,12 +9454,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt32s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const uint32_t [])values - forKeys:(const NSString * [])keys - count:(NSUInteger)count { +- (instancetype)initWithUInt32s:(const uint32_t [])values + forKeys:(const NSString * [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -9475,7 +9477,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBStringUInt32Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithUInt32s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -9486,7 +9488,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt32s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -9524,7 +9526,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndUInt32sUsingBlock: (void (^)(NSString *key, uint32_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSString *aKey, NSNumber *aValue, @@ -9582,13 +9584,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(NSString *key, uint32_t value, BOOL *stop) { + [self enumerateKeysAndUInt32sUsingBlock:^(NSString *key, uint32_t value, BOOL *stop) { #pragma unused(stop) block(key, [NSString stringWithFormat:@"%u", value]); }]; } -- (BOOL)valueForKey:(NSString *)key value:(uint32_t *)value { +- (BOOL)getUInt32:(nullable uint32_t *)value forKey:(NSString *)key { NSNumber *wrapped = [_dictionary objectForKey:key]; if (wrapped && value) { *value = [wrapped unsignedIntValue]; @@ -9605,7 +9607,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(uint32_t)value forKey:(NSString *)key { +- (void)setUInt32:(uint32_t)value forKey:(NSString *)key { if (!key) { [NSException raise:NSInvalidArgumentException format:@"Attempting to add nil key to a Dictionary"]; @@ -9616,7 +9618,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(NSString *)aKey { +- (void)removeUInt32ForKey:(NSString *)aKey { [_dictionary removeObjectForKey:aKey]; } @@ -9634,24 +9636,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithInt32s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(int32_t)value ++ (instancetype)dictionaryWithInt32:(int32_t)value forKey:(NSString *)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count: // on to get the type correct. - return [[(GPBStringInt32Dictionary*)[self alloc] initWithValues:&value + return [[(GPBStringInt32Dictionary*)[self alloc] initWithInt32s:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const int32_t [])values ++ (instancetype)dictionaryWithInt32s:(const int32_t [])values forKeys:(const NSString * [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count: // on to get the type correct. - return [[(GPBStringInt32Dictionary*)[self alloc] initWithValues:values + return [[(GPBStringInt32Dictionary*)[self alloc] initWithInt32s:values forKeys:keys count:count] autorelease]; } @@ -9667,10 +9669,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt32s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const int32_t [])values +- (instancetype)initWithInt32s:(const int32_t [])values forKeys:(const NSString * [])keys count:(NSUInteger)count { self = [super init]; @@ -9690,7 +9692,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBStringInt32Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithInt32s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -9701,7 +9703,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt32s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -9739,7 +9741,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndInt32sUsingBlock: (void (^)(NSString *key, int32_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSString *aKey, NSNumber *aValue, @@ -9797,13 +9799,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(NSString *key, int32_t value, BOOL *stop) { + [self enumerateKeysAndInt32sUsingBlock:^(NSString *key, int32_t value, BOOL *stop) { #pragma unused(stop) block(key, [NSString stringWithFormat:@"%d", value]); }]; } -- (BOOL)valueForKey:(NSString *)key value:(int32_t *)value { +- (BOOL)getInt32:(nullable int32_t *)value forKey:(NSString *)key { NSNumber *wrapped = [_dictionary objectForKey:key]; if (wrapped && value) { *value = [wrapped intValue]; @@ -9820,7 +9822,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(int32_t)value forKey:(NSString *)key { +- (void)setInt32:(int32_t)value forKey:(NSString *)key { if (!key) { [NSException raise:NSInvalidArgumentException format:@"Attempting to add nil key to a Dictionary"]; @@ -9831,7 +9833,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(NSString *)aKey { +- (void)removeInt32ForKey:(NSString *)aKey { [_dictionary removeObjectForKey:aKey]; } @@ -9849,24 +9851,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithUInt64s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(uint64_t)value - forKey:(NSString *)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt64:(uint64_t)value + forKey:(NSString *)key { + // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count: // on to get the type correct. - return [[(GPBStringUInt64Dictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBStringUInt64Dictionary*)[self alloc] initWithUInt64s:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const uint64_t [])values - forKeys:(const NSString * [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values + forKeys:(const NSString * [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count: // on to get the type correct. - return [[(GPBStringUInt64Dictionary*)[self alloc] initWithValues:values + return [[(GPBStringUInt64Dictionary*)[self alloc] initWithUInt64s:values forKeys:keys count:count] autorelease]; } @@ -9882,12 +9884,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt64s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const uint64_t [])values - forKeys:(const NSString * [])keys - count:(NSUInteger)count { +- (instancetype)initWithUInt64s:(const uint64_t [])values + forKeys:(const NSString * [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -9905,7 +9907,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBStringUInt64Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithUInt64s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -9916,7 +9918,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt64s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -9954,7 +9956,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndUInt64sUsingBlock: (void (^)(NSString *key, uint64_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSString *aKey, NSNumber *aValue, @@ -10012,13 +10014,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(NSString *key, uint64_t value, BOOL *stop) { + [self enumerateKeysAndUInt64sUsingBlock:^(NSString *key, uint64_t value, BOOL *stop) { #pragma unused(stop) block(key, [NSString stringWithFormat:@"%llu", value]); }]; } -- (BOOL)valueForKey:(NSString *)key value:(uint64_t *)value { +- (BOOL)getUInt64:(nullable uint64_t *)value forKey:(NSString *)key { NSNumber *wrapped = [_dictionary objectForKey:key]; if (wrapped && value) { *value = [wrapped unsignedLongLongValue]; @@ -10035,7 +10037,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(uint64_t)value forKey:(NSString *)key { +- (void)setUInt64:(uint64_t)value forKey:(NSString *)key { if (!key) { [NSException raise:NSInvalidArgumentException format:@"Attempting to add nil key to a Dictionary"]; @@ -10046,7 +10048,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(NSString *)aKey { +- (void)removeUInt64ForKey:(NSString *)aKey { [_dictionary removeObjectForKey:aKey]; } @@ -10064,24 +10066,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithInt64s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(int64_t)value ++ (instancetype)dictionaryWithInt64:(int64_t)value forKey:(NSString *)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count: // on to get the type correct. - return [[(GPBStringInt64Dictionary*)[self alloc] initWithValues:&value + return [[(GPBStringInt64Dictionary*)[self alloc] initWithInt64s:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const int64_t [])values ++ (instancetype)dictionaryWithInt64s:(const int64_t [])values forKeys:(const NSString * [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count: // on to get the type correct. - return [[(GPBStringInt64Dictionary*)[self alloc] initWithValues:values + return [[(GPBStringInt64Dictionary*)[self alloc] initWithInt64s:values forKeys:keys count:count] autorelease]; } @@ -10097,10 +10099,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt64s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const int64_t [])values +- (instancetype)initWithInt64s:(const int64_t [])values forKeys:(const NSString * [])keys count:(NSUInteger)count { self = [super init]; @@ -10120,7 +10122,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBStringInt64Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithInt64s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -10131,7 +10133,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt64s:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -10169,7 +10171,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndInt64sUsingBlock: (void (^)(NSString *key, int64_t value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSString *aKey, NSNumber *aValue, @@ -10227,13 +10229,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(NSString *key, int64_t value, BOOL *stop) { + [self enumerateKeysAndInt64sUsingBlock:^(NSString *key, int64_t value, BOOL *stop) { #pragma unused(stop) block(key, [NSString stringWithFormat:@"%lld", value]); }]; } -- (BOOL)valueForKey:(NSString *)key value:(int64_t *)value { +- (BOOL)getInt64:(nullable int64_t *)value forKey:(NSString *)key { NSNumber *wrapped = [_dictionary objectForKey:key]; if (wrapped && value) { *value = [wrapped longLongValue]; @@ -10250,7 +10252,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(int64_t)value forKey:(NSString *)key { +- (void)setInt64:(int64_t)value forKey:(NSString *)key { if (!key) { [NSException raise:NSInvalidArgumentException format:@"Attempting to add nil key to a Dictionary"]; @@ -10261,7 +10263,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(NSString *)aKey { +- (void)removeInt64ForKey:(NSString *)aKey { [_dictionary removeObjectForKey:aKey]; } @@ -10279,24 +10281,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithBools:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(BOOL)value - forKey:(NSString *)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithBool:(BOOL)value + forKey:(NSString *)key { + // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count: // on to get the type correct. - return [[(GPBStringBoolDictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBStringBoolDictionary*)[self alloc] initWithBools:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const BOOL [])values - forKeys:(const NSString * [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithBools:(const BOOL [])values + forKeys:(const NSString * [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count: // on to get the type correct. - return [[(GPBStringBoolDictionary*)[self alloc] initWithValues:values + return [[(GPBStringBoolDictionary*)[self alloc] initWithBools:values forKeys:keys count:count] autorelease]; } @@ -10312,12 +10314,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithBools:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const BOOL [])values - forKeys:(const NSString * [])keys - count:(NSUInteger)count { +- (instancetype)initWithBools:(const BOOL [])values + forKeys:(const NSString * [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -10335,7 +10337,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBStringBoolDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithBools:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -10346,7 +10348,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithBools:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -10384,7 +10386,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndBoolsUsingBlock: (void (^)(NSString *key, BOOL value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSString *aKey, NSNumber *aValue, @@ -10442,13 +10444,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(NSString *key, BOOL value, BOOL *stop) { + [self enumerateKeysAndBoolsUsingBlock:^(NSString *key, BOOL value, BOOL *stop) { #pragma unused(stop) block(key, (value ? @"true" : @"false")); }]; } -- (BOOL)valueForKey:(NSString *)key value:(BOOL *)value { +- (BOOL)getBool:(nullable BOOL *)value forKey:(NSString *)key { NSNumber *wrapped = [_dictionary objectForKey:key]; if (wrapped && value) { *value = [wrapped boolValue]; @@ -10465,7 +10467,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(BOOL)value forKey:(NSString *)key { +- (void)setBool:(BOOL)value forKey:(NSString *)key { if (!key) { [NSException raise:NSInvalidArgumentException format:@"Attempting to add nil key to a Dictionary"]; @@ -10476,7 +10478,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(NSString *)aKey { +- (void)removeBoolForKey:(NSString *)aKey { [_dictionary removeObjectForKey:aKey]; } @@ -10494,24 +10496,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithFloats:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(float)value ++ (instancetype)dictionaryWithFloat:(float)value forKey:(NSString *)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count: // on to get the type correct. - return [[(GPBStringFloatDictionary*)[self alloc] initWithValues:&value + return [[(GPBStringFloatDictionary*)[self alloc] initWithFloats:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const float [])values ++ (instancetype)dictionaryWithFloats:(const float [])values forKeys:(const NSString * [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count: // on to get the type correct. - return [[(GPBStringFloatDictionary*)[self alloc] initWithValues:values + return [[(GPBStringFloatDictionary*)[self alloc] initWithFloats:values forKeys:keys count:count] autorelease]; } @@ -10527,10 +10529,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithFloats:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const float [])values +- (instancetype)initWithFloats:(const float [])values forKeys:(const NSString * [])keys count:(NSUInteger)count { self = [super init]; @@ -10550,7 +10552,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBStringFloatDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithFloats:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -10561,7 +10563,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithFloats:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -10599,7 +10601,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndFloatsUsingBlock: (void (^)(NSString *key, float value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSString *aKey, NSNumber *aValue, @@ -10657,13 +10659,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(NSString *key, float value, BOOL *stop) { + [self enumerateKeysAndFloatsUsingBlock:^(NSString *key, float value, BOOL *stop) { #pragma unused(stop) block(key, [NSString stringWithFormat:@"%.*g", FLT_DIG, value]); }]; } -- (BOOL)valueForKey:(NSString *)key value:(float *)value { +- (BOOL)getFloat:(nullable float *)value forKey:(NSString *)key { NSNumber *wrapped = [_dictionary objectForKey:key]; if (wrapped && value) { *value = [wrapped floatValue]; @@ -10680,7 +10682,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(float)value forKey:(NSString *)key { +- (void)setFloat:(float)value forKey:(NSString *)key { if (!key) { [NSException raise:NSInvalidArgumentException format:@"Attempting to add nil key to a Dictionary"]; @@ -10691,7 +10693,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(NSString *)aKey { +- (void)removeFloatForKey:(NSString *)aKey { [_dictionary removeObjectForKey:aKey]; } @@ -10709,24 +10711,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithDoubles:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(double)value - forKey:(NSString *)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithDouble:(double)value + forKey:(NSString *)key { + // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count: // on to get the type correct. - return [[(GPBStringDoubleDictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBStringDoubleDictionary*)[self alloc] initWithDoubles:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const double [])values - forKeys:(const NSString * [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithDoubles:(const double [])values + forKeys:(const NSString * [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count: // on to get the type correct. - return [[(GPBStringDoubleDictionary*)[self alloc] initWithValues:values + return [[(GPBStringDoubleDictionary*)[self alloc] initWithDoubles:values forKeys:keys count:count] autorelease]; } @@ -10742,12 +10744,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithDoubles:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const double [])values - forKeys:(const NSString * [])keys - count:(NSUInteger)count { +- (instancetype)initWithDoubles:(const double [])values + forKeys:(const NSString * [])keys + count:(NSUInteger)count { self = [super init]; if (self) { _dictionary = [[NSMutableDictionary alloc] init]; @@ -10765,7 +10767,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBStringDoubleDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithDoubles:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { [_dictionary addEntriesFromDictionary:dictionary->_dictionary]; @@ -10776,7 +10778,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithDoubles:NULL forKeys:NULL count:0]; } - (void)dealloc { @@ -10814,7 +10816,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return _dictionary.count; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndDoublesUsingBlock: (void (^)(NSString *key, double value, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSString *aKey, NSNumber *aValue, @@ -10872,13 +10874,13 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block { - [self enumerateKeysAndValuesUsingBlock:^(NSString *key, double value, BOOL *stop) { + [self enumerateKeysAndDoublesUsingBlock:^(NSString *key, double value, BOOL *stop) { #pragma unused(stop) block(key, [NSString stringWithFormat:@"%.*lg", DBL_DIG, value]); }]; } -- (BOOL)valueForKey:(NSString *)key value:(double *)value { +- (BOOL)getDouble:(nullable double *)value forKey:(NSString *)key { NSNumber *wrapped = [_dictionary objectForKey:key]; if (wrapped && value) { *value = [wrapped doubleValue]; @@ -10895,7 +10897,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(double)value forKey:(NSString *)key { +- (void)setDouble:(double)value forKey:(NSString *)key { if (!key) { [NSException raise:NSInvalidArgumentException format:@"Attempting to add nil key to a Dictionary"]; @@ -10906,7 +10908,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(NSString *)aKey { +- (void)removeDoubleForKey:(NSString *)aKey { [_dictionary removeObjectForKey:aKey]; } @@ -11133,7 +11135,7 @@ void GPBDictionaryReadEntry(id mapDictionary, }]; } -- (BOOL)valueForKey:(NSString *)key value:(int32_t *)value { +- (BOOL)getEnum:(int32_t *)value forKey:(NSString *)key { NSNumber *wrapped = [_dictionary objectForKey:key]; if (wrapped && value) { int32_t result = [wrapped intValue]; @@ -11145,7 +11147,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (wrapped != NULL); } -- (BOOL)valueForKey:(NSString *)key rawValue:(int32_t *)rawValue { +- (BOOL)getRawValue:(int32_t *)rawValue forKey:(NSString *)key { NSNumber *wrapped = [_dictionary objectForKey:key]; if (wrapped && rawValue) { *rawValue = [wrapped intValue]; @@ -11153,7 +11155,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (wrapped != NULL); } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndEnumsUsingBlock: (void (^)(NSString *key, int32_t value, BOOL *stop))block { GPBEnumValidationFunc func = _validationFunc; [_dictionary enumerateKeysAndObjectsUsingBlock:^(NSString *aKey, @@ -11187,7 +11189,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(NSString *)aKey { +- (void)removeEnumForKey:(NSString *)aKey { [_dictionary removeObjectForKey:aKey]; } @@ -11195,7 +11197,7 @@ void GPBDictionaryReadEntry(id mapDictionary, [_dictionary removeAllObjects]; } -- (void)setValue:(int32_t)value forKey:(NSString *)key { +- (void)setEnum:(int32_t)value forKey:(NSString *)key { if (!key) { [NSException raise:NSInvalidArgumentException format:@"Attempting to add nil key to a Dictionary"]; @@ -11229,26 +11231,26 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithUInt32s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(uint32_t)value - forKey:(BOOL)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt32:(uint32_t)value + forKey:(BOOL)key { + // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count: // on to get the type correct. - return [[(GPBBoolUInt32Dictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBBoolUInt32Dictionary*)[self alloc] initWithUInt32s:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const uint32_t [])values - forKeys:(const BOOL [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt32s:(const uint32_t [])values + forKeys:(const BOOL [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithUInt32s:forKeys:count: // on to get the type correct. - return [[(GPBBoolUInt32Dictionary*)[self alloc] initWithValues:values - forKeys:keys - count:count] autorelease]; + return [[(GPBBoolUInt32Dictionary*)[self alloc] initWithUInt32s:values + forKeys:keys + count:count] autorelease]; } + (instancetype)dictionaryWithDictionary:(GPBBoolUInt32Dictionary *)dictionary { @@ -11262,12 +11264,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt32s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const uint32_t [])values - forKeys:(const BOOL [])keys - count:(NSUInteger)count { +- (instancetype)initWithUInt32s:(const uint32_t [])values + forKeys:(const BOOL [])keys + count:(NSUInteger)count { self = [super init]; if (self) { for (NSUInteger i = 0; i < count; ++i) { @@ -11280,7 +11282,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBBoolUInt32Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithUInt32s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { for (int i = 0; i < 2; ++i) { @@ -11296,7 +11298,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt32s:NULL forKeys:NULL count:0]; } #if !defined(NS_BLOCK_ASSERTIONS) @@ -11351,7 +11353,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (_valueSet[0] ? 1 : 0) + (_valueSet[1] ? 1 : 0); } -- (BOOL)valueForKey:(BOOL)key value:(uint32_t *)value { +- (BOOL)getUInt32:(uint32_t *)value forKey:(BOOL)key { int idx = (key ? 1 : 0); if (_valueSet[idx]) { if (value) { @@ -11378,7 +11380,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndUInt32sUsingBlock: (void (^)(BOOL key, uint32_t value, BOOL *stop))block { BOOL stop = NO; if (_valueSet[0]) { @@ -11439,7 +11441,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(uint32_t)value forKey:(BOOL)key { +- (void)setUInt32:(uint32_t)value forKey:(BOOL)key { int idx = (key ? 1 : 0); _values[idx] = value; _valueSet[idx] = YES; @@ -11448,7 +11450,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(BOOL)aKey { +- (void)removeUInt32ForKey:(BOOL)aKey { _valueSet[aKey ? 1 : 0] = NO; } @@ -11471,24 +11473,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithInt32s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(int32_t)value ++ (instancetype)dictionaryWithInt32:(int32_t)value forKey:(BOOL)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count: // on to get the type correct. - return [[(GPBBoolInt32Dictionary*)[self alloc] initWithValues:&value + return [[(GPBBoolInt32Dictionary*)[self alloc] initWithInt32s:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const int32_t [])values ++ (instancetype)dictionaryWithInt32s:(const int32_t [])values forKeys:(const BOOL [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt32s:forKeys:count: // on to get the type correct. - return [[(GPBBoolInt32Dictionary*)[self alloc] initWithValues:values + return [[(GPBBoolInt32Dictionary*)[self alloc] initWithInt32s:values forKeys:keys count:count] autorelease]; } @@ -11504,10 +11506,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt32s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const int32_t [])values +- (instancetype)initWithInt32s:(const int32_t [])values forKeys:(const BOOL [])keys count:(NSUInteger)count { self = [super init]; @@ -11522,7 +11524,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBBoolInt32Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithInt32s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { for (int i = 0; i < 2; ++i) { @@ -11538,7 +11540,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt32s:NULL forKeys:NULL count:0]; } #if !defined(NS_BLOCK_ASSERTIONS) @@ -11593,7 +11595,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (_valueSet[0] ? 1 : 0) + (_valueSet[1] ? 1 : 0); } -- (BOOL)valueForKey:(BOOL)key value:(int32_t *)value { +- (BOOL)getInt32:(int32_t *)value forKey:(BOOL)key { int idx = (key ? 1 : 0); if (_valueSet[idx]) { if (value) { @@ -11620,7 +11622,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndInt32sUsingBlock: (void (^)(BOOL key, int32_t value, BOOL *stop))block { BOOL stop = NO; if (_valueSet[0]) { @@ -11681,7 +11683,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(int32_t)value forKey:(BOOL)key { +- (void)setInt32:(int32_t)value forKey:(BOOL)key { int idx = (key ? 1 : 0); _values[idx] = value; _valueSet[idx] = YES; @@ -11690,7 +11692,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(BOOL)aKey { +- (void)removeInt32ForKey:(BOOL)aKey { _valueSet[aKey ? 1 : 0] = NO; } @@ -11713,26 +11715,26 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithUInt64s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(uint64_t)value - forKey:(BOOL)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt64:(uint64_t)value + forKey:(BOOL)key { + // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count: // on to get the type correct. - return [[(GPBBoolUInt64Dictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBBoolUInt64Dictionary*)[self alloc] initWithUInt64s:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const uint64_t [])values - forKeys:(const BOOL [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithUInt64s:(const uint64_t [])values + forKeys:(const BOOL [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithUInt64s:forKeys:count: // on to get the type correct. - return [[(GPBBoolUInt64Dictionary*)[self alloc] initWithValues:values - forKeys:keys - count:count] autorelease]; + return [[(GPBBoolUInt64Dictionary*)[self alloc] initWithUInt64s:values + forKeys:keys + count:count] autorelease]; } + (instancetype)dictionaryWithDictionary:(GPBBoolUInt64Dictionary *)dictionary { @@ -11746,12 +11748,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt64s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const uint64_t [])values - forKeys:(const BOOL [])keys - count:(NSUInteger)count { +- (instancetype)initWithUInt64s:(const uint64_t [])values + forKeys:(const BOOL [])keys + count:(NSUInteger)count { self = [super init]; if (self) { for (NSUInteger i = 0; i < count; ++i) { @@ -11764,7 +11766,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBBoolUInt64Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithUInt64s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { for (int i = 0; i < 2; ++i) { @@ -11780,7 +11782,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithUInt64s:NULL forKeys:NULL count:0]; } #if !defined(NS_BLOCK_ASSERTIONS) @@ -11835,7 +11837,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (_valueSet[0] ? 1 : 0) + (_valueSet[1] ? 1 : 0); } -- (BOOL)valueForKey:(BOOL)key value:(uint64_t *)value { +- (BOOL)getUInt64:(uint64_t *)value forKey:(BOOL)key { int idx = (key ? 1 : 0); if (_valueSet[idx]) { if (value) { @@ -11862,7 +11864,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndUInt64sUsingBlock: (void (^)(BOOL key, uint64_t value, BOOL *stop))block { BOOL stop = NO; if (_valueSet[0]) { @@ -11923,7 +11925,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(uint64_t)value forKey:(BOOL)key { +- (void)setUInt64:(uint64_t)value forKey:(BOOL)key { int idx = (key ? 1 : 0); _values[idx] = value; _valueSet[idx] = YES; @@ -11932,7 +11934,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(BOOL)aKey { +- (void)removeUInt64ForKey:(BOOL)aKey { _valueSet[aKey ? 1 : 0] = NO; } @@ -11955,24 +11957,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithInt64s:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(int64_t)value ++ (instancetype)dictionaryWithInt64:(int64_t)value forKey:(BOOL)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count: // on to get the type correct. - return [[(GPBBoolInt64Dictionary*)[self alloc] initWithValues:&value + return [[(GPBBoolInt64Dictionary*)[self alloc] initWithInt64s:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const int64_t [])values ++ (instancetype)dictionaryWithInt64s:(const int64_t [])values forKeys:(const BOOL [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithInt64s:forKeys:count: // on to get the type correct. - return [[(GPBBoolInt64Dictionary*)[self alloc] initWithValues:values + return [[(GPBBoolInt64Dictionary*)[self alloc] initWithInt64s:values forKeys:keys count:count] autorelease]; } @@ -11988,10 +11990,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt64s:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const int64_t [])values +- (instancetype)initWithInt64s:(const int64_t [])values forKeys:(const BOOL [])keys count:(NSUInteger)count { self = [super init]; @@ -12006,7 +12008,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBBoolInt64Dictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithInt64s:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { for (int i = 0; i < 2; ++i) { @@ -12022,7 +12024,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithInt64s:NULL forKeys:NULL count:0]; } #if !defined(NS_BLOCK_ASSERTIONS) @@ -12077,7 +12079,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (_valueSet[0] ? 1 : 0) + (_valueSet[1] ? 1 : 0); } -- (BOOL)valueForKey:(BOOL)key value:(int64_t *)value { +- (BOOL)getInt64:(int64_t *)value forKey:(BOOL)key { int idx = (key ? 1 : 0); if (_valueSet[idx]) { if (value) { @@ -12104,7 +12106,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndInt64sUsingBlock: (void (^)(BOOL key, int64_t value, BOOL *stop))block { BOOL stop = NO; if (_valueSet[0]) { @@ -12165,7 +12167,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(int64_t)value forKey:(BOOL)key { +- (void)setInt64:(int64_t)value forKey:(BOOL)key { int idx = (key ? 1 : 0); _values[idx] = value; _valueSet[idx] = YES; @@ -12174,7 +12176,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(BOOL)aKey { +- (void)removeInt64ForKey:(BOOL)aKey { _valueSet[aKey ? 1 : 0] = NO; } @@ -12197,26 +12199,26 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithBools:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(BOOL)value - forKey:(BOOL)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithBool:(BOOL)value + forKey:(BOOL)key { + // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count: // on to get the type correct. - return [[(GPBBoolBoolDictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBBoolBoolDictionary*)[self alloc] initWithBools:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const BOOL [])values - forKeys:(const BOOL [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithBools:(const BOOL [])values + forKeys:(const BOOL [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithBools:forKeys:count: // on to get the type correct. - return [[(GPBBoolBoolDictionary*)[self alloc] initWithValues:values - forKeys:keys - count:count] autorelease]; + return [[(GPBBoolBoolDictionary*)[self alloc] initWithBools:values + forKeys:keys + count:count] autorelease]; } + (instancetype)dictionaryWithDictionary:(GPBBoolBoolDictionary *)dictionary { @@ -12230,12 +12232,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithBools:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const BOOL [])values - forKeys:(const BOOL [])keys - count:(NSUInteger)count { +- (instancetype)initWithBools:(const BOOL [])values + forKeys:(const BOOL [])keys + count:(NSUInteger)count { self = [super init]; if (self) { for (NSUInteger i = 0; i < count; ++i) { @@ -12248,7 +12250,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBBoolBoolDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithBools:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { for (int i = 0; i < 2; ++i) { @@ -12264,7 +12266,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithBools:NULL forKeys:NULL count:0]; } #if !defined(NS_BLOCK_ASSERTIONS) @@ -12319,7 +12321,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (_valueSet[0] ? 1 : 0) + (_valueSet[1] ? 1 : 0); } -- (BOOL)valueForKey:(BOOL)key value:(BOOL *)value { +- (BOOL)getBool:(BOOL *)value forKey:(BOOL)key { int idx = (key ? 1 : 0); if (_valueSet[idx]) { if (value) { @@ -12346,7 +12348,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndBoolsUsingBlock: (void (^)(BOOL key, BOOL value, BOOL *stop))block { BOOL stop = NO; if (_valueSet[0]) { @@ -12407,7 +12409,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(BOOL)value forKey:(BOOL)key { +- (void)setBool:(BOOL)value forKey:(BOOL)key { int idx = (key ? 1 : 0); _values[idx] = value; _valueSet[idx] = YES; @@ -12416,7 +12418,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(BOOL)aKey { +- (void)removeBoolForKey:(BOOL)aKey { _valueSet[aKey ? 1 : 0] = NO; } @@ -12439,24 +12441,24 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithFloats:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(float)value ++ (instancetype)dictionaryWithFloat:(float)value forKey:(BOOL)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count: // on to get the type correct. - return [[(GPBBoolFloatDictionary*)[self alloc] initWithValues:&value + return [[(GPBBoolFloatDictionary*)[self alloc] initWithFloats:&value forKeys:&key count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const float [])values ++ (instancetype)dictionaryWithFloats:(const float [])values forKeys:(const BOOL [])keys count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: + // Cast is needed so the compiler knows what class we are invoking initWithFloats:forKeys:count: // on to get the type correct. - return [[(GPBBoolFloatDictionary*)[self alloc] initWithValues:values + return [[(GPBBoolFloatDictionary*)[self alloc] initWithFloats:values forKeys:keys count:count] autorelease]; } @@ -12472,10 +12474,10 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithFloats:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const float [])values +- (instancetype)initWithFloats:(const float [])values forKeys:(const BOOL [])keys count:(NSUInteger)count { self = [super init]; @@ -12490,7 +12492,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBBoolFloatDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithFloats:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { for (int i = 0; i < 2; ++i) { @@ -12506,7 +12508,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithFloats:NULL forKeys:NULL count:0]; } #if !defined(NS_BLOCK_ASSERTIONS) @@ -12561,7 +12563,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (_valueSet[0] ? 1 : 0) + (_valueSet[1] ? 1 : 0); } -- (BOOL)valueForKey:(BOOL)key value:(float *)value { +- (BOOL)getFloat:(float *)value forKey:(BOOL)key { int idx = (key ? 1 : 0); if (_valueSet[idx]) { if (value) { @@ -12588,7 +12590,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndFloatsUsingBlock: (void (^)(BOOL key, float value, BOOL *stop))block { BOOL stop = NO; if (_valueSet[0]) { @@ -12649,7 +12651,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(float)value forKey:(BOOL)key { +- (void)setFloat:(float)value forKey:(BOOL)key { int idx = (key ? 1 : 0); _values[idx] = value; _valueSet[idx] = YES; @@ -12658,7 +12660,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(BOOL)aKey { +- (void)removeFloatForKey:(BOOL)aKey { _valueSet[aKey ? 1 : 0] = NO; } @@ -12681,26 +12683,26 @@ void GPBDictionaryReadEntry(id mapDictionary, } + (instancetype)dictionary { - return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease]; + return [[[self alloc] initWithDoubles:NULL forKeys:NULL count:0] autorelease]; } -+ (instancetype)dictionaryWithValue:(double)value - forKey:(BOOL)key { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithDouble:(double)value + forKey:(BOOL)key { + // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count: // on to get the type correct. - return [[(GPBBoolDoubleDictionary*)[self alloc] initWithValues:&value - forKeys:&key - count:1] autorelease]; + return [[(GPBBoolDoubleDictionary*)[self alloc] initWithDoubles:&value + forKeys:&key + count:1] autorelease]; } -+ (instancetype)dictionaryWithValues:(const double [])values - forKeys:(const BOOL [])keys - count:(NSUInteger)count { - // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count: ++ (instancetype)dictionaryWithDoubles:(const double [])values + forKeys:(const BOOL [])keys + count:(NSUInteger)count { + // Cast is needed so the compiler knows what class we are invoking initWithDoubles:forKeys:count: // on to get the type correct. - return [[(GPBBoolDoubleDictionary*)[self alloc] initWithValues:values - forKeys:keys - count:count] autorelease]; + return [[(GPBBoolDoubleDictionary*)[self alloc] initWithDoubles:values + forKeys:keys + count:count] autorelease]; } + (instancetype)dictionaryWithDictionary:(GPBBoolDoubleDictionary *)dictionary { @@ -12714,12 +12716,12 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)init { - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithDoubles:NULL forKeys:NULL count:0]; } -- (instancetype)initWithValues:(const double [])values - forKeys:(const BOOL [])keys - count:(NSUInteger)count { +- (instancetype)initWithDoubles:(const double [])values + forKeys:(const BOOL [])keys + count:(NSUInteger)count { self = [super init]; if (self) { for (NSUInteger i = 0; i < count; ++i) { @@ -12732,7 +12734,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } - (instancetype)initWithDictionary:(GPBBoolDoubleDictionary *)dictionary { - self = [self initWithValues:NULL forKeys:NULL count:0]; + self = [self initWithDoubles:NULL forKeys:NULL count:0]; if (self) { if (dictionary) { for (int i = 0; i < 2; ++i) { @@ -12748,7 +12750,7 @@ void GPBDictionaryReadEntry(id mapDictionary, - (instancetype)initWithCapacity:(NSUInteger)numItems { #pragma unused(numItems) - return [self initWithValues:NULL forKeys:NULL count:0]; + return [self initWithDoubles:NULL forKeys:NULL count:0]; } #if !defined(NS_BLOCK_ASSERTIONS) @@ -12803,7 +12805,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (_valueSet[0] ? 1 : 0) + (_valueSet[1] ? 1 : 0); } -- (BOOL)valueForKey:(BOOL)key value:(double *)value { +- (BOOL)getDouble:(double *)value forKey:(BOOL)key { int idx = (key ? 1 : 0); if (_valueSet[idx]) { if (value) { @@ -12830,7 +12832,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndDoublesUsingBlock: (void (^)(BOOL key, double value, BOOL *stop))block { BOOL stop = NO; if (_valueSet[0]) { @@ -12891,7 +12893,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(double)value forKey:(BOOL)key { +- (void)setDouble:(double)value forKey:(BOOL)key { int idx = (key ? 1 : 0); _values[idx] = value; _valueSet[idx] = YES; @@ -12900,7 +12902,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(BOOL)aKey { +- (void)removeDoubleForKey:(BOOL)aKey { _valueSet[aKey ? 1 : 0] = NO; } @@ -13335,7 +13337,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return (_valueSet[0] ? 1 : 0) + (_valueSet[1] ? 1 : 0); } -- (BOOL)valueForKey:(BOOL)key value:(int32_t*)value { +- (BOOL)getEnum:(int32_t*)value forKey:(BOOL)key { int idx = (key ? 1 : 0); if (_valueSet[idx]) { if (value) { @@ -13350,7 +13352,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return NO; } -- (BOOL)valueForKey:(BOOL)key rawValue:(int32_t*)rawValue { +- (BOOL)getRawValue:(int32_t*)rawValue forKey:(BOOL)key { int idx = (key ? 1 : 0); if (_valueSet[idx]) { if (rawValue) { @@ -13361,7 +13363,7 @@ void GPBDictionaryReadEntry(id mapDictionary, return NO; } -- (void)enumerateKeysAndValuesUsingBlock: +- (void)enumerateKeysAndRawValuesUsingBlock: (void (^)(BOOL key, int32_t value, BOOL *stop))block { BOOL stop = NO; if (_valueSet[0]) { @@ -13372,7 +13374,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)enumerateKeysAndRawValuesUsingBlock: +- (void)enumerateKeysAndEnumsUsingBlock: (void (^)(BOOL key, int32_t rawValue, BOOL *stop))block { BOOL stop = NO; GPBEnumValidationFunc func = _validationFunc; @@ -13477,7 +13479,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)setValue:(int32_t)value forKey:(BOOL)key { +- (void)setEnum:(int32_t)value forKey:(BOOL)key { if (!_validationFunc(value)) { [NSException raise:NSInvalidArgumentException format:@"GPBBoolEnumDictionary: Attempt to set an unknown enum value (%d)", @@ -13500,7 +13502,7 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)removeValueForKey:(BOOL)aKey { +- (void)removeEnumForKey:(BOOL)aKey { _valueSet[aKey ? 1 : 0] = NO; } -- cgit v1.2.3