xref: /aosp_15_r20/external/cronet/third_party/protobuf/src/google/protobuf/any.pb.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: google/protobuf/any.proto
3 
4 #include <google/protobuf/any.pb.h>
5 
6 #include <algorithm>
7 
8 #include <google/protobuf/io/coded_stream.h>
9 #include <google/protobuf/extension_set.h>
10 #include <google/protobuf/wire_format_lite.h>
11 #include <google/protobuf/descriptor.h>
12 #include <google/protobuf/generated_message_reflection.h>
13 #include <google/protobuf/reflection_ops.h>
14 #include <google/protobuf/wire_format.h>
15 // @@protoc_insertion_point(includes)
16 #include <google/protobuf/port_def.inc>
17 
18 PROTOBUF_PRAGMA_INIT_SEG
19 
20 namespace _pb = ::PROTOBUF_NAMESPACE_ID;
21 namespace _pbi = _pb::internal;
22 
23 #if defined(__llvm__)
24   #pragma clang diagnostic push
25   #pragma clang diagnostic ignored "-Wuninitialized"
26 #endif  // __llvm__
27 PROTOBUF_NAMESPACE_OPEN
Any(::_pbi::ConstantInitialized)28 PROTOBUF_CONSTEXPR Any::Any(
29     ::_pbi::ConstantInitialized): _impl_{
30     /*decltype(_impl_.type_url_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
31   , /*decltype(_impl_.value_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
32   , /*decltype(_impl_._cached_size_)*/{}
33   , /*decltype(_impl_._any_metadata_)*/{&_impl_.type_url_, &_impl_.value_}} {}
34 struct AnyDefaultTypeInternal {
AnyDefaultTypeInternalAnyDefaultTypeInternal35   PROTOBUF_CONSTEXPR AnyDefaultTypeInternal()
36       : _instance(::_pbi::ConstantInitialized{}) {}
~AnyDefaultTypeInternalAnyDefaultTypeInternal37   ~AnyDefaultTypeInternal() {}
38   union {
39     Any _instance;
40   };
41 };
42 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 AnyDefaultTypeInternal _Any_default_instance_;
43 PROTOBUF_NAMESPACE_CLOSE
44 static ::_pb::Metadata file_level_metadata_google_2fprotobuf_2fany_2eproto[1];
45 static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto = nullptr;
46 static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fany_2eproto = nullptr;
47 
48 const uint32_t TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
49   ~0u,  // no _has_bits_
50   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _internal_metadata_),
51   ~0u,  // no _extensions_
52   ~0u,  // no _oneof_case_
53   ~0u,  // no _weak_field_map_
54   ~0u,  // no _inlined_string_donated_
55   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _impl_.type_url_),
56   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _impl_.value_),
57 };
58 static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
59   { 0, -1, -1, sizeof(::PROTOBUF_NAMESPACE_ID::Any)},
60 };
61 
62 static const ::_pb::Message* const file_default_instances[] = {
63   &::PROTOBUF_NAMESPACE_ID::_Any_default_instance_._instance,
64 };
65 
66 const char descriptor_table_protodef_google_2fprotobuf_2fany_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
67   "\n\031google/protobuf/any.proto\022\017google.prot"
68   "obuf\"&\n\003Any\022\020\n\010type_url\030\001 \001(\t\022\r\n\005value\030\002"
69   " \001(\014Bv\n\023com.google.protobufB\010AnyProtoP\001Z"
70   ",google.golang.org/protobuf/types/known/"
71   "anypb\242\002\003GPB\252\002\036Google.Protobuf.WellKnownT"
72   "ypesb\006proto3"
73   ;
74 static ::_pbi::once_flag descriptor_table_google_2fprotobuf_2fany_2eproto_once;
75 const ::_pbi::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto = {
76     false, false, 212, descriptor_table_protodef_google_2fprotobuf_2fany_2eproto,
77     "google/protobuf/any.proto",
78     &descriptor_table_google_2fprotobuf_2fany_2eproto_once, nullptr, 0, 1,
79     schemas, file_default_instances, TableStruct_google_2fprotobuf_2fany_2eproto::offsets,
80     file_level_metadata_google_2fprotobuf_2fany_2eproto, file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto,
81     file_level_service_descriptors_google_2fprotobuf_2fany_2eproto,
82 };
descriptor_table_google_2fprotobuf_2fany_2eproto_getter()83 PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_google_2fprotobuf_2fany_2eproto_getter() {
84   return &descriptor_table_google_2fprotobuf_2fany_2eproto;
85 }
86 
87 // Force running AddDescriptors() at dynamic initialization time.
88 PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_google_2fprotobuf_2fany_2eproto(&descriptor_table_google_2fprotobuf_2fany_2eproto);
89 PROTOBUF_NAMESPACE_OPEN
90 
91 // ===================================================================
92 
GetAnyFieldDescriptors(const::PROTOBUF_NAMESPACE_ID::Message & message,const::PROTOBUF_NAMESPACE_ID::FieldDescriptor ** type_url_field,const::PROTOBUF_NAMESPACE_ID::FieldDescriptor ** value_field)93 bool Any::GetAnyFieldDescriptors(
94     const ::PROTOBUF_NAMESPACE_ID::Message& message,
95     const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** type_url_field,
96     const ::PROTOBUF_NAMESPACE_ID::FieldDescriptor** value_field) {
97   return ::_pbi::GetAnyFieldDescriptors(
98       message, type_url_field, value_field);
99 }
ParseAnyTypeUrl(::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url,std::string * full_type_name)100 bool Any::ParseAnyTypeUrl(
101     ::PROTOBUF_NAMESPACE_ID::ConstStringParam type_url,
102     std::string* full_type_name) {
103   return ::_pbi::ParseAnyTypeUrl(type_url, full_type_name);
104 }
105 
106 class Any::_Internal {
107  public:
108 };
109 
Any(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)110 Any::Any(::PROTOBUF_NAMESPACE_ID::Arena* arena,
111                          bool is_message_owned)
112   : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
113   SharedCtor(arena, is_message_owned);
114   // @@protoc_insertion_point(arena_constructor:google.protobuf.Any)
115 }
Any(const Any & from)116 Any::Any(const Any& from)
117   : ::PROTOBUF_NAMESPACE_ID::Message() {
118   Any* const _this = this; (void)_this;
119   new (&_impl_) Impl_{
120       decltype(_impl_.type_url_){}
121     , decltype(_impl_.value_){}
122     , /*decltype(_impl_._cached_size_)*/{}
123     , /*decltype(_impl_._any_metadata_)*/{&_impl_.type_url_, &_impl_.value_}};
124 
125   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
126   _impl_.type_url_.InitDefault();
127   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
128     _impl_.type_url_.Set("", GetArenaForAllocation());
129   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
130   if (!from._internal_type_url().empty()) {
131     _this->_impl_.type_url_.Set(from._internal_type_url(),
132       _this->GetArenaForAllocation());
133   }
134   _impl_.value_.InitDefault();
135   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
136     _impl_.value_.Set("", GetArenaForAllocation());
137   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
138   if (!from._internal_value().empty()) {
139     _this->_impl_.value_.Set(from._internal_value(),
140       _this->GetArenaForAllocation());
141   }
142   // @@protoc_insertion_point(copy_constructor:google.protobuf.Any)
143 }
144 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)145 inline void Any::SharedCtor(
146     ::_pb::Arena* arena, bool is_message_owned) {
147   (void)arena;
148   (void)is_message_owned;
149   new (&_impl_) Impl_{
150       decltype(_impl_.type_url_){}
151     , decltype(_impl_.value_){}
152     , /*decltype(_impl_._cached_size_)*/{}
153     , /*decltype(_impl_._any_metadata_)*/{&_impl_.type_url_, &_impl_.value_}
154   };
155   _impl_.type_url_.InitDefault();
156   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
157     _impl_.type_url_.Set("", GetArenaForAllocation());
158   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
159   _impl_.value_.InitDefault();
160   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
161     _impl_.value_.Set("", GetArenaForAllocation());
162   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
163 }
164 
~Any()165 Any::~Any() {
166   // @@protoc_insertion_point(destructor:google.protobuf.Any)
167   if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
168   (void)arena;
169     return;
170   }
171   SharedDtor();
172 }
173 
SharedDtor()174 inline void Any::SharedDtor() {
175   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
176   _impl_.type_url_.Destroy();
177   _impl_.value_.Destroy();
178   _impl_._any_metadata_.~AnyMetadata();
179 }
180 
SetCachedSize(int size) const181 void Any::SetCachedSize(int size) const {
182   _impl_._cached_size_.Set(size);
183 }
184 
Clear()185 void Any::Clear() {
186 // @@protoc_insertion_point(message_clear_start:google.protobuf.Any)
187   uint32_t cached_has_bits = 0;
188   // Prevent compiler warnings about cached_has_bits being unused
189   (void) cached_has_bits;
190 
191   _impl_.type_url_.ClearToEmpty();
192   _impl_.value_.ClearToEmpty();
193   _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
194 }
195 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)196 const char* Any::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
197 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
198   while (!ctx->Done(&ptr)) {
199     uint32_t tag;
200     ptr = ::_pbi::ReadTag(ptr, &tag);
201     switch (tag >> 3) {
202       // string type_url = 1;
203       case 1:
204         if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
205           auto str = _internal_mutable_type_url();
206           ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
207           CHK_(ptr);
208           CHK_(::_pbi::VerifyUTF8(str, "google.protobuf.Any.type_url"));
209         } else
210           goto handle_unusual;
211         continue;
212       // bytes value = 2;
213       case 2:
214         if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
215           auto str = _internal_mutable_value();
216           ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
217           CHK_(ptr);
218         } else
219           goto handle_unusual;
220         continue;
221       default:
222         goto handle_unusual;
223     }  // switch
224   handle_unusual:
225     if ((tag == 0) || ((tag & 7) == 4)) {
226       CHK_(ptr);
227       ctx->SetLastTag(tag);
228       goto message_done;
229     }
230     ptr = UnknownFieldParse(
231         tag,
232         _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
233         ptr, ctx);
234     CHK_(ptr != nullptr);
235   }  // while
236 message_done:
237   return ptr;
238 failure:
239   ptr = nullptr;
240   goto message_done;
241 #undef CHK_
242 }
243 
_InternalSerialize(uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const244 uint8_t* Any::_InternalSerialize(
245     uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
246   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Any)
247   uint32_t cached_has_bits = 0;
248   (void) cached_has_bits;
249 
250   // string type_url = 1;
251   if (!this->_internal_type_url().empty()) {
252     ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
253       this->_internal_type_url().data(), static_cast<int>(this->_internal_type_url().length()),
254       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
255       "google.protobuf.Any.type_url");
256     target = stream->WriteStringMaybeAliased(
257         1, this->_internal_type_url(), target);
258   }
259 
260   // bytes value = 2;
261   if (!this->_internal_value().empty()) {
262     target = stream->WriteBytesMaybeAliased(
263         2, this->_internal_value(), target);
264   }
265 
266   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
267     target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
268         _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
269   }
270   // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Any)
271   return target;
272 }
273 
ByteSizeLong() const274 size_t Any::ByteSizeLong() const {
275 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Any)
276   size_t total_size = 0;
277 
278   uint32_t cached_has_bits = 0;
279   // Prevent compiler warnings about cached_has_bits being unused
280   (void) cached_has_bits;
281 
282   // string type_url = 1;
283   if (!this->_internal_type_url().empty()) {
284     total_size += 1 +
285       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
286         this->_internal_type_url());
287   }
288 
289   // bytes value = 2;
290   if (!this->_internal_value().empty()) {
291     total_size += 1 +
292       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
293         this->_internal_value());
294   }
295 
296   return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
297 }
298 
299 const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Any::_class_data_ = {
300     ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
301     Any::MergeImpl
302 };
GetClassData() const303 const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Any::GetClassData() const { return &_class_data_; }
304 
305 
MergeImpl(::PROTOBUF_NAMESPACE_ID::Message & to_msg,const::PROTOBUF_NAMESPACE_ID::Message & from_msg)306 void Any::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
307   auto* const _this = static_cast<Any*>(&to_msg);
308   auto& from = static_cast<const Any&>(from_msg);
309   // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Any)
310   GOOGLE_DCHECK_NE(&from, _this);
311   uint32_t cached_has_bits = 0;
312   (void) cached_has_bits;
313 
314   if (!from._internal_type_url().empty()) {
315     _this->_internal_set_type_url(from._internal_type_url());
316   }
317   if (!from._internal_value().empty()) {
318     _this->_internal_set_value(from._internal_value());
319   }
320   _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
321 }
322 
CopyFrom(const Any & from)323 void Any::CopyFrom(const Any& from) {
324 // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Any)
325   if (&from == this) return;
326   Clear();
327   MergeFrom(from);
328 }
329 
IsInitialized() const330 bool Any::IsInitialized() const {
331   return true;
332 }
333 
InternalSwap(Any * other)334 void Any::InternalSwap(Any* other) {
335   using std::swap;
336   auto* lhs_arena = GetArenaForAllocation();
337   auto* rhs_arena = other->GetArenaForAllocation();
338   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
339   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
340       &_impl_.type_url_, lhs_arena,
341       &other->_impl_.type_url_, rhs_arena
342   );
343   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
344       &_impl_.value_, lhs_arena,
345       &other->_impl_.value_, rhs_arena
346   );
347 }
348 
GetMetadata() const349 ::PROTOBUF_NAMESPACE_ID::Metadata Any::GetMetadata() const {
350   return ::_pbi::AssignDescriptors(
351       &descriptor_table_google_2fprotobuf_2fany_2eproto_getter, &descriptor_table_google_2fprotobuf_2fany_2eproto_once,
352       file_level_metadata_google_2fprotobuf_2fany_2eproto[0]);
353 }
354 
355 // @@protoc_insertion_point(namespace_scope)
356 PROTOBUF_NAMESPACE_CLOSE
357 PROTOBUF_NAMESPACE_OPEN
358 template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Any*
CreateMaybeMessage(Arena * arena)359 Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Any >(Arena* arena) {
360   return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Any >(arena);
361 }
362 PROTOBUF_NAMESPACE_CLOSE
363 
364 // @@protoc_insertion_point(global_scope)
365 #if defined(__llvm__)
366   #pragma clang diagnostic pop
367 #endif  // __llvm__
368 #include <google/protobuf/port_undef.inc>
369