| Index: third_party/protobuf/objectivec/GPBDictionary.m
|
| diff --git a/third_party/protobuf/objectivec/GPBDictionary.m b/third_party/protobuf/objectivec/GPBDictionary.m
|
| index 3bd146e0f9e568af8c4f98c9da7f13fa83912dc7..fd8bd1ce77ab5c8362621e3f44f78e283fd7f067 100644
|
| --- a/third_party/protobuf/objectivec/GPBDictionary.m
|
| +++ b/third_party/protobuf/objectivec/GPBDictionary.m
|
| @@ -45,6 +45,12 @@
|
| // directly.
|
| // ------------------------------------------------------------------
|
|
|
| +// Direct access is use for speed, to avoid even internally declaring things
|
| +// read/write, etc. The warning is enabled in the project to ensure code calling
|
| +// protos can turn on -Wdirect-ivar-access without issues.
|
| +#pragma clang diagnostic push
|
| +#pragma clang diagnostic ignored "-Wdirect-ivar-access"
|
| +
|
| // Used to include code only visible to specific versions of the static
|
| // analyzer. Useful for wrapping code that only exists to silence the analyzer.
|
| // Determine the values you want to use for BEGIN_APPLE_BUILD_VERSION,
|
| @@ -484,6 +490,8 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| key.valueString = [@"" retain];
|
| }
|
| if (GPBDataTypeIsObject(valueDataType) && value.valueString == nil) {
|
| +#pragma clang diagnostic push
|
| +#pragma clang diagnostic ignored "-Wswitch-enum"
|
| switch (valueDataType) {
|
| case GPBDataTypeString:
|
| value.valueString = [@"" retain];
|
| @@ -505,6 +513,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| // Nothing
|
| break;
|
| }
|
| +#pragma clang diagnostic pop
|
| }
|
|
|
| if ((keyDataType == GPBDataTypeString) && GPBDataTypeIsObject(valueDataType)) {
|
| @@ -568,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 {
|
| @@ -582,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];
|
| //%}
|
| @@ -615,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])];
|
| //% }
|
| //% }
|
| //% }
|
| @@ -634,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];
|
| @@ -645,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
|
| //%
|
| @@ -762,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);
|
| @@ -776,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);
|
| @@ -784,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,
|
| @@ -798,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)",
|
| @@ -816,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: %@",
|
| @@ -829,14 +838,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| //% return [[GPB##KEY_NAME##VALUE_NAME##Dictionary allocWithZone:zone] initWithDictionary:self];
|
| //%}
|
| //%
|
| -//%- (BOOL)isEqual:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)other {
|
| +//%- (BOOL)isEqual:(id)other {
|
| //% if (self == other) {
|
| //% return YES;
|
| //% }
|
| //% if (![other isKindOfClass:[GPB##KEY_NAME##VALUE_NAME##Dictionary class]]) {
|
| //% return NO;
|
| //% }
|
| -//% return [_dictionary isEqual:other->_dictionary];
|
| +//% GPB##KEY_NAME##VALUE_NAME##Dictionary *otherDictionary = other;
|
| +//% return [_dictionary isEqual:otherDictionary->_dictionary];
|
| //%}
|
| //%
|
| //%- (NSUInteger)hash {
|
| @@ -851,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);
|
| //% }];
|
| //%}
|
| //%
|
| @@ -870,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);
|
| @@ -888,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);
|
| //% }];
|
| //%}
|
| //%
|
| @@ -909,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];
|
| @@ -924,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)];
|
| //%}
|
| //%
|
| @@ -944,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 {
|
| @@ -957,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];
|
| //%}
|
| @@ -990,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()
|
| @@ -1006,19 +1018,20 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| //% return [[GPBBool##VALUE_NAME##Dictionary allocWithZone:zone] initWithDictionary:self];
|
| //%}
|
| //%
|
| -//%- (BOOL)isEqual:(GPBBool##VALUE_NAME##Dictionary *)other {
|
| +//%- (BOOL)isEqual:(id)other {
|
| //% if (self == other) {
|
| //% return YES;
|
| //% }
|
| //% if (![other isKindOfClass:[GPBBool##VALUE_NAME##Dictionary class]]) {
|
| //% return NO;
|
| //% }
|
| -//% if ((BOOL_DICT_W_HAS##HELPER(0, ) != BOOL_DICT_W_HAS##HELPER(0, other->)) ||
|
| -//% (BOOL_DICT_W_HAS##HELPER(1, ) != BOOL_DICT_W_HAS##HELPER(1, other->))) {
|
| +//% GPBBool##VALUE_NAME##Dictionary *otherDictionary = other;
|
| +//% if ((BOOL_DICT_W_HAS##HELPER(0, ) != BOOL_DICT_W_HAS##HELPER(0, otherDictionary->)) ||
|
| +//% (BOOL_DICT_W_HAS##HELPER(1, ) != BOOL_DICT_W_HAS##HELPER(1, otherDictionary->))) {
|
| //% return NO;
|
| //% }
|
| -//% if ((BOOL_DICT_W_HAS##HELPER(0, ) && (NEQ_##HELPER(_values[0], other->_values[0]))) ||
|
| -//% (BOOL_DICT_W_HAS##HELPER(1, ) && (NEQ_##HELPER(_values[1], other->_values[1])))) {
|
| +//% if ((BOOL_DICT_W_HAS##HELPER(0, ) && (NEQ_##HELPER(_values[0], otherDictionary->_values[0]))) ||
|
| +//% (BOOL_DICT_W_HAS##HELPER(1, ) && (NEQ_##HELPER(_values[1], otherDictionary->_values[1])))) {
|
| //% return NO;
|
| //% }
|
| //% return YES;
|
| @@ -1044,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)
|
| //%
|
| @@ -1057,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);
|
| @@ -1115,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);
|
| @@ -1205,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) {
|
| @@ -1220,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) {
|
| @@ -1246,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) {
|
| @@ -1279,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;
|
| @@ -1288,7 +1301,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| //% }
|
| //%}
|
| //%
|
| -//%- (void)removeValueForKey:(BOOL)aKey {
|
| +//%- (void)remove##VALUE_NAME##ForKey:(BOOL)aKey {
|
| //% _valueSet[aKey ? 1 : 0] = NO;
|
| //%}
|
| //%
|
| @@ -1449,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];
|
| //%}
|
| @@ -1516,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];
|
| }
|
| @@ -1549,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];
|
| @@ -1568,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];
|
| @@ -1579,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 {
|
| @@ -1594,14 +1607,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt32UInt32Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt32UInt32Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt32UInt32Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt32UInt32Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -1616,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,
|
| @@ -1674,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];
|
| @@ -1697,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)];
|
| }
|
|
|
| @@ -1722,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];
|
| }
|
| @@ -1755,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];
|
| @@ -1774,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];
|
| @@ -1785,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 {
|
| @@ -1800,14 +1814,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt32Int32Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt32Int32Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt32Int32Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt32Int32Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -1822,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,
|
| @@ -1880,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];
|
| @@ -1903,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)];
|
| }
|
|
|
| @@ -1928,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];
|
| }
|
| @@ -1961,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];
|
| @@ -1980,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];
|
| @@ -1991,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 {
|
| @@ -2006,14 +2021,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt32UInt64Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt32UInt64Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt32UInt64Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt32UInt64Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -2028,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,
|
| @@ -2086,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];
|
| @@ -2109,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)];
|
| }
|
|
|
| @@ -2134,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];
|
| }
|
| @@ -2167,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];
|
| @@ -2186,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];
|
| @@ -2197,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 {
|
| @@ -2212,14 +2228,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt32Int64Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt32Int64Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt32Int64Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt32Int64Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -2234,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,
|
| @@ -2292,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];
|
| @@ -2315,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)];
|
| }
|
|
|
| @@ -2340,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];
|
| }
|
| @@ -2373,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];
|
| @@ -2392,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];
|
| @@ -2403,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 {
|
| @@ -2418,14 +2435,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt32BoolDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt32BoolDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt32BoolDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt32BoolDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -2440,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,
|
| @@ -2498,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];
|
| @@ -2521,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)];
|
| }
|
|
|
| @@ -2546,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];
|
| }
|
| @@ -2579,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];
|
| @@ -2598,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];
|
| @@ -2609,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 {
|
| @@ -2624,14 +2642,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt32FloatDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt32FloatDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt32FloatDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt32FloatDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -2646,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,
|
| @@ -2704,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];
|
| @@ -2727,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)];
|
| }
|
|
|
| @@ -2752,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];
|
| }
|
| @@ -2785,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];
|
| @@ -2804,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];
|
| @@ -2815,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 {
|
| @@ -2830,14 +2849,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt32DoubleDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt32DoubleDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt32DoubleDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt32DoubleDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -2852,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,
|
| @@ -2910,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];
|
| @@ -2933,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)];
|
| }
|
|
|
| @@ -3064,14 +3084,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt32EnumDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt32EnumDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt32EnumDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt32EnumDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -3162,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];
|
| @@ -3174,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];
|
| @@ -3182,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,
|
| @@ -3212,7 +3233,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(uint32_t)aKey {
|
| +- (void)removeEnumForKey:(uint32_t)aKey {
|
| [_dictionary removeObjectForKey:@(aKey)];
|
| }
|
|
|
| @@ -3220,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)",
|
| @@ -3325,14 +3346,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt32ObjectDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt32ObjectDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt32ObjectDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt32ObjectDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -3480,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];
|
| }
|
| @@ -3513,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];
|
| @@ -3532,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];
|
| @@ -3543,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 {
|
| @@ -3558,14 +3580,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt32UInt32Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt32UInt32Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt32UInt32Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt32UInt32Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -3580,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,
|
| @@ -3638,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];
|
| @@ -3661,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)];
|
| }
|
|
|
| @@ -3686,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];
|
| }
|
| @@ -3719,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];
|
| @@ -3738,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];
|
| @@ -3749,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 {
|
| @@ -3764,14 +3787,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt32Int32Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt32Int32Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt32Int32Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt32Int32Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -3786,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,
|
| @@ -3844,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];
|
| @@ -3867,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)];
|
| }
|
|
|
| @@ -3892,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];
|
| }
|
| @@ -3925,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];
|
| @@ -3944,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];
|
| @@ -3955,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 {
|
| @@ -3970,14 +3994,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt32UInt64Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt32UInt64Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt32UInt64Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt32UInt64Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -3992,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,
|
| @@ -4050,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];
|
| @@ -4073,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)];
|
| }
|
|
|
| @@ -4098,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];
|
| }
|
| @@ -4131,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];
|
| @@ -4150,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];
|
| @@ -4161,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 {
|
| @@ -4176,14 +4201,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt32Int64Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt32Int64Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt32Int64Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt32Int64Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -4198,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,
|
| @@ -4256,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];
|
| @@ -4279,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)];
|
| }
|
|
|
| @@ -4304,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];
|
| }
|
| @@ -4337,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];
|
| @@ -4356,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];
|
| @@ -4367,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 {
|
| @@ -4382,14 +4408,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt32BoolDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt32BoolDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt32BoolDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt32BoolDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -4404,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,
|
| @@ -4462,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];
|
| @@ -4485,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)];
|
| }
|
|
|
| @@ -4510,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];
|
| }
|
| @@ -4543,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];
|
| @@ -4562,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];
|
| @@ -4573,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 {
|
| @@ -4588,14 +4615,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt32FloatDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt32FloatDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt32FloatDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt32FloatDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -4610,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,
|
| @@ -4668,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];
|
| @@ -4691,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)];
|
| }
|
|
|
| @@ -4716,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];
|
| }
|
| @@ -4749,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];
|
| @@ -4768,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];
|
| @@ -4779,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 {
|
| @@ -4794,14 +4822,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt32DoubleDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt32DoubleDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt32DoubleDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt32DoubleDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -4816,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,
|
| @@ -4874,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];
|
| @@ -4897,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)];
|
| }
|
|
|
| @@ -5028,14 +5057,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt32EnumDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt32EnumDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt32EnumDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt32EnumDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -5126,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];
|
| @@ -5138,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];
|
| @@ -5146,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,
|
| @@ -5176,7 +5206,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(int32_t)aKey {
|
| +- (void)removeEnumForKey:(int32_t)aKey {
|
| [_dictionary removeObjectForKey:@(aKey)];
|
| }
|
|
|
| @@ -5184,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)",
|
| @@ -5289,14 +5319,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt32ObjectDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt32ObjectDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt32ObjectDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt32ObjectDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -5444,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];
|
| }
|
| @@ -5477,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];
|
| @@ -5496,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];
|
| @@ -5507,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 {
|
| @@ -5522,14 +5553,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt64UInt32Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt64UInt32Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt64UInt32Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt64UInt32Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -5544,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,
|
| @@ -5602,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];
|
| @@ -5625,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)];
|
| }
|
|
|
| @@ -5650,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];
|
| }
|
| @@ -5683,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];
|
| @@ -5702,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];
|
| @@ -5713,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 {
|
| @@ -5728,14 +5760,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt64Int32Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt64Int32Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt64Int32Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt64Int32Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -5750,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,
|
| @@ -5808,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];
|
| @@ -5831,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)];
|
| }
|
|
|
| @@ -5856,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];
|
| }
|
| @@ -5889,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];
|
| @@ -5908,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];
|
| @@ -5919,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 {
|
| @@ -5934,14 +5967,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt64UInt64Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt64UInt64Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt64UInt64Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt64UInt64Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -5956,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,
|
| @@ -6014,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];
|
| @@ -6037,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)];
|
| }
|
|
|
| @@ -6062,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];
|
| }
|
| @@ -6095,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];
|
| @@ -6114,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];
|
| @@ -6125,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 {
|
| @@ -6140,14 +6174,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt64Int64Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt64Int64Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt64Int64Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt64Int64Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -6162,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,
|
| @@ -6220,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];
|
| @@ -6243,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)];
|
| }
|
|
|
| @@ -6268,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];
|
| }
|
| @@ -6301,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];
|
| @@ -6320,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];
|
| @@ -6331,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 {
|
| @@ -6346,14 +6381,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt64BoolDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt64BoolDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt64BoolDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt64BoolDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -6368,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,
|
| @@ -6426,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];
|
| @@ -6449,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)];
|
| }
|
|
|
| @@ -6474,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];
|
| }
|
| @@ -6507,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];
|
| @@ -6526,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];
|
| @@ -6537,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 {
|
| @@ -6552,14 +6588,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt64FloatDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt64FloatDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt64FloatDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt64FloatDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -6574,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,
|
| @@ -6632,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];
|
| @@ -6655,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)];
|
| }
|
|
|
| @@ -6680,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];
|
| }
|
| @@ -6713,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];
|
| @@ -6732,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];
|
| @@ -6743,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 {
|
| @@ -6758,14 +6795,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt64DoubleDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt64DoubleDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt64DoubleDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt64DoubleDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -6780,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,
|
| @@ -6838,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];
|
| @@ -6861,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)];
|
| }
|
|
|
| @@ -6992,14 +7030,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt64EnumDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt64EnumDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt64EnumDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt64EnumDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -7090,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];
|
| @@ -7102,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];
|
| @@ -7110,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,
|
| @@ -7140,7 +7179,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(uint64_t)aKey {
|
| +- (void)removeEnumForKey:(uint64_t)aKey {
|
| [_dictionary removeObjectForKey:@(aKey)];
|
| }
|
|
|
| @@ -7148,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)",
|
| @@ -7253,14 +7292,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBUInt64ObjectDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBUInt64ObjectDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBUInt64ObjectDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBUInt64ObjectDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -7408,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];
|
| }
|
| @@ -7441,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];
|
| @@ -7460,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];
|
| @@ -7471,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 {
|
| @@ -7486,14 +7526,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt64UInt32Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt64UInt32Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt64UInt32Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt64UInt32Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -7508,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,
|
| @@ -7566,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];
|
| @@ -7589,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)];
|
| }
|
|
|
| @@ -7614,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];
|
| }
|
| @@ -7647,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];
|
| @@ -7666,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];
|
| @@ -7677,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 {
|
| @@ -7692,14 +7733,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt64Int32Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt64Int32Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt64Int32Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt64Int32Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -7714,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,
|
| @@ -7772,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];
|
| @@ -7795,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)];
|
| }
|
|
|
| @@ -7820,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];
|
| }
|
| @@ -7853,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];
|
| @@ -7872,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];
|
| @@ -7883,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 {
|
| @@ -7898,14 +7940,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt64UInt64Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt64UInt64Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt64UInt64Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt64UInt64Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -7920,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,
|
| @@ -7978,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];
|
| @@ -8001,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)];
|
| }
|
|
|
| @@ -8026,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];
|
| }
|
| @@ -8059,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];
|
| @@ -8078,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];
|
| @@ -8089,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 {
|
| @@ -8104,14 +8147,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt64Int64Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt64Int64Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt64Int64Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt64Int64Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -8126,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,
|
| @@ -8184,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];
|
| @@ -8207,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)];
|
| }
|
|
|
| @@ -8232,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];
|
| }
|
| @@ -8265,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];
|
| @@ -8284,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];
|
| @@ -8295,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 {
|
| @@ -8310,14 +8354,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt64BoolDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt64BoolDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt64BoolDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt64BoolDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -8332,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,
|
| @@ -8390,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];
|
| @@ -8413,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)];
|
| }
|
|
|
| @@ -8438,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];
|
| }
|
| @@ -8471,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];
|
| @@ -8490,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];
|
| @@ -8501,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 {
|
| @@ -8516,14 +8561,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt64FloatDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt64FloatDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt64FloatDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt64FloatDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -8538,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,
|
| @@ -8596,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];
|
| @@ -8619,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)];
|
| }
|
|
|
| @@ -8644,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];
|
| }
|
| @@ -8677,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];
|
| @@ -8696,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];
|
| @@ -8707,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 {
|
| @@ -8722,14 +8768,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt64DoubleDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt64DoubleDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt64DoubleDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt64DoubleDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -8744,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,
|
| @@ -8802,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];
|
| @@ -8825,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)];
|
| }
|
|
|
| @@ -8956,14 +9003,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt64EnumDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt64EnumDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt64EnumDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt64EnumDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -9054,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];
|
| @@ -9066,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];
|
| @@ -9074,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,
|
| @@ -9104,7 +9152,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(int64_t)aKey {
|
| +- (void)removeEnumForKey:(int64_t)aKey {
|
| [_dictionary removeObjectForKey:@(aKey)];
|
| }
|
|
|
| @@ -9112,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)",
|
| @@ -9217,14 +9265,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBInt64ObjectDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBInt64ObjectDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBInt64ObjectDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBInt64ObjectDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -9372,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];
|
| }
|
| @@ -9405,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];
|
| @@ -9428,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];
|
| @@ -9439,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 {
|
| @@ -9454,14 +9503,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBStringUInt32Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBStringUInt32Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBStringUInt32Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBStringUInt32Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -9476,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,
|
| @@ -9534,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];
|
| @@ -9557,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"];
|
| @@ -9568,7 +9618,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(NSString *)aKey {
|
| +- (void)removeUInt32ForKey:(NSString *)aKey {
|
| [_dictionary removeObjectForKey:aKey];
|
| }
|
|
|
| @@ -9586,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];
|
| }
|
| @@ -9619,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];
|
| @@ -9642,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];
|
| @@ -9653,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 {
|
| @@ -9668,14 +9718,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBStringInt32Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBStringInt32Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBStringInt32Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBStringInt32Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -9690,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,
|
| @@ -9748,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];
|
| @@ -9771,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"];
|
| @@ -9782,7 +9833,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(NSString *)aKey {
|
| +- (void)removeInt32ForKey:(NSString *)aKey {
|
| [_dictionary removeObjectForKey:aKey];
|
| }
|
|
|
| @@ -9800,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];
|
| }
|
| @@ -9833,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];
|
| @@ -9856,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];
|
| @@ -9867,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 {
|
| @@ -9882,14 +9933,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBStringUInt64Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBStringUInt64Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBStringUInt64Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBStringUInt64Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -9904,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,
|
| @@ -9962,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];
|
| @@ -9985,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"];
|
| @@ -9996,7 +10048,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(NSString *)aKey {
|
| +- (void)removeUInt64ForKey:(NSString *)aKey {
|
| [_dictionary removeObjectForKey:aKey];
|
| }
|
|
|
| @@ -10014,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];
|
| }
|
| @@ -10047,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];
|
| @@ -10070,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];
|
| @@ -10081,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 {
|
| @@ -10096,14 +10148,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBStringInt64Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBStringInt64Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBStringInt64Dictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBStringInt64Dictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -10118,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,
|
| @@ -10176,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];
|
| @@ -10199,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"];
|
| @@ -10210,7 +10263,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(NSString *)aKey {
|
| +- (void)removeInt64ForKey:(NSString *)aKey {
|
| [_dictionary removeObjectForKey:aKey];
|
| }
|
|
|
| @@ -10228,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];
|
| }
|
| @@ -10261,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];
|
| @@ -10284,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];
|
| @@ -10295,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 {
|
| @@ -10310,14 +10363,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBStringBoolDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBStringBoolDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBStringBoolDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBStringBoolDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -10332,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,
|
| @@ -10390,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];
|
| @@ -10413,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"];
|
| @@ -10424,7 +10478,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(NSString *)aKey {
|
| +- (void)removeBoolForKey:(NSString *)aKey {
|
| [_dictionary removeObjectForKey:aKey];
|
| }
|
|
|
| @@ -10442,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];
|
| }
|
| @@ -10475,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];
|
| @@ -10498,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];
|
| @@ -10509,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 {
|
| @@ -10524,14 +10578,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBStringFloatDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBStringFloatDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBStringFloatDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBStringFloatDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -10546,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,
|
| @@ -10604,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];
|
| @@ -10627,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"];
|
| @@ -10638,7 +10693,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(NSString *)aKey {
|
| +- (void)removeFloatForKey:(NSString *)aKey {
|
| [_dictionary removeObjectForKey:aKey];
|
| }
|
|
|
| @@ -10656,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];
|
| }
|
| @@ -10689,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];
|
| @@ -10712,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];
|
| @@ -10723,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 {
|
| @@ -10738,14 +10793,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBStringDoubleDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBStringDoubleDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBStringDoubleDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBStringDoubleDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -10760,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,
|
| @@ -10818,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];
|
| @@ -10841,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"];
|
| @@ -10852,7 +10908,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(NSString *)aKey {
|
| +- (void)removeDoubleForKey:(NSString *)aKey {
|
| [_dictionary removeObjectForKey:aKey];
|
| }
|
|
|
| @@ -10980,14 +11036,15 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBStringEnumDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBStringEnumDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBStringEnumDictionary class]]) {
|
| return NO;
|
| }
|
| - return [_dictionary isEqual:other->_dictionary];
|
| + GPBStringEnumDictionary *otherDictionary = other;
|
| + return [_dictionary isEqual:otherDictionary->_dictionary];
|
| }
|
|
|
| - (NSUInteger)hash {
|
| @@ -11078,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];
|
| @@ -11090,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];
|
| @@ -11098,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,
|
| @@ -11132,7 +11189,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(NSString *)aKey {
|
| +- (void)removeEnumForKey:(NSString *)aKey {
|
| [_dictionary removeObjectForKey:aKey];
|
| }
|
|
|
| @@ -11140,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"];
|
| @@ -11174,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 {
|
| @@ -11207,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) {
|
| @@ -11225,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) {
|
| @@ -11241,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)
|
| @@ -11257,19 +11314,20 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBBoolUInt32Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBBoolUInt32Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBBoolUInt32Dictionary class]]) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] != other->_valueSet[0]) ||
|
| - (_valueSet[1] != other->_valueSet[1])) {
|
| + GPBBoolUInt32Dictionary *otherDictionary = other;
|
| + if ((_valueSet[0] != otherDictionary->_valueSet[0]) ||
|
| + (_valueSet[1] != otherDictionary->_valueSet[1])) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] && (_values[0] != other->_values[0])) ||
|
| - (_valueSet[1] && (_values[1] != other->_values[1]))) {
|
| + if ((_valueSet[0] && (_values[0] != otherDictionary->_values[0])) ||
|
| + (_valueSet[1] && (_values[1] != otherDictionary->_values[1]))) {
|
| return NO;
|
| }
|
| return YES;
|
| @@ -11295,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) {
|
| @@ -11322,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]) {
|
| @@ -11383,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;
|
| @@ -11392,7 +11450,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(BOOL)aKey {
|
| +- (void)removeUInt32ForKey:(BOOL)aKey {
|
| _valueSet[aKey ? 1 : 0] = NO;
|
| }
|
|
|
| @@ -11415,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];
|
| }
|
| @@ -11448,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];
|
| @@ -11466,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) {
|
| @@ -11482,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)
|
| @@ -11498,19 +11556,20 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBBoolInt32Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBBoolInt32Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBBoolInt32Dictionary class]]) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] != other->_valueSet[0]) ||
|
| - (_valueSet[1] != other->_valueSet[1])) {
|
| + GPBBoolInt32Dictionary *otherDictionary = other;
|
| + if ((_valueSet[0] != otherDictionary->_valueSet[0]) ||
|
| + (_valueSet[1] != otherDictionary->_valueSet[1])) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] && (_values[0] != other->_values[0])) ||
|
| - (_valueSet[1] && (_values[1] != other->_values[1]))) {
|
| + if ((_valueSet[0] && (_values[0] != otherDictionary->_values[0])) ||
|
| + (_valueSet[1] && (_values[1] != otherDictionary->_values[1]))) {
|
| return NO;
|
| }
|
| return YES;
|
| @@ -11536,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) {
|
| @@ -11563,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]) {
|
| @@ -11624,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;
|
| @@ -11633,7 +11692,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(BOOL)aKey {
|
| +- (void)removeInt32ForKey:(BOOL)aKey {
|
| _valueSet[aKey ? 1 : 0] = NO;
|
| }
|
|
|
| @@ -11656,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 {
|
| @@ -11689,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) {
|
| @@ -11707,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) {
|
| @@ -11723,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)
|
| @@ -11739,19 +11798,20 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBBoolUInt64Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBBoolUInt64Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBBoolUInt64Dictionary class]]) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] != other->_valueSet[0]) ||
|
| - (_valueSet[1] != other->_valueSet[1])) {
|
| + GPBBoolUInt64Dictionary *otherDictionary = other;
|
| + if ((_valueSet[0] != otherDictionary->_valueSet[0]) ||
|
| + (_valueSet[1] != otherDictionary->_valueSet[1])) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] && (_values[0] != other->_values[0])) ||
|
| - (_valueSet[1] && (_values[1] != other->_values[1]))) {
|
| + if ((_valueSet[0] && (_values[0] != otherDictionary->_values[0])) ||
|
| + (_valueSet[1] && (_values[1] != otherDictionary->_values[1]))) {
|
| return NO;
|
| }
|
| return YES;
|
| @@ -11777,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) {
|
| @@ -11804,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]) {
|
| @@ -11865,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;
|
| @@ -11874,7 +11934,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(BOOL)aKey {
|
| +- (void)removeUInt64ForKey:(BOOL)aKey {
|
| _valueSet[aKey ? 1 : 0] = NO;
|
| }
|
|
|
| @@ -11897,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];
|
| }
|
| @@ -11930,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];
|
| @@ -11948,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) {
|
| @@ -11964,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)
|
| @@ -11980,19 +12040,20 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBBoolInt64Dictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBBoolInt64Dictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBBoolInt64Dictionary class]]) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] != other->_valueSet[0]) ||
|
| - (_valueSet[1] != other->_valueSet[1])) {
|
| + GPBBoolInt64Dictionary *otherDictionary = other;
|
| + if ((_valueSet[0] != otherDictionary->_valueSet[0]) ||
|
| + (_valueSet[1] != otherDictionary->_valueSet[1])) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] && (_values[0] != other->_values[0])) ||
|
| - (_valueSet[1] && (_values[1] != other->_values[1]))) {
|
| + if ((_valueSet[0] && (_values[0] != otherDictionary->_values[0])) ||
|
| + (_valueSet[1] && (_values[1] != otherDictionary->_values[1]))) {
|
| return NO;
|
| }
|
| return YES;
|
| @@ -12018,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) {
|
| @@ -12045,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]) {
|
| @@ -12106,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;
|
| @@ -12115,7 +12176,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(BOOL)aKey {
|
| +- (void)removeInt64ForKey:(BOOL)aKey {
|
| _valueSet[aKey ? 1 : 0] = NO;
|
| }
|
|
|
| @@ -12138,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 {
|
| @@ -12171,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) {
|
| @@ -12189,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) {
|
| @@ -12205,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)
|
| @@ -12221,19 +12282,20 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBBoolBoolDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBBoolBoolDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBBoolBoolDictionary class]]) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] != other->_valueSet[0]) ||
|
| - (_valueSet[1] != other->_valueSet[1])) {
|
| + GPBBoolBoolDictionary *otherDictionary = other;
|
| + if ((_valueSet[0] != otherDictionary->_valueSet[0]) ||
|
| + (_valueSet[1] != otherDictionary->_valueSet[1])) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] && (_values[0] != other->_values[0])) ||
|
| - (_valueSet[1] && (_values[1] != other->_values[1]))) {
|
| + if ((_valueSet[0] && (_values[0] != otherDictionary->_values[0])) ||
|
| + (_valueSet[1] && (_values[1] != otherDictionary->_values[1]))) {
|
| return NO;
|
| }
|
| return YES;
|
| @@ -12259,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) {
|
| @@ -12286,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]) {
|
| @@ -12347,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;
|
| @@ -12356,7 +12418,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(BOOL)aKey {
|
| +- (void)removeBoolForKey:(BOOL)aKey {
|
| _valueSet[aKey ? 1 : 0] = NO;
|
| }
|
|
|
| @@ -12379,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];
|
| }
|
| @@ -12412,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];
|
| @@ -12430,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) {
|
| @@ -12446,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)
|
| @@ -12462,19 +12524,20 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBBoolFloatDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBBoolFloatDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBBoolFloatDictionary class]]) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] != other->_valueSet[0]) ||
|
| - (_valueSet[1] != other->_valueSet[1])) {
|
| + GPBBoolFloatDictionary *otherDictionary = other;
|
| + if ((_valueSet[0] != otherDictionary->_valueSet[0]) ||
|
| + (_valueSet[1] != otherDictionary->_valueSet[1])) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] && (_values[0] != other->_values[0])) ||
|
| - (_valueSet[1] && (_values[1] != other->_values[1]))) {
|
| + if ((_valueSet[0] && (_values[0] != otherDictionary->_values[0])) ||
|
| + (_valueSet[1] && (_values[1] != otherDictionary->_values[1]))) {
|
| return NO;
|
| }
|
| return YES;
|
| @@ -12500,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) {
|
| @@ -12527,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]) {
|
| @@ -12588,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;
|
| @@ -12597,7 +12660,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(BOOL)aKey {
|
| +- (void)removeFloatForKey:(BOOL)aKey {
|
| _valueSet[aKey ? 1 : 0] = NO;
|
| }
|
|
|
| @@ -12620,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 {
|
| @@ -12653,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) {
|
| @@ -12671,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) {
|
| @@ -12687,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)
|
| @@ -12703,19 +12766,20 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBBoolDoubleDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBBoolDoubleDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBBoolDoubleDictionary class]]) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] != other->_valueSet[0]) ||
|
| - (_valueSet[1] != other->_valueSet[1])) {
|
| + GPBBoolDoubleDictionary *otherDictionary = other;
|
| + if ((_valueSet[0] != otherDictionary->_valueSet[0]) ||
|
| + (_valueSet[1] != otherDictionary->_valueSet[1])) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] && (_values[0] != other->_values[0])) ||
|
| - (_valueSet[1] && (_values[1] != other->_values[1]))) {
|
| + if ((_valueSet[0] && (_values[0] != otherDictionary->_values[0])) ||
|
| + (_valueSet[1] && (_values[1] != otherDictionary->_values[1]))) {
|
| return NO;
|
| }
|
| return YES;
|
| @@ -12741,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) {
|
| @@ -12768,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]) {
|
| @@ -12829,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;
|
| @@ -12838,7 +12902,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(BOOL)aKey {
|
| +- (void)removeDoubleForKey:(BOOL)aKey {
|
| _valueSet[aKey ? 1 : 0] = NO;
|
| }
|
|
|
| @@ -12943,19 +13007,20 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBBoolObjectDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBBoolObjectDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBBoolObjectDictionary class]]) {
|
| return NO;
|
| }
|
| - if (((_values[0] != nil) != (other->_values[0] != nil)) ||
|
| - ((_values[1] != nil) != (other->_values[1] != nil))) {
|
| + GPBBoolObjectDictionary *otherDictionary = other;
|
| + if (((_values[0] != nil) != (otherDictionary->_values[0] != nil)) ||
|
| + ((_values[1] != nil) != (otherDictionary->_values[1] != nil))) {
|
| return NO;
|
| }
|
| - if (((_values[0] != nil) && (![_values[0] isEqual:other->_values[0]])) ||
|
| - ((_values[1] != nil) && (![_values[1] isEqual:other->_values[1]]))) {
|
| + if (((_values[0] != nil) && (![_values[0] isEqual:otherDictionary->_values[0]])) ||
|
| + ((_values[1] != nil) && (![_values[1] isEqual:otherDictionary->_values[1]]))) {
|
| return NO;
|
| }
|
| return YES;
|
| @@ -13233,19 +13298,20 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| return [[GPBBoolEnumDictionary allocWithZone:zone] initWithDictionary:self];
|
| }
|
|
|
| -- (BOOL)isEqual:(GPBBoolEnumDictionary *)other {
|
| +- (BOOL)isEqual:(id)other {
|
| if (self == other) {
|
| return YES;
|
| }
|
| if (![other isKindOfClass:[GPBBoolEnumDictionary class]]) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] != other->_valueSet[0]) ||
|
| - (_valueSet[1] != other->_valueSet[1])) {
|
| + GPBBoolEnumDictionary *otherDictionary = other;
|
| + if ((_valueSet[0] != otherDictionary->_valueSet[0]) ||
|
| + (_valueSet[1] != otherDictionary->_valueSet[1])) {
|
| return NO;
|
| }
|
| - if ((_valueSet[0] && (_values[0] != other->_values[0])) ||
|
| - (_valueSet[1] && (_values[1] != other->_values[1]))) {
|
| + if ((_valueSet[0] && (_values[0] != otherDictionary->_values[0])) ||
|
| + (_valueSet[1] && (_values[1] != otherDictionary->_values[1]))) {
|
| return NO;
|
| }
|
| return YES;
|
| @@ -13271,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) {
|
| @@ -13286,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) {
|
| @@ -13297,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]) {
|
| @@ -13308,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;
|
| @@ -13413,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)",
|
| @@ -13436,7 +13502,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
| }
|
|
|
| -- (void)removeValueForKey:(BOOL)aKey {
|
| +- (void)removeEnumForKey:(BOOL)aKey {
|
| _valueSet[aKey ? 1 : 0] = NO;
|
| }
|
|
|
| @@ -13553,3 +13619,5 @@ void GPBDictionaryReadEntry(id mapDictionary,
|
| }
|
|
|
| @end
|
| +
|
| +#pragma clang diagnostic pop
|
|
|