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