blob: 70dae31c68a06950712642232fa1f029c28fd759 [file] [log] [blame]
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -04001// Generated by the protocol buffer compiler. DO NOT EDIT!
2// source: google/protobuf/type.proto
3
Thomas Van Lenten7da023b2016-05-09 13:53:20 -04004// This CPP symbol can be defined to use imports that match up to the framework
5// imports needed when using CocoaPods.
6#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
7 #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
8#endif
9
10#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -050011 #import <Protobuf/GPBProtocolBuffers_RuntimeSupport.h>
Thomas Van Lenten7da023b2016-05-09 13:53:20 -040012#else
13 #import "GPBProtocolBuffers_RuntimeSupport.h"
14#endif
15
Thomas Van Lenten3e1587f2018-01-23 13:38:28 -050016#import <stdatomic.h>
17
Thomas Van Lenten7da023b2016-05-09 13:53:20 -040018#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -050019 #import <Protobuf/GPBType.pbobjc.h>
20 #import <Protobuf/GPBAny.pbobjc.h>
21 #import <Protobuf/GPBSourceContext.pbobjc.h>
Thomas Van Lenten7da023b2016-05-09 13:53:20 -040022#else
Thomas Van Lenten56c48ae2020-01-22 15:50:52 -050023 #import "GPBType.pbobjc.h"
24 #import "GPBAny.pbobjc.h"
25 #import "GPBSourceContext.pbobjc.h"
Thomas Van Lenten7da023b2016-05-09 13:53:20 -040026#endif
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -040027// @@protoc_insertion_point(imports)
28
Thomas Van Lentene664aa62016-04-19 13:13:04 -040029#pragma clang diagnostic push
30#pragma clang diagnostic ignored "-Wdeprecated-declarations"
Dave MacLachlan74956e12019-12-17 17:32:09 -080031#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
32
Dave MacLachlanaa1d7e72020-01-19 17:46:35 -080033#pragma mark - Objective C Class declarations
34// Forward declarations of Objective C classes that we can use as
35// static values in struct initializers.
36// We don't use [Foo class] because it is not a static value.
37GPBObjCClassDeclaration(GPBAny);
38GPBObjCClassDeclaration(GPBEnumValue);
39GPBObjCClassDeclaration(GPBField);
40GPBObjCClassDeclaration(GPBOption);
41GPBObjCClassDeclaration(GPBSourceContext);
Thomas Van Lentene664aa62016-04-19 13:13:04 -040042
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -040043#pragma mark - GPBTypeRoot
44
45@implementation GPBTypeRoot
46
Thomas Van Lenten13a41242016-09-01 11:45:50 -040047// No extensions in the file and none of the imports (direct or indirect)
48// defined extensions, so no need to generate +extensionRegistry.
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -040049
50@end
51
Thomas Van Lentend846b0b2015-06-08 16:24:57 -040052#pragma mark - GPBTypeRoot_FileDescriptor
53
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -040054static GPBFileDescriptor *GPBTypeRoot_FileDescriptor(void) {
55 // This is called by +initialize so there is no need to worry
56 // about thread safety of the singleton.
57 static GPBFileDescriptor *descriptor = NULL;
58 if (!descriptor) {
Thomas Van Lenten1aa65002016-09-15 13:27:17 -040059 GPB_DEBUG_CHECK_RUNTIME_VERSIONS();
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -040060 descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf"
Thomas Van Lenten337ec302016-08-16 11:26:49 -040061 objcPrefix:@"GPB"
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -040062 syntax:GPBFileSyntaxProto3];
63 }
64 return descriptor;
65}
66
TeBoringaca5a602015-08-26 14:02:44 -070067#pragma mark - Enum GPBSyntax
68
69GPBEnumDescriptor *GPBSyntax_EnumDescriptor(void) {
Thomas Van Lentend83837d2018-01-31 13:58:11 -050070 static _Atomic(GPBEnumDescriptor*) descriptor = nil;
TeBoringaca5a602015-08-26 14:02:44 -070071 if (!descriptor) {
Thomas Van Lenten79a23c42016-03-17 10:04:21 -040072 static const char *valueNames =
73 "SyntaxProto2\000SyntaxProto3\000";
74 static const int32_t values[] = {
75 GPBSyntax_SyntaxProto2,
76 GPBSyntax_SyntaxProto3,
TeBoringaca5a602015-08-26 14:02:44 -070077 };
Thomas Van Lenten79a23c42016-03-17 10:04:21 -040078 GPBEnumDescriptor *worker =
79 [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBSyntax)
80 valueNames:valueNames
81 values:values
82 count:(uint32_t)(sizeof(values) / sizeof(int32_t))
83 enumVerifier:GPBSyntax_IsValidValue];
Jonathan Dierksena721bf62018-01-22 13:26:39 -080084 GPBEnumDescriptor *expected = nil;
85 if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
Thomas Van Lenten79a23c42016-03-17 10:04:21 -040086 [worker release];
87 }
TeBoringaca5a602015-08-26 14:02:44 -070088 }
89 return descriptor;
90}
91
92BOOL GPBSyntax_IsValidValue(int32_t value__) {
93 switch (value__) {
94 case GPBSyntax_SyntaxProto2:
95 case GPBSyntax_SyntaxProto3:
96 return YES;
97 default:
98 return NO;
99 }
100}
101
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400102#pragma mark - GPBType
103
104@implementation GPBType
105
106@dynamic name;
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400107@dynamic fieldsArray, fieldsArray_Count;
108@dynamic oneofsArray, oneofsArray_Count;
109@dynamic optionsArray, optionsArray_Count;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400110@dynamic hasSourceContext, sourceContext;
TeBoringaca5a602015-08-26 14:02:44 -0700111@dynamic syntax;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400112
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400113typedef struct GPBType__storage_ {
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400114 uint32_t _has_storage_[1];
TeBoringaca5a602015-08-26 14:02:44 -0700115 GPBSyntax syntax;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400116 NSString *name;
117 NSMutableArray *fieldsArray;
118 NSMutableArray *oneofsArray;
119 NSMutableArray *optionsArray;
120 GPBSourceContext *sourceContext;
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400121} GPBType__storage_;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400122
123// This method is threadsafe because it is initially called
124// in +initialize for each subclass.
125+ (GPBDescriptor *)descriptor {
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400126 static GPBDescriptor *descriptor = nil;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400127 if (!descriptor) {
128 static GPBMessageFieldDescription fields[] = {
129 {
130 .name = "name",
Dave MacLachlan74956e12019-12-17 17:32:09 -0800131 .dataTypeSpecific.clazz = Nil,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400132 .number = GPBType_FieldNumber_Name,
133 .hasIndex = 0,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400134 .offset = (uint32_t)offsetof(GPBType__storage_, name),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400135 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400136 .dataType = GPBDataTypeString,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400137 },
138 {
139 .name = "fieldsArray",
Dave MacLachlanaa1d7e72020-01-19 17:46:35 -0800140 .dataTypeSpecific.clazz = GPBObjCClass(GPBField),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400141 .number = GPBType_FieldNumber_FieldsArray,
142 .hasIndex = GPBNoHasBit,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400143 .offset = (uint32_t)offsetof(GPBType__storage_, fieldsArray),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400144 .flags = GPBFieldRepeated,
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400145 .dataType = GPBDataTypeMessage,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400146 },
147 {
148 .name = "oneofsArray",
Dave MacLachlan74956e12019-12-17 17:32:09 -0800149 .dataTypeSpecific.clazz = Nil,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400150 .number = GPBType_FieldNumber_OneofsArray,
151 .hasIndex = GPBNoHasBit,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400152 .offset = (uint32_t)offsetof(GPBType__storage_, oneofsArray),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400153 .flags = GPBFieldRepeated,
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400154 .dataType = GPBDataTypeString,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400155 },
156 {
157 .name = "optionsArray",
Dave MacLachlanaa1d7e72020-01-19 17:46:35 -0800158 .dataTypeSpecific.clazz = GPBObjCClass(GPBOption),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400159 .number = GPBType_FieldNumber_OptionsArray,
160 .hasIndex = GPBNoHasBit,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400161 .offset = (uint32_t)offsetof(GPBType__storage_, optionsArray),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400162 .flags = GPBFieldRepeated,
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400163 .dataType = GPBDataTypeMessage,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400164 },
165 {
166 .name = "sourceContext",
Dave MacLachlanaa1d7e72020-01-19 17:46:35 -0800167 .dataTypeSpecific.clazz = GPBObjCClass(GPBSourceContext),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400168 .number = GPBType_FieldNumber_SourceContext,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400169 .hasIndex = 1,
170 .offset = (uint32_t)offsetof(GPBType__storage_, sourceContext),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400171 .flags = GPBFieldOptional,
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400172 .dataType = GPBDataTypeMessage,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400173 },
TeBoringaca5a602015-08-26 14:02:44 -0700174 {
175 .name = "syntax",
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400176 .dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
TeBoringaca5a602015-08-26 14:02:44 -0700177 .number = GPBType_FieldNumber_Syntax,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400178 .hasIndex = 2,
179 .offset = (uint32_t)offsetof(GPBType__storage_, syntax),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400180 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero),
TeBoringaca5a602015-08-26 14:02:44 -0700181 .dataType = GPBDataTypeEnum,
TeBoringaca5a602015-08-26 14:02:44 -0700182 },
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400183 };
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400184 GPBDescriptor *localDescriptor =
185 [GPBDescriptor allocDescriptorForClass:[GPBType class]
186 rootClass:[GPBTypeRoot class]
187 file:GPBTypeRoot_FileDescriptor()
188 fields:fields
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400189 fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400190 storageSize:sizeof(GPBType__storage_)
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400191 flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
Dave MacLachlanb6311762018-12-11 16:32:48 -0800192 #if defined(DEBUG) && DEBUG
193 NSAssert(descriptor == nil, @"Startup recursed!");
194 #endif // DEBUG
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400195 descriptor = localDescriptor;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400196 }
197 return descriptor;
198}
199
200@end
201
TeBoringaca5a602015-08-26 14:02:44 -0700202int32_t GPBType_Syntax_RawValue(GPBType *message) {
203 GPBDescriptor *descriptor = [GPBType descriptor];
204 GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBType_FieldNumber_Syntax];
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400205 return GPBGetMessageRawEnumField(message, field);
TeBoringaca5a602015-08-26 14:02:44 -0700206}
207
208void SetGPBType_Syntax_RawValue(GPBType *message, int32_t value) {
209 GPBDescriptor *descriptor = [GPBType descriptor];
210 GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBType_FieldNumber_Syntax];
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400211 GPBSetMessageRawEnumField(message, field, value);
TeBoringaca5a602015-08-26 14:02:44 -0700212}
213
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400214#pragma mark - GPBField
215
216@implementation GPBField
217
218@dynamic kind;
219@dynamic cardinality;
220@dynamic number;
221@dynamic name;
222@dynamic typeURL;
223@dynamic oneofIndex;
224@dynamic packed;
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400225@dynamic optionsArray, optionsArray_Count;
TeBoringaca5a602015-08-26 14:02:44 -0700226@dynamic jsonName;
Thomas Van Lentenfcce7842016-01-05 15:23:50 -0500227@dynamic defaultValue;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400228
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400229typedef struct GPBField__storage_ {
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400230 uint32_t _has_storage_[1];
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400231 GPBField_Kind kind;
232 GPBField_Cardinality cardinality;
233 int32_t number;
234 int32_t oneofIndex;
235 NSString *name;
236 NSString *typeURL;
237 NSMutableArray *optionsArray;
TeBoringaca5a602015-08-26 14:02:44 -0700238 NSString *jsonName;
Thomas Van Lentenfcce7842016-01-05 15:23:50 -0500239 NSString *defaultValue;
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400240} GPBField__storage_;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400241
242// This method is threadsafe because it is initially called
243// in +initialize for each subclass.
244+ (GPBDescriptor *)descriptor {
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400245 static GPBDescriptor *descriptor = nil;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400246 if (!descriptor) {
247 static GPBMessageFieldDescription fields[] = {
248 {
249 .name = "kind",
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400250 .dataTypeSpecific.enumDescFunc = GPBField_Kind_EnumDescriptor,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400251 .number = GPBField_FieldNumber_Kind,
252 .hasIndex = 0,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400253 .offset = (uint32_t)offsetof(GPBField__storage_, kind),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400254 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero),
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400255 .dataType = GPBDataTypeEnum,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400256 },
257 {
258 .name = "cardinality",
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400259 .dataTypeSpecific.enumDescFunc = GPBField_Cardinality_EnumDescriptor,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400260 .number = GPBField_FieldNumber_Cardinality,
261 .hasIndex = 1,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400262 .offset = (uint32_t)offsetof(GPBField__storage_, cardinality),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400263 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero),
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400264 .dataType = GPBDataTypeEnum,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400265 },
266 {
267 .name = "number",
Dave MacLachlan74956e12019-12-17 17:32:09 -0800268 .dataTypeSpecific.clazz = Nil,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400269 .number = GPBField_FieldNumber_Number,
270 .hasIndex = 2,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400271 .offset = (uint32_t)offsetof(GPBField__storage_, number),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400272 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400273 .dataType = GPBDataTypeInt32,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400274 },
275 {
276 .name = "name",
Dave MacLachlan74956e12019-12-17 17:32:09 -0800277 .dataTypeSpecific.clazz = Nil,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400278 .number = GPBField_FieldNumber_Name,
279 .hasIndex = 3,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400280 .offset = (uint32_t)offsetof(GPBField__storage_, name),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400281 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400282 .dataType = GPBDataTypeString,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400283 },
284 {
285 .name = "typeURL",
Dave MacLachlan74956e12019-12-17 17:32:09 -0800286 .dataTypeSpecific.clazz = Nil,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400287 .number = GPBField_FieldNumber_TypeURL,
288 .hasIndex = 4,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400289 .offset = (uint32_t)offsetof(GPBField__storage_, typeURL),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400290 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom | GPBFieldClearHasIvarOnZero),
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400291 .dataType = GPBDataTypeString,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400292 },
293 {
294 .name = "oneofIndex",
Dave MacLachlan74956e12019-12-17 17:32:09 -0800295 .dataTypeSpecific.clazz = Nil,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400296 .number = GPBField_FieldNumber_OneofIndex,
297 .hasIndex = 5,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400298 .offset = (uint32_t)offsetof(GPBField__storage_, oneofIndex),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400299 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400300 .dataType = GPBDataTypeInt32,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400301 },
302 {
303 .name = "packed",
Dave MacLachlan74956e12019-12-17 17:32:09 -0800304 .dataTypeSpecific.clazz = Nil,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400305 .number = GPBField_FieldNumber_Packed,
306 .hasIndex = 6,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400307 .offset = 7, // Stored in _has_storage_ to save space.
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400308 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400309 .dataType = GPBDataTypeBool,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400310 },
311 {
312 .name = "optionsArray",
Dave MacLachlanaa1d7e72020-01-19 17:46:35 -0800313 .dataTypeSpecific.clazz = GPBObjCClass(GPBOption),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400314 .number = GPBField_FieldNumber_OptionsArray,
315 .hasIndex = GPBNoHasBit,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400316 .offset = (uint32_t)offsetof(GPBField__storage_, optionsArray),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400317 .flags = GPBFieldRepeated,
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400318 .dataType = GPBDataTypeMessage,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400319 },
TeBoringaca5a602015-08-26 14:02:44 -0700320 {
321 .name = "jsonName",
Dave MacLachlan74956e12019-12-17 17:32:09 -0800322 .dataTypeSpecific.clazz = Nil,
TeBoringaca5a602015-08-26 14:02:44 -0700323 .number = GPBField_FieldNumber_JsonName,
324 .hasIndex = 8,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400325 .offset = (uint32_t)offsetof(GPBField__storage_, jsonName),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400326 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
TeBoringaca5a602015-08-26 14:02:44 -0700327 .dataType = GPBDataTypeString,
TeBoringaca5a602015-08-26 14:02:44 -0700328 },
Thomas Van Lentenfcce7842016-01-05 15:23:50 -0500329 {
330 .name = "defaultValue",
Dave MacLachlan74956e12019-12-17 17:32:09 -0800331 .dataTypeSpecific.clazz = Nil,
Thomas Van Lentenfcce7842016-01-05 15:23:50 -0500332 .number = GPBField_FieldNumber_DefaultValue,
333 .hasIndex = 9,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400334 .offset = (uint32_t)offsetof(GPBField__storage_, defaultValue),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400335 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
Thomas Van Lentenfcce7842016-01-05 15:23:50 -0500336 .dataType = GPBDataTypeString,
Thomas Van Lentenfcce7842016-01-05 15:23:50 -0500337 },
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400338 };
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400339 GPBDescriptor *localDescriptor =
340 [GPBDescriptor allocDescriptorForClass:[GPBField class]
341 rootClass:[GPBTypeRoot class]
342 file:GPBTypeRoot_FileDescriptor()
343 fields:fields
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400344 fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400345 storageSize:sizeof(GPBField__storage_)
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400346 flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400347#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
348 static const char *extraTextFormatInfo =
349 "\001\006\004\241!!\000";
350 [localDescriptor setupExtraTextInfo:extraTextFormatInfo];
351#endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
Dave MacLachlanb6311762018-12-11 16:32:48 -0800352 #if defined(DEBUG) && DEBUG
353 NSAssert(descriptor == nil, @"Startup recursed!");
354 #endif // DEBUG
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400355 descriptor = localDescriptor;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400356 }
357 return descriptor;
358}
359
360@end
361
362int32_t GPBField_Kind_RawValue(GPBField *message) {
363 GPBDescriptor *descriptor = [GPBField descriptor];
364 GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Kind];
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400365 return GPBGetMessageRawEnumField(message, field);
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400366}
367
368void SetGPBField_Kind_RawValue(GPBField *message, int32_t value) {
369 GPBDescriptor *descriptor = [GPBField descriptor];
370 GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Kind];
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400371 GPBSetMessageRawEnumField(message, field, value);
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400372}
373
374int32_t GPBField_Cardinality_RawValue(GPBField *message) {
375 GPBDescriptor *descriptor = [GPBField descriptor];
376 GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Cardinality];
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400377 return GPBGetMessageRawEnumField(message, field);
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400378}
379
380void SetGPBField_Cardinality_RawValue(GPBField *message, int32_t value) {
381 GPBDescriptor *descriptor = [GPBField descriptor];
382 GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Cardinality];
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400383 GPBSetMessageRawEnumField(message, field, value);
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400384}
385
386#pragma mark - Enum GPBField_Kind
387
388GPBEnumDescriptor *GPBField_Kind_EnumDescriptor(void) {
Thomas Van Lentend83837d2018-01-31 13:58:11 -0500389 static _Atomic(GPBEnumDescriptor*) descriptor = nil;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400390 if (!descriptor) {
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400391 static const char *valueNames =
392 "TypeUnknown\000TypeDouble\000TypeFloat\000TypeInt"
393 "64\000TypeUint64\000TypeInt32\000TypeFixed64\000Type"
394 "Fixed32\000TypeBool\000TypeString\000TypeGroup\000Ty"
395 "peMessage\000TypeBytes\000TypeUint32\000TypeEnum\000"
396 "TypeSfixed32\000TypeSfixed64\000TypeSint32\000Typ"
397 "eSint64\000";
398 static const int32_t values[] = {
399 GPBField_Kind_TypeUnknown,
400 GPBField_Kind_TypeDouble,
401 GPBField_Kind_TypeFloat,
402 GPBField_Kind_TypeInt64,
403 GPBField_Kind_TypeUint64,
404 GPBField_Kind_TypeInt32,
405 GPBField_Kind_TypeFixed64,
406 GPBField_Kind_TypeFixed32,
407 GPBField_Kind_TypeBool,
408 GPBField_Kind_TypeString,
409 GPBField_Kind_TypeGroup,
410 GPBField_Kind_TypeMessage,
411 GPBField_Kind_TypeBytes,
412 GPBField_Kind_TypeUint32,
413 GPBField_Kind_TypeEnum,
414 GPBField_Kind_TypeSfixed32,
415 GPBField_Kind_TypeSfixed64,
416 GPBField_Kind_TypeSint32,
417 GPBField_Kind_TypeSint64,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400418 };
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400419 GPBEnumDescriptor *worker =
420 [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Kind)
421 valueNames:valueNames
422 values:values
423 count:(uint32_t)(sizeof(values) / sizeof(int32_t))
424 enumVerifier:GPBField_Kind_IsValidValue];
Jonathan Dierksena721bf62018-01-22 13:26:39 -0800425 GPBEnumDescriptor *expected = nil;
426 if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400427 [worker release];
428 }
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400429 }
430 return descriptor;
431}
432
433BOOL GPBField_Kind_IsValidValue(int32_t value__) {
434 switch (value__) {
435 case GPBField_Kind_TypeUnknown:
436 case GPBField_Kind_TypeDouble:
437 case GPBField_Kind_TypeFloat:
438 case GPBField_Kind_TypeInt64:
439 case GPBField_Kind_TypeUint64:
440 case GPBField_Kind_TypeInt32:
441 case GPBField_Kind_TypeFixed64:
442 case GPBField_Kind_TypeFixed32:
443 case GPBField_Kind_TypeBool:
444 case GPBField_Kind_TypeString:
TeBoringaca5a602015-08-26 14:02:44 -0700445 case GPBField_Kind_TypeGroup:
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400446 case GPBField_Kind_TypeMessage:
447 case GPBField_Kind_TypeBytes:
448 case GPBField_Kind_TypeUint32:
449 case GPBField_Kind_TypeEnum:
450 case GPBField_Kind_TypeSfixed32:
451 case GPBField_Kind_TypeSfixed64:
452 case GPBField_Kind_TypeSint32:
453 case GPBField_Kind_TypeSint64:
454 return YES;
455 default:
456 return NO;
457 }
458}
459
460#pragma mark - Enum GPBField_Cardinality
461
462GPBEnumDescriptor *GPBField_Cardinality_EnumDescriptor(void) {
Thomas Van Lentend83837d2018-01-31 13:58:11 -0500463 static _Atomic(GPBEnumDescriptor*) descriptor = nil;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400464 if (!descriptor) {
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400465 static const char *valueNames =
466 "CardinalityUnknown\000CardinalityOptional\000C"
467 "ardinalityRequired\000CardinalityRepeated\000";
468 static const int32_t values[] = {
469 GPBField_Cardinality_CardinalityUnknown,
470 GPBField_Cardinality_CardinalityOptional,
471 GPBField_Cardinality_CardinalityRequired,
472 GPBField_Cardinality_CardinalityRepeated,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400473 };
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400474 GPBEnumDescriptor *worker =
475 [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Cardinality)
476 valueNames:valueNames
477 values:values
478 count:(uint32_t)(sizeof(values) / sizeof(int32_t))
479 enumVerifier:GPBField_Cardinality_IsValidValue];
Jonathan Dierksena721bf62018-01-22 13:26:39 -0800480 GPBEnumDescriptor *expected = nil;
481 if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400482 [worker release];
483 }
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400484 }
485 return descriptor;
486}
487
488BOOL GPBField_Cardinality_IsValidValue(int32_t value__) {
489 switch (value__) {
490 case GPBField_Cardinality_CardinalityUnknown:
491 case GPBField_Cardinality_CardinalityOptional:
492 case GPBField_Cardinality_CardinalityRequired:
493 case GPBField_Cardinality_CardinalityRepeated:
494 return YES;
495 default:
496 return NO;
497 }
498}
499
500#pragma mark - GPBEnum
501
502@implementation GPBEnum
503
504@dynamic name;
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400505@dynamic enumvalueArray, enumvalueArray_Count;
506@dynamic optionsArray, optionsArray_Count;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400507@dynamic hasSourceContext, sourceContext;
TeBoringaca5a602015-08-26 14:02:44 -0700508@dynamic syntax;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400509
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400510typedef struct GPBEnum__storage_ {
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400511 uint32_t _has_storage_[1];
TeBoringaca5a602015-08-26 14:02:44 -0700512 GPBSyntax syntax;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400513 NSString *name;
514 NSMutableArray *enumvalueArray;
515 NSMutableArray *optionsArray;
516 GPBSourceContext *sourceContext;
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400517} GPBEnum__storage_;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400518
519// This method is threadsafe because it is initially called
520// in +initialize for each subclass.
521+ (GPBDescriptor *)descriptor {
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400522 static GPBDescriptor *descriptor = nil;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400523 if (!descriptor) {
524 static GPBMessageFieldDescription fields[] = {
525 {
526 .name = "name",
Dave MacLachlan74956e12019-12-17 17:32:09 -0800527 .dataTypeSpecific.clazz = Nil,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400528 .number = GPBEnum_FieldNumber_Name,
529 .hasIndex = 0,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400530 .offset = (uint32_t)offsetof(GPBEnum__storage_, name),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400531 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400532 .dataType = GPBDataTypeString,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400533 },
534 {
535 .name = "enumvalueArray",
Dave MacLachlanaa1d7e72020-01-19 17:46:35 -0800536 .dataTypeSpecific.clazz = GPBObjCClass(GPBEnumValue),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400537 .number = GPBEnum_FieldNumber_EnumvalueArray,
538 .hasIndex = GPBNoHasBit,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400539 .offset = (uint32_t)offsetof(GPBEnum__storage_, enumvalueArray),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400540 .flags = GPBFieldRepeated,
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400541 .dataType = GPBDataTypeMessage,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400542 },
543 {
544 .name = "optionsArray",
Dave MacLachlanaa1d7e72020-01-19 17:46:35 -0800545 .dataTypeSpecific.clazz = GPBObjCClass(GPBOption),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400546 .number = GPBEnum_FieldNumber_OptionsArray,
547 .hasIndex = GPBNoHasBit,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400548 .offset = (uint32_t)offsetof(GPBEnum__storage_, optionsArray),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400549 .flags = GPBFieldRepeated,
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400550 .dataType = GPBDataTypeMessage,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400551 },
552 {
553 .name = "sourceContext",
Dave MacLachlanaa1d7e72020-01-19 17:46:35 -0800554 .dataTypeSpecific.clazz = GPBObjCClass(GPBSourceContext),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400555 .number = GPBEnum_FieldNumber_SourceContext,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400556 .hasIndex = 1,
557 .offset = (uint32_t)offsetof(GPBEnum__storage_, sourceContext),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400558 .flags = GPBFieldOptional,
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400559 .dataType = GPBDataTypeMessage,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400560 },
TeBoringaca5a602015-08-26 14:02:44 -0700561 {
562 .name = "syntax",
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400563 .dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
TeBoringaca5a602015-08-26 14:02:44 -0700564 .number = GPBEnum_FieldNumber_Syntax,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400565 .hasIndex = 2,
566 .offset = (uint32_t)offsetof(GPBEnum__storage_, syntax),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400567 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero),
TeBoringaca5a602015-08-26 14:02:44 -0700568 .dataType = GPBDataTypeEnum,
TeBoringaca5a602015-08-26 14:02:44 -0700569 },
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400570 };
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400571 GPBDescriptor *localDescriptor =
572 [GPBDescriptor allocDescriptorForClass:[GPBEnum class]
573 rootClass:[GPBTypeRoot class]
574 file:GPBTypeRoot_FileDescriptor()
575 fields:fields
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400576 fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400577 storageSize:sizeof(GPBEnum__storage_)
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400578 flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
Dave MacLachlanb6311762018-12-11 16:32:48 -0800579 #if defined(DEBUG) && DEBUG
580 NSAssert(descriptor == nil, @"Startup recursed!");
581 #endif // DEBUG
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400582 descriptor = localDescriptor;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400583 }
584 return descriptor;
585}
586
587@end
588
TeBoringaca5a602015-08-26 14:02:44 -0700589int32_t GPBEnum_Syntax_RawValue(GPBEnum *message) {
590 GPBDescriptor *descriptor = [GPBEnum descriptor];
591 GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBEnum_FieldNumber_Syntax];
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400592 return GPBGetMessageRawEnumField(message, field);
TeBoringaca5a602015-08-26 14:02:44 -0700593}
594
595void SetGPBEnum_Syntax_RawValue(GPBEnum *message, int32_t value) {
596 GPBDescriptor *descriptor = [GPBEnum descriptor];
597 GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBEnum_FieldNumber_Syntax];
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400598 GPBSetMessageRawEnumField(message, field, value);
TeBoringaca5a602015-08-26 14:02:44 -0700599}
600
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400601#pragma mark - GPBEnumValue
602
603@implementation GPBEnumValue
604
605@dynamic name;
606@dynamic number;
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400607@dynamic optionsArray, optionsArray_Count;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400608
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400609typedef struct GPBEnumValue__storage_ {
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400610 uint32_t _has_storage_[1];
611 int32_t number;
612 NSString *name;
613 NSMutableArray *optionsArray;
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400614} GPBEnumValue__storage_;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400615
616// This method is threadsafe because it is initially called
617// in +initialize for each subclass.
618+ (GPBDescriptor *)descriptor {
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400619 static GPBDescriptor *descriptor = nil;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400620 if (!descriptor) {
621 static GPBMessageFieldDescription fields[] = {
622 {
623 .name = "name",
Dave MacLachlan74956e12019-12-17 17:32:09 -0800624 .dataTypeSpecific.clazz = Nil,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400625 .number = GPBEnumValue_FieldNumber_Name,
626 .hasIndex = 0,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400627 .offset = (uint32_t)offsetof(GPBEnumValue__storage_, name),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400628 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400629 .dataType = GPBDataTypeString,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400630 },
631 {
632 .name = "number",
Dave MacLachlan74956e12019-12-17 17:32:09 -0800633 .dataTypeSpecific.clazz = Nil,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400634 .number = GPBEnumValue_FieldNumber_Number,
635 .hasIndex = 1,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400636 .offset = (uint32_t)offsetof(GPBEnumValue__storage_, number),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400637 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400638 .dataType = GPBDataTypeInt32,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400639 },
640 {
641 .name = "optionsArray",
Dave MacLachlanaa1d7e72020-01-19 17:46:35 -0800642 .dataTypeSpecific.clazz = GPBObjCClass(GPBOption),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400643 .number = GPBEnumValue_FieldNumber_OptionsArray,
644 .hasIndex = GPBNoHasBit,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400645 .offset = (uint32_t)offsetof(GPBEnumValue__storage_, optionsArray),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400646 .flags = GPBFieldRepeated,
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400647 .dataType = GPBDataTypeMessage,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400648 },
649 };
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400650 GPBDescriptor *localDescriptor =
651 [GPBDescriptor allocDescriptorForClass:[GPBEnumValue class]
652 rootClass:[GPBTypeRoot class]
653 file:GPBTypeRoot_FileDescriptor()
654 fields:fields
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400655 fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400656 storageSize:sizeof(GPBEnumValue__storage_)
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400657 flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
Dave MacLachlanb6311762018-12-11 16:32:48 -0800658 #if defined(DEBUG) && DEBUG
659 NSAssert(descriptor == nil, @"Startup recursed!");
660 #endif // DEBUG
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400661 descriptor = localDescriptor;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400662 }
663 return descriptor;
664}
665
666@end
667
668#pragma mark - GPBOption
669
670@implementation GPBOption
671
672@dynamic name;
673@dynamic hasValue, value;
674
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400675typedef struct GPBOption__storage_ {
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400676 uint32_t _has_storage_[1];
677 NSString *name;
678 GPBAny *value;
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400679} GPBOption__storage_;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400680
681// This method is threadsafe because it is initially called
682// in +initialize for each subclass.
683+ (GPBDescriptor *)descriptor {
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400684 static GPBDescriptor *descriptor = nil;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400685 if (!descriptor) {
686 static GPBMessageFieldDescription fields[] = {
687 {
688 .name = "name",
Dave MacLachlan74956e12019-12-17 17:32:09 -0800689 .dataTypeSpecific.clazz = Nil,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400690 .number = GPBOption_FieldNumber_Name,
691 .hasIndex = 0,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400692 .offset = (uint32_t)offsetof(GPBOption__storage_, name),
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400693 .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400694 .dataType = GPBDataTypeString,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400695 },
696 {
697 .name = "value",
Dave MacLachlanaa1d7e72020-01-19 17:46:35 -0800698 .dataTypeSpecific.clazz = GPBObjCClass(GPBAny),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400699 .number = GPBOption_FieldNumber_Value,
700 .hasIndex = 1,
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400701 .offset = (uint32_t)offsetof(GPBOption__storage_, value),
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400702 .flags = GPBFieldOptional,
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400703 .dataType = GPBDataTypeMessage,
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400704 },
705 };
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400706 GPBDescriptor *localDescriptor =
707 [GPBDescriptor allocDescriptorForClass:[GPBOption class]
708 rootClass:[GPBTypeRoot class]
709 file:GPBTypeRoot_FileDescriptor()
710 fields:fields
Thomas Van Lenten79a23c42016-03-17 10:04:21 -0400711 fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400712 storageSize:sizeof(GPBOption__storage_)
Thomas Van Lentenb0e27922020-04-13 13:36:56 -0400713 flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
Dave MacLachlanb6311762018-12-11 16:32:48 -0800714 #if defined(DEBUG) && DEBUG
715 NSAssert(descriptor == nil, @"Startup recursed!");
716 #endif // DEBUG
Thomas Van Lentend846b0b2015-06-08 16:24:57 -0400717 descriptor = localDescriptor;
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400718 }
719 return descriptor;
720}
721
722@end
723
724
Thomas Van Lentene664aa62016-04-19 13:13:04 -0400725#pragma clang diagnostic pop
726
Thomas Van Lenten1dcc3292015-05-21 17:14:52 -0400727// @@protoc_insertion_point(global_scope)