OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 16 matching lines...) Expand all Loading... |
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
31 #import <Foundation/Foundation.h> | 31 #import <Foundation/Foundation.h> |
32 | 32 |
33 #import "GPBRuntimeTypes.h" | 33 #import "GPBRuntimeTypes.h" |
34 | 34 |
35 @class GPBEnumDescriptor; | 35 @class GPBEnumDescriptor; |
36 @class GPBFieldDescriptor; | 36 @class GPBFieldDescriptor; |
37 @class GPBFieldOptions; | |
38 @class GPBFileDescriptor; | 37 @class GPBFileDescriptor; |
39 @class GPBOneofDescriptor; | 38 @class GPBOneofDescriptor; |
40 | 39 |
41 NS_ASSUME_NONNULL_BEGIN | 40 NS_ASSUME_NONNULL_BEGIN |
42 | 41 |
43 typedef NS_ENUM(NSInteger, GPBFileSyntax) { | 42 typedef NS_ENUM(uint8_t, GPBFileSyntax) { |
44 GPBFileSyntaxUnknown = 0, | 43 GPBFileSyntaxUnknown = 0, |
45 GPBFileSyntaxProto2 = 2, | 44 GPBFileSyntaxProto2 = 2, |
46 GPBFileSyntaxProto3 = 3, | 45 GPBFileSyntaxProto3 = 3, |
47 }; | 46 }; |
48 | 47 |
49 typedef NS_ENUM(NSInteger, GPBFieldType) { | 48 typedef NS_ENUM(uint8_t, GPBFieldType) { |
50 GPBFieldTypeSingle, // optional/required | 49 GPBFieldTypeSingle, // optional/required |
51 GPBFieldTypeRepeated, // repeated | 50 GPBFieldTypeRepeated, // repeated |
52 GPBFieldTypeMap, // map<K,V> | 51 GPBFieldTypeMap, // map<K,V> |
53 }; | 52 }; |
54 | 53 |
55 @interface GPBDescriptor : NSObject<NSCopying> | 54 @interface GPBDescriptor : NSObject<NSCopying> |
56 | 55 |
57 @property(nonatomic, readonly, copy) NSString *name; | 56 @property(nonatomic, readonly, copy) NSString *name; |
58 @property(nonatomic, readonly, strong, nullable) NSArray *fields; | 57 @property(nonatomic, readonly, strong, nullable) NSArray<GPBFieldDescriptor*> *f
ields; |
59 @property(nonatomic, readonly, strong, nullable) NSArray *oneofs; | 58 @property(nonatomic, readonly, strong, nullable) NSArray<GPBOneofDescriptor*> *o
neofs; |
60 @property(nonatomic, readonly, strong, nullable) NSArray *enums; | |
61 @property(nonatomic, readonly, nullable) const GPBExtensionRange *extensionRange
s; | 59 @property(nonatomic, readonly, nullable) const GPBExtensionRange *extensionRange
s; |
62 @property(nonatomic, readonly) NSUInteger extensionRangesCount; | 60 @property(nonatomic, readonly) uint32_t extensionRangesCount; |
63 @property(nonatomic, readonly, assign) GPBFileDescriptor *file; | 61 @property(nonatomic, readonly, assign) GPBFileDescriptor *file; |
64 | 62 |
65 @property(nonatomic, readonly, getter=isWireFormat) BOOL wireFormat; | 63 @property(nonatomic, readonly, getter=isWireFormat) BOOL wireFormat; |
66 @property(nonatomic, readonly) Class messageClass; | 64 @property(nonatomic, readonly) Class messageClass; |
67 | 65 |
68 - (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber; | 66 - (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber; |
69 - (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name; | 67 - (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name; |
70 - (nullable GPBOneofDescriptor *)oneofWithName:(NSString *)name; | 68 - (nullable GPBOneofDescriptor *)oneofWithName:(NSString *)name; |
71 - (nullable GPBEnumDescriptor *)enumWithName:(NSString *)name; | |
72 | 69 |
73 @end | 70 @end |
74 | 71 |
75 @interface GPBFileDescriptor : NSObject | 72 @interface GPBFileDescriptor : NSObject |
76 | 73 |
77 @property(nonatomic, readonly, copy) NSString *package; | 74 @property(nonatomic, readonly, copy) NSString *package; |
78 @property(nonatomic, readonly) GPBFileSyntax syntax; | 75 @property(nonatomic, readonly) GPBFileSyntax syntax; |
79 | 76 |
80 @end | 77 @end |
81 | 78 |
82 @interface GPBOneofDescriptor : NSObject | 79 @interface GPBOneofDescriptor : NSObject |
83 @property(nonatomic, readonly) NSString *name; | 80 @property(nonatomic, readonly) NSString *name; |
84 @property(nonatomic, readonly) NSArray *fields; | 81 @property(nonatomic, readonly) NSArray<GPBFieldDescriptor*> *fields; |
85 | 82 |
86 - (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber; | 83 - (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber; |
87 - (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name; | 84 - (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name; |
88 @end | 85 @end |
89 | 86 |
90 @interface GPBFieldDescriptor : NSObject | 87 @interface GPBFieldDescriptor : NSObject |
91 | 88 |
92 @property(nonatomic, readonly, copy) NSString *name; | 89 @property(nonatomic, readonly, copy) NSString *name; |
93 @property(nonatomic, readonly) uint32_t number; | 90 @property(nonatomic, readonly) uint32_t number; |
94 @property(nonatomic, readonly) GPBDataType dataType; | 91 @property(nonatomic, readonly) GPBDataType dataType; |
95 @property(nonatomic, readonly) BOOL hasDefaultValue; | 92 @property(nonatomic, readonly) BOOL hasDefaultValue; |
96 @property(nonatomic, readonly) GPBGenericValue defaultValue; | 93 @property(nonatomic, readonly) GPBGenericValue defaultValue; |
97 @property(nonatomic, readonly, getter=isRequired) BOOL required; | 94 @property(nonatomic, readonly, getter=isRequired) BOOL required; |
98 @property(nonatomic, readonly, getter=isOptional) BOOL optional; | 95 @property(nonatomic, readonly, getter=isOptional) BOOL optional; |
99 @property(nonatomic, readonly) GPBFieldType fieldType; | 96 @property(nonatomic, readonly) GPBFieldType fieldType; |
100 // If it is a map, the value type is in -type. | 97 // If it is a map, the value type is in -type. |
101 @property(nonatomic, readonly) GPBDataType mapKeyDataType; | 98 @property(nonatomic, readonly) GPBDataType mapKeyDataType; |
102 @property(nonatomic, readonly, getter=isPackable) BOOL packable; | 99 @property(nonatomic, readonly, getter=isPackable) BOOL packable; |
103 | 100 |
104 @property(nonatomic, readonly, assign, nullable) GPBOneofDescriptor *containingO
neof; | 101 @property(nonatomic, readonly, assign, nullable) GPBOneofDescriptor *containingO
neof; |
105 | 102 |
106 @property(nonatomic, readonly, nullable) GPBFieldOptions *fieldOptions; | |
107 | |
108 // Message properties | 103 // Message properties |
109 @property(nonatomic, readonly, assign, nullable) Class msgClass; | 104 @property(nonatomic, readonly, assign, nullable) Class msgClass; |
110 | 105 |
111 // Enum properties | 106 // Enum properties |
112 @property(nonatomic, readonly, strong, nullable) GPBEnumDescriptor *enumDescript
or; | 107 @property(nonatomic, readonly, strong, nullable) GPBEnumDescriptor *enumDescript
or; |
113 | 108 |
114 - (BOOL)isValidEnumValue:(int32_t)value; | 109 - (BOOL)isValidEnumValue:(int32_t)value; |
115 | 110 |
116 // For now, this will return nil if it doesn't know the name to use for | 111 // For now, this will return nil if it doesn't know the name to use for |
117 // TextFormat. | 112 // TextFormat. |
(...skipping 19 matching lines...) Expand all Loading... |
137 @property(nonatomic, readonly) GPBDataType dataType; | 132 @property(nonatomic, readonly) GPBDataType dataType; |
138 @property(nonatomic, readonly, getter=isRepeated) BOOL repeated; | 133 @property(nonatomic, readonly, getter=isRepeated) BOOL repeated; |
139 @property(nonatomic, readonly, getter=isPackable) BOOL packable; | 134 @property(nonatomic, readonly, getter=isPackable) BOOL packable; |
140 @property(nonatomic, readonly, assign) Class msgClass; | 135 @property(nonatomic, readonly, assign) Class msgClass; |
141 @property(nonatomic, readonly) NSString *singletonName; | 136 @property(nonatomic, readonly) NSString *singletonName; |
142 @property(nonatomic, readonly, strong, nullable) GPBEnumDescriptor *enumDescript
or; | 137 @property(nonatomic, readonly, strong, nullable) GPBEnumDescriptor *enumDescript
or; |
143 @property(nonatomic, readonly) id defaultValue; | 138 @property(nonatomic, readonly) id defaultValue; |
144 @end | 139 @end |
145 | 140 |
146 NS_ASSUME_NONNULL_END | 141 NS_ASSUME_NONNULL_END |
OLD | NEW |