GPBStruct.pbobjc.m 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: google/protobuf/struct.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/GPBStruct.pbobjc.h>
  16. #else
  17. #import "GPBStruct.pbobjc.h"
  18. #endif
  19. // @@protoc_insertion_point(imports)
  20. #pragma clang diagnostic push
  21. #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  22. #pragma clang diagnostic ignored "-Wdirect-ivar-access"
  23. #pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
  24. #pragma mark - Objective C Class declarations
  25. // Forward declarations of Objective C classes that we can use as
  26. // static values in struct initializers.
  27. // We don't use [Foo class] because it is not a static value.
  28. GPBObjCClassDeclaration(GPBListValue);
  29. GPBObjCClassDeclaration(GPBStruct);
  30. GPBObjCClassDeclaration(GPBValue);
  31. #pragma mark - GPBStructRoot
  32. @implementation GPBStructRoot
  33. // No extensions in the file and no imports, so no need to generate
  34. // +extensionRegistry.
  35. @end
  36. #pragma mark - GPBStructRoot_FileDescriptor
  37. static GPBFileDescriptor *GPBStructRoot_FileDescriptor(void) {
  38. // This is called by +initialize so there is no need to worry
  39. // about thread safety of the singleton.
  40. static GPBFileDescriptor *descriptor = NULL;
  41. if (!descriptor) {
  42. GPB_DEBUG_CHECK_RUNTIME_VERSIONS();
  43. descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"google.protobuf"
  44. objcPrefix:@"GPB"
  45. syntax:GPBFileSyntaxProto3];
  46. }
  47. return descriptor;
  48. }
  49. #pragma mark - Enum GPBNullValue
  50. GPBEnumDescriptor *GPBNullValue_EnumDescriptor(void) {
  51. static _Atomic(GPBEnumDescriptor*) descriptor = nil;
  52. if (!descriptor) {
  53. static const char *valueNames =
  54. "NullValue\000";
  55. static const int32_t values[] = {
  56. GPBNullValue_NullValue,
  57. };
  58. GPBEnumDescriptor *worker =
  59. [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBNullValue)
  60. valueNames:valueNames
  61. values:values
  62. count:(uint32_t)(sizeof(values) / sizeof(int32_t))
  63. enumVerifier:GPBNullValue_IsValidValue];
  64. GPBEnumDescriptor *expected = nil;
  65. if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
  66. [worker release];
  67. }
  68. }
  69. return descriptor;
  70. }
  71. BOOL GPBNullValue_IsValidValue(int32_t value__) {
  72. switch (value__) {
  73. case GPBNullValue_NullValue:
  74. return YES;
  75. default:
  76. return NO;
  77. }
  78. }
  79. #pragma mark - GPBStruct
  80. @implementation GPBStruct
  81. @dynamic fields, fields_Count;
  82. typedef struct GPBStruct__storage_ {
  83. uint32_t _has_storage_[1];
  84. NSMutableDictionary *fields;
  85. } GPBStruct__storage_;
  86. // This method is threadsafe because it is initially called
  87. // in +initialize for each subclass.
  88. + (GPBDescriptor *)descriptor {
  89. static GPBDescriptor *descriptor = nil;
  90. if (!descriptor) {
  91. static GPBMessageFieldDescription fields[] = {
  92. {
  93. .name = "fields",
  94. .dataTypeSpecific.clazz = GPBObjCClass(GPBValue),
  95. .number = GPBStruct_FieldNumber_Fields,
  96. .hasIndex = GPBNoHasBit,
  97. .offset = (uint32_t)offsetof(GPBStruct__storage_, fields),
  98. .flags = GPBFieldMapKeyString,
  99. .dataType = GPBDataTypeMessage,
  100. },
  101. };
  102. GPBDescriptor *localDescriptor =
  103. [GPBDescriptor allocDescriptorForClass:[GPBStruct class]
  104. rootClass:[GPBStructRoot class]
  105. file:GPBStructRoot_FileDescriptor()
  106. fields:fields
  107. fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
  108. storageSize:sizeof(GPBStruct__storage_)
  109. flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
  110. #if defined(DEBUG) && DEBUG
  111. NSAssert(descriptor == nil, @"Startup recursed!");
  112. #endif // DEBUG
  113. descriptor = localDescriptor;
  114. }
  115. return descriptor;
  116. }
  117. @end
  118. #pragma mark - GPBValue
  119. @implementation GPBValue
  120. @dynamic kindOneOfCase;
  121. @dynamic nullValue;
  122. @dynamic numberValue;
  123. @dynamic stringValue;
  124. @dynamic boolValue;
  125. @dynamic structValue;
  126. @dynamic listValue;
  127. typedef struct GPBValue__storage_ {
  128. uint32_t _has_storage_[2];
  129. GPBNullValue nullValue;
  130. NSString *stringValue;
  131. GPBStruct *structValue;
  132. GPBListValue *listValue;
  133. double numberValue;
  134. } GPBValue__storage_;
  135. // This method is threadsafe because it is initially called
  136. // in +initialize for each subclass.
  137. + (GPBDescriptor *)descriptor {
  138. static GPBDescriptor *descriptor = nil;
  139. if (!descriptor) {
  140. static GPBMessageFieldDescription fields[] = {
  141. {
  142. .name = "nullValue",
  143. .dataTypeSpecific.enumDescFunc = GPBNullValue_EnumDescriptor,
  144. .number = GPBValue_FieldNumber_NullValue,
  145. .hasIndex = -1,
  146. .offset = (uint32_t)offsetof(GPBValue__storage_, nullValue),
  147. .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldHasEnumDescriptor),
  148. .dataType = GPBDataTypeEnum,
  149. },
  150. {
  151. .name = "numberValue",
  152. .dataTypeSpecific.clazz = Nil,
  153. .number = GPBValue_FieldNumber_NumberValue,
  154. .hasIndex = -1,
  155. .offset = (uint32_t)offsetof(GPBValue__storage_, numberValue),
  156. .flags = GPBFieldOptional,
  157. .dataType = GPBDataTypeDouble,
  158. },
  159. {
  160. .name = "stringValue",
  161. .dataTypeSpecific.clazz = Nil,
  162. .number = GPBValue_FieldNumber_StringValue,
  163. .hasIndex = -1,
  164. .offset = (uint32_t)offsetof(GPBValue__storage_, stringValue),
  165. .flags = GPBFieldOptional,
  166. .dataType = GPBDataTypeString,
  167. },
  168. {
  169. .name = "boolValue",
  170. .dataTypeSpecific.clazz = Nil,
  171. .number = GPBValue_FieldNumber_BoolValue,
  172. .hasIndex = -1,
  173. .offset = 0, // Stored in _has_storage_ to save space.
  174. .flags = GPBFieldOptional,
  175. .dataType = GPBDataTypeBool,
  176. },
  177. {
  178. .name = "structValue",
  179. .dataTypeSpecific.clazz = GPBObjCClass(GPBStruct),
  180. .number = GPBValue_FieldNumber_StructValue,
  181. .hasIndex = -1,
  182. .offset = (uint32_t)offsetof(GPBValue__storage_, structValue),
  183. .flags = GPBFieldOptional,
  184. .dataType = GPBDataTypeMessage,
  185. },
  186. {
  187. .name = "listValue",
  188. .dataTypeSpecific.clazz = GPBObjCClass(GPBListValue),
  189. .number = GPBValue_FieldNumber_ListValue,
  190. .hasIndex = -1,
  191. .offset = (uint32_t)offsetof(GPBValue__storage_, listValue),
  192. .flags = GPBFieldOptional,
  193. .dataType = GPBDataTypeMessage,
  194. },
  195. };
  196. GPBDescriptor *localDescriptor =
  197. [GPBDescriptor allocDescriptorForClass:[GPBValue class]
  198. rootClass:[GPBStructRoot class]
  199. file:GPBStructRoot_FileDescriptor()
  200. fields:fields
  201. fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
  202. storageSize:sizeof(GPBValue__storage_)
  203. flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
  204. static const char *oneofs[] = {
  205. "kind",
  206. };
  207. [localDescriptor setupOneofs:oneofs
  208. count:(uint32_t)(sizeof(oneofs) / sizeof(char*))
  209. firstHasIndex:-1];
  210. #if defined(DEBUG) && DEBUG
  211. NSAssert(descriptor == nil, @"Startup recursed!");
  212. #endif // DEBUG
  213. descriptor = localDescriptor;
  214. }
  215. return descriptor;
  216. }
  217. @end
  218. int32_t GPBValue_NullValue_RawValue(GPBValue *message) {
  219. GPBDescriptor *descriptor = [GPBValue descriptor];
  220. GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBValue_FieldNumber_NullValue];
  221. return GPBGetMessageRawEnumField(message, field);
  222. }
  223. void SetGPBValue_NullValue_RawValue(GPBValue *message, int32_t value) {
  224. GPBDescriptor *descriptor = [GPBValue descriptor];
  225. GPBFieldDescriptor *field = [descriptor fieldWithNumber:GPBValue_FieldNumber_NullValue];
  226. GPBSetMessageRawEnumField(message, field, value);
  227. }
  228. void GPBValue_ClearKindOneOfCase(GPBValue *message) {
  229. GPBDescriptor *descriptor = [GPBValue descriptor];
  230. GPBOneofDescriptor *oneof = [descriptor.oneofs objectAtIndex:0];
  231. GPBClearOneof(message, oneof);
  232. }
  233. #pragma mark - GPBListValue
  234. @implementation GPBListValue
  235. @dynamic valuesArray, valuesArray_Count;
  236. typedef struct GPBListValue__storage_ {
  237. uint32_t _has_storage_[1];
  238. NSMutableArray *valuesArray;
  239. } GPBListValue__storage_;
  240. // This method is threadsafe because it is initially called
  241. // in +initialize for each subclass.
  242. + (GPBDescriptor *)descriptor {
  243. static GPBDescriptor *descriptor = nil;
  244. if (!descriptor) {
  245. static GPBMessageFieldDescription fields[] = {
  246. {
  247. .name = "valuesArray",
  248. .dataTypeSpecific.clazz = GPBObjCClass(GPBValue),
  249. .number = GPBListValue_FieldNumber_ValuesArray,
  250. .hasIndex = GPBNoHasBit,
  251. .offset = (uint32_t)offsetof(GPBListValue__storage_, valuesArray),
  252. .flags = GPBFieldRepeated,
  253. .dataType = GPBDataTypeMessage,
  254. },
  255. };
  256. GPBDescriptor *localDescriptor =
  257. [GPBDescriptor allocDescriptorForClass:[GPBListValue class]
  258. rootClass:[GPBStructRoot class]
  259. file:GPBStructRoot_FileDescriptor()
  260. fields:fields
  261. fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
  262. storageSize:sizeof(GPBListValue__storage_)
  263. flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
  264. #if defined(DEBUG) && DEBUG
  265. NSAssert(descriptor == nil, @"Startup recursed!");
  266. #endif // DEBUG
  267. descriptor = localDescriptor;
  268. }
  269. return descriptor;
  270. }
  271. @end
  272. #pragma clang diagnostic pop
  273. // @@protoc_insertion_point(global_scope)