Avoid recursive call to `Insert` in the flat case.
[google-protobuf.git] / objectivec / GPBAny.pbobjc.m
blob600aafd874e50836affcdbf4c9efa133cf343502
1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // NO CHECKED-IN PROTOBUF GENCODE
3 // clang-format off
4 // source: google/protobuf/any.proto
6 #import "GPBProtocolBuffers_RuntimeSupport.h"
7 #import "GPBWellKnownTypes.h"
8 #import "GPBAny.pbobjc.h"
10 #if GOOGLE_PROTOBUF_OBJC_VERSION < 30007
11 #error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
12 #endif
13 #if 30007 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
14 #error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
15 #endif
17 // @@protoc_insertion_point(imports)
19 #pragma clang diagnostic push
20 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
21 #pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
23 #pragma mark - Objective-C Class declarations
24 // Forward declarations of Objective-C classes that we can use as
25 // static values in struct initializers.
26 // We don't use [Foo class] because it is not a static value.
27 GPBObjCClassDeclaration(GPBAny);
29 #pragma mark - GPBAnyRoot
31 @implementation GPBAnyRoot
33 // No extensions in the file and no imports or none of the imports (direct or
34 // indirect) defined extensions, so no need to generate +extensionRegistry.
36 @end
38 static GPBFileDescription GPBAnyRoot_FileDescription = {
39   .package = "google.protobuf",
40   .prefix = "GPB",
41   .syntax = GPBFileSyntaxProto3
44 // This is to help make sure that the GPBWellKnownTypes.* categories get linked and
45 // developers do not have to use the `-ObjC` linker flag. More information
46 // here: https://medium.com/ios-os-x-development/categories-in-static-libraries-78e41f8ddb96
47 __attribute__((used)) static NSString* any_importCategories(void) {
48   return GPBWellKnownTypesErrorDomain;
51 #pragma mark - GPBAny
53 @implementation GPBAny
55 @dynamic typeURL;
56 @dynamic value;
58 typedef struct GPBAny__storage_ {
59   uint32_t _has_storage_[1];
60   NSString *typeURL;
61   NSData *value;
62 } GPBAny__storage_;
64 // This method is threadsafe because it is initially called
65 // in +initialize for each subclass.
66 + (GPBDescriptor *)descriptor {
67   static GPBDescriptor *descriptor = nil;
68   if (!descriptor) {
69     GPB_DEBUG_CHECK_RUNTIME_VERSIONS();
70     static GPBMessageFieldDescription fields[] = {
71       {
72         .name = "typeURL",
73         .dataTypeSpecific.clazz = Nil,
74         .number = GPBAny_FieldNumber_TypeURL,
75         .hasIndex = 0,
76         .offset = (uint32_t)offsetof(GPBAny__storage_, typeURL),
77         .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldTextFormatNameCustom | GPBFieldClearHasIvarOnZero),
78         .dataType = GPBDataTypeString,
79       },
80       {
81         .name = "value",
82         .dataTypeSpecific.clazz = Nil,
83         .number = GPBAny_FieldNumber_Value,
84         .hasIndex = 1,
85         .offset = (uint32_t)offsetof(GPBAny__storage_, value),
86         .flags = (GPBFieldFlags)(GPBFieldOptional | GPBFieldClearHasIvarOnZero),
87         .dataType = GPBDataTypeBytes,
88       },
89     };
90     GPBDescriptor *localDescriptor =
91         [GPBDescriptor allocDescriptorForClass:GPBObjCClass(GPBAny)
92                                    messageName:@"Any"
93                                fileDescription:&GPBAnyRoot_FileDescription
94                                         fields:fields
95                                     fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
96                                    storageSize:sizeof(GPBAny__storage_)
97                                          flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
98     #if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
99       static const char *extraTextFormatInfo =
100         "\001\001\004\241!!\000";
101       [localDescriptor setupExtraTextInfo:extraTextFormatInfo];
102     #endif  // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
103     #if defined(DEBUG) && DEBUG
104       NSAssert(descriptor == nil, @"Startup recursed!");
105     #endif  // DEBUG
106     descriptor = localDescriptor;
107   }
108   return descriptor;
111 @end
114 #pragma clang diagnostic pop
116 // @@protoc_insertion_point(global_scope)
118 // clang-format on