GPBType.pbobjc.m 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: google/protobuf/type.proto
  3. // This CPP symbol can be defined to use imports that match up to the framework
  4. // imports needed when using CocoaPods.
  5. #if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
  6. #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
  7. #endif
  8. #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
  9. #import <Protobuf/GPBProtocolBuffers_RuntimeSupport.h>
  10. #else
  11. #import "GPBProtocolBuffers_RuntimeSupport.h"
  12. #endif
  13. #import <stdatomic.h>
  14. #if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
  15. #import <Protobuf/GPBType.pbobjc.h>
  16. #import <Protobuf/GPBAny.pbobjc.h>
  17. #import <Protobuf/GPBSourceContext.pbobjc.h>
  18. #else
  19. #import "GPBType.pbobjc.h"
  20. #import "GPBAny.pbobjc.h"
  21. #import "GPBSourceContext.pbobjc.h"
  22. #endif
  23. // @@protoc_insertion_point(imports)
  24. #pragma clang diagnostic push
  25. #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  26. #pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
  27. #pragma mark - Objective C Class declarations
  28. // Forward declarations of Objective C classes that we can use as
  29. // static values in struct initializers.
  30. // We don't use [Foo class] because it is not a static value.
  31. GPBObjCClassDeclaration(GPBAny);
  32. GPBObjCClassDeclaration(GPBEnumValue);
  33. GPBObjCClassDeclaration(GPBField);
  34. GPBObjCClassDeclaration(GPBOption);
  35. GPBObjCClassDeclaration(GPBSourceContext);
  36. #pragma mark - GPBTypeRoot
  37. @implementation GPBTypeRoot
  38. // No extensions in the file and none of the imports (direct or indirect)
  39. // defined extensions, so no need to generate +extensionRegistry.
  40. @end
  41. #pragma mark - GPBTypeRoot_FileDescriptor
  42. static GPBFileDescriptor *GPBTypeRoot_FileDescriptor(void) {
  43. // This is called by +initialize so there is no need to worry
  44. // about thread safety of the singleton.
  45. static GPBFileDescriptor *descriptor = NULL;
  46. if (!descriptor) {
  47. GPB_DEBUG_CHECK_RUNTIME_VERSIONS();
  48. descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf"
  49. objcPrefix:@"GPB"
  50. syntax:GPBFileSyntaxProto3];
  51. }
  52. return descriptor;
  53. }
  54. #pragma mark - Enum GPBSyntax
  55. GPBEnumDescriptor *GPBSyntax_EnumDescriptor(void) {
  56. static _Atomic(GPBEnumDescriptor*) descriptor = nil;
  57. if (!descriptor) {
  58. static const char *valueNames =
  59. "SyntaxProto2\000SyntaxProto3\000";
  60. static const int32_t values[] = {
  61. GPBSyntax_SyntaxProto2,
  62. GPBSyntax_SyntaxProto3,
  63. };
  64. GPBEnumDescriptor *worker =
  65. [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBSyntax)
  66. valueNames:valueNames
  67. values:values
  68. count:(uint32_t)(sizeof(values) / sizeof(int32_t))
  69. enumVerifier:GPBSyntax_IsValidValue];
  70. GPBEnumDescriptor *expected = nil;
  71. if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
  72. [worker release];
  73. }
  74. }
  75. return descriptor;
  76. }
  77. BOOL GPBSyntax_IsValidValue(int32_t value__) {
  78. switch (value__) {
  79. case GPBSyntax_SyntaxProto2:
  80. case GPBSyntax_SyntaxProto3:
  81. return YES;
  82. default:
  83. return NO;
  84. }
  85. }
  86. #pragma mark - GPBType
  87. @implementation GPBType
  88. @dynamic name;
  89. @dynamic fieldsArray, fieldsArray_Count;
  90. @dynamic oneofsArray, oneofsArray_Count;
  91. @dynamic optionsArray, optionsArray_Count;
  92. @dynamic hasSourceContext, sourceContext;
  93. @dynamic syntax;
  94. typedef struct GPBType__storage_ {
  95. uint32_t _has_storage_[1];
  96. GPBSyntax syntax;
  97. NSString *name;
  98. NSMutableArray *fieldsArray;
  99. NSMutableArray *oneofsArray;
  100. NSMutableArray *optionsArray;
  101. GPBSourceContext *sourceContext;
  102. } GPBType__storage_;
  103. // This method is threadsafe because it is initially called
  104. // in +initialize for each subclass.
  105. + (GPBDescriptor *)descriptor {
  106. static GPBDescriptor *descriptor = nil;
  107. if (!descriptor) {
  108. static GPBMessageFieldDescription fields[] = {
  109. {
  110. .name = "name",
  111. .dataTypeSpecific.clazz = Nil,
  112. .number = GPBType_FieldNumber_Name,
  113. .hasIndex = 0,
  114. .offset = (uint32_t)offsetof(GPBType__storage_, name),
  115. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
  116. .dataType = GPBDataTypeString,
  117. },
  118. {
  119. .name = "fieldsArray",
  120. .dataTypeSpecific.clazz = GPBObjCClass(GPBField),
  121. .number = GPBType_FieldNumber_FieldsArray,
  122. .hasIndex = GPBNoHasBit,
  123. .offset = (uint32_t)offsetof(GPBType__storage_, fieldsArray),
  124. .flags = GPBFieldRepeated,
  125. .dataType = GPBDataTypeMessage,
  126. },
  127. {
  128. .name = "oneofsArray",
  129. .dataTypeSpecific.clazz = Nil,
  130. .number = GPBType_FieldNumber_OneofsArray,
  131. .hasIndex = GPBNoHasBit,
  132. .offset = (uint32_t)offsetof(GPBType__storage_, oneofsArray),
  133. .flags = GPBFieldRepeated,
  134. .dataType = GPBDataTypeString,
  135. },
  136. {
  137. .name = "optionsArray",
  138. .dataTypeSpecific.clazz = GPBObjCClass(GPBOption),
  139. .number = GPBType_FieldNumber_OptionsArray,
  140. .hasIndex = GPBNoHasBit,
  141. .offset = (uint32_t)offsetof(GPBType__storage_, optionsArray),
  142. .flags = GPBFieldRepeated,
  143. .dataType = GPBDataTypeMessage,
  144. },
  145. {
  146. .name = "sourceContext",
  147. .dataTypeSpecific.clazz = GPBObjCClass(GPBSourceContext),
  148. .number = GPBType_FieldNumber_SourceContext,
  149. .hasIndex = 1,
  150. .offset = (uint32_t)offsetof(GPBType__storage_, sourceContext),
  151. .flags = GPBFieldOptional,
  152. .dataType = GPBDataTypeMessage,
  153. },
  154. {
  155. .name = "syntax",
  156. .dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
  157. .number = GPBType_FieldNumber_Syntax,
  158. .hasIndex = 2,
  159. .offset = (uint32_t)offsetof(GPBType__storage_, syntax),
  160. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero),
  161. .dataType = GPBDataTypeEnum,
  162. },
  163. };
  164. GPBDescriptor *localDescriptor =
  165. [GPBDescriptor allocDescriptorForClass:[GPBType class]
  166. rootClass:[GPBTypeRoot class]
  167. file:GPBTypeRoot_FileDescriptor()
  168. fields:fields
  169. fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
  170. storageSize:sizeof(GPBType__storage_)
  171. flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
  172. #if defined(DEBUG) && DEBUG
  173. NSAssert(descriptor == nil, @"Startup recursed!");
  174. #endif // DEBUG
  175. descriptor = localDescriptor;
  176. }
  177. return descriptor;
  178. }
  179. @end
  180. int32_t GPBType_Syntax_RawValue(GPBType *message) {
  181. GPBDescriptor *descriptor = [GPBType descriptor];
  182. GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBType_FieldNumber_Syntax];
  183. return GPBGetMessageRawEnumField(message, field);
  184. }
  185. void SetGPBType_Syntax_RawValue(GPBType *message, int32_t value) {
  186. GPBDescriptor *descriptor = [GPBType descriptor];
  187. GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBType_FieldNumber_Syntax];
  188. GPBSetMessageRawEnumField(message, field, value);
  189. }
  190. #pragma mark - GPBField
  191. @implementation GPBField
  192. @dynamic kind;
  193. @dynamic cardinality;
  194. @dynamic number;
  195. @dynamic name;
  196. @dynamic typeURL;
  197. @dynamic oneofIndex;
  198. @dynamic packed;
  199. @dynamic optionsArray, optionsArray_Count;
  200. @dynamic jsonName;
  201. @dynamic defaultValue;
  202. typedef struct GPBField__storage_ {
  203. uint32_t _has_storage_[1];
  204. GPBField_Kind kind;
  205. GPBField_Cardinality cardinality;
  206. int32_t number;
  207. int32_t oneofIndex;
  208. NSString *name;
  209. NSString *typeURL;
  210. NSMutableArray *optionsArray;
  211. NSString *jsonName;
  212. NSString *defaultValue;
  213. } GPBField__storage_;
  214. // This method is threadsafe because it is initially called
  215. // in +initialize for each subclass.
  216. + (GPBDescriptor *)descriptor {
  217. static GPBDescriptor *descriptor = nil;
  218. if (!descriptor) {
  219. static GPBMessageFieldDescription fields[] = {
  220. {
  221. .name = "kind",
  222. .dataTypeSpecific.enumDescFunc = GPBField_Kind_EnumDescriptor,
  223. .number = GPBField_FieldNumber_Kind,
  224. .hasIndex = 0,
  225. .offset = (uint32_t)offsetof(GPBField__storage_, kind),
  226. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero),
  227. .dataType = GPBDataTypeEnum,
  228. },
  229. {
  230. .name = "cardinality",
  231. .dataTypeSpecific.enumDescFunc = GPBField_Cardinality_EnumDescriptor,
  232. .number = GPBField_FieldNumber_Cardinality,
  233. .hasIndex = 1,
  234. .offset = (uint32_t)offsetof(GPBField__storage_, cardinality),
  235. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero),
  236. .dataType = GPBDataTypeEnum,
  237. },
  238. {
  239. .name = "number",
  240. .dataTypeSpecific.clazz = Nil,
  241. .number = GPBField_FieldNumber_Number,
  242. .hasIndex = 2,
  243. .offset = (uint32_t)offsetof(GPBField__storage_, number),
  244. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
  245. .dataType = GPBDataTypeInt32,
  246. },
  247. {
  248. .name = "name",
  249. .dataTypeSpecific.clazz = Nil,
  250. .number = GPBField_FieldNumber_Name,
  251. .hasIndex = 3,
  252. .offset = (uint32_t)offsetof(GPBField__storage_, name),
  253. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
  254. .dataType = GPBDataTypeString,
  255. },
  256. {
  257. .name = "typeURL",
  258. .dataTypeSpecific.clazz = Nil,
  259. .number = GPBField_FieldNumber_TypeURL,
  260. .hasIndex = 4,
  261. .offset = (uint32_t)offsetof(GPBField__storage_, typeURL),
  262. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom | GPBFieldClearHasIvarOnZero),
  263. .dataType = GPBDataTypeString,
  264. },
  265. {
  266. .name = "oneofIndex",
  267. .dataTypeSpecific.clazz = Nil,
  268. .number = GPBField_FieldNumber_OneofIndex,
  269. .hasIndex = 5,
  270. .offset = (uint32_t)offsetof(GPBField__storage_, oneofIndex),
  271. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
  272. .dataType = GPBDataTypeInt32,
  273. },
  274. {
  275. .name = "packed",
  276. .dataTypeSpecific.clazz = Nil,
  277. .number = GPBField_FieldNumber_Packed,
  278. .hasIndex = 6,
  279. .offset = 7, // Stored in _has_storage_ to save space.
  280. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
  281. .dataType = GPBDataTypeBool,
  282. },
  283. {
  284. .name = "optionsArray",
  285. .dataTypeSpecific.clazz = GPBObjCClass(GPBOption),
  286. .number = GPBField_FieldNumber_OptionsArray,
  287. .hasIndex = GPBNoHasBit,
  288. .offset = (uint32_t)offsetof(GPBField__storage_, optionsArray),
  289. .flags = GPBFieldRepeated,
  290. .dataType = GPBDataTypeMessage,
  291. },
  292. {
  293. .name = "jsonName",
  294. .dataTypeSpecific.clazz = Nil,
  295. .number = GPBField_FieldNumber_JsonName,
  296. .hasIndex = 8,
  297. .offset = (uint32_t)offsetof(GPBField__storage_, jsonName),
  298. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
  299. .dataType = GPBDataTypeString,
  300. },
  301. {
  302. .name = "defaultValue",
  303. .dataTypeSpecific.clazz = Nil,
  304. .number = GPBField_FieldNumber_DefaultValue,
  305. .hasIndex = 9,
  306. .offset = (uint32_t)offsetof(GPBField__storage_, defaultValue),
  307. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
  308. .dataType = GPBDataTypeString,
  309. },
  310. };
  311. GPBDescriptor *localDescriptor =
  312. [GPBDescriptor allocDescriptorForClass:[GPBField class]
  313. rootClass:[GPBTypeRoot class]
  314. file:GPBTypeRoot_FileDescriptor()
  315. fields:fields
  316. fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
  317. storageSize:sizeof(GPBField__storage_)
  318. flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
  319. #if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
  320. static const char *extraTextFormatInfo =
  321. "\001\006\004\241!!\000";
  322. [localDescriptor setupExtraTextInfo:extraTextFormatInfo];
  323. #endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
  324. #if defined(DEBUG) && DEBUG
  325. NSAssert(descriptor == nil, @"Startup recursed!");
  326. #endif // DEBUG
  327. descriptor = localDescriptor;
  328. }
  329. return descriptor;
  330. }
  331. @end
  332. int32_t GPBField_Kind_RawValue(GPBField *message) {
  333. GPBDescriptor *descriptor = [GPBField descriptor];
  334. GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Kind];
  335. return GPBGetMessageRawEnumField(message, field);
  336. }
  337. void SetGPBField_Kind_RawValue(GPBField *message, int32_t value) {
  338. GPBDescriptor *descriptor = [GPBField descriptor];
  339. GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Kind];
  340. GPBSetMessageRawEnumField(message, field, value);
  341. }
  342. int32_t GPBField_Cardinality_RawValue(GPBField *message) {
  343. GPBDescriptor *descriptor = [GPBField descriptor];
  344. GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Cardinality];
  345. return GPBGetMessageRawEnumField(message, field);
  346. }
  347. void SetGPBField_Cardinality_RawValue(GPBField *message, int32_t value) {
  348. GPBDescriptor *descriptor = [GPBField descriptor];
  349. GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBField_FieldNumber_Cardinality];
  350. GPBSetMessageRawEnumField(message, field, value);
  351. }
  352. #pragma mark - Enum GPBField_Kind
  353. GPBEnumDescriptor *GPBField_Kind_EnumDescriptor(void) {
  354. static _Atomic(GPBEnumDescriptor*) descriptor = nil;
  355. if (!descriptor) {
  356. static const char *valueNames =
  357. "TypeUnknown\000TypeDouble\000TypeFloat\000TypeInt"
  358. "64\000TypeUint64\000TypeInt32\000TypeFixed64\000Type"
  359. "Fixed32\000TypeBool\000TypeString\000TypeGroup\000Ty"
  360. "peMessage\000TypeBytes\000TypeUint32\000TypeEnum\000"
  361. "TypeSfixed32\000TypeSfixed64\000TypeSint32\000Typ"
  362. "eSint64\000";
  363. static const int32_t values[] = {
  364. GPBField_Kind_TypeUnknown,
  365. GPBField_Kind_TypeDouble,
  366. GPBField_Kind_TypeFloat,
  367. GPBField_Kind_TypeInt64,
  368. GPBField_Kind_TypeUint64,
  369. GPBField_Kind_TypeInt32,
  370. GPBField_Kind_TypeFixed64,
  371. GPBField_Kind_TypeFixed32,
  372. GPBField_Kind_TypeBool,
  373. GPBField_Kind_TypeString,
  374. GPBField_Kind_TypeGroup,
  375. GPBField_Kind_TypeMessage,
  376. GPBField_Kind_TypeBytes,
  377. GPBField_Kind_TypeUint32,
  378. GPBField_Kind_TypeEnum,
  379. GPBField_Kind_TypeSfixed32,
  380. GPBField_Kind_TypeSfixed64,
  381. GPBField_Kind_TypeSint32,
  382. GPBField_Kind_TypeSint64,
  383. };
  384. GPBEnumDescriptor *worker =
  385. [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Kind)
  386. valueNames:valueNames
  387. values:values
  388. count:(uint32_t)(sizeof(values) / sizeof(int32_t))
  389. enumVerifier:GPBField_Kind_IsValidValue];
  390. GPBEnumDescriptor *expected = nil;
  391. if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
  392. [worker release];
  393. }
  394. }
  395. return descriptor;
  396. }
  397. BOOL GPBField_Kind_IsValidValue(int32_t value__) {
  398. switch (value__) {
  399. case GPBField_Kind_TypeUnknown:
  400. case GPBField_Kind_TypeDouble:
  401. case GPBField_Kind_TypeFloat:
  402. case GPBField_Kind_TypeInt64:
  403. case GPBField_Kind_TypeUint64:
  404. case GPBField_Kind_TypeInt32:
  405. case GPBField_Kind_TypeFixed64:
  406. case GPBField_Kind_TypeFixed32:
  407. case GPBField_Kind_TypeBool:
  408. case GPBField_Kind_TypeString:
  409. case GPBField_Kind_TypeGroup:
  410. case GPBField_Kind_TypeMessage:
  411. case GPBField_Kind_TypeBytes:
  412. case GPBField_Kind_TypeUint32:
  413. case GPBField_Kind_TypeEnum:
  414. case GPBField_Kind_TypeSfixed32:
  415. case GPBField_Kind_TypeSfixed64:
  416. case GPBField_Kind_TypeSint32:
  417. case GPBField_Kind_TypeSint64:
  418. return YES;
  419. default:
  420. return NO;
  421. }
  422. }
  423. #pragma mark - Enum GPBField_Cardinality
  424. GPBEnumDescriptor *GPBField_Cardinality_EnumDescriptor(void) {
  425. static _Atomic(GPBEnumDescriptor*) descriptor = nil;
  426. if (!descriptor) {
  427. static const char *valueNames =
  428. "CardinalityUnknown\000CardinalityOptional\000C"
  429. "ardinalityRequired\000CardinalityRepeated\000";
  430. static const int32_t values[] = {
  431. GPBField_Cardinality_CardinalityUnknown,
  432. GPBField_Cardinality_CardinalityOptional,
  433. GPBField_Cardinality_CardinalityRequired,
  434. GPBField_Cardinality_CardinalityRepeated,
  435. };
  436. GPBEnumDescriptor *worker =
  437. [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Cardinality)
  438. valueNames:valueNames
  439. values:values
  440. count:(uint32_t)(sizeof(values) / sizeof(int32_t))
  441. enumVerifier:GPBField_Cardinality_IsValidValue];
  442. GPBEnumDescriptor *expected = nil;
  443. if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
  444. [worker release];
  445. }
  446. }
  447. return descriptor;
  448. }
  449. BOOL GPBField_Cardinality_IsValidValue(int32_t value__) {
  450. switch (value__) {
  451. case GPBField_Cardinality_CardinalityUnknown:
  452. case GPBField_Cardinality_CardinalityOptional:
  453. case GPBField_Cardinality_CardinalityRequired:
  454. case GPBField_Cardinality_CardinalityRepeated:
  455. return YES;
  456. default:
  457. return NO;
  458. }
  459. }
  460. #pragma mark - GPBEnum
  461. @implementation GPBEnum
  462. @dynamic name;
  463. @dynamic enumvalueArray, enumvalueArray_Count;
  464. @dynamic optionsArray, optionsArray_Count;
  465. @dynamic hasSourceContext, sourceContext;
  466. @dynamic syntax;
  467. typedef struct GPBEnum__storage_ {
  468. uint32_t _has_storage_[1];
  469. GPBSyntax syntax;
  470. NSString *name;
  471. NSMutableArray *enumvalueArray;
  472. NSMutableArray *optionsArray;
  473. GPBSourceContext *sourceContext;
  474. } GPBEnum__storage_;
  475. // This method is threadsafe because it is initially called
  476. // in +initialize for each subclass.
  477. + (GPBDescriptor *)descriptor {
  478. static GPBDescriptor *descriptor = nil;
  479. if (!descriptor) {
  480. static GPBMessageFieldDescription fields[] = {
  481. {
  482. .name = "name",
  483. .dataTypeSpecific.clazz = Nil,
  484. .number = GPBEnum_FieldNumber_Name,
  485. .hasIndex = 0,
  486. .offset = (uint32_t)offsetof(GPBEnum__storage_, name),
  487. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
  488. .dataType = GPBDataTypeString,
  489. },
  490. {
  491. .name = "enumvalueArray",
  492. .dataTypeSpecific.clazz = GPBObjCClass(GPBEnumValue),
  493. .number = GPBEnum_FieldNumber_EnumvalueArray,
  494. .hasIndex = GPBNoHasBit,
  495. .offset = (uint32_t)offsetof(GPBEnum__storage_, enumvalueArray),
  496. .flags = GPBFieldRepeated,
  497. .dataType = GPBDataTypeMessage,
  498. },
  499. {
  500. .name = "optionsArray",
  501. .dataTypeSpecific.clazz = GPBObjCClass(GPBOption),
  502. .number = GPBEnum_FieldNumber_OptionsArray,
  503. .hasIndex = GPBNoHasBit,
  504. .offset = (uint32_t)offsetof(GPBEnum__storage_, optionsArray),
  505. .flags = GPBFieldRepeated,
  506. .dataType = GPBDataTypeMessage,
  507. },
  508. {
  509. .name = "sourceContext",
  510. .dataTypeSpecific.clazz = GPBObjCClass(GPBSourceContext),
  511. .number = GPBEnum_FieldNumber_SourceContext,
  512. .hasIndex = 1,
  513. .offset = (uint32_t)offsetof(GPBEnum__storage_, sourceContext),
  514. .flags = GPBFieldOptional,
  515. .dataType = GPBDataTypeMessage,
  516. },
  517. {
  518. .name = "syntax",
  519. .dataTypeSpecific.enumDescFunc = GPBSyntax_EnumDescriptor,
  520. .number = GPBEnum_FieldNumber_Syntax,
  521. .hasIndex = 2,
  522. .offset = (uint32_t)offsetof(GPBEnum__storage_, syntax),
  523. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor | GPBFieldClearHasIvarOnZero),
  524. .dataType = GPBDataTypeEnum,
  525. },
  526. };
  527. GPBDescriptor *localDescriptor =
  528. [GPBDescriptor allocDescriptorForClass:[GPBEnum class]
  529. rootClass:[GPBTypeRoot class]
  530. file:GPBTypeRoot_FileDescriptor()
  531. fields:fields
  532. fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
  533. storageSize:sizeof(GPBEnum__storage_)
  534. flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
  535. #if defined(DEBUG) && DEBUG
  536. NSAssert(descriptor == nil, @"Startup recursed!");
  537. #endif // DEBUG
  538. descriptor = localDescriptor;
  539. }
  540. return descriptor;
  541. }
  542. @end
  543. int32_t GPBEnum_Syntax_RawValue(GPBEnum *message) {
  544. GPBDescriptor *descriptor = [GPBEnum descriptor];
  545. GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBEnum_FieldNumber_Syntax];
  546. return GPBGetMessageRawEnumField(message, field);
  547. }
  548. void SetGPBEnum_Syntax_RawValue(GPBEnum *message, int32_t value) {
  549. GPBDescriptor *descriptor = [GPBEnum descriptor];
  550. GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBEnum_FieldNumber_Syntax];
  551. GPBSetMessageRawEnumField(message, field, value);
  552. }
  553. #pragma mark - GPBEnumValue
  554. @implementation GPBEnumValue
  555. @dynamic name;
  556. @dynamic number;
  557. @dynamic optionsArray, optionsArray_Count;
  558. typedef struct GPBEnumValue__storage_ {
  559. uint32_t _has_storage_[1];
  560. int32_t number;
  561. NSString *name;
  562. NSMutableArray *optionsArray;
  563. } GPBEnumValue__storage_;
  564. // This method is threadsafe because it is initially called
  565. // in +initialize for each subclass.
  566. + (GPBDescriptor *)descriptor {
  567. static GPBDescriptor *descriptor = nil;
  568. if (!descriptor) {
  569. static GPBMessageFieldDescription fields[] = {
  570. {
  571. .name = "name",
  572. .dataTypeSpecific.clazz = Nil,
  573. .number = GPBEnumValue_FieldNumber_Name,
  574. .hasIndex = 0,
  575. .offset = (uint32_t)offsetof(GPBEnumValue__storage_, name),
  576. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
  577. .dataType = GPBDataTypeString,
  578. },
  579. {
  580. .name = "number",
  581. .dataTypeSpecific.clazz = Nil,
  582. .number = GPBEnumValue_FieldNumber_Number,
  583. .hasIndex = 1,
  584. .offset = (uint32_t)offsetof(GPBEnumValue__storage_, number),
  585. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
  586. .dataType = GPBDataTypeInt32,
  587. },
  588. {
  589. .name = "optionsArray",
  590. .dataTypeSpecific.clazz = GPBObjCClass(GPBOption),
  591. .number = GPBEnumValue_FieldNumber_OptionsArray,
  592. .hasIndex = GPBNoHasBit,
  593. .offset = (uint32_t)offsetof(GPBEnumValue__storage_, optionsArray),
  594. .flags = GPBFieldRepeated,
  595. .dataType = GPBDataTypeMessage,
  596. },
  597. };
  598. GPBDescriptor *localDescriptor =
  599. [GPBDescriptor allocDescriptorForClass:[GPBEnumValue class]
  600. rootClass:[GPBTypeRoot class]
  601. file:GPBTypeRoot_FileDescriptor()
  602. fields:fields
  603. fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
  604. storageSize:sizeof(GPBEnumValue__storage_)
  605. flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
  606. #if defined(DEBUG) && DEBUG
  607. NSAssert(descriptor == nil, @"Startup recursed!");
  608. #endif // DEBUG
  609. descriptor = localDescriptor;
  610. }
  611. return descriptor;
  612. }
  613. @end
  614. #pragma mark - GPBOption
  615. @implementation GPBOption
  616. @dynamic name;
  617. @dynamic hasValue, value;
  618. typedef struct GPBOption__storage_ {
  619. uint32_t _has_storage_[1];
  620. NSString *name;
  621. GPBAny *value;
  622. } GPBOption__storage_;
  623. // This method is threadsafe because it is initially called
  624. // in +initialize for each subclass.
  625. + (GPBDescriptor *)descriptor {
  626. static GPBDescriptor *descriptor = nil;
  627. if (!descriptor) {
  628. static GPBMessageFieldDescription fields[] = {
  629. {
  630. .name = "name",
  631. .dataTypeSpecific.clazz = Nil,
  632. .number = GPBOption_FieldNumber_Name,
  633. .hasIndex = 0,
  634. .offset = (uint32_t)offsetof(GPBOption__storage_, name),
  635. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
  636. .dataType = GPBDataTypeString,
  637. },
  638. {
  639. .name = "value",
  640. .dataTypeSpecific.clazz = GPBObjCClass(GPBAny),
  641. .number = GPBOption_FieldNumber_Value,
  642. .hasIndex = 1,
  643. .offset = (uint32_t)offsetof(GPBOption__storage_, value),
  644. .flags = GPBFieldOptional,
  645. .dataType = GPBDataTypeMessage,
  646. },
  647. };
  648. GPBDescriptor *localDescriptor =
  649. [GPBDescriptor allocDescriptorForClass:[GPBOption class]
  650. rootClass:[GPBTypeRoot class]
  651. file:GPBTypeRoot_FileDescriptor()
  652. fields:fields
  653. fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
  654. storageSize:sizeof(GPBOption__storage_)
  655. flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
  656. #if defined(DEBUG) && DEBUG
  657. NSAssert(descriptor == nil, @"Startup recursed!");
  658. #endif // DEBUG
  659. descriptor = localDescriptor;
  660. }
  661. return descriptor;
  662. }
  663. @end
  664. #pragma clang diagnostic pop
  665. // @@protoc_insertion_point(global_scope)