forked from PoomSmart/YouTubeHeader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGPBDescriptor.h
114 lines (86 loc) · 4.17 KB
/
GPBDescriptor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#import <Foundation/Foundation.h>
#import "GPBRuntimeTypes.h"
@class GPBEnumDescriptor;
@class GPBFieldDescriptor;
@class GPBFileDescriptor;
@class GPBOneofDescriptor;
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(uint8_t, GPBFileSyntax) {
GPBFileSyntaxUnknown = 0,
GPBFileSyntaxProto2 = 2,
GPBFileSyntaxProto3 = 3,
GPBFileSyntaxProtoEditions = 99,
};
typedef NS_ENUM(uint8_t, GPBFieldType) {
GPBFieldTypeSingle,
GPBFieldTypeRepeated,
GPBFieldTypeMap,
};
@interface GPBDescriptor : NSObject<NSCopying>
@property(nonatomic, readonly, copy) NSString *name;
@property(nonatomic, readonly, strong, nullable) NSArray<GPBFieldDescriptor *> *fields;
@property(nonatomic, readonly, strong, nullable) NSArray<GPBOneofDescriptor *> *oneofs;
@property(nonatomic, readonly) const GPBExtensionRange *extensionRanges;
@property(nonatomic, readonly) uint32_t extensionRangesCount;
@property(nonatomic, readonly) GPBFileDescriptor *file;
@property(nonatomic, readonly, getter=isWireFormat) BOOL wireFormat;
@property(nonatomic, readonly) Class messageClass;
@property(readonly, nullable) GPBDescriptor *containingType;
@property(readonly, nullable) NSString *fullName;
- (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber;
- (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name;
- (nullable GPBOneofDescriptor *)oneofWithName:(NSString *)name;
@end
@interface GPBFileDescriptor : NSObject<NSCopying>
@property(nonatomic, readonly, copy) NSString *package;
@property(nonatomic, readonly, copy, nullable) NSString *objcPrefix;
@property(nonatomic, readonly) GPBFileSyntax syntax
__attribute__((deprecated("Syntax will be removed in the future.")));
@end
@interface GPBOneofDescriptor : NSObject<NSCopying>
@property(nonatomic, readonly) NSString *name;
@property(nonatomic, readonly) NSArray<GPBFieldDescriptor *> *fields;
- (nullable GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber;
- (nullable GPBFieldDescriptor *)fieldWithName:(NSString *)name;
@end
@interface GPBFieldDescriptor : NSObject<NSCopying>
@property(nonatomic, readonly, copy) NSString *name;
@property(nonatomic, readonly) uint32_t number;
@property(nonatomic, readonly) GPBDataType dataType;
@property(nonatomic, readonly) BOOL hasDefaultValue;
@property(nonatomic, readonly) GPBGenericValue defaultValue;
@property(nonatomic, readonly, getter=isRequired) BOOL required;
@property(nonatomic, readonly, getter=isOptional) BOOL optional;
@property(nonatomic, readonly) GPBFieldType fieldType;
@property(nonatomic, readonly) GPBDataType mapKeyDataType;
@property(nonatomic, readonly, getter=isPackable) BOOL packable;
@property(nonatomic, readonly, nullable) GPBOneofDescriptor *containingOneof;
@property(nonatomic, readonly, nullable) Class msgClass;
@property(nonatomic, readonly, strong, nullable) GPBEnumDescriptor *enumDescriptor;
- (BOOL)isValidEnumValue:(int32_t)value;
- (nullable NSString *)textFormatName;
@end
@interface GPBEnumDescriptor : NSObject<NSCopying>
@property(nonatomic, readonly, copy) NSString *name;
@property(nonatomic, readonly) GPBEnumValidationFunc enumVerifier;
@property(nonatomic, readonly) BOOL isClosed;
- (nullable NSString *)enumNameForValue:(int32_t)number;
- (BOOL)getValue:(nullable int32_t *)outValue forEnumName:(NSString *)name;
- (nullable NSString *)textFormatNameForValue:(int32_t)number;
- (BOOL)getValue:(nullable int32_t *)outValue forEnumTextFormatName:(NSString *)textFormatName;
@property(nonatomic, readonly) uint32_t enumNameCount;
- (nullable NSString *)getEnumNameForIndex:(uint32_t)index;
- (nullable NSString *)getEnumTextFormatNameForIndex:(uint32_t)index;
@end
@interface GPBExtensionDescriptor : NSObject<NSCopying>
@property(nonatomic, readonly) uint32_t fieldNumber;
@property(nonatomic, readonly) Class containingMessageClass;
@property(nonatomic, readonly) GPBDataType dataType;
@property(nonatomic, readonly, getter=isRepeated) BOOL repeated;
@property(nonatomic, readonly, getter=isPackable) BOOL packable;
@property(nonatomic, readonly) Class msgClass;
@property(nonatomic, readonly) NSString *singletonName;
@property(nonatomic, readonly, strong, nullable) GPBEnumDescriptor *enumDescriptor;
@property(nonatomic, readonly, nullable) id defaultValue;
@end
NS_ASSUME_NONNULL_END