aboutsummaryrefslogtreecommitdiffhomepage
path: root/objectivec/GPBDescriptor.h
diff options
context:
space:
mode:
authorGravatar Thomas Van Lenten <thomasvl@google.com>2015-06-16 16:45:14 -0400
committerGravatar Thomas Van Lenten <thomasvl@google.com>2015-06-16 17:04:50 -0400
commit8c88957ef375f3b739b6e72ea5c2fb71b12e1fc2 (patch)
tree31b4561aae2a11b1a9b4b7010dc9df10c52a4d72 /objectivec/GPBDescriptor.h
parent4cbb612299eaf8259db25f5dcda46022fbd1db54 (diff)
Add nonnil markup to ObjC library.
Add the clang annotations to the objc library and generated code to help with Swift bridging and compiler checks.
Diffstat (limited to 'objectivec/GPBDescriptor.h')
-rw-r--r--objectivec/GPBDescriptor.h42
1 files changed, 23 insertions, 19 deletions
diff --git a/objectivec/GPBDescriptor.h b/objectivec/GPBDescriptor.h
index aeac9029..360afe96 100644
--- a/objectivec/GPBDescriptor.h
+++ b/objectivec/GPBDescriptor.h
@@ -38,6 +38,8 @@
@class GPBFileDescriptor;
@class GPBOneofDescriptor;
+NS_ASSUME_NONNULL_BEGIN
+
typedef NS_ENUM(NSInteger, GPBFileSyntax) {
GPBFileSyntaxUnknown = 0,
GPBFileSyntaxProto2 = 2,
@@ -53,20 +55,20 @@ typedef NS_ENUM(NSInteger, GPBFieldType) {
@interface GPBDescriptor : NSObject<NSCopying>
@property(nonatomic, readonly, copy) NSString *name;
-@property(nonatomic, readonly, strong) NSArray *fields;
-@property(nonatomic, readonly, strong) NSArray *oneofs;
-@property(nonatomic, readonly, strong) NSArray *enums;
-@property(nonatomic, readonly) const GPBExtensionRange *extensionRanges;
+@property(nonatomic, readonly, strong, nullable) NSArray *fields;
+@property(nonatomic, readonly, strong, nullable) NSArray *oneofs;
+@property(nonatomic, readonly, strong, nullable) NSArray *enums;
+@property(nonatomic, readonly, nullable) const GPBExtensionRange *extensionRanges;
@property(nonatomic, readonly) NSUInteger extensionRangesCount;
@property(nonatomic, readonly, assign) GPBFileDescriptor *file;
@property(nonatomic, readonly, getter=isWireFormat) BOOL wireFormat;
@property(nonatomic, readonly) Class messageClass;
-- (GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber;
-- (GPBFieldDescriptor *)fieldWithName:(NSString *)name;
-- (GPBOneofDescriptor *)oneofWithName:(NSString *)name;
-- (GPBEnumDescriptor *)enumWithName:(NSString *)name;
+- (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber;
+- (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name;
+- (nullable GPBOneofDescriptor *)oneofWithName:(NSString *)name;
+- (nullable GPBEnumDescriptor *)enumWithName:(NSString *)name;
@end
@@ -81,8 +83,8 @@ typedef NS_ENUM(NSInteger, GPBFieldType) {
@property(nonatomic, readonly) NSString *name;
@property(nonatomic, readonly) NSArray *fields;
-- (GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber;
-- (GPBFieldDescriptor *)fieldWithName:(NSString *)name;
+- (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber;
+- (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name;
@end
@interface GPBFieldDescriptor : NSObject
@@ -99,21 +101,21 @@ typedef NS_ENUM(NSInteger, GPBFieldType) {
@property(nonatomic, readonly) GPBDataType mapKeyDataType;
@property(nonatomic, readonly, getter=isPackable) BOOL packable;
-@property(nonatomic, readonly, assign) GPBOneofDescriptor *containingOneof;
+@property(nonatomic, readonly, assign, nullable) GPBOneofDescriptor *containingOneof;
-@property(nonatomic, readonly) GPBFieldOptions *fieldOptions;
+@property(nonatomic, readonly, nullable) GPBFieldOptions *fieldOptions;
// Message properties
-@property(nonatomic, readonly, assign) Class msgClass;
+@property(nonatomic, readonly, assign, nullable) Class msgClass;
// Enum properties
-@property(nonatomic, readonly, strong) GPBEnumDescriptor *enumDescriptor;
+@property(nonatomic, readonly, strong, nullable) GPBEnumDescriptor *enumDescriptor;
- (BOOL)isValidEnumValue:(int32_t)value;
// For now, this will return nil if it doesn't know the name to use for
// TextFormat.
-- (NSString *)textFormatName;
+- (nullable NSString *)textFormatName;
@end
@@ -122,10 +124,10 @@ typedef NS_ENUM(NSInteger, GPBFieldType) {
@property(nonatomic, readonly, copy) NSString *name;
@property(nonatomic, readonly) GPBEnumValidationFunc enumVerifier;
-- (NSString *)enumNameForValue:(int32_t)number;
-- (BOOL)getValue:(int32_t *)outValue forEnumName:(NSString *)name;
+- (nullable NSString *)enumNameForValue:(int32_t)number;
+- (BOOL)getValue:(nullable int32_t *)outValue forEnumName:(NSString *)name;
-- (NSString *)textFormatNameForValue:(int32_t)number;
+- (nullable NSString *)textFormatNameForValue:(int32_t)number;
@end
@@ -137,6 +139,8 @@ typedef NS_ENUM(NSInteger, GPBFieldType) {
@property(nonatomic, readonly, getter=isPackable) BOOL packable;
@property(nonatomic, readonly, assign) Class msgClass;
@property(nonatomic, readonly) NSString *singletonName;
-@property(nonatomic, readonly, strong) GPBEnumDescriptor *enumDescriptor;
+@property(nonatomic, readonly, strong, nullable) GPBEnumDescriptor *enumDescriptor;
@property(nonatomic, readonly) id defaultValue;
@end
+
+NS_ASSUME_NONNULL_END