aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xobjectivec/DevTools/full_mac_build.sh4
-rw-r--r--objectivec/GPBDictionary.h174
-rw-r--r--objectivec/GPBDictionary.m589
-rw-r--r--objectivec/Tests/GPBDictionaryTests+Bool.m200
-rw-r--r--objectivec/Tests/GPBDictionaryTests+Int32.m254
-rw-r--r--objectivec/Tests/GPBDictionaryTests+Int64.m254
-rw-r--r--objectivec/Tests/GPBDictionaryTests+String.m36
-rw-r--r--objectivec/Tests/GPBDictionaryTests+UInt32.m254
-rw-r--r--objectivec/Tests/GPBDictionaryTests+UInt64.m254
-rw-r--r--objectivec/Tests/GPBDictionaryTests.pddm376
-rw-r--r--objectivec/Tests/GPBMessageTests+Merge.m7
-rw-r--r--objectivec/Tests/GPBMessageTests+Runtime.m6
-rw-r--r--objectivec/Tests/GPBMessageTests+Serialization.m8
-rw-r--r--objectivec/Tests/GPBTestUtilities.m4
-rw-r--r--objectivec/Tests/GPBWireFormatTests.m4
15 files changed, 1216 insertions, 1208 deletions
diff --git a/objectivec/DevTools/full_mac_build.sh b/objectivec/DevTools/full_mac_build.sh
index 2192b760..c38fce7c 100755
--- a/objectivec/DevTools/full_mac_build.sh
+++ b/objectivec/DevTools/full_mac_build.sh
@@ -202,9 +202,9 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then
# Don't need to worry about form factors or retina/non retina;
# just pick a mix of OS Versions and 32/64 bit.
-destination "platform=iOS Simulator,name=iPhone 4s,OS=7.1" # 32bit
- -destination "platform=iOS Simulator,name=iPhone 6,OS=8.3" # 64bit
+ -destination "platform=iOS Simulator,name=iPhone 6,OS=8.4" # 64bit
-destination "platform=iOS Simulator,name=iPad 2,OS=7.1" # 32bit
- -destination "platform=iOS Simulator,name=iPad Air,OS=8.3" # 64bit
+ -destination "platform=iOS Simulator,name=iPad Air,OS=8.4" # 64bit
)
header "Doing Xcode iOS build/tests - Debug"
"${XCODEBUILD_TEST_BASE_IOS[@]}" -configuration Debug test
diff --git a/objectivec/GPBDictionary.h b/objectivec/GPBDictionary.h
index cc4a698a..6961cfc3 100644
--- a/objectivec/GPBDictionary.h
+++ b/objectivec/GPBDictionary.h
@@ -360,30 +360,30 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
+ (instancetype)dictionary;
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(uint32_t)key;
-+ (instancetype)dictionaryWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count;
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(uint32_t)key;
++ (instancetype)dictionaryWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const uint32_t [])keys
+ count:(NSUInteger)count;
+ (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary;
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-- (instancetype)initWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const uint32_t [])keys
+ count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary;
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-- (id)valueForKey:(uint32_t)key;
+- (id)objectForKey:(uint32_t)key;
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(uint32_t key, id value, BOOL *stop))block;
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(uint32_t key, id object, BOOL *stop))block;
- (void)addEntriesFromDictionary:(GPBUInt32ObjectDictionary *)otherDictionary;
-- (void)setValue:(id)value forKey:(uint32_t)key;
+- (void)setObject:(id)object forKey:(uint32_t)key;
-- (void)removeValueForKey:(uint32_t)aKey;
+- (void)removeObjectForKey:(uint32_t)aKey;
- (void)removeAll;
@end
@@ -706,30 +706,30 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
+ (instancetype)dictionary;
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(int32_t)key;
-+ (instancetype)dictionaryWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count;
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(int32_t)key;
++ (instancetype)dictionaryWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const int32_t [])keys
+ count:(NSUInteger)count;
+ (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-- (instancetype)initWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const int32_t [])keys
+ count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-- (id)valueForKey:(int32_t)key;
+- (id)objectForKey:(int32_t)key;
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(int32_t key, id value, BOOL *stop))block;
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(int32_t key, id object, BOOL *stop))block;
- (void)addEntriesFromDictionary:(GPBInt32ObjectDictionary *)otherDictionary;
-- (void)setValue:(id)value forKey:(int32_t)key;
+- (void)setObject:(id)object forKey:(int32_t)key;
-- (void)removeValueForKey:(int32_t)aKey;
+- (void)removeObjectForKey:(int32_t)aKey;
- (void)removeAll;
@end
@@ -1052,30 +1052,30 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
+ (instancetype)dictionary;
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(uint64_t)key;
-+ (instancetype)dictionaryWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count;
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(uint64_t)key;
++ (instancetype)dictionaryWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const uint64_t [])keys
+ count:(NSUInteger)count;
+ (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary;
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-- (instancetype)initWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const uint64_t [])keys
+ count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary;
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-- (id)valueForKey:(uint64_t)key;
+- (id)objectForKey:(uint64_t)key;
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(uint64_t key, id value, BOOL *stop))block;
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(uint64_t key, id object, BOOL *stop))block;
- (void)addEntriesFromDictionary:(GPBUInt64ObjectDictionary *)otherDictionary;
-- (void)setValue:(id)value forKey:(uint64_t)key;
+- (void)setObject:(id)object forKey:(uint64_t)key;
-- (void)removeValueForKey:(uint64_t)aKey;
+- (void)removeObjectForKey:(uint64_t)aKey;
- (void)removeAll;
@end
@@ -1398,30 +1398,30 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
+ (instancetype)dictionary;
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(int64_t)key;
-+ (instancetype)dictionaryWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count;
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(int64_t)key;
++ (instancetype)dictionaryWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const int64_t [])keys
+ count:(NSUInteger)count;
+ (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-- (instancetype)initWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const int64_t [])keys
+ count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-- (id)valueForKey:(int64_t)key;
+- (id)objectForKey:(int64_t)key;
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(int64_t key, id value, BOOL *stop))block;
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(int64_t key, id object, BOOL *stop))block;
- (void)addEntriesFromDictionary:(GPBInt64ObjectDictionary *)otherDictionary;
-- (void)setValue:(id)value forKey:(int64_t)key;
+- (void)setObject:(id)object forKey:(int64_t)key;
-- (void)removeValueForKey:(int64_t)aKey;
+- (void)removeObjectForKey:(int64_t)aKey;
- (void)removeAll;
@end
@@ -1744,30 +1744,30 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly) NSUInteger count;
+ (instancetype)dictionary;
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(BOOL)key;
-+ (instancetype)dictionaryWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count;
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(BOOL)key;
++ (instancetype)dictionaryWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const BOOL [])keys
+ count:(NSUInteger)count;
+ (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary;
+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
-- (instancetype)initWithValues:(const id GPB_UNSAFE_UNRETAINED [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+- (instancetype)initWithObjects:(const id GPB_UNSAFE_UNRETAINED [])objects
+ forKeys:(const BOOL [])keys
+ count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary;
- (instancetype)initWithCapacity:(NSUInteger)numItems;
-- (id)valueForKey:(BOOL)key;
+- (id)objectForKey:(BOOL)key;
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(BOOL key, id value, BOOL *stop))block;
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(BOOL key, id object, BOOL *stop))block;
- (void)addEntriesFromDictionary:(GPBBoolObjectDictionary *)otherDictionary;
-- (void)setValue:(id)value forKey:(BOOL)key;
+- (void)setObject:(id)object forKey:(BOOL)key;
-- (void)removeValueForKey:(BOOL)aKey;
+- (void)removeObjectForKey:(BOOL)aKey;
- (void)removeAll;
@end
@@ -2107,13 +2107,13 @@ NS_ASSUME_NONNULL_END
//%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Double, double)
//%DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Enum, int32_t)
//%PDDM-DEFINE DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE)
-//%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, POD)
+//%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, POD, value)
//%PDDM-DEFINE DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, VALUE_NAME, VALUE_TYPE)
-//%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, , POD, VALUE_NAME, VALUE_TYPE, OBJECT)
+//%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, , POD, VALUE_NAME, VALUE_TYPE, OBJECT, object)
//%PDDM-DEFINE VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE)
//%- (BOOL)valueForKey:(KEY_TYPE)key value:(nullable VALUE_TYPE *)value;
//%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_TYPE)
-//%- (VALUE_TYPE)valueForKey:(KEY_TYPE)key;
+//%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key;
//%PDDM-DEFINE VALUE_FOR_KEY_Enum(KEY_TYPE, VALUE_TYPE)
//%VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE)
//%PDDM-DEFINE ARRAY_ARG_MODIFIERPOD()
@@ -2122,7 +2122,7 @@ NS_ASSUME_NONNULL_END
// Nothing
//%PDDM-DEFINE ARRAY_ARG_MODIFIEROBJECT()
//%GPB_UNSAFE_UNRETAINED ##
-//%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER)
+//%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
//%#pragma mark - KEY_NAME -> VALUE_NAME
//%
//%@interface GPB##KEY_NAME##VALUE_NAME##Dictionary : NSObject <NSCopying>
@@ -2130,25 +2130,25 @@ NS_ASSUME_NONNULL_END
//%@property(nonatomic, readonly) NSUInteger count;
//%
//%+ (instancetype)dictionary;
-//%+ (instancetype)dictionaryWithValue:(VALUE_TYPE)value
-//% forKey:(KEY_TYPE##KisP$S##KisP)key;
-//%+ (instancetype)dictionaryWithValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])values
-//% forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
-//% count:(NSUInteger)count;
+//%+ (instancetype)dictionaryWith##VNAME$u##:(VALUE_TYPE)##VNAME
+//% ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key;
+//%+ (instancetype)dictionaryWith##VNAME$u##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])##VNAME##s
+//% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
+//% ##VNAME$S## count:(NSUInteger)count;
//%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
//%+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
//%
-//%- (instancetype)initWithValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])values
-//% forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
-//% count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
+//%- (instancetype)initWith##VNAME$u##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])##VNAME##s
+//% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
+//% ##VNAME$S## count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
//%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
//%- (instancetype)initWithCapacity:(NSUInteger)numItems;
//%
-//%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER)
+//%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
//%
//%- (void)addEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary;
//%
-//%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER)
+//%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
//%
//%@end
//%
@@ -2189,7 +2189,7 @@ NS_ASSUME_NONNULL_END
//%// is not a valid enumerator as defined by validationFunc. If the actual value is
//%// desired, use "raw" version of the method.
//%
-//%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER)
+//%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, value)
//%
//%// These methods bypass the validationFunc to provide access to values that were not
//%// known at the time the binary was compiled.
@@ -2206,21 +2206,21 @@ NS_ASSUME_NONNULL_END
//%// to the default value. Use the rawValue methods below to assign non enumerator
//%// values.
//%
-//%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER)
+//%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, value)
//%
//%@end
//%
-//%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER)
+//%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
//%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_TYPE)
//%
-//%- (void)enumerateKeysAndValuesUsingBlock:
-//% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE value, BOOL *stop))block;
+//%- (void)enumerateKeysAnd##VNAME$u##sUsingBlock:
+//% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME, BOOL *stop))block;
-//%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER)
-//%- (void)setValue:(VALUE_TYPE)value forKey:(KEY_TYPE##KisP$S##KisP)key;
+//%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME)
+//%- (void)set##VNAME$u##:(VALUE_TYPE)##VNAME forKey:(KEY_TYPE##KisP$S##KisP)key;
//%DICTIONARY_EXTRA_MUTABLE_METHODS_##VHELPER(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
-//%- (void)removeValueForKey:(KEY_TYPE##KisP$S##KisP)aKey;
+//%- (void)remove##VNAME$u##ForKey:(KEY_TYPE##KisP$S##KisP)aKey;
//%- (void)removeAll;
//%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_POD(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
diff --git a/objectivec/GPBDictionary.m b/objectivec/GPBDictionary.m
index df634279..31ee410e 100644
--- a/objectivec/GPBDictionary.m
+++ b/objectivec/GPBDictionary.m
@@ -479,6 +479,12 @@ void GPBDictionaryReadEntry(id mapDictionary,
case GPBDataTypeBytes:
value.valueData = [GPBEmptyNSData() retain];
break;
+#if defined(__clang_analyzer__)
+ case GPBDataTypeGroup:
+ // Maps can't really have Groups as the value type, but this case is needed
+ // so the analyzer won't report the posibility of send nil in for the value
+ // in the NSMutableDictionary case below.
+#endif
case GPBDataTypeMessage: {
value.valueMessage = [[field.msgClass alloc] init];
break;
@@ -491,7 +497,8 @@ void GPBDictionaryReadEntry(id mapDictionary,
if ((keyDataType == GPBDataTypeString) && GPBDataTypeIsObject(valueDataType)) {
// mapDictionary is an NSMutableDictionary
- [mapDictionary setObject:value.valueString forKey:key.valueString];
+ [(NSMutableDictionary *)mapDictionary setObject:value.valueString
+ forKey:key.valueString];
} else {
if (valueDataType == GPBDataTypeEnum) {
if (GPBHasPreservingUnknownEnumSemantics([parentMessage descriptor].file.syntax) ||
@@ -536,12 +543,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)
+//%DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, POD, 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)
+//%DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, , VALUE_NAME, VALUE_TYPE, POD, OBJECT, object)
-//%PDDM-DEFINE DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER)
+//%PDDM-DEFINE DICTIONARY_COMMON_IMPL(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME)
//%#pragma mark - KEY_NAME -> VALUE_NAME
//%
//%@implementation GPB##KEY_NAME##VALUE_NAME##Dictionary {
@@ -550,30 +557,30 @@ void GPBDictionaryReadEntry(id mapDictionary,
//%}
//%
//%+ (instancetype)dictionary {
-//% return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+//% return [[[self alloc] initWith##VNAME$u##s:NULL forKeys:NULL count:0] autorelease];
//%}
//%
-//%+ (instancetype)dictionaryWithValue:(VALUE_TYPE)value
-//% forKey:(KEY_TYPE##KisP$S##KisP)key {
-//% // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+//%+ (instancetype)dictionaryWith##VNAME$u##:(VALUE_TYPE)##VNAME
+//% ##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:
//% // on to get the type correct.
-//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWithValues:&value
-//% KEY_NAME$S VALUE_NAME$S forKeys:&key
-//% KEY_NAME$S VALUE_NAME$S count:1] autorelease];
+//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME$u##s:&##VNAME
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:&key
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:1] autorelease];
//%}
//%
-//%+ (instancetype)dictionaryWithValues:(const VALUE_TYPE [])values
-//% forKeys:(const KEY_TYPE##KisP$S##KisP [])keys
-//% count:(NSUInteger)count {
-//% // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+//%+ (instancetype)dictionaryWith##VNAME$u##s:(const VALUE_TYPE [])##VNAME##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:
//% // on to get the type correct.
-//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWithValues:values
+//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME$u##s:##VNAME##s
//% KEY_NAME$S VALUE_NAME$S forKeys:keys
//% KEY_NAME$S VALUE_NAME$S count:count] autorelease];
//%}
//%
//%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary {
-//% // 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 initWithDictionary:
//% // on to get the type correct.
//% return [[(GPB##KEY_NAME##VALUE_NAME##Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
//%}
@@ -583,18 +590,18 @@ void GPBDictionaryReadEntry(id mapDictionary,
//%}
//%
//%- (instancetype)init {
-//% return [self initWithValues:NULL forKeys:NULL count:0];
+//% return [self initWith##VNAME$u##s:NULL forKeys:NULL count:0];
//%}
//%
-//%- (instancetype)initWithValues:(const VALUE_TYPE [])values
-//% forKeys:(const KEY_TYPE##KisP$S##KisP [])keys
-//% count:(NSUInteger)count {
+//%- (instancetype)initWith##VNAME$u##s:(const VALUE_TYPE [])##VNAME##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 && values && keys) {
+//% if (count && VNAME##s && keys) {
//% for (NSUInteger i = 0; i < count; ++i) {
-//% [_dictionary setObject:WRAPPED##VHELPER(values[i]) forKey:WRAPPED##KHELPER(keys[i])];
+//% [_dictionary setObject:WRAPPED##VHELPER(VNAME##s[i]) forKey:WRAPPED##KHELPER(keys[i])];
//% }
//% }
//% }
@@ -602,7 +609,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
//%}
//%
//%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary {
-//% self = [self initWithValues:NULL forKeys:NULL count:0];
+//% self = [self initWith##VNAME$u##s:NULL forKeys:NULL count:0];
//% if (self) {
//% if (dictionary) {
//% [_dictionary addEntriesFromDictionary:dictionary->_dictionary];
@@ -613,14 +620,14 @@ void GPBDictionaryReadEntry(id mapDictionary,
//%
//%- (instancetype)initWithCapacity:(NSUInteger)numItems {
//% #pragma unused(numItems)
-//% return [self initWithValues:NULL forKeys:NULL count:0];
+//% return [self initWith##VNAME$u##s:NULL forKeys:NULL count:0];
//%}
//%
-//%DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, )
+//%DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, )
//%
//%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, )
+//%DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, )
//%
//%@end
//%
@@ -730,7 +737,7 @@ 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, Raw)
+//%DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, value, Raw)
//%
//%- (BOOL)valueForKey:(KEY_TYPE##KisP$S##KisP)key value:(VALUE_TYPE *)value {
//% NSNumber *wrapped = [_dictionary objectForKey:WRAPPED##KHELPER(key)];
@@ -766,7 +773,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
//% }];
//%}
//%
-//%DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, Raw)
+//%DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, value, Raw)
//%
//%- (void)setValue:(VALUE_TYPE)value forKey:(KEY_TYPE##KisP$S##KisP)key {
//% if (!_validationFunc(value)) {
@@ -784,7 +791,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
//%@end
//%
-//%PDDM-DEFINE DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, ACCESSOR_NAME)
+//%PDDM-DEFINE DICTIONARY_IMMUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, ACCESSOR_NAME)
//%- (void)dealloc {
//% NSAssert(!_autocreator,
//% @"%@: Autocreator must be cleared before release, autocreator: %@",
@@ -819,12 +826,12 @@ void GPBDictionaryReadEntry(id mapDictionary,
//% return _dictionary.count;
//%}
//%
-//%- (void)enumerateKeysAnd##ACCESSOR_NAME##ValuesUsingBlock:
-//% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE value, BOOL *stop))block {
+//%- (void)enumerateKeysAnd##ACCESSOR_NAME##VNAME$u##sUsingBlock:
+//% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME, BOOL *stop))block {
//% [_dictionary enumerateKeysAndObjectsUsingBlock:^(ENUM_TYPE##KHELPER(KEY_TYPE)##aKey,
-//% ENUM_TYPE##VHELPER(VALUE_TYPE)##aValue,
+//% ENUM_TYPE##VHELPER(VALUE_TYPE)##a##VNAME$u,
//% BOOL *stop) {
-//% block(UNWRAP##KEY_NAME(aKey), UNWRAP##VALUE_NAME(aValue), stop);
+//% block(UNWRAP##KEY_NAME(aKey), UNWRAP##VALUE_NAME(a##VNAME$u), stop);
//% }];
//%}
//%
@@ -838,11 +845,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)##aValue,
+//% ENUM_TYPE##VHELPER(VALUE_TYPE)##a##VNAME$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(aValue), kMapValueFieldNumber, valueDataType);
+//% msgSize += ComputeDict##VALUE_NAME##FieldSize(UNWRAP##VALUE_NAME(a##VNAME$u), kMapValueFieldNumber, valueDataType);
//% result += GPBComputeRawVarint32SizeForInteger(msgSize) + msgSize;
//% }];
//% size_t tagSize = GPBComputeWireFormatTagSize(GPBFieldNumber(field), GPBDataTypeMessage);
@@ -856,18 +863,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)##aValue,
+//% ENUM_TYPE##VHELPER(VALUE_TYPE)##a##VNAME$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(aValue), kMapValueFieldNumber, valueDataType);
+//% msgSize += ComputeDict##VALUE_NAME##FieldSize(UNWRAP##VALUE_NAME(a##VNAME$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(aValue), kMapValueFieldNumber, valueDataType);
+//% WriteDict##VALUE_NAME##Field(outputStream, UNWRAP##VALUE_NAME(a##VNAME$u), kMapValueFieldNumber, valueDataType);
//% }];
//%}
//%
@@ -877,12 +884,12 @@ void GPBDictionaryReadEntry(id mapDictionary,
//%}
//%
//%- (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block {
-//% [self enumerateKeysAnd##ACCESSOR_NAME##ValuesUsingBlock:^(KEY_TYPE KisP##key, VALUE_TYPE value, BOOL *stop) {
+//% [self enumerateKeysAnd##ACCESSOR_NAME##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##key, VALUE_TYPE VNAME, BOOL *stop) {
//% #pragma unused(stop)
-//% block(TEXT_FORMAT_OBJ##KEY_NAME(key), TEXT_FORMAT_OBJ##VALUE_NAME(value));
+//% block(TEXT_FORMAT_OBJ##KEY_NAME(key), TEXT_FORMAT_OBJ##VALUE_NAME(VNAME));
//% }];
//%}
-//%PDDM-DEFINE DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, ACCESSOR_NAME)
+//%PDDM-DEFINE DICTIONARY_MUTABLE_CORE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, KHELPER, VHELPER, VNAME, ACCESSOR_NAME)
//%- (void)add##ACCESSOR_NAME##EntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary {
//% if (otherDictionary) {
//% [_dictionary addEntriesFromDictionary:otherDictionary->_dictionary];
@@ -892,14 +899,14 @@ void GPBDictionaryReadEntry(id mapDictionary,
//% }
//%}
//%
-//%- (void)set##ACCESSOR_NAME##Value:(VALUE_TYPE)value forKey:(KEY_TYPE##KisP$S##KisP)key {
-//% [_dictionary setObject:WRAPPED##VHELPER(value) forKey:WRAPPED##KHELPER(key)];
+//%- (void)set##ACCESSOR_NAME##VNAME$u##:(VALUE_TYPE)VNAME forKey:(KEY_TYPE##KisP$S##KisP)key {
+//% [_dictionary setObject:WRAPPED##VHELPER(VNAME) forKey:WRAPPED##KHELPER(key)];
//% if (_autocreator) {
//% GPBAutocreatedDictionaryModified(_autocreator, self);
//% }
//%}
//%
-//%- (void)removeValueForKey:(KEY_TYPE##KisP$S##KisP)aKey {
+//%- (void)remove##VNAME$u##ForKey:(KEY_TYPE##KisP$S##KisP)aKey {
//% [_dictionary removeObjectForKey:WRAPPED##KHELPER(aKey)];
//%}
//%
@@ -912,11 +919,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)
+//%DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, POD, value)
//%PDDM-DEFINE DICTIONARY_BOOL_KEY_TO_OBJECT_IMPL(VALUE_NAME, VALUE_TYPE)
-//%DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, OBJECT)
+//%DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, OBJECT, object)
-//%PDDM-DEFINE DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, HELPER)
+//%PDDM-DEFINE DICTIONARY_BOOL_KEY_TO_VALUE_IMPL(VALUE_NAME, VALUE_TYPE, HELPER, VNAME)
//%#pragma mark - Bool -> VALUE_NAME
//%
//%@implementation GPBBool##VALUE_NAME##Dictionary {
@@ -925,30 +932,30 @@ void GPBDictionaryReadEntry(id mapDictionary,
//%BOOL_DICT_HAS_STORAGE_##HELPER()}
//%
//%+ (instancetype)dictionary {
-//% return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+//% return [[[self alloc] initWith##VNAME$u##s:NULL forKeys:NULL count:0] autorelease];
//%}
//%
-//%+ (instancetype)dictionaryWithValue:(VALUE_TYPE)value
-//% forKey:(BOOL)key {
-//% // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+//%+ (instancetype)dictionaryWith##VNAME$u##:(VALUE_TYPE)VNAME
+//% ##VNAME$S## forKey:(BOOL)key {
+//% // Cast is needed so the compiler knows what class we are invoking initWith##VNAME$u##s:forKeys:count:
//% // on to get the type correct.
-//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWithValues:&value
-//% VALUE_NAME$S forKeys:&key
-//% VALUE_NAME$S count:1] autorelease];
+//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME$u##s:&##VNAME
+//% VALUE_NAME$S ##VNAME$S## forKeys:&key
+//% VALUE_NAME$S ##VNAME$S## count:1] autorelease];
//%}
//%
-//%+ (instancetype)dictionaryWithValues:(const VALUE_TYPE [])values
-//% forKeys:(const BOOL [])keys
-//% count:(NSUInteger)count {
-//% // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
+//%+ (instancetype)dictionaryWith##VNAME$u##s:(const VALUE_TYPE [])##VNAME##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:
//% // on to get the type correct.
-//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWithValues:values
-//% VALUE_NAME$S forKeys:keys
-//% VALUE_NAME$S count:count] autorelease];
+//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWith##VNAME$u##s:##VNAME##s
+//% VALUE_NAME$S ##VNAME$S## forKeys:keys
+//% VALUE_NAME$S ##VNAME$S## count:count] autorelease];
//%}
//%
//%+ (instancetype)dictionaryWithDictionary:(GPBBool##VALUE_NAME##Dictionary *)dictionary {
-//% // 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 initWithDictionary:
//% // on to get the type correct.
//% return [[(GPBBool##VALUE_NAME##Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
//%}
@@ -958,14 +965,14 @@ void GPBDictionaryReadEntry(id mapDictionary,
//%}
//%
//%- (instancetype)init {
-//% return [self initWithValues:NULL forKeys:NULL count:0];
+//% return [self initWith##VNAME$u##s:NULL forKeys:NULL count:0];
//%}
//%
//%BOOL_DICT_INITS_##HELPER(VALUE_NAME, VALUE_TYPE)
//%
//%- (instancetype)initWithCapacity:(NSUInteger)numItems {
//% #pragma unused(numItems)
-//% return [self initWithValues:NULL forKeys:NULL count:0];
+//% return [self initWith##VNAME$u##s:NULL forKeys:NULL count:0];
//%}
//%
//%BOOL_DICT_DEALLOC##HELPER()
@@ -1025,8 +1032,8 @@ void GPBDictionaryReadEntry(id mapDictionary,
//% }
//%}
//%
-//%- (void)enumerateKeysAndValuesUsingBlock:
-//% (void (^)(BOOL key, VALUE_TYPE value, BOOL *stop))block {
+//%- (void)enumerateKeysAnd##VNAME$u##sUsingBlock:
+//% (void (^)(BOOL key, VALUE_TYPE VNAME, BOOL *stop))block {
//% BOOL stop = NO;
//% if (BOOL_DICT_HAS##HELPER(0, )) {
//% block(NO, _values[0], &stop);
@@ -1282,7 +1289,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
//
//%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_NAME, VALUE_TYPE, KHELPER)
-//%- (VALUE_TYPE)valueForKey:(KEY_TYPE)key {
+//%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key {
//% VALUE_TYPE result = [_dictionary objectForKey:WRAPPED##KHELPER(key)];
//% return result;
//%}
@@ -1361,22 +1368,22 @@ void GPBDictionaryReadEntry(id mapDictionary,
//%PDDM-DEFINE BOOL_DICT_HAS_STORAGE_OBJECT()
// Empty
//%PDDM-DEFINE BOOL_DICT_INITS_OBJECT(VALUE_NAME, VALUE_TYPE)
-//%- (instancetype)initWithValues:(const VALUE_TYPE [])values
-//% forKeys:(const BOOL [])keys
-//% count:(NSUInteger)count {
+//%- (instancetype)initWithObjects:(const VALUE_TYPE [])objects
+//% forKeys:(const BOOL [])keys
+//% count:(NSUInteger)count {
//% self = [super init];
//% if (self) {
//% for (NSUInteger i = 0; i < count; ++i) {
//% int idx = keys[i] ? 1 : 0;
//% [_values[idx] release];
-//% _values[idx] = (VALUE_TYPE)[values[i] retain];
+//% _values[idx] = (VALUE_TYPE)[objects[i] retain];
//% }
//% }
//% return self;
//%}
//%
//%- (instancetype)initWithDictionary:(GPBBool##VALUE_NAME##Dictionary *)dictionary {
-//% self = [self initWithValues:NULL forKeys:NULL count:0];
+//% self = [self initWithObjects:NULL forKeys:NULL count:0];
//% if (self) {
//% if (dictionary) {
//% _values[0] = [dictionary->_values[0] retain];
@@ -1399,7 +1406,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
//%PDDM-DEFINE BOOL_DICT_HASOBJECT(IDX, REF)
//%REF##_values[IDX] != nil
//%PDDM-DEFINE BOOL_VALUE_FOR_KEY_OBJECT(VALUE_TYPE)
-//%- (VALUE_TYPE)valueForKey:(BOOL)key {
+//%- (VALUE_TYPE)objectForKey:(BOOL)key {
//% return _values[key ? 1 : 0];
//%}
//%PDDM-DEFINE BOOL_SET_GPBVALUE_FOR_KEY_OBJECT(VALUE_NAME, VALUE_TYPE, VisP)
@@ -1425,16 +1432,16 @@ void GPBDictionaryReadEntry(id mapDictionary,
//% }
//%}
//%
-//%- (void)setValue:(VALUE_TYPE)value forKey:(BOOL)key {
+//%- (void)setObject:(VALUE_TYPE)object forKey:(BOOL)key {
//% int idx = (key ? 1 : 0);
//% [_values[idx] release];
-//% _values[idx] = [value retain];
+//% _values[idx] = [object retain];
//% if (_autocreator) {
//% GPBAutocreatedDictionaryModified(_autocreator, self);
//% }
//%}
//%
-//%- (void)removeValueForKey:(BOOL)aKey {
+//%- (void)removeObjectForKey:(BOOL)aKey {
//% int idx = (aKey ? 1 : 0);
//% [_values[idx] release];
//% _values[idx] = nil;
@@ -1484,7 +1491,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32UInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -1690,7 +1697,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32Int32Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32Int32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -1896,7 +1903,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32UInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -2102,7 +2109,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32Int64Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32Int64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -2308,7 +2315,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32BoolDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32BoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -2514,7 +2521,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32FloatDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32FloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -2720,7 +2727,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32DoubleDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32DoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -3188,30 +3195,30 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionary {
- return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+ return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
}
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(uint32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(uint32_t)key {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBUInt32ObjectDictionary*)[self alloc] initWithValues:&value
- forKeys:&key
- count:1] autorelease];
+ return [[(GPBUInt32ObjectDictionary*)[self alloc] initWithObjects:&object
+ forKeys:&key
+ count:1] autorelease];
}
-+ (instancetype)dictionaryWithValues:(const id [])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)dictionaryWithObjects:(const id [])objects
+ forKeys:(const uint32_t [])keys
+ count:(NSUInteger)count {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBUInt32ObjectDictionary*)[self alloc] initWithValues:values
+ return [[(GPBUInt32ObjectDictionary*)[self alloc] initWithObjects:objects
forKeys:keys
count:count] autorelease];
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt32ObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -3221,18 +3228,18 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
- (instancetype)init {
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
-- (instancetype)initWithValues:(const id [])values
- forKeys:(const uint32_t [])keys
- count:(NSUInteger)count {
+- (instancetype)initWithObjects:(const id [])objects
+ forKeys:(const uint32_t [])keys
+ count:(NSUInteger)count {
self = [super init];
if (self) {
_dictionary = [[NSMutableDictionary alloc] init];
- if (count && values && keys) {
+ if (count && objects && keys) {
for (NSUInteger i = 0; i < count; ++i) {
- [_dictionary setObject:values[i] forKey:@(keys[i])];
+ [_dictionary setObject:objects[i] forKey:@(keys[i])];
}
}
}
@@ -3240,7 +3247,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
- (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary {
- self = [self initWithValues:NULL forKeys:NULL count:0];
+ self = [self initWithObjects:NULL forKeys:NULL count:0];
if (self) {
if (dictionary) {
[_dictionary addEntriesFromDictionary:dictionary->_dictionary];
@@ -3251,7 +3258,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
- (instancetype)initWithCapacity:(NSUInteger)numItems {
#pragma unused(numItems)
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
- (void)dealloc {
@@ -3288,12 +3295,12 @@ void GPBDictionaryReadEntry(id mapDictionary,
return _dictionary.count;
}
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(uint32_t key, id value, BOOL *stop))block {
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(uint32_t key, id object, BOOL *stop))block {
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
- block([aKey unsignedIntValue], aValue, stop);
+ block([aKey unsignedIntValue], aObject, stop);
}];
}
@@ -3330,11 +3337,11 @@ void GPBDictionaryReadEntry(id mapDictionary,
GPBDataType keyDataType = field.mapKeyDataType;
__block size_t result = 0;
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
size_t msgSize = ComputeDictUInt32FieldSize([aKey unsignedIntValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
result += GPBComputeRawVarint32SizeForInteger(msgSize) + msgSize;
}];
size_t tagSize = GPBComputeWireFormatTagSize(GPBFieldNumber(field), GPBDataTypeMessage);
@@ -3348,18 +3355,18 @@ void GPBDictionaryReadEntry(id mapDictionary,
GPBDataType keyDataType = field.mapKeyDataType;
uint32_t tag = GPBWireFormatMakeTag(GPBFieldNumber(field), GPBWireFormatLengthDelimited);
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
// Write the tag.
[outputStream writeInt32NoTag:tag];
// Write the size of the message.
size_t msgSize = ComputeDictUInt32FieldSize([aKey unsignedIntValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
[outputStream writeInt32NoTag:(int32_t)msgSize];
// Write the fields.
WriteDictUInt32Field(outputStream, [aKey unsignedIntValue], kMapKeyFieldNumber, keyDataType);
- WriteDictObjectField(outputStream, aValue, kMapValueFieldNumber, valueDataType);
+ WriteDictObjectField(outputStream, aObject, kMapValueFieldNumber, valueDataType);
}];
}
@@ -3369,13 +3376,13 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
- (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block {
- [self enumerateKeysAndValuesUsingBlock:^(uint32_t key, id value, BOOL *stop) {
+ [self enumerateKeysAndObjectsUsingBlock:^(uint32_t key, id object, BOOL *stop) {
#pragma unused(stop)
- block([NSString stringWithFormat:@"%u", key], value);
+ block([NSString stringWithFormat:@"%u", key], object);
}];
}
-- (id)valueForKey:(uint32_t)key {
+- (id)objectForKey:(uint32_t)key {
id result = [_dictionary objectForKey:@(key)];
return result;
}
@@ -3389,14 +3396,14 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
}
-- (void)setValue:(id)value forKey:(uint32_t)key {
- [_dictionary setObject:value forKey:@(key)];
+- (void)setObject:(id)object forKey:(uint32_t)key {
+ [_dictionary setObject:object forKey:@(key)];
if (_autocreator) {
GPBAutocreatedDictionaryModified(_autocreator, self);
}
}
-- (void)removeValueForKey:(uint32_t)aKey {
+- (void)removeObjectForKey:(uint32_t)aKey {
[_dictionary removeObjectForKey:@(aKey)];
}
@@ -3440,7 +3447,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32UInt32Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt32UInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -3646,7 +3653,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32Int32Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt32Int32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -3852,7 +3859,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32UInt64Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt32UInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -4058,7 +4065,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32Int64Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt32Int64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -4264,7 +4271,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32BoolDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt32BoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -4470,7 +4477,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32FloatDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt32FloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -4676,7 +4683,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32DoubleDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt32DoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -5144,30 +5151,30 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionary {
- return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+ return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
}
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(int32_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(int32_t)key {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBInt32ObjectDictionary*)[self alloc] initWithValues:&value
- forKeys:&key
- count:1] autorelease];
+ return [[(GPBInt32ObjectDictionary*)[self alloc] initWithObjects:&object
+ forKeys:&key
+ count:1] autorelease];
}
-+ (instancetype)dictionaryWithValues:(const id [])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)dictionaryWithObjects:(const id [])objects
+ forKeys:(const int32_t [])keys
+ count:(NSUInteger)count {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBInt32ObjectDictionary*)[self alloc] initWithValues:values
+ return [[(GPBInt32ObjectDictionary*)[self alloc] initWithObjects:objects
forKeys:keys
count:count] autorelease];
}
+ (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt32ObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -5177,18 +5184,18 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
- (instancetype)init {
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
-- (instancetype)initWithValues:(const id [])values
- forKeys:(const int32_t [])keys
- count:(NSUInteger)count {
+- (instancetype)initWithObjects:(const id [])objects
+ forKeys:(const int32_t [])keys
+ count:(NSUInteger)count {
self = [super init];
if (self) {
_dictionary = [[NSMutableDictionary alloc] init];
- if (count && values && keys) {
+ if (count && objects && keys) {
for (NSUInteger i = 0; i < count; ++i) {
- [_dictionary setObject:values[i] forKey:@(keys[i])];
+ [_dictionary setObject:objects[i] forKey:@(keys[i])];
}
}
}
@@ -5196,7 +5203,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
- (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary {
- self = [self initWithValues:NULL forKeys:NULL count:0];
+ self = [self initWithObjects:NULL forKeys:NULL count:0];
if (self) {
if (dictionary) {
[_dictionary addEntriesFromDictionary:dictionary->_dictionary];
@@ -5207,7 +5214,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
- (instancetype)initWithCapacity:(NSUInteger)numItems {
#pragma unused(numItems)
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
- (void)dealloc {
@@ -5244,12 +5251,12 @@ void GPBDictionaryReadEntry(id mapDictionary,
return _dictionary.count;
}
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(int32_t key, id value, BOOL *stop))block {
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(int32_t key, id object, BOOL *stop))block {
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
- block([aKey intValue], aValue, stop);
+ block([aKey intValue], aObject, stop);
}];
}
@@ -5286,11 +5293,11 @@ void GPBDictionaryReadEntry(id mapDictionary,
GPBDataType keyDataType = field.mapKeyDataType;
__block size_t result = 0;
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
size_t msgSize = ComputeDictInt32FieldSize([aKey intValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
result += GPBComputeRawVarint32SizeForInteger(msgSize) + msgSize;
}];
size_t tagSize = GPBComputeWireFormatTagSize(GPBFieldNumber(field), GPBDataTypeMessage);
@@ -5304,18 +5311,18 @@ void GPBDictionaryReadEntry(id mapDictionary,
GPBDataType keyDataType = field.mapKeyDataType;
uint32_t tag = GPBWireFormatMakeTag(GPBFieldNumber(field), GPBWireFormatLengthDelimited);
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
// Write the tag.
[outputStream writeInt32NoTag:tag];
// Write the size of the message.
size_t msgSize = ComputeDictInt32FieldSize([aKey intValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
[outputStream writeInt32NoTag:(int32_t)msgSize];
// Write the fields.
WriteDictInt32Field(outputStream, [aKey intValue], kMapKeyFieldNumber, keyDataType);
- WriteDictObjectField(outputStream, aValue, kMapValueFieldNumber, valueDataType);
+ WriteDictObjectField(outputStream, aObject, kMapValueFieldNumber, valueDataType);
}];
}
@@ -5325,13 +5332,13 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
- (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block {
- [self enumerateKeysAndValuesUsingBlock:^(int32_t key, id value, BOOL *stop) {
+ [self enumerateKeysAndObjectsUsingBlock:^(int32_t key, id object, BOOL *stop) {
#pragma unused(stop)
- block([NSString stringWithFormat:@"%d", key], value);
+ block([NSString stringWithFormat:@"%d", key], object);
}];
}
-- (id)valueForKey:(int32_t)key {
+- (id)objectForKey:(int32_t)key {
id result = [_dictionary objectForKey:@(key)];
return result;
}
@@ -5345,14 +5352,14 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
}
-- (void)setValue:(id)value forKey:(int32_t)key {
- [_dictionary setObject:value forKey:@(key)];
+- (void)setObject:(id)object forKey:(int32_t)key {
+ [_dictionary setObject:object forKey:@(key)];
if (_autocreator) {
GPBAutocreatedDictionaryModified(_autocreator, self);
}
}
-- (void)removeValueForKey:(int32_t)aKey {
+- (void)removeObjectForKey:(int32_t)aKey {
[_dictionary removeObjectForKey:@(aKey)];
}
@@ -5396,7 +5403,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64UInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -5602,7 +5609,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64Int32Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64Int32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -5808,7 +5815,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64UInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -6014,7 +6021,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64Int64Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64Int64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -6220,7 +6227,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64BoolDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64BoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -6426,7 +6433,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64FloatDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64FloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -6632,7 +6639,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64DoubleDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64DoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -7100,30 +7107,30 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionary {
- return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+ return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
}
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(uint64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(uint64_t)key {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBUInt64ObjectDictionary*)[self alloc] initWithValues:&value
- forKeys:&key
- count:1] autorelease];
+ return [[(GPBUInt64ObjectDictionary*)[self alloc] initWithObjects:&object
+ forKeys:&key
+ count:1] autorelease];
}
-+ (instancetype)dictionaryWithValues:(const id [])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)dictionaryWithObjects:(const id [])objects
+ forKeys:(const uint64_t [])keys
+ count:(NSUInteger)count {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBUInt64ObjectDictionary*)[self alloc] initWithValues:values
+ return [[(GPBUInt64ObjectDictionary*)[self alloc] initWithObjects:objects
forKeys:keys
count:count] autorelease];
}
+ (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBUInt64ObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -7133,18 +7140,18 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
- (instancetype)init {
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
-- (instancetype)initWithValues:(const id [])values
- forKeys:(const uint64_t [])keys
- count:(NSUInteger)count {
+- (instancetype)initWithObjects:(const id [])objects
+ forKeys:(const uint64_t [])keys
+ count:(NSUInteger)count {
self = [super init];
if (self) {
_dictionary = [[NSMutableDictionary alloc] init];
- if (count && values && keys) {
+ if (count && objects && keys) {
for (NSUInteger i = 0; i < count; ++i) {
- [_dictionary setObject:values[i] forKey:@(keys[i])];
+ [_dictionary setObject:objects[i] forKey:@(keys[i])];
}
}
}
@@ -7152,7 +7159,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
- (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary {
- self = [self initWithValues:NULL forKeys:NULL count:0];
+ self = [self initWithObjects:NULL forKeys:NULL count:0];
if (self) {
if (dictionary) {
[_dictionary addEntriesFromDictionary:dictionary->_dictionary];
@@ -7163,7 +7170,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
- (instancetype)initWithCapacity:(NSUInteger)numItems {
#pragma unused(numItems)
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
- (void)dealloc {
@@ -7200,12 +7207,12 @@ void GPBDictionaryReadEntry(id mapDictionary,
return _dictionary.count;
}
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(uint64_t key, id value, BOOL *stop))block {
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(uint64_t key, id object, BOOL *stop))block {
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
- block([aKey unsignedLongLongValue], aValue, stop);
+ block([aKey unsignedLongLongValue], aObject, stop);
}];
}
@@ -7242,11 +7249,11 @@ void GPBDictionaryReadEntry(id mapDictionary,
GPBDataType keyDataType = field.mapKeyDataType;
__block size_t result = 0;
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
size_t msgSize = ComputeDictUInt64FieldSize([aKey unsignedLongLongValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
result += GPBComputeRawVarint32SizeForInteger(msgSize) + msgSize;
}];
size_t tagSize = GPBComputeWireFormatTagSize(GPBFieldNumber(field), GPBDataTypeMessage);
@@ -7260,18 +7267,18 @@ void GPBDictionaryReadEntry(id mapDictionary,
GPBDataType keyDataType = field.mapKeyDataType;
uint32_t tag = GPBWireFormatMakeTag(GPBFieldNumber(field), GPBWireFormatLengthDelimited);
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
// Write the tag.
[outputStream writeInt32NoTag:tag];
// Write the size of the message.
size_t msgSize = ComputeDictUInt64FieldSize([aKey unsignedLongLongValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
[outputStream writeInt32NoTag:(int32_t)msgSize];
// Write the fields.
WriteDictUInt64Field(outputStream, [aKey unsignedLongLongValue], kMapKeyFieldNumber, keyDataType);
- WriteDictObjectField(outputStream, aValue, kMapValueFieldNumber, valueDataType);
+ WriteDictObjectField(outputStream, aObject, kMapValueFieldNumber, valueDataType);
}];
}
@@ -7281,13 +7288,13 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
- (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block {
- [self enumerateKeysAndValuesUsingBlock:^(uint64_t key, id value, BOOL *stop) {
+ [self enumerateKeysAndObjectsUsingBlock:^(uint64_t key, id object, BOOL *stop) {
#pragma unused(stop)
- block([NSString stringWithFormat:@"%llu", key], value);
+ block([NSString stringWithFormat:@"%llu", key], object);
}];
}
-- (id)valueForKey:(uint64_t)key {
+- (id)objectForKey:(uint64_t)key {
id result = [_dictionary objectForKey:@(key)];
return result;
}
@@ -7301,14 +7308,14 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
}
-- (void)setValue:(id)value forKey:(uint64_t)key {
- [_dictionary setObject:value forKey:@(key)];
+- (void)setObject:(id)object forKey:(uint64_t)key {
+ [_dictionary setObject:object forKey:@(key)];
if (_autocreator) {
GPBAutocreatedDictionaryModified(_autocreator, self);
}
}
-- (void)removeValueForKey:(uint64_t)aKey {
+- (void)removeObjectForKey:(uint64_t)aKey {
[_dictionary removeObjectForKey:@(aKey)];
}
@@ -7352,7 +7359,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64UInt32Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt64UInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -7558,7 +7565,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64Int32Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt64Int32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -7764,7 +7771,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64UInt64Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt64UInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -7970,7 +7977,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64Int64Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt64Int64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -8176,7 +8183,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64BoolDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt64BoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -8382,7 +8389,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64FloatDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt64FloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -8588,7 +8595,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64DoubleDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt64DoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -9056,30 +9063,30 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionary {
- return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+ return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
}
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(int64_t)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(int64_t)key {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBInt64ObjectDictionary*)[self alloc] initWithValues:&value
- forKeys:&key
- count:1] autorelease];
+ return [[(GPBInt64ObjectDictionary*)[self alloc] initWithObjects:&object
+ forKeys:&key
+ count:1] autorelease];
}
-+ (instancetype)dictionaryWithValues:(const id [])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)dictionaryWithObjects:(const id [])objects
+ forKeys:(const int64_t [])keys
+ count:(NSUInteger)count {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBInt64ObjectDictionary*)[self alloc] initWithValues:values
+ return [[(GPBInt64ObjectDictionary*)[self alloc] initWithObjects:objects
forKeys:keys
count:count] autorelease];
}
+ (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBInt64ObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -9089,18 +9096,18 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
- (instancetype)init {
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
-- (instancetype)initWithValues:(const id [])values
- forKeys:(const int64_t [])keys
- count:(NSUInteger)count {
+- (instancetype)initWithObjects:(const id [])objects
+ forKeys:(const int64_t [])keys
+ count:(NSUInteger)count {
self = [super init];
if (self) {
_dictionary = [[NSMutableDictionary alloc] init];
- if (count && values && keys) {
+ if (count && objects && keys) {
for (NSUInteger i = 0; i < count; ++i) {
- [_dictionary setObject:values[i] forKey:@(keys[i])];
+ [_dictionary setObject:objects[i] forKey:@(keys[i])];
}
}
}
@@ -9108,7 +9115,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
- (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary {
- self = [self initWithValues:NULL forKeys:NULL count:0];
+ self = [self initWithObjects:NULL forKeys:NULL count:0];
if (self) {
if (dictionary) {
[_dictionary addEntriesFromDictionary:dictionary->_dictionary];
@@ -9119,7 +9126,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
- (instancetype)initWithCapacity:(NSUInteger)numItems {
#pragma unused(numItems)
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
- (void)dealloc {
@@ -9156,12 +9163,12 @@ void GPBDictionaryReadEntry(id mapDictionary,
return _dictionary.count;
}
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(int64_t key, id value, BOOL *stop))block {
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(int64_t key, id object, BOOL *stop))block {
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
- block([aKey longLongValue], aValue, stop);
+ block([aKey longLongValue], aObject, stop);
}];
}
@@ -9198,11 +9205,11 @@ void GPBDictionaryReadEntry(id mapDictionary,
GPBDataType keyDataType = field.mapKeyDataType;
__block size_t result = 0;
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
size_t msgSize = ComputeDictInt64FieldSize([aKey longLongValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
result += GPBComputeRawVarint32SizeForInteger(msgSize) + msgSize;
}];
size_t tagSize = GPBComputeWireFormatTagSize(GPBFieldNumber(field), GPBDataTypeMessage);
@@ -9216,18 +9223,18 @@ void GPBDictionaryReadEntry(id mapDictionary,
GPBDataType keyDataType = field.mapKeyDataType;
uint32_t tag = GPBWireFormatMakeTag(GPBFieldNumber(field), GPBWireFormatLengthDelimited);
[_dictionary enumerateKeysAndObjectsUsingBlock:^(NSNumber *aKey,
- id aValue,
+ id aObject,
BOOL *stop) {
#pragma unused(stop)
// Write the tag.
[outputStream writeInt32NoTag:tag];
// Write the size of the message.
size_t msgSize = ComputeDictInt64FieldSize([aKey longLongValue], kMapKeyFieldNumber, keyDataType);
- msgSize += ComputeDictObjectFieldSize(aValue, kMapValueFieldNumber, valueDataType);
+ msgSize += ComputeDictObjectFieldSize(aObject, kMapValueFieldNumber, valueDataType);
[outputStream writeInt32NoTag:(int32_t)msgSize];
// Write the fields.
WriteDictInt64Field(outputStream, [aKey longLongValue], kMapKeyFieldNumber, keyDataType);
- WriteDictObjectField(outputStream, aValue, kMapValueFieldNumber, valueDataType);
+ WriteDictObjectField(outputStream, aObject, kMapValueFieldNumber, valueDataType);
}];
}
@@ -9237,13 +9244,13 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
- (void)enumerateForTextFormat:(void (^)(id keyObj, id valueObj))block {
- [self enumerateKeysAndValuesUsingBlock:^(int64_t key, id value, BOOL *stop) {
+ [self enumerateKeysAndObjectsUsingBlock:^(int64_t key, id object, BOOL *stop) {
#pragma unused(stop)
- block([NSString stringWithFormat:@"%lld", key], value);
+ block([NSString stringWithFormat:@"%lld", key], object);
}];
}
-- (id)valueForKey:(int64_t)key {
+- (id)objectForKey:(int64_t)key {
id result = [_dictionary objectForKey:@(key)];
return result;
}
@@ -9257,14 +9264,14 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
}
-- (void)setValue:(id)value forKey:(int64_t)key {
- [_dictionary setObject:value forKey:@(key)];
+- (void)setObject:(id)object forKey:(int64_t)key {
+ [_dictionary setObject:object forKey:@(key)];
if (_autocreator) {
GPBAutocreatedDictionaryModified(_autocreator, self);
}
}
-- (void)removeValueForKey:(int64_t)aKey {
+- (void)removeObjectForKey:(int64_t)aKey {
[_dictionary removeObjectForKey:@(aKey)];
}
@@ -9308,7 +9315,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBStringUInt32Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBStringUInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -9514,7 +9521,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBStringInt32Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBStringInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -9720,7 +9727,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBStringUInt64Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBStringUInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -9926,7 +9933,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBStringInt64Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBStringInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -10132,7 +10139,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBStringBoolDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBStringBoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -10338,7 +10345,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBStringFloatDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBStringFloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -10544,7 +10551,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBStringDoubleDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBStringDoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -11042,7 +11049,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolUInt32Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBBoolUInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -11283,7 +11290,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolInt32Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBBoolInt32Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -11524,7 +11531,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolUInt64Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBBoolUInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -11765,7 +11772,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolInt64Dictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBBoolInt64Dictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -12006,7 +12013,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolBoolDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBBoolBoolDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -12247,7 +12254,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolFloatDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBBoolFloatDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -12488,7 +12495,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolDoubleDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBBoolDoubleDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -12705,30 +12712,30 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
+ (instancetype)dictionary {
- return [[[self alloc] initWithValues:NULL forKeys:NULL count:0] autorelease];
+ return [[[self alloc] initWithObjects:NULL forKeys:NULL count:0] autorelease];
}
-+ (instancetype)dictionaryWithValue:(id)value
- forKey:(BOOL)key {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObject:(id)object
+ forKey:(BOOL)key {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBBoolObjectDictionary*)[self alloc] initWithValues:&value
- forKeys:&key
- count:1] autorelease];
+ return [[(GPBBoolObjectDictionary*)[self alloc] initWithObjects:&object
+ forKeys:&key
+ count:1] autorelease];
}
-+ (instancetype)dictionaryWithValues:(const id [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count {
- // Cast is needed so the compiler knows what class we are invoking initWithValues:forKeys:count:
++ (instancetype)dictionaryWithObjects:(const id [])objects
+ forKeys:(const BOOL [])keys
+ count:(NSUInteger)count {
+ // Cast is needed so the compiler knows what class we are invoking initWithObjects:forKeys:count:
// on to get the type correct.
- return [[(GPBBoolObjectDictionary*)[self alloc] initWithValues:values
- forKeys:keys
- count:count] autorelease];
+ return [[(GPBBoolObjectDictionary*)[self alloc] initWithObjects:objects
+ forKeys:keys
+ count:count] autorelease];
}
+ (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary {
- // 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 initWithDictionary:
// on to get the type correct.
return [[(GPBBoolObjectDictionary*)[self alloc] initWithDictionary:dictionary] autorelease];
}
@@ -12738,25 +12745,25 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
- (instancetype)init {
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
-- (instancetype)initWithValues:(const id [])values
- forKeys:(const BOOL [])keys
- count:(NSUInteger)count {
+- (instancetype)initWithObjects:(const id [])objects
+ forKeys:(const BOOL [])keys
+ count:(NSUInteger)count {
self = [super init];
if (self) {
for (NSUInteger i = 0; i < count; ++i) {
int idx = keys[i] ? 1 : 0;
[_values[idx] release];
- _values[idx] = (id)[values[i] retain];
+ _values[idx] = (id)[objects[i] retain];
}
}
return self;
}
- (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary {
- self = [self initWithValues:NULL forKeys:NULL count:0];
+ self = [self initWithObjects:NULL forKeys:NULL count:0];
if (self) {
if (dictionary) {
_values[0] = [dictionary->_values[0] retain];
@@ -12768,7 +12775,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
- (instancetype)initWithCapacity:(NSUInteger)numItems {
#pragma unused(numItems)
- return [self initWithValues:NULL forKeys:NULL count:0];
+ return [self initWithObjects:NULL forKeys:NULL count:0];
}
- (void)dealloc {
@@ -12822,7 +12829,7 @@ void GPBDictionaryReadEntry(id mapDictionary,
return ((_values[0] != nil) ? 1 : 0) + ((_values[1] != nil) ? 1 : 0);
}
-- (id)valueForKey:(BOOL)key {
+- (id)objectForKey:(BOOL)key {
return _values[key ? 1 : 0];
}
@@ -12842,8 +12849,8 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
}
-- (void)enumerateKeysAndValuesUsingBlock:
- (void (^)(BOOL key, id value, BOOL *stop))block {
+- (void)enumerateKeysAndObjectsUsingBlock:
+ (void (^)(BOOL key, id object, BOOL *stop))block {
BOOL stop = NO;
if (_values[0] != nil) {
block(NO, _values[0], &stop);
@@ -12924,16 +12931,16 @@ void GPBDictionaryReadEntry(id mapDictionary,
}
}
-- (void)setValue:(id)value forKey:(BOOL)key {
+- (void)setObject:(id)object forKey:(BOOL)key {
int idx = (key ? 1 : 0);
[_values[idx] release];
- _values[idx] = [value retain];
+ _values[idx] = [object retain];
if (_autocreator) {
GPBAutocreatedDictionaryModified(_autocreator, self);
}
}
-- (void)removeValueForKey:(BOOL)aKey {
+- (void)removeObjectForKey:(BOOL)aKey {
int idx = (aKey ? 1 : 0);
[_values[idx] release];
_values[idx] = nil;
diff --git a/objectivec/Tests/GPBDictionaryTests+Bool.m b/objectivec/Tests/GPBDictionaryTests+Bool.m
index 43650f51..8b1900fe 100644
--- a/objectivec/Tests/GPBDictionaryTests+Bool.m
+++ b/objectivec/Tests/GPBDictionaryTests+Bool.m
@@ -167,10 +167,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -468,10 +468,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -769,10 +769,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -1070,10 +1070,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -1371,10 +1371,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -1672,10 +1672,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -1973,10 +1973,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -2161,46 +2161,46 @@
GPBBoolObjectDictionary *dict = [[GPBBoolObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:YES]);
- [dict enumerateKeysAndValuesUsingBlock:^(BOOL aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue, stop)
+ XCTAssertNil([dict objectForKey:YES]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(BOOL aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject, stop)
XCTFail(@"Shouldn't get here!");
}];
[dict release];
}
- (void)testOne {
- GPBBoolObjectDictionary *dict = [GPBBoolObjectDictionary dictionaryWithValue:@"abc" forKey:YES];
+ GPBBoolObjectDictionary *dict = [GPBBoolObjectDictionary dictionaryWithObject:@"abc" forKey:YES];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertNil([dict valueForKey:NO]);
- [dict enumerateKeysAndValuesUsingBlock:^(BOOL aKey, id aValue, BOOL *stop) {
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertNil([dict objectForKey:NO]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(BOOL aKey, id aObject, BOOL *stop) {
XCTAssertEqual(aKey, YES);
- XCTAssertEqualObjects(aValue, @"abc");
+ XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
}
- (void)testBasics {
const BOOL kKeys[] = { YES, NO };
- const id kValues[] = { @"abc", @"def" };
+ const id kObjects[] = { @"abc", @"def" };
GPBBoolObjectDictionary *dict =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertEqualObjects([dict valueForKey:NO], @"def");
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:NO], @"def");
__block NSUInteger idx = 0;
BOOL *seenKeys = malloc(2 * sizeof(BOOL));
- id *seenValues = malloc(2 * sizeof(id));
- [dict enumerateKeysAndValuesUsingBlock:^(BOOL aKey, id aValue, BOOL *stop) {
+ id *seenObjects = malloc(2 * sizeof(id));
+ [dict enumerateKeysAndObjectsUsingBlock:^(BOOL aKey, id aObject, BOOL *stop) {
XCTAssertLessThan(idx, 2U);
seenKeys[idx] = aKey;
- seenValues[idx] = aValue;
+ seenObjects[idx] = aObject;
XCTAssertNotEqual(stop, NULL);
++idx;
}];
@@ -2209,18 +2209,18 @@
for (int j = 0; (j < 2) && !foundKey; ++j) {
if (kKeys[i] == seenKeys[j]) {
foundKey = YES;
- XCTAssertEqualObjects(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+ XCTAssertEqualObjects(kObjects[i], seenObjects[j], @"i = %d, j = %d", i, j);
}
}
XCTAssertTrue(foundKey, @"i = %d", i);
}
free(seenKeys);
- free(seenValues);
+ free(seenObjects);
// Stopping the enumeration.
idx = 0;
- [dict enumerateKeysAndValuesUsingBlock:^(BOOL aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue)
+ [dict enumerateKeysAndObjectsUsingBlock:^(BOOL aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject)
if (idx == 0) *stop = YES;
XCTAssertNotEqual(idx, 2U);
++idx;
@@ -2231,33 +2231,33 @@
- (void)testEquality {
const BOOL kKeys1[] = { YES, NO };
const BOOL kKeys2[] = { NO, YES };
- const id kValues1[] = { @"abc", @"def" };
- const id kValues2[] = { @"def", @"abc" };
- const id kValues3[] = { @"def" };
+ const id kObjects1[] = { @"abc", @"def" };
+ const id kObjects2[] = { @"def", @"abc" };
+ const id kObjects3[] = { @"def" };
GPBBoolObjectDictionary *dict1 =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1);
GPBBoolObjectDictionary *dict1prime =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1prime);
GPBBoolObjectDictionary *dict2 =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
GPBBoolObjectDictionary *dict3 =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict3);
GPBBoolObjectDictionary *dict4 =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues3
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues3)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects3
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects3)];
XCTAssertNotNil(dict4);
// 1/1Prime should be different objects, but equal.
@@ -2266,10 +2266,10 @@
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different objects; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same objects; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 Fewer pairs; not equal
@@ -2284,11 +2284,11 @@
- (void)testCopy {
const BOOL kKeys[] = { YES, NO };
- const id kValues[] = { @"abc", @"def" };
+ const id kObjects[] = { @"abc", @"def" };
GPBBoolObjectDictionary *dict =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBBoolObjectDictionary *dict2 = [dict copy];
@@ -2305,11 +2305,11 @@
- (void)testDictionaryFromDictionary {
const BOOL kKeys[] = { YES, NO };
- const id kValues[] = { @"abc", @"def" };
+ const id kObjects[] = { @"abc", @"def" };
GPBBoolObjectDictionary *dict =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBBoolObjectDictionary *dict2 =
@@ -2327,85 +2327,85 @@
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- [dict setValue:@"abc" forKey:YES];
+ [dict setObject:@"abc" forKey:YES];
XCTAssertEqual(dict.count, 1U);
const BOOL kKeys[] = { NO };
- const id kValues[] = { @"def" };
+ const id kObjects[] = { @"def" };
GPBBoolObjectDictionary *dict2 =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertEqualObjects([dict valueForKey:NO], @"def");
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:NO], @"def");
[dict2 release];
}
- (void)testRemove {
const BOOL kKeys[] = { YES, NO};
- const id kValues[] = { @"abc", @"def" };
+ const id kObjects[] = { @"abc", @"def" };
GPBBoolObjectDictionary *dict =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 2U);
- [dict removeValueForKey:NO];
+ [dict removeObjectForKey:NO];
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertNil([dict valueForKey:NO]);
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertNil([dict objectForKey:NO]);
// Remove again does nothing.
- [dict removeValueForKey:NO];
+ [dict removeObjectForKey:NO];
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertNil([dict valueForKey:NO]);
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertNil([dict objectForKey:NO]);
[dict removeAll];
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:YES]);
- XCTAssertNil([dict valueForKey:NO]);
+ XCTAssertNil([dict objectForKey:YES]);
+ XCTAssertNil([dict objectForKey:NO]);
[dict release];
}
- (void)testInplaceMutation {
const BOOL kKeys[] = { YES, NO };
- const id kValues[] = { @"abc", @"def" };
+ const id kObjects[] = { @"abc", @"def" };
GPBBoolObjectDictionary *dict =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertEqualObjects([dict valueForKey:NO], @"def");
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:NO], @"def");
- [dict setValue:@"def" forKey:YES];
+ [dict setObject:@"def" forKey:YES];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"def");
- XCTAssertEqualObjects([dict valueForKey:NO], @"def");
+ XCTAssertEqualObjects([dict objectForKey:YES], @"def");
+ XCTAssertEqualObjects([dict objectForKey:NO], @"def");
- [dict setValue:@"abc" forKey:NO];
+ [dict setObject:@"abc" forKey:NO];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"def");
- XCTAssertEqualObjects([dict valueForKey:NO], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:YES], @"def");
+ XCTAssertEqualObjects([dict objectForKey:NO], @"abc");
const BOOL kKeys2[] = { NO, YES };
- const id kValues2[] = { @"def", @"abc" };
+ const id kObjects2[] = { @"def", @"abc" };
GPBBoolObjectDictionary *dict2 =
- [[GPBBoolObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBBoolObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:YES], @"abc");
- XCTAssertEqualObjects([dict valueForKey:NO], @"def");
+ XCTAssertEqualObjects([dict objectForKey:YES], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:NO], @"def");
[dict2 release];
[dict release];
diff --git a/objectivec/Tests/GPBDictionaryTests+Int32.m b/objectivec/Tests/GPBDictionaryTests+Int32.m
index 1ee099ee..21d3f07d 100644
--- a/objectivec/Tests/GPBDictionaryTests+Int32.m
+++ b/objectivec/Tests/GPBDictionaryTests+Int32.m
@@ -211,10 +211,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -568,10 +568,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -925,10 +925,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1282,10 +1282,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1639,10 +1639,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1996,10 +1996,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2353,10 +2353,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2710,10 +2710,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3071,10 +3071,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3366,48 +3366,48 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
GPBInt32ObjectDictionary *dict = [[GPBInt32ObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:11]);
- [dict enumerateKeysAndValuesUsingBlock:^(int32_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue, stop)
+ XCTAssertNil([dict objectForKey:11]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(int32_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject, stop)
XCTFail(@"Shouldn't get here!");
}];
[dict release];
}
- (void)testOne {
- GPBInt32ObjectDictionary *dict = [GPBInt32ObjectDictionary dictionaryWithValue:@"abc" forKey:11];
+ GPBInt32ObjectDictionary *dict = [GPBInt32ObjectDictionary dictionaryWithObject:@"abc" forKey:11];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertNil([dict valueForKey:12]);
- [dict enumerateKeysAndValuesUsingBlock:^(int32_t aKey, id aValue, BOOL *stop) {
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertNil([dict objectForKey:12]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(int32_t aKey, id aObject, BOOL *stop) {
XCTAssertEqual(aKey, 11);
- XCTAssertEqualObjects(aValue, @"abc");
+ XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
}
- (void)testBasics {
const int32_t kKeys[] = { 11, 12, 13 };
- const id kValues[] = { @"abc", @"def", @"ghi" };
+ const id kObjects[] = { @"abc", @"def", @"ghi" };
GPBInt32ObjectDictionary *dict =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertEqualObjects([dict valueForKey:12], @"def");
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertNil([dict valueForKey:14]);
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:12], @"def");
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertNil([dict objectForKey:14]);
__block NSUInteger idx = 0;
int32_t *seenKeys = malloc(3 * sizeof(int32_t));
- id *seenValues = malloc(3 * sizeof(id));
- [dict enumerateKeysAndValuesUsingBlock:^(int32_t aKey, id aValue, BOOL *stop) {
+ id *seenObjects = malloc(3 * sizeof(id));
+ [dict enumerateKeysAndObjectsUsingBlock:^(int32_t aKey, id aObject, BOOL *stop) {
XCTAssertLessThan(idx, 3U);
seenKeys[idx] = aKey;
- seenValues[idx] = aValue;
+ seenObjects[idx] = aObject;
XCTAssertNotEqual(stop, NULL);
++idx;
}];
@@ -3416,18 +3416,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
for (int j = 0; (j < 3) && !foundKey; ++j) {
if (kKeys[i] == seenKeys[j]) {
foundKey = YES;
- XCTAssertEqualObjects(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+ XCTAssertEqualObjects(kObjects[i], seenObjects[j], @"i = %d, j = %d", i, j);
}
}
XCTAssertTrue(foundKey, @"i = %d", i);
}
free(seenKeys);
- free(seenValues);
+ free(seenObjects);
// Stopping the enumeration.
idx = 0;
- [dict enumerateKeysAndValuesUsingBlock:^(int32_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue)
+ [dict enumerateKeysAndObjectsUsingBlock:^(int32_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject)
if (idx == 1) *stop = YES;
XCTAssertNotEqual(idx, 2U);
++idx;
@@ -3438,33 +3438,33 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
- (void)testEquality {
const int32_t kKeys1[] = { 11, 12, 13, 14 };
const int32_t kKeys2[] = { 12, 11, 14 };
- const id kValues1[] = { @"abc", @"def", @"ghi" };
- const id kValues2[] = { @"abc", @"jkl", @"ghi" };
- const id kValues3[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects1[] = { @"abc", @"def", @"ghi" };
+ const id kObjects2[] = { @"abc", @"jkl", @"ghi" };
+ const id kObjects3[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt32ObjectDictionary *dict1 =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1);
GPBInt32ObjectDictionary *dict1prime =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1prime);
GPBInt32ObjectDictionary *dict2 =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
GPBInt32ObjectDictionary *dict3 =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict3);
GPBInt32ObjectDictionary *dict4 =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues3
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues3)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects3
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects3)];
XCTAssertNotNil(dict4);
// 1/1Prime should be different objects, but equal.
@@ -3473,10 +3473,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different objects; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same objects; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3491,11 +3491,11 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
- (void)testCopy {
const int32_t kKeys[] = { 11, 12, 13, 14 };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt32ObjectDictionary *dict =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBInt32ObjectDictionary *dict2 = [dict copy];
@@ -3512,11 +3512,11 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
- (void)testDictionaryFromDictionary {
const int32_t kKeys[] = { 11, 12, 13, 14 };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt32ObjectDictionary *dict =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBInt32ObjectDictionary *dict2 =
@@ -3534,108 +3534,108 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- [dict setValue:@"abc" forKey:11];
+ [dict setObject:@"abc" forKey:11];
XCTAssertEqual(dict.count, 1U);
const int32_t kKeys[] = { 12, 13, 14 };
- const id kValues[] = { @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"def", @"ghi", @"jkl" };
GPBInt32ObjectDictionary *dict2 =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertEqualObjects([dict valueForKey:12], @"def");
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:14], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:12], @"def");
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:14], @"jkl");
[dict2 release];
}
- (void)testRemove {
const int32_t kKeys[] = { 11, 12, 13, 14 };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt32ObjectDictionary *dict =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- [dict removeValueForKey:12];
+ [dict removeObjectForKey:12];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertNil([dict valueForKey:12]);
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:14], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertNil([dict objectForKey:12]);
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:14], @"jkl");
// Remove again does nothing.
- [dict removeValueForKey:12];
+ [dict removeObjectForKey:12];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertNil([dict valueForKey:12]);
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:14], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertNil([dict objectForKey:12]);
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:14], @"jkl");
- [dict removeValueForKey:14];
+ [dict removeObjectForKey:14];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertNil([dict valueForKey:12]);
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertNil([dict valueForKey:14]);
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertNil([dict objectForKey:12]);
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertNil([dict objectForKey:14]);
[dict removeAll];
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:11]);
- XCTAssertNil([dict valueForKey:12]);
- XCTAssertNil([dict valueForKey:13]);
- XCTAssertNil([dict valueForKey:14]);
+ XCTAssertNil([dict objectForKey:11]);
+ XCTAssertNil([dict objectForKey:12]);
+ XCTAssertNil([dict objectForKey:13]);
+ XCTAssertNil([dict objectForKey:14]);
[dict release];
}
- (void)testInplaceMutation {
const int32_t kKeys[] = { 11, 12, 13, 14 };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt32ObjectDictionary *dict =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:11], @"abc");
- XCTAssertEqualObjects([dict valueForKey:12], @"def");
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:14], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:11], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:12], @"def");
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:14], @"jkl");
- [dict setValue:@"jkl" forKey:11];
+ [dict setObject:@"jkl" forKey:11];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:11], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:12], @"def");
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:14], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:11], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:12], @"def");
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:14], @"jkl");
- [dict setValue:@"def" forKey:14];
+ [dict setObject:@"def" forKey:14];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:11], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:12], @"def");
- XCTAssertEqualObjects([dict valueForKey:13], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:14], @"def");
+ XCTAssertEqualObjects([dict objectForKey:11], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:12], @"def");
+ XCTAssertEqualObjects([dict objectForKey:13], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:14], @"def");
const int32_t kKeys2[] = { 12, 13 };
- const id kValues2[] = { @"ghi", @"abc" };
+ const id kObjects2[] = { @"ghi", @"abc" };
GPBInt32ObjectDictionary *dict2 =
- [[GPBInt32ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBInt32ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:11], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:12], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:13], @"abc");
- XCTAssertEqualObjects([dict valueForKey:14], @"def");
+ XCTAssertEqualObjects([dict objectForKey:11], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:12], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:13], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:14], @"def");
[dict2 release];
[dict release];
diff --git a/objectivec/Tests/GPBDictionaryTests+Int64.m b/objectivec/Tests/GPBDictionaryTests+Int64.m
index 4a94e033..27f77f28 100644
--- a/objectivec/Tests/GPBDictionaryTests+Int64.m
+++ b/objectivec/Tests/GPBDictionaryTests+Int64.m
@@ -211,10 +211,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -568,10 +568,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -925,10 +925,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1282,10 +1282,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1639,10 +1639,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1996,10 +1996,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2353,10 +2353,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2710,10 +2710,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3071,10 +3071,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3366,48 +3366,48 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
GPBInt64ObjectDictionary *dict = [[GPBInt64ObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:21LL]);
- [dict enumerateKeysAndValuesUsingBlock:^(int64_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue, stop)
+ XCTAssertNil([dict objectForKey:21LL]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(int64_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject, stop)
XCTFail(@"Shouldn't get here!");
}];
[dict release];
}
- (void)testOne {
- GPBInt64ObjectDictionary *dict = [GPBInt64ObjectDictionary dictionaryWithValue:@"abc" forKey:21LL];
+ GPBInt64ObjectDictionary *dict = [GPBInt64ObjectDictionary dictionaryWithObject:@"abc" forKey:21LL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertNil([dict valueForKey:22LL]);
- [dict enumerateKeysAndValuesUsingBlock:^(int64_t aKey, id aValue, BOOL *stop) {
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertNil([dict objectForKey:22LL]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(int64_t aKey, id aObject, BOOL *stop) {
XCTAssertEqual(aKey, 21LL);
- XCTAssertEqualObjects(aValue, @"abc");
+ XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
}
- (void)testBasics {
const int64_t kKeys[] = { 21LL, 22LL, 23LL };
- const id kValues[] = { @"abc", @"def", @"ghi" };
+ const id kObjects[] = { @"abc", @"def", @"ghi" };
GPBInt64ObjectDictionary *dict =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:22LL], @"def");
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertNil([dict valueForKey:24LL]);
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:22LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertNil([dict objectForKey:24LL]);
__block NSUInteger idx = 0;
int64_t *seenKeys = malloc(3 * sizeof(int64_t));
- id *seenValues = malloc(3 * sizeof(id));
- [dict enumerateKeysAndValuesUsingBlock:^(int64_t aKey, id aValue, BOOL *stop) {
+ id *seenObjects = malloc(3 * sizeof(id));
+ [dict enumerateKeysAndObjectsUsingBlock:^(int64_t aKey, id aObject, BOOL *stop) {
XCTAssertLessThan(idx, 3U);
seenKeys[idx] = aKey;
- seenValues[idx] = aValue;
+ seenObjects[idx] = aObject;
XCTAssertNotEqual(stop, NULL);
++idx;
}];
@@ -3416,18 +3416,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
for (int j = 0; (j < 3) && !foundKey; ++j) {
if (kKeys[i] == seenKeys[j]) {
foundKey = YES;
- XCTAssertEqualObjects(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+ XCTAssertEqualObjects(kObjects[i], seenObjects[j], @"i = %d, j = %d", i, j);
}
}
XCTAssertTrue(foundKey, @"i = %d", i);
}
free(seenKeys);
- free(seenValues);
+ free(seenObjects);
// Stopping the enumeration.
idx = 0;
- [dict enumerateKeysAndValuesUsingBlock:^(int64_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue)
+ [dict enumerateKeysAndObjectsUsingBlock:^(int64_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject)
if (idx == 1) *stop = YES;
XCTAssertNotEqual(idx, 2U);
++idx;
@@ -3438,33 +3438,33 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
- (void)testEquality {
const int64_t kKeys1[] = { 21LL, 22LL, 23LL, 24LL };
const int64_t kKeys2[] = { 22LL, 21LL, 24LL };
- const id kValues1[] = { @"abc", @"def", @"ghi" };
- const id kValues2[] = { @"abc", @"jkl", @"ghi" };
- const id kValues3[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects1[] = { @"abc", @"def", @"ghi" };
+ const id kObjects2[] = { @"abc", @"jkl", @"ghi" };
+ const id kObjects3[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt64ObjectDictionary *dict1 =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1);
GPBInt64ObjectDictionary *dict1prime =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1prime);
GPBInt64ObjectDictionary *dict2 =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
GPBInt64ObjectDictionary *dict3 =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict3);
GPBInt64ObjectDictionary *dict4 =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues3
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues3)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects3
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects3)];
XCTAssertNotNil(dict4);
// 1/1Prime should be different objects, but equal.
@@ -3473,10 +3473,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different objects; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same objects; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3491,11 +3491,11 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
- (void)testCopy {
const int64_t kKeys[] = { 21LL, 22LL, 23LL, 24LL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt64ObjectDictionary *dict =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBInt64ObjectDictionary *dict2 = [dict copy];
@@ -3512,11 +3512,11 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
- (void)testDictionaryFromDictionary {
const int64_t kKeys[] = { 21LL, 22LL, 23LL, 24LL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt64ObjectDictionary *dict =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBInt64ObjectDictionary *dict2 =
@@ -3534,108 +3534,108 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- [dict setValue:@"abc" forKey:21LL];
+ [dict setObject:@"abc" forKey:21LL];
XCTAssertEqual(dict.count, 1U);
const int64_t kKeys[] = { 22LL, 23LL, 24LL };
- const id kValues[] = { @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"def", @"ghi", @"jkl" };
GPBInt64ObjectDictionary *dict2 =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:22LL], @"def");
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:22LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"jkl");
[dict2 release];
}
- (void)testRemove {
const int64_t kKeys[] = { 21LL, 22LL, 23LL, 24LL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt64ObjectDictionary *dict =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- [dict removeValueForKey:22LL];
+ [dict removeObjectForKey:22LL];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertNil([dict valueForKey:22LL]);
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertNil([dict objectForKey:22LL]);
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"jkl");
// Remove again does nothing.
- [dict removeValueForKey:22LL];
+ [dict removeObjectForKey:22LL];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertNil([dict valueForKey:22LL]);
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertNil([dict objectForKey:22LL]);
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"jkl");
- [dict removeValueForKey:24LL];
+ [dict removeObjectForKey:24LL];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertNil([dict valueForKey:22LL]);
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertNil([dict valueForKey:24LL]);
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertNil([dict objectForKey:22LL]);
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertNil([dict objectForKey:24LL]);
[dict removeAll];
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:21LL]);
- XCTAssertNil([dict valueForKey:22LL]);
- XCTAssertNil([dict valueForKey:23LL]);
- XCTAssertNil([dict valueForKey:24LL]);
+ XCTAssertNil([dict objectForKey:21LL]);
+ XCTAssertNil([dict objectForKey:22LL]);
+ XCTAssertNil([dict objectForKey:23LL]);
+ XCTAssertNil([dict objectForKey:24LL]);
[dict release];
}
- (void)testInplaceMutation {
const int64_t kKeys[] = { 21LL, 22LL, 23LL, 24LL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBInt64ObjectDictionary *dict =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:22LL], @"def");
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:22LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"jkl");
- [dict setValue:@"jkl" forKey:21LL];
+ [dict setObject:@"jkl" forKey:21LL];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:22LL], @"def");
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:22LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"jkl");
- [dict setValue:@"def" forKey:24LL];
+ [dict setObject:@"def" forKey:24LL];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:22LL], @"def");
- XCTAssertEqualObjects([dict valueForKey:23LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:22LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"def");
const int64_t kKeys2[] = { 22LL, 23LL };
- const id kValues2[] = { @"ghi", @"abc" };
+ const id kObjects2[] = { @"ghi", @"abc" };
GPBInt64ObjectDictionary *dict2 =
- [[GPBInt64ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBInt64ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:21LL], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:22LL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:23LL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:24LL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:21LL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:22LL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:23LL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:24LL], @"def");
[dict2 release];
[dict release];
diff --git a/objectivec/Tests/GPBDictionaryTests+String.m b/objectivec/Tests/GPBDictionaryTests+String.m
index 09fbc608..bfa10b19 100644
--- a/objectivec/Tests/GPBDictionaryTests+String.m
+++ b/objectivec/Tests/GPBDictionaryTests+String.m
@@ -211,10 +211,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -568,10 +568,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -925,10 +925,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1282,10 +1282,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1639,10 +1639,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1996,10 +1996,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2353,10 +2353,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2710,10 +2710,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3071,10 +3071,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
diff --git a/objectivec/Tests/GPBDictionaryTests+UInt32.m b/objectivec/Tests/GPBDictionaryTests+UInt32.m
index f8d280fa..c7c57652 100644
--- a/objectivec/Tests/GPBDictionaryTests+UInt32.m
+++ b/objectivec/Tests/GPBDictionaryTests+UInt32.m
@@ -211,10 +211,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -568,10 +568,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -925,10 +925,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1282,10 +1282,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1639,10 +1639,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1996,10 +1996,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2353,10 +2353,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2710,10 +2710,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3071,10 +3071,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3366,48 +3366,48 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
GPBUInt32ObjectDictionary *dict = [[GPBUInt32ObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:1U]);
- [dict enumerateKeysAndValuesUsingBlock:^(uint32_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue, stop)
+ XCTAssertNil([dict objectForKey:1U]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint32_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject, stop)
XCTFail(@"Shouldn't get here!");
}];
[dict release];
}
- (void)testOne {
- GPBUInt32ObjectDictionary *dict = [GPBUInt32ObjectDictionary dictionaryWithValue:@"abc" forKey:1U];
+ GPBUInt32ObjectDictionary *dict = [GPBUInt32ObjectDictionary dictionaryWithObject:@"abc" forKey:1U];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertNil([dict valueForKey:2U]);
- [dict enumerateKeysAndValuesUsingBlock:^(uint32_t aKey, id aValue, BOOL *stop) {
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertNil([dict objectForKey:2U]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint32_t aKey, id aObject, BOOL *stop) {
XCTAssertEqual(aKey, 1U);
- XCTAssertEqualObjects(aValue, @"abc");
+ XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
}
- (void)testBasics {
const uint32_t kKeys[] = { 1U, 2U, 3U };
- const id kValues[] = { @"abc", @"def", @"ghi" };
+ const id kObjects[] = { @"abc", @"def", @"ghi" };
GPBUInt32ObjectDictionary *dict =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertEqualObjects([dict valueForKey:2U], @"def");
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertNil([dict valueForKey:4U]);
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:2U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertNil([dict objectForKey:4U]);
__block NSUInteger idx = 0;
uint32_t *seenKeys = malloc(3 * sizeof(uint32_t));
- id *seenValues = malloc(3 * sizeof(id));
- [dict enumerateKeysAndValuesUsingBlock:^(uint32_t aKey, id aValue, BOOL *stop) {
+ id *seenObjects = malloc(3 * sizeof(id));
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint32_t aKey, id aObject, BOOL *stop) {
XCTAssertLessThan(idx, 3U);
seenKeys[idx] = aKey;
- seenValues[idx] = aValue;
+ seenObjects[idx] = aObject;
XCTAssertNotEqual(stop, NULL);
++idx;
}];
@@ -3416,18 +3416,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
for (int j = 0; (j < 3) && !foundKey; ++j) {
if (kKeys[i] == seenKeys[j]) {
foundKey = YES;
- XCTAssertEqualObjects(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+ XCTAssertEqualObjects(kObjects[i], seenObjects[j], @"i = %d, j = %d", i, j);
}
}
XCTAssertTrue(foundKey, @"i = %d", i);
}
free(seenKeys);
- free(seenValues);
+ free(seenObjects);
// Stopping the enumeration.
idx = 0;
- [dict enumerateKeysAndValuesUsingBlock:^(uint32_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue)
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint32_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject)
if (idx == 1) *stop = YES;
XCTAssertNotEqual(idx, 2U);
++idx;
@@ -3438,33 +3438,33 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
- (void)testEquality {
const uint32_t kKeys1[] = { 1U, 2U, 3U, 4U };
const uint32_t kKeys2[] = { 2U, 1U, 4U };
- const id kValues1[] = { @"abc", @"def", @"ghi" };
- const id kValues2[] = { @"abc", @"jkl", @"ghi" };
- const id kValues3[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects1[] = { @"abc", @"def", @"ghi" };
+ const id kObjects2[] = { @"abc", @"jkl", @"ghi" };
+ const id kObjects3[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt32ObjectDictionary *dict1 =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1);
GPBUInt32ObjectDictionary *dict1prime =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1prime);
GPBUInt32ObjectDictionary *dict2 =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
GPBUInt32ObjectDictionary *dict3 =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict3);
GPBUInt32ObjectDictionary *dict4 =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues3
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues3)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects3
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects3)];
XCTAssertNotNil(dict4);
// 1/1Prime should be different objects, but equal.
@@ -3473,10 +3473,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different objects; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same objects; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3491,11 +3491,11 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
- (void)testCopy {
const uint32_t kKeys[] = { 1U, 2U, 3U, 4U };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt32ObjectDictionary *dict =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBUInt32ObjectDictionary *dict2 = [dict copy];
@@ -3512,11 +3512,11 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
- (void)testDictionaryFromDictionary {
const uint32_t kKeys[] = { 1U, 2U, 3U, 4U };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt32ObjectDictionary *dict =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBUInt32ObjectDictionary *dict2 =
@@ -3534,108 +3534,108 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- [dict setValue:@"abc" forKey:1U];
+ [dict setObject:@"abc" forKey:1U];
XCTAssertEqual(dict.count, 1U);
const uint32_t kKeys[] = { 2U, 3U, 4U };
- const id kValues[] = { @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"def", @"ghi", @"jkl" };
GPBUInt32ObjectDictionary *dict2 =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertEqualObjects([dict valueForKey:2U], @"def");
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:4U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:2U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"jkl");
[dict2 release];
}
- (void)testRemove {
const uint32_t kKeys[] = { 1U, 2U, 3U, 4U };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt32ObjectDictionary *dict =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- [dict removeValueForKey:2U];
+ [dict removeObjectForKey:2U];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertNil([dict valueForKey:2U]);
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:4U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertNil([dict objectForKey:2U]);
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"jkl");
// Remove again does nothing.
- [dict removeValueForKey:2U];
+ [dict removeObjectForKey:2U];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertNil([dict valueForKey:2U]);
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:4U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertNil([dict objectForKey:2U]);
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"jkl");
- [dict removeValueForKey:4U];
+ [dict removeObjectForKey:4U];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertNil([dict valueForKey:2U]);
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertNil([dict valueForKey:4U]);
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertNil([dict objectForKey:2U]);
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertNil([dict objectForKey:4U]);
[dict removeAll];
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:1U]);
- XCTAssertNil([dict valueForKey:2U]);
- XCTAssertNil([dict valueForKey:3U]);
- XCTAssertNil([dict valueForKey:4U]);
+ XCTAssertNil([dict objectForKey:1U]);
+ XCTAssertNil([dict objectForKey:2U]);
+ XCTAssertNil([dict objectForKey:3U]);
+ XCTAssertNil([dict objectForKey:4U]);
[dict release];
}
- (void)testInplaceMutation {
const uint32_t kKeys[] = { 1U, 2U, 3U, 4U };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt32ObjectDictionary *dict =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"abc");
- XCTAssertEqualObjects([dict valueForKey:2U], @"def");
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:4U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:2U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"jkl");
- [dict setValue:@"jkl" forKey:1U];
+ [dict setObject:@"jkl" forKey:1U];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:2U], @"def");
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:4U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:2U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"jkl");
- [dict setValue:@"def" forKey:4U];
+ [dict setObject:@"def" forKey:4U];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:2U], @"def");
- XCTAssertEqualObjects([dict valueForKey:3U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:4U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:2U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:3U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"def");
const uint32_t kKeys2[] = { 2U, 3U };
- const id kValues2[] = { @"ghi", @"abc" };
+ const id kObjects2[] = { @"ghi", @"abc" };
GPBUInt32ObjectDictionary *dict2 =
- [[GPBUInt32ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBUInt32ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:1U], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:2U], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:3U], @"abc");
- XCTAssertEqualObjects([dict valueForKey:4U], @"def");
+ XCTAssertEqualObjects([dict objectForKey:1U], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:2U], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:3U], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:4U], @"def");
[dict2 release];
[dict release];
diff --git a/objectivec/Tests/GPBDictionaryTests+UInt64.m b/objectivec/Tests/GPBDictionaryTests+UInt64.m
index cebd6df2..b64d3a96 100644
--- a/objectivec/Tests/GPBDictionaryTests+UInt64.m
+++ b/objectivec/Tests/GPBDictionaryTests+UInt64.m
@@ -211,10 +211,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -568,10 +568,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -925,10 +925,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1282,10 +1282,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1639,10 +1639,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -1996,10 +1996,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2353,10 +2353,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -2710,10 +2710,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3071,10 +3071,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different values; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same values; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3366,48 +3366,48 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
GPBUInt64ObjectDictionary *dict = [[GPBUInt64ObjectDictionary alloc] init];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:31ULL]);
- [dict enumerateKeysAndValuesUsingBlock:^(uint64_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue, stop)
+ XCTAssertNil([dict objectForKey:31ULL]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint64_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject, stop)
XCTFail(@"Shouldn't get here!");
}];
[dict release];
}
- (void)testOne {
- GPBUInt64ObjectDictionary *dict = [GPBUInt64ObjectDictionary dictionaryWithValue:@"abc" forKey:31ULL];
+ GPBUInt64ObjectDictionary *dict = [GPBUInt64ObjectDictionary dictionaryWithObject:@"abc" forKey:31ULL];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 1U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertNil([dict valueForKey:32ULL]);
- [dict enumerateKeysAndValuesUsingBlock:^(uint64_t aKey, id aValue, BOOL *stop) {
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertNil([dict objectForKey:32ULL]);
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint64_t aKey, id aObject, BOOL *stop) {
XCTAssertEqual(aKey, 31ULL);
- XCTAssertEqualObjects(aValue, @"abc");
+ XCTAssertEqualObjects(aObject, @"abc");
XCTAssertNotEqual(stop, NULL);
}];
}
- (void)testBasics {
const uint64_t kKeys[] = { 31ULL, 32ULL, 33ULL };
- const id kValues[] = { @"abc", @"def", @"ghi" };
+ const id kObjects[] = { @"abc", @"def", @"ghi" };
GPBUInt64ObjectDictionary *dict =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:32ULL], @"def");
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertNil([dict valueForKey:34ULL]);
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:32ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertNil([dict objectForKey:34ULL]);
__block NSUInteger idx = 0;
uint64_t *seenKeys = malloc(3 * sizeof(uint64_t));
- id *seenValues = malloc(3 * sizeof(id));
- [dict enumerateKeysAndValuesUsingBlock:^(uint64_t aKey, id aValue, BOOL *stop) {
+ id *seenObjects = malloc(3 * sizeof(id));
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint64_t aKey, id aObject, BOOL *stop) {
XCTAssertLessThan(idx, 3U);
seenKeys[idx] = aKey;
- seenValues[idx] = aValue;
+ seenObjects[idx] = aObject;
XCTAssertNotEqual(stop, NULL);
++idx;
}];
@@ -3416,18 +3416,18 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
for (int j = 0; (j < 3) && !foundKey; ++j) {
if (kKeys[i] == seenKeys[j]) {
foundKey = YES;
- XCTAssertEqualObjects(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+ XCTAssertEqualObjects(kObjects[i], seenObjects[j], @"i = %d, j = %d", i, j);
}
}
XCTAssertTrue(foundKey, @"i = %d", i);
}
free(seenKeys);
- free(seenValues);
+ free(seenObjects);
// Stopping the enumeration.
idx = 0;
- [dict enumerateKeysAndValuesUsingBlock:^(uint64_t aKey, id aValue, BOOL *stop) {
- #pragma unused(aKey, aValue)
+ [dict enumerateKeysAndObjectsUsingBlock:^(uint64_t aKey, id aObject, BOOL *stop) {
+ #pragma unused(aKey, aObject)
if (idx == 1) *stop = YES;
XCTAssertNotEqual(idx, 2U);
++idx;
@@ -3438,33 +3438,33 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
- (void)testEquality {
const uint64_t kKeys1[] = { 31ULL, 32ULL, 33ULL, 34ULL };
const uint64_t kKeys2[] = { 32ULL, 31ULL, 34ULL };
- const id kValues1[] = { @"abc", @"def", @"ghi" };
- const id kValues2[] = { @"abc", @"jkl", @"ghi" };
- const id kValues3[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects1[] = { @"abc", @"def", @"ghi" };
+ const id kObjects2[] = { @"abc", @"jkl", @"ghi" };
+ const id kObjects3[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt64ObjectDictionary *dict1 =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1);
GPBUInt64ObjectDictionary *dict1prime =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict1prime);
GPBUInt64ObjectDictionary *dict2 =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
GPBUInt64ObjectDictionary *dict3 =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues1
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues1)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects1
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects1)];
XCTAssertNotNil(dict3);
GPBUInt64ObjectDictionary *dict4 =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues3
- forKeys:kKeys1
- count:GPBARRAYSIZE(kValues3)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects3
+ forKeys:kKeys1
+ count:GPBARRAYSIZE(kObjects3)];
XCTAssertNotNil(dict4);
// 1/1Prime should be different objects, but equal.
@@ -3473,10 +3473,10 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
// Equal, so they must have same hash.
XCTAssertEqual([dict1 hash], [dict1prime hash]);
- // 2 is save keys, different values; not equal.
+ // 2 is same keys, different objects; not equal.
XCTAssertNotEqualObjects(dict1, dict2);
- // 3 is different keys, samae values; not equal.
+ // 3 is different keys, same objects; not equal.
XCTAssertNotEqualObjects(dict1, dict3);
// 4 extra pair; not equal
@@ -3491,11 +3491,11 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
- (void)testCopy {
const uint64_t kKeys[] = { 31ULL, 32ULL, 33ULL, 34ULL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt64ObjectDictionary *dict =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBUInt64ObjectDictionary *dict2 = [dict copy];
@@ -3512,11 +3512,11 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
- (void)testDictionaryFromDictionary {
const uint64_t kKeys[] = { 31ULL, 32ULL, 33ULL, 34ULL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt64ObjectDictionary *dict =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
GPBUInt64ObjectDictionary *dict2 =
@@ -3534,108 +3534,108 @@ static BOOL TestingEnum_IsValidValue(int32_t value) {
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 0U);
- [dict setValue:@"abc" forKey:31ULL];
+ [dict setObject:@"abc" forKey:31ULL];
XCTAssertEqual(dict.count, 1U);
const uint64_t kKeys[] = { 32ULL, 33ULL, 34ULL };
- const id kValues[] = { @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"def", @"ghi", @"jkl" };
GPBUInt64ObjectDictionary *dict2 =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:32ULL], @"def");
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:32ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"jkl");
[dict2 release];
}
- (void)testRemove {
const uint64_t kKeys[] = { 31ULL, 32ULL, 33ULL, 34ULL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt64ObjectDictionary *dict =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- [dict removeValueForKey:32ULL];
+ [dict removeObjectForKey:32ULL];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertNil([dict valueForKey:32ULL]);
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertNil([dict objectForKey:32ULL]);
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"jkl");
// Remove again does nothing.
- [dict removeValueForKey:32ULL];
+ [dict removeObjectForKey:32ULL];
XCTAssertEqual(dict.count, 3U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertNil([dict valueForKey:32ULL]);
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertNil([dict objectForKey:32ULL]);
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"jkl");
- [dict removeValueForKey:34ULL];
+ [dict removeObjectForKey:34ULL];
XCTAssertEqual(dict.count, 2U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertNil([dict valueForKey:32ULL]);
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertNil([dict valueForKey:34ULL]);
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertNil([dict objectForKey:32ULL]);
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertNil([dict objectForKey:34ULL]);
[dict removeAll];
XCTAssertEqual(dict.count, 0U);
- XCTAssertNil([dict valueForKey:31ULL]);
- XCTAssertNil([dict valueForKey:32ULL]);
- XCTAssertNil([dict valueForKey:33ULL]);
- XCTAssertNil([dict valueForKey:34ULL]);
+ XCTAssertNil([dict objectForKey:31ULL]);
+ XCTAssertNil([dict objectForKey:32ULL]);
+ XCTAssertNil([dict objectForKey:33ULL]);
+ XCTAssertNil([dict objectForKey:34ULL]);
[dict release];
}
- (void)testInplaceMutation {
const uint64_t kKeys[] = { 31ULL, 32ULL, 33ULL, 34ULL };
- const id kValues[] = { @"abc", @"def", @"ghi", @"jkl" };
+ const id kObjects[] = { @"abc", @"def", @"ghi", @"jkl" };
GPBUInt64ObjectDictionary *dict =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues
- forKeys:kKeys
- count:GPBARRAYSIZE(kValues)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects
+ forKeys:kKeys
+ count:GPBARRAYSIZE(kObjects)];
XCTAssertNotNil(dict);
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:32ULL], @"def");
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:32ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"jkl");
- [dict setValue:@"jkl" forKey:31ULL];
+ [dict setObject:@"jkl" forKey:31ULL];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:32ULL], @"def");
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:32ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"jkl");
- [dict setValue:@"def" forKey:34ULL];
+ [dict setObject:@"def" forKey:34ULL];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:32ULL], @"def");
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:32ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"def");
const uint64_t kKeys2[] = { 32ULL, 33ULL };
- const id kValues2[] = { @"ghi", @"abc" };
+ const id kObjects2[] = { @"ghi", @"abc" };
GPBUInt64ObjectDictionary *dict2 =
- [[GPBUInt64ObjectDictionary alloc] initWithValues:kValues2
- forKeys:kKeys2
- count:GPBARRAYSIZE(kValues2)];
+ [[GPBUInt64ObjectDictionary alloc] initWithObjects:kObjects2
+ forKeys:kKeys2
+ count:GPBARRAYSIZE(kObjects2)];
XCTAssertNotNil(dict2);
[dict addEntriesFromDictionary:dict2];
XCTAssertEqual(dict.count, 4U);
- XCTAssertEqualObjects([dict valueForKey:31ULL], @"jkl");
- XCTAssertEqualObjects([dict valueForKey:32ULL], @"ghi");
- XCTAssertEqualObjects([dict valueForKey:33ULL], @"abc");
- XCTAssertEqualObjects([dict valueForKey:34ULL], @"def");
+ XCTAssertEqualObjects([dict objectForKey:31ULL], @"jkl");
+ XCTAssertEqualObjects([dict objectForKey:32ULL], @"ghi");
+ XCTAssertEqualObjects([dict objectForKey:33ULL], @"abc");
+ XCTAssertEqualObjects([dict objectForKey:34ULL], @"def");
[dict2 release];
[dict release];
diff --git a/objectivec/Tests/GPBDictionaryTests.pddm b/objectivec/Tests/GPBDictionaryTests.pddm
index ee26fac8..ada93c64 100644
--- a/objectivec/Tests/GPBDictionaryTests.pddm
+++ b/objectivec/Tests/GPBDictionaryTests.pddm
@@ -45,12 +45,12 @@
//%TESTS_FOR_ENUM_VALUE_RAW_ADDITIONS(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, KEY3, KEY4)
//%PDDM-DEFINE TESTS_FOR_POD_VALUE(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, VACCESSOR, VAL1, VAL2, VAL3, VAL4)
-//%TESTS_COMMON(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, , POD, VACCESSOR, VAL1, VAL2, VAL3, VAL4)
+//%TESTS_COMMON(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, , value, POD, VACCESSOR, VAL1, VAL2, VAL3, VAL4)
//%PDDM-DEFINE TESTS_FOR_POD_KEY_OBJECT_VALUE(KEY_NAME, KEY_TYPE, KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, VAL1, VAL2, VAL3, VAL4)
-//%TESTS_COMMON(KEY_NAME, KEY_TYPE, , , KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, Objects, OBJECT, , VAL1, VAL2, VAL3, VAL4)
+//%TESTS_COMMON(KEY_NAME, KEY_TYPE, , , KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, Objects, object, OBJECT, , VAL1, VAL2, VAL3, VAL4)
-//%PDDM-DEFINE TESTS_COMMON(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, VSUFFIX, VHELPER, VACCESSOR, VAL1, VAL2, VAL3, VAL4)
+//%PDDM-DEFINE TESTS_COMMON(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, KEY3, KEY4, VALUE_NAME, VALUE_TYPE, VSUFFIX, VNAME, VHELPER, VACCESSOR, VAL1, VAL2, VAL3, VAL4)
//%#pragma mark - KEY_NAME -> VALUE_NAME
//%
//%@interface GPB##KEY_NAME##VALUE_NAME##DictionaryTests : XCTestCase
@@ -63,47 +63,47 @@
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 0U);
//%VALUE_NOT_FOUND##VHELPER(dict, KEY1)
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
-//% #pragma unused(aKey, aValue, stop)
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u, BOOL *stop) {
+//% #pragma unused(aKey, a##VNAME$u, stop)
//% XCTFail(@"Shouldn't get here!");
//% }];
//% [dict release];
//%}
//%
//%- (void)testOne {
-//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithValue:VAL1 forKey:KEY1];
+//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWith##VNAME$u##:VAL1 forKey:KEY1];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 1U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u, BOOL *stop) {
//% XCTAssertEqual##KSUFFIX(aKey, KEY1);
-//% XCTAssertEqual##VSUFFIX(aValue, VAL1);
+//% XCTAssertEqual##VSUFFIX(a##VNAME$u, VAL1);
//% XCTAssertNotEqual(stop, NULL);
//% }];
//%}
//%
//%- (void)testBasics {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2, KEY3 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2, VAL3 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2, VAL3 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 3U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY4)
//%
//% __block NSUInteger idx = 0;
//% KEY_TYPE KisP##*seenKeys = malloc(3 * sizeof(KEY_TYPE##KisP));
-//% VALUE_TYPE *seenValues = malloc(3 * sizeof(VALUE_TYPE));
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
+//% VALUE_TYPE *seen##VNAME$u##s = malloc(3 * sizeof(VALUE_TYPE));
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u, BOOL *stop) {
//% XCTAssertLessThan(idx, 3U);
//% seenKeys[idx] = aKey;
-//% seenValues[idx] = aValue;
+//% seen##VNAME$u##s[idx] = a##VNAME$u##;
//% XCTAssertNotEqual(stop, NULL);
//% ++idx;
//% }];
@@ -112,18 +112,18 @@
//% for (int j = 0; (j < 3) && !foundKey; ++j) {
//% if (COMPARE_KEYS##KSUFFIX(kKeys[i], seenKeys[j])) {
//% foundKey = YES;
-//% XCTAssertEqual##VSUFFIX(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+//% XCTAssertEqual##VSUFFIX(k##VNAME$u##s[i], seen##VNAME$u##s[j], @"i = %d, j = %d", i, j);
//% }
//% }
//% XCTAssertTrue(foundKey, @"i = %d", i);
//% }
//% free(seenKeys);
-//% free(seenValues);
+//% free(seen##VNAME$u##s);
//%
//% // Stopping the enumeration.
//% idx = 0;
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
-//% #pragma unused(aKey, aValue)
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u, BOOL *stop) {
+//% #pragma unused(aKey, a##VNAME$u)
//% if (idx == 1) *stop = YES;
//% XCTAssertNotEqual(idx, 2U);
//% ++idx;
@@ -134,33 +134,33 @@
//%- (void)testEquality {
//% const KEY_TYPE KisP##kKeys1[] = { KEY1, KEY2, KEY3, KEY4 };
//% const KEY_TYPE KisP##kKeys2[] = { KEY2, KEY1, KEY4 };
-//% const VALUE_TYPE kValues1[] = { VAL1, VAL2, VAL3 };
-//% const VALUE_TYPE kValues2[] = { VAL1, VAL4, VAL3 };
-//% const VALUE_TYPE kValues3[] = { VAL1, VAL2, VAL3, VAL4 };
+//% const VALUE_TYPE k##VNAME$u##s1[] = { VAL1, VAL2, VAL3 };
+//% const VALUE_TYPE k##VNAME$u##s2[] = { VAL1, VAL4, VAL3 };
+//% const VALUE_TYPE k##VNAME$u##s3[] = { VAL1, VAL2, VAL3, VAL4 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict1 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues1
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues1)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s1)];
//% XCTAssertNotNil(dict1);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict1prime =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues1
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues1)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s1)];
//% XCTAssertNotNil(dict1prime);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues2
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues2)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s2)];
//% XCTAssertNotNil(dict2);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict3 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues1
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys2
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues1)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s1)];
//% XCTAssertNotNil(dict3);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict4 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues3
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues3)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s3
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s3)];
//% XCTAssertNotNil(dict4);
//%
//% // 1/1Prime should be different objects, but equal.
@@ -169,10 +169,10 @@
//% // Equal, so they must have same hash.
//% XCTAssertEqual([dict1 hash], [dict1prime hash]);
//%
-//% // 2 is save keys, different values; not equal.
+//% // 2 is same keys, different ##VNAME##s; not equal.
//% XCTAssertNotEqualObjects(dict1, dict2);
//%
-//% // 3 is different keys, samae values; not equal.
+//% // 3 is different keys, same ##VNAME##s; not equal.
//% XCTAssertNotEqualObjects(dict1, dict3);
//%
//% // 4 extra pair; not equal
@@ -187,11 +187,11 @@
//%
//%- (void)testCopy {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2, KEY3, KEY4 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2, VAL3, VAL4 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2, VAL3, VAL4 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//%
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 = [dict copy];
@@ -208,11 +208,11 @@
//%
//%- (void)testDictionaryFromDictionary {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2, KEY3, KEY4 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2, VAL3, VAL4 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2, VAL3, VAL4 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//%
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
@@ -230,56 +230,56 @@
//% XCTAssertNotNil(dict);
//%
//% XCTAssertEqual(dict.count, 0U);
-//% [dict setValue:VAL1 forKey:KEY1];
+//% [dict set##VNAME$u##:VAL1 forKey:KEY1];
//% XCTAssertEqual(dict.count, 1U);
//%
//% const KEY_TYPE KisP##kKeys[] = { KEY2, KEY3, KEY4 };
-//% const VALUE_TYPE kValues[] = { VAL2, VAL3, VAL4 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL2, VAL3, VAL4 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict2);
//% [dict add##VACCESSOR##EntriesFromDictionary:dict2];
//% XCTAssertEqual(dict.count, 4U);
//%
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL4)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL4)
//% [dict2 release];
//%}
//%
//%- (void)testRemove {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2, KEY3, KEY4 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2, VAL3, VAL4 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2, VAL3, VAL4 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 4U);
//%
-//% [dict removeValueForKey:KEY2];
+//% [dict remove##VNAME$u##ForKey:KEY2];
//% XCTAssertEqual(dict.count, 3U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL4)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL4)
//%
//% // Remove again does nothing.
-//% [dict removeValueForKey:KEY2];
+//% [dict remove##VNAME$u##ForKey:KEY2];
//% XCTAssertEqual(dict.count, 3U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL4)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL4)
//%
-//% [dict removeValueForKey:KEY4];
+//% [dict remove##VNAME$u##ForKey:KEY4];
//% XCTAssertEqual(dict.count, 2U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY4)
//%
//% [dict removeAll];
@@ -293,45 +293,45 @@
//%
//%- (void)testInplaceMutation {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2, KEY3, KEY4 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2, VAL3, VAL4 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2, VAL3, VAL4 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 4U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL4)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL4)
//%
-//% [dict setValue:VAL4 forKey:KEY1];
+//% [dict set##VNAME$u##:VAL4 forKey:KEY1];
//% XCTAssertEqual(dict.count, 4U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL4)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL4)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL4)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL4)
//%
-//% [dict setValue:VAL2 forKey:KEY4];
+//% [dict set##VNAME$u##:VAL2 forKey:KEY4];
//% XCTAssertEqual(dict.count, 4U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL4)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL4)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL2)
//%
//% const KEY_TYPE KisP##kKeys2[] = { KEY2, KEY3 };
-//% const VALUE_TYPE kValues2[] = { VAL3, VAL1 };
+//% const VALUE_TYPE k##VNAME$u##s2[] = { VAL3, VAL1 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues2
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys2
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues2)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s2)];
//% XCTAssertNotNil(dict2);
//% [dict add##VACCESSOR##EntriesFromDictionary:dict2];
//% XCTAssertEqual(dict.count, 4U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL4)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL3)
-//%TEST_VALUE##VHELPER(dict, value, KEY3, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY4, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL4)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL3)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY3, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY4, VAL2)
//%
//% [dict2 release];
//% [dict release];
@@ -466,10 +466,10 @@
//% // Equal, so they must have same hash.
//% XCTAssertEqual([dict1 hash], [dict1prime hash]);
//%
-//% // 2 is save keys, different values; not equal.
+//% // 2 is same keys, different values; not equal.
//% XCTAssertNotEqualObjects(dict1, dict2);
//%
-//% // 3 is different keys, samae values; not equal.
+//% // 3 is different keys, same values; not equal.
//% XCTAssertNotEqualObjects(dict1, dict3);
//%
//% // 4 extra pair; not equal
@@ -709,9 +709,9 @@
//%PDDM-DEFINE DECLARE_VALUE_STORAGEOBJECT(VALUE_TYPE, NAME)
// Empty
//%PDDM-DEFINE VALUE_NOT_FOUNDOBJECT(DICT, KEY)
-//% XCTAssertNil([DICT valueForKey:KEY]);
+//% XCTAssertNil([DICT objectForKey:KEY]);
//%PDDM-DEFINE TEST_VALUEOBJECT(DICT, STORAGE, KEY, VALUE)
-//% XCTAssertEqualObjects([DICT valueForKey:KEY], VALUE);
+//% XCTAssertEqualObjects([DICT objectForKey:KEY], VALUE);
//%PDDM-DEFINE COMPARE_KEYSObjects(KEY1, KEY2)
//%[KEY1 isEqual:KEY2]
@@ -768,12 +768,12 @@
//TODO(thomasvl): enum tests
//%PDDM-DEFINE BOOL_TESTS_FOR_POD_VALUE(VALUE_NAME, VALUE_TYPE, VAL1, VAL2)
-//%BOOL_TESTS_COMMON(Bool, BOOL, , , YES, NO, VALUE_NAME, VALUE_TYPE, , POD, VAL1, VAL2)
+//%BOOL_TESTS_COMMON(Bool, BOOL, , , YES, NO, VALUE_NAME, VALUE_TYPE, , value, POD, VAL1, VAL2)
//%PDDM-DEFINE TESTS_FOR_BOOL_KEY_OBJECT_VALUE(VALUE_NAME, VALUE_TYPE, VAL1, VAL2)
-//%BOOL_TESTS_COMMON(Bool, BOOL, , , YES, NO, VALUE_NAME, VALUE_TYPE, Objects, OBJECT, VAL1, VAL2)
+//%BOOL_TESTS_COMMON(Bool, BOOL, , , YES, NO, VALUE_NAME, VALUE_TYPE, Objects, object, OBJECT, VAL1, VAL2)
-//%PDDM-DEFINE BOOL_TESTS_COMMON(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, VALUE_NAME, VALUE_TYPE, VSUFFIX, VHELPER, VAL1, VAL2)
+//%PDDM-DEFINE BOOL_TESTS_COMMON(KEY_NAME, KEY_TYPE, KisP, KSUFFIX, KEY1, KEY2, VALUE_NAME, VALUE_TYPE, VSUFFIX, VNAME, VHELPER, VAL1, VAL2)
//%#pragma mark - KEY_NAME -> VALUE_NAME
//%
//%@interface GPB##KEY_NAME##VALUE_NAME##DictionaryTests : XCTestCase
@@ -786,45 +786,45 @@
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 0U);
//%VALUE_NOT_FOUND##VHELPER(dict, KEY1)
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
-//% #pragma unused(aKey, aValue, stop)
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u##, BOOL *stop) {
+//% #pragma unused(aKey, a##VNAME$u##, stop)
//% XCTFail(@"Shouldn't get here!");
//% }];
//% [dict release];
//%}
//%
//%- (void)testOne {
-//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWithValue:VAL1 forKey:KEY1];
+//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict = [GPB##KEY_NAME##VALUE_NAME##Dictionary dictionaryWith##VNAME$u##:VAL1 forKey:KEY1];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 1U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u, BOOL *stop) {
//% XCTAssertEqual##KSUFFIX(aKey, KEY1);
-//% XCTAssertEqual##VSUFFIX(aValue, VAL1);
+//% XCTAssertEqual##VSUFFIX(a##VNAME$u, VAL1);
//% XCTAssertNotEqual(stop, NULL);
//% }];
//%}
//%
//%- (void)testBasics {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 2U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
//%
//% __block NSUInteger idx = 0;
//% KEY_TYPE KisP##*seenKeys = malloc(2 * sizeof(KEY_TYPE##KisP));
-//% VALUE_TYPE *seenValues = malloc(2 * sizeof(VALUE_TYPE));
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
+//% VALUE_TYPE *seen##VNAME$u##s = malloc(2 * sizeof(VALUE_TYPE));
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u##, BOOL *stop) {
//% XCTAssertLessThan(idx, 2U);
//% seenKeys[idx] = aKey;
-//% seenValues[idx] = aValue;
+//% seen##VNAME$u##s[idx] = a##VNAME$u;
//% XCTAssertNotEqual(stop, NULL);
//% ++idx;
//% }];
@@ -833,18 +833,18 @@
//% for (int j = 0; (j < 2) && !foundKey; ++j) {
//% if (COMPARE_KEYS##KSUFFIX(kKeys[i], seenKeys[j])) {
//% foundKey = YES;
-//% XCTAssertEqual##VSUFFIX(kValues[i], seenValues[j], @"i = %d, j = %d", i, j);
+//% XCTAssertEqual##VSUFFIX(k##VNAME$u##s[i], seen##VNAME$u##s[j], @"i = %d, j = %d", i, j);
//% }
//% }
//% XCTAssertTrue(foundKey, @"i = %d", i);
//% }
//% free(seenKeys);
-//% free(seenValues);
+//% free(seen##VNAME$u##s);
//%
//% // Stopping the enumeration.
//% idx = 0;
-//% [dict enumerateKeysAndValuesUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE aValue, BOOL *stop) {
-//% #pragma unused(aKey, aValue)
+//% [dict enumerateKeysAnd##VNAME$u##sUsingBlock:^(KEY_TYPE KisP##aKey, VALUE_TYPE a##VNAME$u##, BOOL *stop) {
+//% #pragma unused(aKey, a##VNAME$u)
//% if (idx == 0) *stop = YES;
//% XCTAssertNotEqual(idx, 2U);
//% ++idx;
@@ -855,33 +855,33 @@
//%- (void)testEquality {
//% const KEY_TYPE KisP##kKeys1[] = { KEY1, KEY2 };
//% const KEY_TYPE KisP##kKeys2[] = { KEY2, KEY1 };
-//% const VALUE_TYPE kValues1[] = { VAL1, VAL2 };
-//% const VALUE_TYPE kValues2[] = { VAL2, VAL1 };
-//% const VALUE_TYPE kValues3[] = { VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s1[] = { VAL1, VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s2[] = { VAL2, VAL1 };
+//% const VALUE_TYPE k##VNAME$u##s3[] = { VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict1 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues1
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues1)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s1)];
//% XCTAssertNotNil(dict1);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict1prime =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues1
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues1)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s1)];
//% XCTAssertNotNil(dict1prime);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues2
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues2)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s2)];
//% XCTAssertNotNil(dict2);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict3 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues1
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys2
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues1)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s1)];
//% XCTAssertNotNil(dict3);
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict4 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues3
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys1
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues3)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s3
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys1
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s3)];
//% XCTAssertNotNil(dict4);
//%
//% // 1/1Prime should be different objects, but equal.
@@ -890,10 +890,10 @@
//% // Equal, so they must have same hash.
//% XCTAssertEqual([dict1 hash], [dict1prime hash]);
//%
-//% // 2 is save keys, different values; not equal.
+//% // 2 is same keys, different ##VNAME##s; not equal.
//% XCTAssertNotEqualObjects(dict1, dict2);
//%
-//% // 3 is different keys, samae values; not equal.
+//% // 3 is different keys, same ##VNAME##s; not equal.
//% XCTAssertNotEqualObjects(dict1, dict3);
//%
//% // 4 Fewer pairs; not equal
@@ -908,11 +908,11 @@
//%
//%- (void)testCopy {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//%
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 = [dict copy];
@@ -929,11 +929,11 @@
//%
//%- (void)testDictionaryFromDictionary {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//%
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
@@ -951,43 +951,43 @@
//% XCTAssertNotNil(dict);
//%
//% XCTAssertEqual(dict.count, 0U);
-//% [dict setValue:VAL1 forKey:KEY1];
+//% [dict set##VNAME$u:VAL1 forKey:KEY1];
//% XCTAssertEqual(dict.count, 1U);
//%
//% const KEY_TYPE KisP##kKeys[] = { KEY2 };
-//% const VALUE_TYPE kValues[] = { VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict2);
//% [dict addEntriesFromDictionary:dict2];
//% XCTAssertEqual(dict.count, 2U);
//%
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
//% [dict2 release];
//%}
//%
//%- (void)testRemove {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2};
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 2U);
//%
-//% [dict removeValueForKey:KEY2];
+//% [dict remove##VNAME$u##ForKey:KEY2];
//% XCTAssertEqual(dict.count, 1U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
//%
//% // Remove again does nothing.
-//% [dict removeValueForKey:KEY2];
+//% [dict remove##VNAME$u##ForKey:KEY2];
//% XCTAssertEqual(dict.count, 1U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
//%VALUE_NOT_FOUND##VHELPER(dict, KEY2)
//%
//% [dict removeAll];
@@ -999,37 +999,37 @@
//%
//%- (void)testInplaceMutation {
//% const KEY_TYPE KisP##kKeys[] = { KEY1, KEY2 };
-//% const VALUE_TYPE kValues[] = { VAL1, VAL2 };
+//% const VALUE_TYPE k##VNAME$u##s[] = { VAL1, VAL2 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s)];
//% XCTAssertNotNil(dict);
//% XCTAssertEqual(dict.count, 2U);
-//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, value)TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
+//%DECLARE_VALUE_STORAGE##VHELPER(VALUE_TYPE, VNAME)TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
//%
-//% [dict setValue:VAL2 forKey:KEY1];
+//% [dict set##VNAME$u##:VAL2 forKey:KEY1];
//% XCTAssertEqual(dict.count, 2U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
//%
-//% [dict setValue:VAL1 forKey:KEY2];
+//% [dict set##VNAME$u##:VAL1 forKey:KEY2];
//% XCTAssertEqual(dict.count, 2U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL2)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL1)
//%
//% const KEY_TYPE KisP##kKeys2[] = { KEY2, KEY1 };
-//% const VALUE_TYPE kValues2[] = { VAL2, VAL1 };
+//% const VALUE_TYPE k##VNAME$u##s2[] = { VAL2, VAL1 };
//% GPB##KEY_NAME##VALUE_NAME##Dictionary *dict2 =
-//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWithValues:kValues2
-//% KEY_NAME$S VALUE_NAME$S forKeys:kKeys2
-//% KEY_NAME$S VALUE_NAME$S count:GPBARRAYSIZE(kValues2)];
+//% [[GPB##KEY_NAME##VALUE_NAME##Dictionary alloc] initWith##VNAME$u##s:k##VNAME$u##s2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## forKeys:kKeys2
+//% KEY_NAME$S VALUE_NAME$S ##VNAME$S## count:GPBARRAYSIZE(k##VNAME$u##s2)];
//% XCTAssertNotNil(dict2);
//% [dict addEntriesFromDictionary:dict2];
//% XCTAssertEqual(dict.count, 2U);
-//%TEST_VALUE##VHELPER(dict, value, KEY1, VAL1)
-//%TEST_VALUE##VHELPER(dict, value, KEY2, VAL2)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY1, VAL1)
+//%TEST_VALUE##VHELPER(dict, VNAME, KEY2, VAL2)
//%
//% [dict2 release];
//% [dict release];
diff --git a/objectivec/Tests/GPBMessageTests+Merge.m b/objectivec/Tests/GPBMessageTests+Merge.m
index 3b6fdbd4..a3908aab 100644
--- a/objectivec/Tests/GPBMessageTests+Merge.m
+++ b/objectivec/Tests/GPBMessageTests+Merge.m
@@ -676,20 +676,21 @@
TestAllTypes *subMsg = [TestAllTypes message];
subMsg.repeatedInt32Array = [GPBInt32Array arrayWithValue:100];
msg1.mapInt32Message = [GPBInt32ObjectDictionary dictionary];
- [msg1.mapInt32Message setValue:subMsg forKey:0];
+ [msg1.mapInt32Message setObject:subMsg forKey:0];
subMsg = nil;
subMsg = [TestAllTypes message];
subMsg.repeatedInt32Array = [GPBInt32Array arrayWithValue:101];
msg2.mapInt32Message = [GPBInt32ObjectDictionary dictionary];
- [msg2.mapInt32Message setValue:subMsg forKey:0];
+
+ [msg2.mapInt32Message setObject:subMsg forKey:0];
subMsg = nil;
[msg1 mergeFrom:msg2];
// Checks repeated field is overwritten.
XCTAssertEqual(msg1.mapInt32Message.count, 1U);
- subMsg = [msg1.mapInt32Message valueForKey:0];
+ subMsg = [msg1.mapInt32Message objectForKey:0];
XCTAssertNotNil(subMsg);
XCTAssertEqual(subMsg.repeatedInt32Array.count, 1U);
XCTAssertEqual([subMsg.repeatedInt32Array valueAtIndex:0], 101);
diff --git a/objectivec/Tests/GPBMessageTests+Runtime.m b/objectivec/Tests/GPBMessageTests+Runtime.m
index 8942a843..e536bfec 100644
--- a/objectivec/Tests/GPBMessageTests+Runtime.m
+++ b/objectivec/Tests/GPBMessageTests+Runtime.m
@@ -2059,9 +2059,9 @@
// Ensure the messages are unique per map.
[msg1.mapInt32ForeignMessage
- enumerateKeysAndValuesUsingBlock:^(int32_t key, id value, BOOL *stop) {
+ enumerateKeysAndObjectsUsingBlock:^(int32_t key, id value, BOOL *stop) {
#pragma unused(stop)
- ForeignMessage *subMsg2 = [msg2.mapInt32ForeignMessage valueForKey:key];
+ ForeignMessage *subMsg2 = [msg2.mapInt32ForeignMessage objectForKey:key];
XCTAssertNotEqual(value, subMsg2); // Ptr compare, new object.
}];
}
@@ -2075,7 +2075,7 @@
// Add an uninitialized message.
TestRequired *subMsg = [[TestRequired alloc] init];
msg.mapField = [GPBInt32ObjectDictionary dictionary];
- [msg.mapField setValue:subMsg forKey:0];
+ [msg.mapField setObject:subMsg forKey:0];
XCTAssertFalse(msg.initialized);
// Initialize uninitialized message
diff --git a/objectivec/Tests/GPBMessageTests+Serialization.m b/objectivec/Tests/GPBMessageTests+Serialization.m
index ae4be9e5..4dcca7a3 100644
--- a/objectivec/Tests/GPBMessageTests+Serialization.m
+++ b/objectivec/Tests/GPBMessageTests+Serialization.m
@@ -994,16 +994,16 @@ static NSData *DataFromCStr(const char *str) {
val2.optionalInt32 = 129;
[msg.mapStringMessage setValue:val1 forKey:@"228"];
[msg.mapStringMessage setValue:val2 forKey:@"2029"];
- [msg.mapInt32Bytes setValue:DataFromCStr("1030 bytes") forKey:230];
- [msg.mapInt32Bytes setValue:DataFromCStr("131") forKey:2031];
+ [msg.mapInt32Bytes setObject:DataFromCStr("1030 bytes") forKey:230];
+ [msg.mapInt32Bytes setObject:DataFromCStr("131") forKey:2031];
[msg.mapInt32Enum setValue:Message2_Enum_Bar forKey:232];
[msg.mapInt32Enum setValue:Message2_Enum_Baz forKey:2033];
Message2 *val3 = [[Message2 alloc] init];
val3.optionalInt32 = 1034;
Message2 *val4 = [[Message2 alloc] init];
val4.optionalInt32 = 135;
- [msg.mapInt32Message setValue:val3 forKey:234];
- [msg.mapInt32Message setValue:val4 forKey:2035];
+ [msg.mapInt32Message setObject:val3 forKey:234];
+ [msg.mapInt32Message setObject:val4 forKey:2035];
NSData *data = [msg data];
Message2 *msg2 = [[Message2 alloc] initWithData:data error:NULL];
diff --git a/objectivec/Tests/GPBTestUtilities.m b/objectivec/Tests/GPBTestUtilities.m
index 3d85c744..726761a7 100644
--- a/objectivec/Tests/GPBTestUtilities.m
+++ b/objectivec/Tests/GPBTestUtilities.m
@@ -1110,7 +1110,7 @@ const uint32_t kGPBDefaultRepeatCount = 2;
[dataStr release];
NSData *data = [[NSData alloc] initWithUint32_gpbtu:i + 1];
- [message.mapInt32Bytes setValue:data forKey:113 + i * 100];
+ [message.mapInt32Bytes setObject:data forKey:113 + i * 100];
[data release];
[message.mapInt32Enum
@@ -1119,7 +1119,7 @@ const uint32_t kGPBDefaultRepeatCount = 2;
ForeignMessage *subMsg = [[ForeignMessage alloc] init];
subMsg.c = i + 1;
- [message.mapInt32ForeignMessage setValue:subMsg forKey:115 + i * 100];
+ [message.mapInt32ForeignMessage setObject:subMsg forKey:115 + i * 100];
[subMsg release];
}
}
diff --git a/objectivec/Tests/GPBWireFormatTests.m b/objectivec/Tests/GPBWireFormatTests.m
index c1244212..3fab20b7 100644
--- a/objectivec/Tests/GPBWireFormatTests.m
+++ b/objectivec/Tests/GPBWireFormatTests.m
@@ -167,12 +167,12 @@ const int kUnknownTypeId = 1550055;
XCTAssertEqual([raw.itemArray[2] typeId], kUnknownTypeId);
TestMessageSetExtension1* message1 =
- [TestMessageSetExtension1 parseFromData:[raw.itemArray[0] message]
+ [TestMessageSetExtension1 parseFromData:[((RawMessageSet_Item*)raw.itemArray[0]) message]
error:NULL];
XCTAssertEqual(message1.i, 123);
TestMessageSetExtension2* message2 =
- [TestMessageSetExtension2 parseFromData:[raw.itemArray[1] message]
+ [TestMessageSetExtension2 parseFromData:[((RawMessageSet_Item*)raw.itemArray[1]) message]
error:NULL];
XCTAssertEqualObjects(message2.str, @"foo");