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