aboutsummaryrefslogtreecommitdiff
path: root/objectivec/GPBDictionary.h
diff options
context:
space:
mode:
authorThomas Van Lenten <thomasvl@google.com>2015-09-29 11:41:53 -0400
committerThomas Van Lenten <thomasvl@google.com>2015-09-29 17:18:09 -0400
commit1383d53e67dac1d005fb3f8659e695b0be7e2718 (patch)
tree24b6f67087dc984bd5b1237c0e3964c34971604f /objectivec/GPBDictionary.h
parent0e5686a70768a289782eb1e1aa86646e56897e4d (diff)
downloadprotobuf-1383d53e67dac1d005fb3f8659e695b0be7e2718.tar.gz
protobuf-1383d53e67dac1d005fb3f8659e695b0be7e2718.tar.bz2
protobuf-1383d53e67dac1d005fb3f8659e695b0be7e2718.zip
Cleanups for newer Xcodes
- Move up to 8.4 as the high simulator (assuming Xcode 6.4). - Add cast to NSMutableDictionary so clang and resolve the selector. - Add case for the newer static analyzer so it won't trigger a false warning. - Update the "dictionary" interface to use "object" naming. Xcode 7+ has gotten more strict on the use of nonnull/nullable; combining that with the generic collection support; and the "dictionary" classes we created now collide with what the generic KeyValueCoding in the system headers triggering warnings/errors. Fix this and hopefully all future issue by renaming the methods to use "object" for the classes that have data types as objects instead of PODs. Taking this renaming hit now while ObjC is still in beta because it is a breaking change for any existing code.
Diffstat (limited to 'objectivec/GPBDictionary.h')
-rw-r--r--objectivec/GPBDictionary.h174
1 files changed, 87 insertions, 87 deletions
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)