Struct.pbobjc.m 10.0 KB

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