1 // Generated by the protocol buffer compiler. DO NOT EDIT!
2 // source: google/protobuf/struct.proto
3
4 #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
5 #include <google/protobuf/struct.pb.h>
6
7 #include <algorithm>
8
9 #include <google/protobuf/stubs/common.h>
10 #include <google/protobuf/stubs/port.h>
11 #include <google/protobuf/stubs/once.h>
12 #include <google/protobuf/io/coded_stream.h>
13 #include <google/protobuf/wire_format_lite_inl.h>
14 #include <google/protobuf/descriptor.h>
15 #include <google/protobuf/generated_message_reflection.h>
16 #include <google/protobuf/reflection_ops.h>
17 #include <google/protobuf/wire_format.h>
18 // @@protoc_insertion_point(includes)
19
20 namespace google {
21 namespace protobuf {
22
23 namespace {
24
25 const ::google::protobuf::Descriptor* Struct_descriptor_ = NULL;
26 const ::google::protobuf::internal::GeneratedMessageReflection*
27 Struct_reflection_ = NULL;
28 const ::google::protobuf::Descriptor* Struct_FieldsEntry_descriptor_ = NULL;
29 const ::google::protobuf::Descriptor* Value_descriptor_ = NULL;
30 const ::google::protobuf::internal::GeneratedMessageReflection*
31 Value_reflection_ = NULL;
32 struct ValueOneofInstance {
33 int null_value_;
34 double number_value_;
35 ::google::protobuf::internal::ArenaStringPtr string_value_;
36 bool bool_value_;
37 const ::google::protobuf::Struct* struct_value_;
38 const ::google::protobuf::ListValue* list_value_;
39 }* Value_default_oneof_instance_ = NULL;
40 const ::google::protobuf::Descriptor* ListValue_descriptor_ = NULL;
41 const ::google::protobuf::internal::GeneratedMessageReflection*
42 ListValue_reflection_ = NULL;
43 const ::google::protobuf::EnumDescriptor* NullValue_descriptor_ = NULL;
44
45 } // namespace
46
47
48 void protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto() GOOGLE_ATTRIBUTE_COLD;
protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto()49 void protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto() {
50 protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto();
51 const ::google::protobuf::FileDescriptor* file =
52 ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
53 "google/protobuf/struct.proto");
54 GOOGLE_CHECK(file != NULL);
55 Struct_descriptor_ = file->message_type(0);
56 static const int Struct_offsets_[1] = {
57 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Struct, fields_),
58 };
59 Struct_reflection_ =
60 ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
61 Struct_descriptor_,
62 Struct::default_instance_,
63 Struct_offsets_,
64 -1,
65 -1,
66 -1,
67 sizeof(Struct),
68 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Struct, _internal_metadata_),
69 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Struct, _is_default_instance_));
70 Struct_FieldsEntry_descriptor_ = Struct_descriptor_->nested_type(0);
71 Value_descriptor_ = file->message_type(1);
72 static const int Value_offsets_[7] = {
73 PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, null_value_),
74 PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, number_value_),
75 PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, string_value_),
76 PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, bool_value_),
77 PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, struct_value_),
78 PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, list_value_),
79 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, kind_),
80 };
81 Value_reflection_ =
82 ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
83 Value_descriptor_,
84 Value::default_instance_,
85 Value_offsets_,
86 -1,
87 -1,
88 -1,
89 Value_default_oneof_instance_,
90 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _oneof_case_[0]),
91 sizeof(Value),
92 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _internal_metadata_),
93 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _is_default_instance_));
94 ListValue_descriptor_ = file->message_type(2);
95 static const int ListValue_offsets_[1] = {
96 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListValue, values_),
97 };
98 ListValue_reflection_ =
99 ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
100 ListValue_descriptor_,
101 ListValue::default_instance_,
102 ListValue_offsets_,
103 -1,
104 -1,
105 -1,
106 sizeof(ListValue),
107 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListValue, _internal_metadata_),
108 GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListValue, _is_default_instance_));
109 NullValue_descriptor_ = file->enum_type(0);
110 }
111
112 namespace {
113
114 GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
protobuf_AssignDescriptorsOnce()115 inline void protobuf_AssignDescriptorsOnce() {
116 ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
117 &protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto);
118 }
119
120 void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
protobuf_RegisterTypes(const::std::string &)121 void protobuf_RegisterTypes(const ::std::string&) {
122 protobuf_AssignDescriptorsOnce();
123 ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
124 Struct_descriptor_, &Struct::default_instance());
125 ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
126 Struct_FieldsEntry_descriptor_,
127 ::google::protobuf::internal::MapEntry<
128 ::std::string,
129 ::google::protobuf::Value,
130 ::google::protobuf::internal::WireFormatLite::TYPE_STRING,
131 ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
132 0>::CreateDefaultInstance(
133 Struct_FieldsEntry_descriptor_));
134 ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
135 Value_descriptor_, &Value::default_instance());
136 ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
137 ListValue_descriptor_, &ListValue::default_instance());
138 }
139
140 } // namespace
141
protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto()142 void protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto() {
143 delete Struct::default_instance_;
144 delete Struct_reflection_;
145 delete Value::default_instance_;
146 delete Value_default_oneof_instance_;
147 delete Value_reflection_;
148 delete ListValue::default_instance_;
149 delete ListValue_reflection_;
150 }
151
152 void protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto() GOOGLE_ATTRIBUTE_COLD;
protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto()153 void protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto() {
154 static bool already_here = false;
155 if (already_here) return;
156 already_here = true;
157 GOOGLE_PROTOBUF_VERIFY_VERSION;
158
159 ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
160 "\n\034google/protobuf/struct.proto\022\017google.p"
161 "rotobuf\"\204\001\n\006Struct\0223\n\006fields\030\001 \003(\0132#.goo"
162 "gle.protobuf.Struct.FieldsEntry\032E\n\013Field"
163 "sEntry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026.goo"
164 "gle.protobuf.Value:\0028\001\"\352\001\n\005Value\0220\n\nnull"
165 "_value\030\001 \001(\0162\032.google.protobuf.NullValue"
166 "H\000\022\026\n\014number_value\030\002 \001(\001H\000\022\026\n\014string_val"
167 "ue\030\003 \001(\tH\000\022\024\n\nbool_value\030\004 \001(\010H\000\022/\n\014stru"
168 "ct_value\030\005 \001(\0132\027.google.protobuf.StructH"
169 "\000\0220\n\nlist_value\030\006 \001(\0132\032.google.protobuf."
170 "ListValueH\000B\006\n\004kind\"3\n\tListValue\022&\n\006valu"
171 "es\030\001 \003(\0132\026.google.protobuf.Value*\033\n\tNull"
172 "Value\022\016\n\nNULL_VALUE\020\000B\201\001\n\023com.google.pro"
173 "tobufB\013StructProtoP\001Z1github.com/golang/"
174 "protobuf/ptypes/struct;structpb\240\001\001\242\002\003GPB"
175 "\252\002\036Google.Protobuf.WellKnownTypesb\006proto"
176 "3", 641);
177 ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
178 "google/protobuf/struct.proto", &protobuf_RegisterTypes);
179 Struct::default_instance_ = new Struct();
180 Value::default_instance_ = new Value();
181 Value_default_oneof_instance_ = new ValueOneofInstance();
182 ListValue::default_instance_ = new ListValue();
183 Struct::default_instance_->InitAsDefaultInstance();
184 Value::default_instance_->InitAsDefaultInstance();
185 ListValue::default_instance_->InitAsDefaultInstance();
186 ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto);
187 }
188
189 // Force AddDescriptors() to be called at static initialization time.
190 struct StaticDescriptorInitializer_google_2fprotobuf_2fstruct_2eproto {
StaticDescriptorInitializer_google_2fprotobuf_2fstruct_2eprotogoogle::protobuf::StaticDescriptorInitializer_google_2fprotobuf_2fstruct_2eproto191 StaticDescriptorInitializer_google_2fprotobuf_2fstruct_2eproto() {
192 protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto();
193 }
194 } static_descriptor_initializer_google_2fprotobuf_2fstruct_2eproto_;
NullValue_descriptor()195 const ::google::protobuf::EnumDescriptor* NullValue_descriptor() {
196 protobuf_AssignDescriptorsOnce();
197 return NullValue_descriptor_;
198 }
NullValue_IsValid(int value)199 bool NullValue_IsValid(int value) {
200 switch(value) {
201 case 0:
202 return true;
203 default:
204 return false;
205 }
206 }
207
208
209 // ===================================================================
210
211 #if !defined(_MSC_VER) || _MSC_VER >= 1900
212 const int Struct::kFieldsFieldNumber;
213 #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
214
Struct()215 Struct::Struct()
216 : ::google::protobuf::Message(), _internal_metadata_(NULL) {
217 SharedCtor();
218 // @@protoc_insertion_point(constructor:google.protobuf.Struct)
219 }
220
InitAsDefaultInstance()221 void Struct::InitAsDefaultInstance() {
222 _is_default_instance_ = true;
223 }
224
Struct(const Struct & from)225 Struct::Struct(const Struct& from)
226 : ::google::protobuf::Message(),
227 _internal_metadata_(NULL) {
228 SharedCtor();
229 MergeFrom(from);
230 // @@protoc_insertion_point(copy_constructor:google.protobuf.Struct)
231 }
232
SharedCtor()233 void Struct::SharedCtor() {
234 _is_default_instance_ = false;
235 ::google::protobuf::internal::GetEmptyString();
236 _cached_size_ = 0;
237 fields_.SetAssignDescriptorCallback(
238 protobuf_AssignDescriptorsOnce);
239 fields_.SetEntryDescriptor(
240 &::google::protobuf::Struct_FieldsEntry_descriptor_);
241 }
242
~Struct()243 Struct::~Struct() {
244 // @@protoc_insertion_point(destructor:google.protobuf.Struct)
245 SharedDtor();
246 }
247
SharedDtor()248 void Struct::SharedDtor() {
249 if (this != default_instance_) {
250 }
251 }
252
SetCachedSize(int size) const253 void Struct::SetCachedSize(int size) const {
254 GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
255 _cached_size_ = size;
256 GOOGLE_SAFE_CONCURRENT_WRITES_END();
257 }
descriptor()258 const ::google::protobuf::Descriptor* Struct::descriptor() {
259 protobuf_AssignDescriptorsOnce();
260 return Struct_descriptor_;
261 }
262
default_instance()263 const Struct& Struct::default_instance() {
264 if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto();
265 return *default_instance_;
266 }
267
268 Struct* Struct::default_instance_ = NULL;
269
New(::google::protobuf::Arena * arena) const270 Struct* Struct::New(::google::protobuf::Arena* arena) const {
271 Struct* n = new Struct;
272 if (arena != NULL) {
273 arena->Own(n);
274 }
275 return n;
276 }
277
Clear()278 void Struct::Clear() {
279 // @@protoc_insertion_point(message_clear_start:google.protobuf.Struct)
280 fields_.Clear();
281 }
282
MergePartialFromCodedStream(::google::protobuf::io::CodedInputStream * input)283 bool Struct::MergePartialFromCodedStream(
284 ::google::protobuf::io::CodedInputStream* input) {
285 #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
286 ::google::protobuf::uint32 tag;
287 // @@protoc_insertion_point(parse_start:google.protobuf.Struct)
288 for (;;) {
289 ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
290 tag = p.first;
291 if (!p.second) goto handle_unusual;
292 switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
293 // map<string, .google.protobuf.Value> fields = 1;
294 case 1: {
295 if (tag == 10) {
296 DO_(input->IncrementRecursionDepth());
297 parse_loop_fields:
298 Struct_FieldsEntry::Parser< ::google::protobuf::internal::MapField<
299 ::std::string, ::google::protobuf::Value,
300 ::google::protobuf::internal::WireFormatLite::TYPE_STRING,
301 ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
302 0 >,
303 ::google::protobuf::Map< ::std::string, ::google::protobuf::Value > > parser(&fields_);
304 DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
305 input, &parser));
306 DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
307 parser.key().data(), parser.key().length(),
308 ::google::protobuf::internal::WireFormatLite::PARSE,
309 "google.protobuf.Struct.FieldsEntry.key"));
310 } else {
311 goto handle_unusual;
312 }
313 if (input->ExpectTag(10)) goto parse_loop_fields;
314 input->UnsafeDecrementRecursionDepth();
315 if (input->ExpectAtEnd()) goto success;
316 break;
317 }
318
319 default: {
320 handle_unusual:
321 if (tag == 0 ||
322 ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
323 ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
324 goto success;
325 }
326 DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
327 break;
328 }
329 }
330 }
331 success:
332 // @@protoc_insertion_point(parse_success:google.protobuf.Struct)
333 return true;
334 failure:
335 // @@protoc_insertion_point(parse_failure:google.protobuf.Struct)
336 return false;
337 #undef DO_
338 }
339
SerializeWithCachedSizes(::google::protobuf::io::CodedOutputStream * output) const340 void Struct::SerializeWithCachedSizes(
341 ::google::protobuf::io::CodedOutputStream* output) const {
342 // @@protoc_insertion_point(serialize_start:google.protobuf.Struct)
343 // map<string, .google.protobuf.Value> fields = 1;
344 if (!this->fields().empty()) {
345 typedef ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_pointer
346 ConstPtr;
347 typedef ConstPtr SortItem;
348 typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
349 struct Utf8Check {
350 static void Check(ConstPtr p) {
351 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
352 p->first.data(), p->first.length(),
353 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
354 "google.protobuf.Struct.FieldsEntry.key");
355 }
356 };
357
358 if (output->IsSerializationDeterminstic() &&
359 this->fields().size() > 1) {
360 ::google::protobuf::scoped_array<SortItem> items(
361 new SortItem[this->fields().size()]);
362 typedef ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::size_type size_type;
363 size_type n = 0;
364 for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
365 it = this->fields().begin();
366 it != this->fields().end(); ++it, ++n) {
367 items[n] = SortItem(&*it);
368 }
369 ::std::sort(&items[0], &items[n], Less());
370 ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
371 for (size_type i = 0; i < n; i++) {
372 entry.reset(fields_.NewEntryWrapper(
373 items[i]->first, items[i]->second));
374 ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
375 1, *entry, output);
376 Utf8Check::Check(items[i]);
377 }
378 } else {
379 ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
380 for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
381 it = this->fields().begin();
382 it != this->fields().end(); ++it) {
383 entry.reset(fields_.NewEntryWrapper(
384 it->first, it->second));
385 ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
386 1, *entry, output);
387 Utf8Check::Check(&*it);
388 }
389 }
390 }
391
392 // @@protoc_insertion_point(serialize_end:google.protobuf.Struct)
393 }
394
InternalSerializeWithCachedSizesToArray(bool deterministic,::google::protobuf::uint8 * target) const395 ::google::protobuf::uint8* Struct::InternalSerializeWithCachedSizesToArray(
396 bool deterministic, ::google::protobuf::uint8* target) const {
397 // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Struct)
398 // map<string, .google.protobuf.Value> fields = 1;
399 if (!this->fields().empty()) {
400 typedef ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_pointer
401 ConstPtr;
402 typedef ConstPtr SortItem;
403 typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
404 struct Utf8Check {
405 static void Check(ConstPtr p) {
406 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
407 p->first.data(), p->first.length(),
408 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
409 "google.protobuf.Struct.FieldsEntry.key");
410 }
411 };
412
413 if (deterministic &&
414 this->fields().size() > 1) {
415 ::google::protobuf::scoped_array<SortItem> items(
416 new SortItem[this->fields().size()]);
417 typedef ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::size_type size_type;
418 size_type n = 0;
419 for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
420 it = this->fields().begin();
421 it != this->fields().end(); ++it, ++n) {
422 items[n] = SortItem(&*it);
423 }
424 ::std::sort(&items[0], &items[n], Less());
425 ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
426 for (size_type i = 0; i < n; i++) {
427 entry.reset(fields_.NewEntryWrapper(
428 items[i]->first, items[i]->second));
429 target = ::google::protobuf::internal::WireFormatLite::
430 InternalWriteMessageNoVirtualToArray(
431 1, *entry, deterministic, target);
432 ;
433 Utf8Check::Check(items[i]);
434 }
435 } else {
436 ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
437 for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
438 it = this->fields().begin();
439 it != this->fields().end(); ++it) {
440 entry.reset(fields_.NewEntryWrapper(
441 it->first, it->second));
442 target = ::google::protobuf::internal::WireFormatLite::
443 InternalWriteMessageNoVirtualToArray(
444 1, *entry, deterministic, target);
445 ;
446 Utf8Check::Check(&*it);
447 }
448 }
449 }
450
451 // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Struct)
452 return target;
453 }
454
ByteSize() const455 int Struct::ByteSize() const {
456 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Struct)
457 int total_size = 0;
458
459 // map<string, .google.protobuf.Value> fields = 1;
460 total_size += 1 * this->fields_size();
461 {
462 ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry;
463 for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
464 it = this->fields().begin();
465 it != this->fields().end(); ++it) {
466 entry.reset(fields_.NewEntryWrapper(it->first, it->second));
467 total_size += ::google::protobuf::internal::WireFormatLite::
468 MessageSizeNoVirtual(*entry);
469 }
470 }
471
472 GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
473 _cached_size_ = total_size;
474 GOOGLE_SAFE_CONCURRENT_WRITES_END();
475 return total_size;
476 }
477
MergeFrom(const::google::protobuf::Message & from)478 void Struct::MergeFrom(const ::google::protobuf::Message& from) {
479 // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Struct)
480 if (GOOGLE_PREDICT_FALSE(&from == this)) {
481 ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__);
482 }
483 const Struct* source =
484 ::google::protobuf::internal::DynamicCastToGenerated<const Struct>(
485 &from);
486 if (source == NULL) {
487 // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Struct)
488 ::google::protobuf::internal::ReflectionOps::Merge(from, this);
489 } else {
490 // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Struct)
491 MergeFrom(*source);
492 }
493 }
494
MergeFrom(const Struct & from)495 void Struct::MergeFrom(const Struct& from) {
496 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Struct)
497 if (GOOGLE_PREDICT_FALSE(&from == this)) {
498 ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__);
499 }
500 fields_.MergeFrom(from.fields_);
501 }
502
CopyFrom(const::google::protobuf::Message & from)503 void Struct::CopyFrom(const ::google::protobuf::Message& from) {
504 // @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Struct)
505 if (&from == this) return;
506 Clear();
507 MergeFrom(from);
508 }
509
CopyFrom(const Struct & from)510 void Struct::CopyFrom(const Struct& from) {
511 // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Struct)
512 if (&from == this) return;
513 Clear();
514 MergeFrom(from);
515 }
516
IsInitialized() const517 bool Struct::IsInitialized() const {
518
519 return true;
520 }
521
Swap(Struct * other)522 void Struct::Swap(Struct* other) {
523 if (other == this) return;
524 InternalSwap(other);
525 }
InternalSwap(Struct * other)526 void Struct::InternalSwap(Struct* other) {
527 fields_.Swap(&other->fields_);
528 _internal_metadata_.Swap(&other->_internal_metadata_);
529 std::swap(_cached_size_, other->_cached_size_);
530 }
531
GetMetadata() const532 ::google::protobuf::Metadata Struct::GetMetadata() const {
533 protobuf_AssignDescriptorsOnce();
534 ::google::protobuf::Metadata metadata;
535 metadata.descriptor = Struct_descriptor_;
536 metadata.reflection = Struct_reflection_;
537 return metadata;
538 }
539
540 #if PROTOBUF_INLINE_NOT_IN_HEADERS
541 // Struct
542
543 // map<string, .google.protobuf.Value> fields = 1;
fields_size() const544 int Struct::fields_size() const {
545 return fields_.size();
546 }
clear_fields()547 void Struct::clear_fields() {
548 fields_.Clear();
549 }
550 const ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >&
fields() const551 Struct::fields() const {
552 // @@protoc_insertion_point(field_map:google.protobuf.Struct.fields)
553 return fields_.GetMap();
554 }
555 ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >*
mutable_fields()556 Struct::mutable_fields() {
557 // @@protoc_insertion_point(field_mutable_map:google.protobuf.Struct.fields)
558 return fields_.MutableMap();
559 }
560
561 #endif // PROTOBUF_INLINE_NOT_IN_HEADERS
562
563 // ===================================================================
564
565 #if !defined(_MSC_VER) || _MSC_VER >= 1900
566 const int Value::kNullValueFieldNumber;
567 const int Value::kNumberValueFieldNumber;
568 const int Value::kStringValueFieldNumber;
569 const int Value::kBoolValueFieldNumber;
570 const int Value::kStructValueFieldNumber;
571 const int Value::kListValueFieldNumber;
572 #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
573
Value()574 Value::Value()
575 : ::google::protobuf::Message(), _internal_metadata_(NULL) {
576 SharedCtor();
577 // @@protoc_insertion_point(constructor:google.protobuf.Value)
578 }
579
InitAsDefaultInstance()580 void Value::InitAsDefaultInstance() {
581 _is_default_instance_ = true;
582 Value_default_oneof_instance_->null_value_ = 0;
583 Value_default_oneof_instance_->number_value_ = 0;
584 Value_default_oneof_instance_->string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
585 Value_default_oneof_instance_->bool_value_ = false;
586 Value_default_oneof_instance_->struct_value_ = const_cast< ::google::protobuf::Struct*>(&::google::protobuf::Struct::default_instance());
587 Value_default_oneof_instance_->list_value_ = const_cast< ::google::protobuf::ListValue*>(&::google::protobuf::ListValue::default_instance());
588 }
589
Value(const Value & from)590 Value::Value(const Value& from)
591 : ::google::protobuf::Message(),
592 _internal_metadata_(NULL) {
593 SharedCtor();
594 MergeFrom(from);
595 // @@protoc_insertion_point(copy_constructor:google.protobuf.Value)
596 }
597
SharedCtor()598 void Value::SharedCtor() {
599 _is_default_instance_ = false;
600 ::google::protobuf::internal::GetEmptyString();
601 _cached_size_ = 0;
602 clear_has_kind();
603 }
604
~Value()605 Value::~Value() {
606 // @@protoc_insertion_point(destructor:google.protobuf.Value)
607 SharedDtor();
608 }
609
SharedDtor()610 void Value::SharedDtor() {
611 if (has_kind()) {
612 clear_kind();
613 }
614 if (this != default_instance_) {
615 }
616 }
617
SetCachedSize(int size) const618 void Value::SetCachedSize(int size) const {
619 GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
620 _cached_size_ = size;
621 GOOGLE_SAFE_CONCURRENT_WRITES_END();
622 }
descriptor()623 const ::google::protobuf::Descriptor* Value::descriptor() {
624 protobuf_AssignDescriptorsOnce();
625 return Value_descriptor_;
626 }
627
default_instance()628 const Value& Value::default_instance() {
629 if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto();
630 return *default_instance_;
631 }
632
633 Value* Value::default_instance_ = NULL;
634
New(::google::protobuf::Arena * arena) const635 Value* Value::New(::google::protobuf::Arena* arena) const {
636 Value* n = new Value;
637 if (arena != NULL) {
638 arena->Own(n);
639 }
640 return n;
641 }
642
clear_kind()643 void Value::clear_kind() {
644 // @@protoc_insertion_point(one_of_clear_start:google.protobuf.Value)
645 switch(kind_case()) {
646 case kNullValue: {
647 // No need to clear
648 break;
649 }
650 case kNumberValue: {
651 // No need to clear
652 break;
653 }
654 case kStringValue: {
655 kind_.string_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
656 break;
657 }
658 case kBoolValue: {
659 // No need to clear
660 break;
661 }
662 case kStructValue: {
663 delete kind_.struct_value_;
664 break;
665 }
666 case kListValue: {
667 delete kind_.list_value_;
668 break;
669 }
670 case KIND_NOT_SET: {
671 break;
672 }
673 }
674 _oneof_case_[0] = KIND_NOT_SET;
675 }
676
677
Clear()678 void Value::Clear() {
679 // @@protoc_insertion_point(message_clear_start:google.protobuf.Value)
680 clear_kind();
681 }
682
MergePartialFromCodedStream(::google::protobuf::io::CodedInputStream * input)683 bool Value::MergePartialFromCodedStream(
684 ::google::protobuf::io::CodedInputStream* input) {
685 #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
686 ::google::protobuf::uint32 tag;
687 // @@protoc_insertion_point(parse_start:google.protobuf.Value)
688 for (;;) {
689 ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
690 tag = p.first;
691 if (!p.second) goto handle_unusual;
692 switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
693 // optional .google.protobuf.NullValue null_value = 1;
694 case 1: {
695 if (tag == 8) {
696 int value;
697 DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
698 int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
699 input, &value)));
700 set_null_value(static_cast< ::google::protobuf::NullValue >(value));
701 } else {
702 goto handle_unusual;
703 }
704 if (input->ExpectTag(17)) goto parse_number_value;
705 break;
706 }
707
708 // optional double number_value = 2;
709 case 2: {
710 if (tag == 17) {
711 parse_number_value:
712 clear_kind();
713 DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
714 double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
715 input, &kind_.number_value_)));
716 set_has_number_value();
717 } else {
718 goto handle_unusual;
719 }
720 if (input->ExpectTag(26)) goto parse_string_value;
721 break;
722 }
723
724 // optional string string_value = 3;
725 case 3: {
726 if (tag == 26) {
727 parse_string_value:
728 DO_(::google::protobuf::internal::WireFormatLite::ReadString(
729 input, this->mutable_string_value()));
730 DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
731 this->string_value().data(), this->string_value().length(),
732 ::google::protobuf::internal::WireFormatLite::PARSE,
733 "google.protobuf.Value.string_value"));
734 } else {
735 goto handle_unusual;
736 }
737 if (input->ExpectTag(32)) goto parse_bool_value;
738 break;
739 }
740
741 // optional bool bool_value = 4;
742 case 4: {
743 if (tag == 32) {
744 parse_bool_value:
745 clear_kind();
746 DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
747 bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
748 input, &kind_.bool_value_)));
749 set_has_bool_value();
750 } else {
751 goto handle_unusual;
752 }
753 if (input->ExpectTag(42)) goto parse_struct_value;
754 break;
755 }
756
757 // optional .google.protobuf.Struct struct_value = 5;
758 case 5: {
759 if (tag == 42) {
760 parse_struct_value:
761 DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
762 input, mutable_struct_value()));
763 } else {
764 goto handle_unusual;
765 }
766 if (input->ExpectTag(50)) goto parse_list_value;
767 break;
768 }
769
770 // optional .google.protobuf.ListValue list_value = 6;
771 case 6: {
772 if (tag == 50) {
773 parse_list_value:
774 DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
775 input, mutable_list_value()));
776 } else {
777 goto handle_unusual;
778 }
779 if (input->ExpectAtEnd()) goto success;
780 break;
781 }
782
783 default: {
784 handle_unusual:
785 if (tag == 0 ||
786 ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
787 ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
788 goto success;
789 }
790 DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
791 break;
792 }
793 }
794 }
795 success:
796 // @@protoc_insertion_point(parse_success:google.protobuf.Value)
797 return true;
798 failure:
799 // @@protoc_insertion_point(parse_failure:google.protobuf.Value)
800 return false;
801 #undef DO_
802 }
803
SerializeWithCachedSizes(::google::protobuf::io::CodedOutputStream * output) const804 void Value::SerializeWithCachedSizes(
805 ::google::protobuf::io::CodedOutputStream* output) const {
806 // @@protoc_insertion_point(serialize_start:google.protobuf.Value)
807 // optional .google.protobuf.NullValue null_value = 1;
808 if (has_null_value()) {
809 ::google::protobuf::internal::WireFormatLite::WriteEnum(
810 1, this->null_value(), output);
811 }
812
813 // optional double number_value = 2;
814 if (has_number_value()) {
815 ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->number_value(), output);
816 }
817
818 // optional string string_value = 3;
819 if (has_string_value()) {
820 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
821 this->string_value().data(), this->string_value().length(),
822 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
823 "google.protobuf.Value.string_value");
824 ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
825 3, this->string_value(), output);
826 }
827
828 // optional bool bool_value = 4;
829 if (has_bool_value()) {
830 ::google::protobuf::internal::WireFormatLite::WriteBool(4, this->bool_value(), output);
831 }
832
833 // optional .google.protobuf.Struct struct_value = 5;
834 if (has_struct_value()) {
835 ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
836 5, *kind_.struct_value_, output);
837 }
838
839 // optional .google.protobuf.ListValue list_value = 6;
840 if (has_list_value()) {
841 ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
842 6, *kind_.list_value_, output);
843 }
844
845 // @@protoc_insertion_point(serialize_end:google.protobuf.Value)
846 }
847
InternalSerializeWithCachedSizesToArray(bool deterministic,::google::protobuf::uint8 * target) const848 ::google::protobuf::uint8* Value::InternalSerializeWithCachedSizesToArray(
849 bool deterministic, ::google::protobuf::uint8* target) const {
850 // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Value)
851 // optional .google.protobuf.NullValue null_value = 1;
852 if (has_null_value()) {
853 target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
854 1, this->null_value(), target);
855 }
856
857 // optional double number_value = 2;
858 if (has_number_value()) {
859 target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(2, this->number_value(), target);
860 }
861
862 // optional string string_value = 3;
863 if (has_string_value()) {
864 ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
865 this->string_value().data(), this->string_value().length(),
866 ::google::protobuf::internal::WireFormatLite::SERIALIZE,
867 "google.protobuf.Value.string_value");
868 target =
869 ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
870 3, this->string_value(), target);
871 }
872
873 // optional bool bool_value = 4;
874 if (has_bool_value()) {
875 target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(4, this->bool_value(), target);
876 }
877
878 // optional .google.protobuf.Struct struct_value = 5;
879 if (has_struct_value()) {
880 target = ::google::protobuf::internal::WireFormatLite::
881 InternalWriteMessageNoVirtualToArray(
882 5, *kind_.struct_value_, false, target);
883 }
884
885 // optional .google.protobuf.ListValue list_value = 6;
886 if (has_list_value()) {
887 target = ::google::protobuf::internal::WireFormatLite::
888 InternalWriteMessageNoVirtualToArray(
889 6, *kind_.list_value_, false, target);
890 }
891
892 // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Value)
893 return target;
894 }
895
ByteSize() const896 int Value::ByteSize() const {
897 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Value)
898 int total_size = 0;
899
900 switch (kind_case()) {
901 // optional .google.protobuf.NullValue null_value = 1;
902 case kNullValue: {
903 total_size += 1 +
904 ::google::protobuf::internal::WireFormatLite::EnumSize(this->null_value());
905 break;
906 }
907 // optional double number_value = 2;
908 case kNumberValue: {
909 total_size += 1 + 8;
910 break;
911 }
912 // optional string string_value = 3;
913 case kStringValue: {
914 total_size += 1 +
915 ::google::protobuf::internal::WireFormatLite::StringSize(
916 this->string_value());
917 break;
918 }
919 // optional bool bool_value = 4;
920 case kBoolValue: {
921 total_size += 1 + 1;
922 break;
923 }
924 // optional .google.protobuf.Struct struct_value = 5;
925 case kStructValue: {
926 total_size += 1 +
927 ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
928 *kind_.struct_value_);
929 break;
930 }
931 // optional .google.protobuf.ListValue list_value = 6;
932 case kListValue: {
933 total_size += 1 +
934 ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
935 *kind_.list_value_);
936 break;
937 }
938 case KIND_NOT_SET: {
939 break;
940 }
941 }
942 GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
943 _cached_size_ = total_size;
944 GOOGLE_SAFE_CONCURRENT_WRITES_END();
945 return total_size;
946 }
947
MergeFrom(const::google::protobuf::Message & from)948 void Value::MergeFrom(const ::google::protobuf::Message& from) {
949 // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Value)
950 if (GOOGLE_PREDICT_FALSE(&from == this)) {
951 ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__);
952 }
953 const Value* source =
954 ::google::protobuf::internal::DynamicCastToGenerated<const Value>(
955 &from);
956 if (source == NULL) {
957 // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Value)
958 ::google::protobuf::internal::ReflectionOps::Merge(from, this);
959 } else {
960 // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Value)
961 MergeFrom(*source);
962 }
963 }
964
MergeFrom(const Value & from)965 void Value::MergeFrom(const Value& from) {
966 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Value)
967 if (GOOGLE_PREDICT_FALSE(&from == this)) {
968 ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__);
969 }
970 switch (from.kind_case()) {
971 case kNullValue: {
972 set_null_value(from.null_value());
973 break;
974 }
975 case kNumberValue: {
976 set_number_value(from.number_value());
977 break;
978 }
979 case kStringValue: {
980 set_string_value(from.string_value());
981 break;
982 }
983 case kBoolValue: {
984 set_bool_value(from.bool_value());
985 break;
986 }
987 case kStructValue: {
988 mutable_struct_value()->::google::protobuf::Struct::MergeFrom(from.struct_value());
989 break;
990 }
991 case kListValue: {
992 mutable_list_value()->::google::protobuf::ListValue::MergeFrom(from.list_value());
993 break;
994 }
995 case KIND_NOT_SET: {
996 break;
997 }
998 }
999 }
1000
CopyFrom(const::google::protobuf::Message & from)1001 void Value::CopyFrom(const ::google::protobuf::Message& from) {
1002 // @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Value)
1003 if (&from == this) return;
1004 Clear();
1005 MergeFrom(from);
1006 }
1007
CopyFrom(const Value & from)1008 void Value::CopyFrom(const Value& from) {
1009 // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Value)
1010 if (&from == this) return;
1011 Clear();
1012 MergeFrom(from);
1013 }
1014
IsInitialized() const1015 bool Value::IsInitialized() const {
1016
1017 return true;
1018 }
1019
Swap(Value * other)1020 void Value::Swap(Value* other) {
1021 if (other == this) return;
1022 InternalSwap(other);
1023 }
InternalSwap(Value * other)1024 void Value::InternalSwap(Value* other) {
1025 std::swap(kind_, other->kind_);
1026 std::swap(_oneof_case_[0], other->_oneof_case_[0]);
1027 _internal_metadata_.Swap(&other->_internal_metadata_);
1028 std::swap(_cached_size_, other->_cached_size_);
1029 }
1030
GetMetadata() const1031 ::google::protobuf::Metadata Value::GetMetadata() const {
1032 protobuf_AssignDescriptorsOnce();
1033 ::google::protobuf::Metadata metadata;
1034 metadata.descriptor = Value_descriptor_;
1035 metadata.reflection = Value_reflection_;
1036 return metadata;
1037 }
1038
1039 #if PROTOBUF_INLINE_NOT_IN_HEADERS
1040 // Value
1041
1042 // optional .google.protobuf.NullValue null_value = 1;
has_null_value() const1043 bool Value::has_null_value() const {
1044 return kind_case() == kNullValue;
1045 }
set_has_null_value()1046 void Value::set_has_null_value() {
1047 _oneof_case_[0] = kNullValue;
1048 }
clear_null_value()1049 void Value::clear_null_value() {
1050 if (has_null_value()) {
1051 kind_.null_value_ = 0;
1052 clear_has_kind();
1053 }
1054 }
null_value() const1055 ::google::protobuf::NullValue Value::null_value() const {
1056 // @@protoc_insertion_point(field_get:google.protobuf.Value.null_value)
1057 if (has_null_value()) {
1058 return static_cast< ::google::protobuf::NullValue >(kind_.null_value_);
1059 }
1060 return static_cast< ::google::protobuf::NullValue >(0);
1061 }
set_null_value(::google::protobuf::NullValue value)1062 void Value::set_null_value(::google::protobuf::NullValue value) {
1063 if (!has_null_value()) {
1064 clear_kind();
1065 set_has_null_value();
1066 }
1067 kind_.null_value_ = value;
1068 // @@protoc_insertion_point(field_set:google.protobuf.Value.null_value)
1069 }
1070
1071 // optional double number_value = 2;
has_number_value() const1072 bool Value::has_number_value() const {
1073 return kind_case() == kNumberValue;
1074 }
set_has_number_value()1075 void Value::set_has_number_value() {
1076 _oneof_case_[0] = kNumberValue;
1077 }
clear_number_value()1078 void Value::clear_number_value() {
1079 if (has_number_value()) {
1080 kind_.number_value_ = 0;
1081 clear_has_kind();
1082 }
1083 }
number_value() const1084 double Value::number_value() const {
1085 // @@protoc_insertion_point(field_get:google.protobuf.Value.number_value)
1086 if (has_number_value()) {
1087 return kind_.number_value_;
1088 }
1089 return 0;
1090 }
set_number_value(double value)1091 void Value::set_number_value(double value) {
1092 if (!has_number_value()) {
1093 clear_kind();
1094 set_has_number_value();
1095 }
1096 kind_.number_value_ = value;
1097 // @@protoc_insertion_point(field_set:google.protobuf.Value.number_value)
1098 }
1099
1100 // optional string string_value = 3;
has_string_value() const1101 bool Value::has_string_value() const {
1102 return kind_case() == kStringValue;
1103 }
set_has_string_value()1104 void Value::set_has_string_value() {
1105 _oneof_case_[0] = kStringValue;
1106 }
clear_string_value()1107 void Value::clear_string_value() {
1108 if (has_string_value()) {
1109 kind_.string_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1110 clear_has_kind();
1111 }
1112 }
string_value() const1113 const ::std::string& Value::string_value() const {
1114 // @@protoc_insertion_point(field_get:google.protobuf.Value.string_value)
1115 if (has_string_value()) {
1116 return kind_.string_value_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1117 }
1118 return *&::google::protobuf::internal::GetEmptyStringAlreadyInited();
1119 }
set_string_value(const::std::string & value)1120 void Value::set_string_value(const ::std::string& value) {
1121 // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value)
1122 if (!has_string_value()) {
1123 clear_kind();
1124 set_has_string_value();
1125 kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1126 }
1127 kind_.string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
1128 // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value)
1129 }
set_string_value(const char * value)1130 void Value::set_string_value(const char* value) {
1131 if (!has_string_value()) {
1132 clear_kind();
1133 set_has_string_value();
1134 kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1135 }
1136 kind_.string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
1137 ::std::string(value));
1138 // @@protoc_insertion_point(field_set_char:google.protobuf.Value.string_value)
1139 }
set_string_value(const char * value,size_t size)1140 void Value::set_string_value(const char* value, size_t size) {
1141 if (!has_string_value()) {
1142 clear_kind();
1143 set_has_string_value();
1144 kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1145 }
1146 kind_.string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
1147 reinterpret_cast<const char*>(value), size));
1148 // @@protoc_insertion_point(field_set_pointer:google.protobuf.Value.string_value)
1149 }
mutable_string_value()1150 ::std::string* Value::mutable_string_value() {
1151 if (!has_string_value()) {
1152 clear_kind();
1153 set_has_string_value();
1154 kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1155 }
1156 // @@protoc_insertion_point(field_mutable:google.protobuf.Value.string_value)
1157 return kind_.string_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1158 }
release_string_value()1159 ::std::string* Value::release_string_value() {
1160 // @@protoc_insertion_point(field_release:google.protobuf.Value.string_value)
1161 if (has_string_value()) {
1162 clear_has_kind();
1163 return kind_.string_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1164 } else {
1165 return NULL;
1166 }
1167 }
set_allocated_string_value(::std::string * string_value)1168 void Value::set_allocated_string_value(::std::string* string_value) {
1169 if (!has_string_value()) {
1170 kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1171 }
1172 clear_kind();
1173 if (string_value != NULL) {
1174 set_has_string_value();
1175 kind_.string_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
1176 string_value);
1177 }
1178 // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.string_value)
1179 }
1180
1181 // optional bool bool_value = 4;
has_bool_value() const1182 bool Value::has_bool_value() const {
1183 return kind_case() == kBoolValue;
1184 }
set_has_bool_value()1185 void Value::set_has_bool_value() {
1186 _oneof_case_[0] = kBoolValue;
1187 }
clear_bool_value()1188 void Value::clear_bool_value() {
1189 if (has_bool_value()) {
1190 kind_.bool_value_ = false;
1191 clear_has_kind();
1192 }
1193 }
bool_value() const1194 bool Value::bool_value() const {
1195 // @@protoc_insertion_point(field_get:google.protobuf.Value.bool_value)
1196 if (has_bool_value()) {
1197 return kind_.bool_value_;
1198 }
1199 return false;
1200 }
set_bool_value(bool value)1201 void Value::set_bool_value(bool value) {
1202 if (!has_bool_value()) {
1203 clear_kind();
1204 set_has_bool_value();
1205 }
1206 kind_.bool_value_ = value;
1207 // @@protoc_insertion_point(field_set:google.protobuf.Value.bool_value)
1208 }
1209
1210 // optional .google.protobuf.Struct struct_value = 5;
has_struct_value() const1211 bool Value::has_struct_value() const {
1212 return kind_case() == kStructValue;
1213 }
set_has_struct_value()1214 void Value::set_has_struct_value() {
1215 _oneof_case_[0] = kStructValue;
1216 }
clear_struct_value()1217 void Value::clear_struct_value() {
1218 if (has_struct_value()) {
1219 delete kind_.struct_value_;
1220 clear_has_kind();
1221 }
1222 }
struct_value() const1223 const ::google::protobuf::Struct& Value::struct_value() const {
1224 // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value)
1225 return has_struct_value()
1226 ? *kind_.struct_value_
1227 : ::google::protobuf::Struct::default_instance();
1228 }
mutable_struct_value()1229 ::google::protobuf::Struct* Value::mutable_struct_value() {
1230 if (!has_struct_value()) {
1231 clear_kind();
1232 set_has_struct_value();
1233 kind_.struct_value_ = new ::google::protobuf::Struct;
1234 }
1235 // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value)
1236 return kind_.struct_value_;
1237 }
release_struct_value()1238 ::google::protobuf::Struct* Value::release_struct_value() {
1239 // @@protoc_insertion_point(field_release:google.protobuf.Value.struct_value)
1240 if (has_struct_value()) {
1241 clear_has_kind();
1242 ::google::protobuf::Struct* temp = kind_.struct_value_;
1243 kind_.struct_value_ = NULL;
1244 return temp;
1245 } else {
1246 return NULL;
1247 }
1248 }
set_allocated_struct_value(::google::protobuf::Struct * struct_value)1249 void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) {
1250 clear_kind();
1251 if (struct_value) {
1252 set_has_struct_value();
1253 kind_.struct_value_ = struct_value;
1254 }
1255 // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value)
1256 }
1257
1258 // optional .google.protobuf.ListValue list_value = 6;
has_list_value() const1259 bool Value::has_list_value() const {
1260 return kind_case() == kListValue;
1261 }
set_has_list_value()1262 void Value::set_has_list_value() {
1263 _oneof_case_[0] = kListValue;
1264 }
clear_list_value()1265 void Value::clear_list_value() {
1266 if (has_list_value()) {
1267 delete kind_.list_value_;
1268 clear_has_kind();
1269 }
1270 }
list_value() const1271 const ::google::protobuf::ListValue& Value::list_value() const {
1272 // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value)
1273 return has_list_value()
1274 ? *kind_.list_value_
1275 : ::google::protobuf::ListValue::default_instance();
1276 }
mutable_list_value()1277 ::google::protobuf::ListValue* Value::mutable_list_value() {
1278 if (!has_list_value()) {
1279 clear_kind();
1280 set_has_list_value();
1281 kind_.list_value_ = new ::google::protobuf::ListValue;
1282 }
1283 // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value)
1284 return kind_.list_value_;
1285 }
release_list_value()1286 ::google::protobuf::ListValue* Value::release_list_value() {
1287 // @@protoc_insertion_point(field_release:google.protobuf.Value.list_value)
1288 if (has_list_value()) {
1289 clear_has_kind();
1290 ::google::protobuf::ListValue* temp = kind_.list_value_;
1291 kind_.list_value_ = NULL;
1292 return temp;
1293 } else {
1294 return NULL;
1295 }
1296 }
set_allocated_list_value(::google::protobuf::ListValue * list_value)1297 void Value::set_allocated_list_value(::google::protobuf::ListValue* list_value) {
1298 clear_kind();
1299 if (list_value) {
1300 set_has_list_value();
1301 kind_.list_value_ = list_value;
1302 }
1303 // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.list_value)
1304 }
1305
has_kind() const1306 bool Value::has_kind() const {
1307 return kind_case() != KIND_NOT_SET;
1308 }
clear_has_kind()1309 void Value::clear_has_kind() {
1310 _oneof_case_[0] = KIND_NOT_SET;
1311 }
kind_case() const1312 Value::KindCase Value::kind_case() const {
1313 return Value::KindCase(_oneof_case_[0]);
1314 }
1315 #endif // PROTOBUF_INLINE_NOT_IN_HEADERS
1316
1317 // ===================================================================
1318
1319 #if !defined(_MSC_VER) || _MSC_VER >= 1900
1320 const int ListValue::kValuesFieldNumber;
1321 #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
1322
ListValue()1323 ListValue::ListValue()
1324 : ::google::protobuf::Message(), _internal_metadata_(NULL) {
1325 SharedCtor();
1326 // @@protoc_insertion_point(constructor:google.protobuf.ListValue)
1327 }
1328
InitAsDefaultInstance()1329 void ListValue::InitAsDefaultInstance() {
1330 _is_default_instance_ = true;
1331 }
1332
ListValue(const ListValue & from)1333 ListValue::ListValue(const ListValue& from)
1334 : ::google::protobuf::Message(),
1335 _internal_metadata_(NULL) {
1336 SharedCtor();
1337 MergeFrom(from);
1338 // @@protoc_insertion_point(copy_constructor:google.protobuf.ListValue)
1339 }
1340
SharedCtor()1341 void ListValue::SharedCtor() {
1342 _is_default_instance_ = false;
1343 _cached_size_ = 0;
1344 }
1345
~ListValue()1346 ListValue::~ListValue() {
1347 // @@protoc_insertion_point(destructor:google.protobuf.ListValue)
1348 SharedDtor();
1349 }
1350
SharedDtor()1351 void ListValue::SharedDtor() {
1352 if (this != default_instance_) {
1353 }
1354 }
1355
SetCachedSize(int size) const1356 void ListValue::SetCachedSize(int size) const {
1357 GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
1358 _cached_size_ = size;
1359 GOOGLE_SAFE_CONCURRENT_WRITES_END();
1360 }
descriptor()1361 const ::google::protobuf::Descriptor* ListValue::descriptor() {
1362 protobuf_AssignDescriptorsOnce();
1363 return ListValue_descriptor_;
1364 }
1365
default_instance()1366 const ListValue& ListValue::default_instance() {
1367 if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto();
1368 return *default_instance_;
1369 }
1370
1371 ListValue* ListValue::default_instance_ = NULL;
1372
New(::google::protobuf::Arena * arena) const1373 ListValue* ListValue::New(::google::protobuf::Arena* arena) const {
1374 ListValue* n = new ListValue;
1375 if (arena != NULL) {
1376 arena->Own(n);
1377 }
1378 return n;
1379 }
1380
Clear()1381 void ListValue::Clear() {
1382 // @@protoc_insertion_point(message_clear_start:google.protobuf.ListValue)
1383 values_.Clear();
1384 }
1385
MergePartialFromCodedStream(::google::protobuf::io::CodedInputStream * input)1386 bool ListValue::MergePartialFromCodedStream(
1387 ::google::protobuf::io::CodedInputStream* input) {
1388 #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
1389 ::google::protobuf::uint32 tag;
1390 // @@protoc_insertion_point(parse_start:google.protobuf.ListValue)
1391 for (;;) {
1392 ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
1393 tag = p.first;
1394 if (!p.second) goto handle_unusual;
1395 switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
1396 // repeated .google.protobuf.Value values = 1;
1397 case 1: {
1398 if (tag == 10) {
1399 DO_(input->IncrementRecursionDepth());
1400 parse_loop_values:
1401 DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
1402 input, add_values()));
1403 } else {
1404 goto handle_unusual;
1405 }
1406 if (input->ExpectTag(10)) goto parse_loop_values;
1407 input->UnsafeDecrementRecursionDepth();
1408 if (input->ExpectAtEnd()) goto success;
1409 break;
1410 }
1411
1412 default: {
1413 handle_unusual:
1414 if (tag == 0 ||
1415 ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
1416 ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
1417 goto success;
1418 }
1419 DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
1420 break;
1421 }
1422 }
1423 }
1424 success:
1425 // @@protoc_insertion_point(parse_success:google.protobuf.ListValue)
1426 return true;
1427 failure:
1428 // @@protoc_insertion_point(parse_failure:google.protobuf.ListValue)
1429 return false;
1430 #undef DO_
1431 }
1432
SerializeWithCachedSizes(::google::protobuf::io::CodedOutputStream * output) const1433 void ListValue::SerializeWithCachedSizes(
1434 ::google::protobuf::io::CodedOutputStream* output) const {
1435 // @@protoc_insertion_point(serialize_start:google.protobuf.ListValue)
1436 // repeated .google.protobuf.Value values = 1;
1437 for (unsigned int i = 0, n = this->values_size(); i < n; i++) {
1438 ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1439 1, this->values(i), output);
1440 }
1441
1442 // @@protoc_insertion_point(serialize_end:google.protobuf.ListValue)
1443 }
1444
InternalSerializeWithCachedSizesToArray(bool deterministic,::google::protobuf::uint8 * target) const1445 ::google::protobuf::uint8* ListValue::InternalSerializeWithCachedSizesToArray(
1446 bool deterministic, ::google::protobuf::uint8* target) const {
1447 // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ListValue)
1448 // repeated .google.protobuf.Value values = 1;
1449 for (unsigned int i = 0, n = this->values_size(); i < n; i++) {
1450 target = ::google::protobuf::internal::WireFormatLite::
1451 InternalWriteMessageNoVirtualToArray(
1452 1, this->values(i), false, target);
1453 }
1454
1455 // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ListValue)
1456 return target;
1457 }
1458
ByteSize() const1459 int ListValue::ByteSize() const {
1460 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ListValue)
1461 int total_size = 0;
1462
1463 // repeated .google.protobuf.Value values = 1;
1464 total_size += 1 * this->values_size();
1465 for (int i = 0; i < this->values_size(); i++) {
1466 total_size +=
1467 ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
1468 this->values(i));
1469 }
1470
1471 GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
1472 _cached_size_ = total_size;
1473 GOOGLE_SAFE_CONCURRENT_WRITES_END();
1474 return total_size;
1475 }
1476
MergeFrom(const::google::protobuf::Message & from)1477 void ListValue::MergeFrom(const ::google::protobuf::Message& from) {
1478 // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.ListValue)
1479 if (GOOGLE_PREDICT_FALSE(&from == this)) {
1480 ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__);
1481 }
1482 const ListValue* source =
1483 ::google::protobuf::internal::DynamicCastToGenerated<const ListValue>(
1484 &from);
1485 if (source == NULL) {
1486 // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.ListValue)
1487 ::google::protobuf::internal::ReflectionOps::Merge(from, this);
1488 } else {
1489 // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.ListValue)
1490 MergeFrom(*source);
1491 }
1492 }
1493
MergeFrom(const ListValue & from)1494 void ListValue::MergeFrom(const ListValue& from) {
1495 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ListValue)
1496 if (GOOGLE_PREDICT_FALSE(&from == this)) {
1497 ::google::protobuf::internal::MergeFromFail(__FILE__, __LINE__);
1498 }
1499 values_.MergeFrom(from.values_);
1500 }
1501
CopyFrom(const::google::protobuf::Message & from)1502 void ListValue::CopyFrom(const ::google::protobuf::Message& from) {
1503 // @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.ListValue)
1504 if (&from == this) return;
1505 Clear();
1506 MergeFrom(from);
1507 }
1508
CopyFrom(const ListValue & from)1509 void ListValue::CopyFrom(const ListValue& from) {
1510 // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.ListValue)
1511 if (&from == this) return;
1512 Clear();
1513 MergeFrom(from);
1514 }
1515
IsInitialized() const1516 bool ListValue::IsInitialized() const {
1517
1518 return true;
1519 }
1520
Swap(ListValue * other)1521 void ListValue::Swap(ListValue* other) {
1522 if (other == this) return;
1523 InternalSwap(other);
1524 }
InternalSwap(ListValue * other)1525 void ListValue::InternalSwap(ListValue* other) {
1526 values_.UnsafeArenaSwap(&other->values_);
1527 _internal_metadata_.Swap(&other->_internal_metadata_);
1528 std::swap(_cached_size_, other->_cached_size_);
1529 }
1530
GetMetadata() const1531 ::google::protobuf::Metadata ListValue::GetMetadata() const {
1532 protobuf_AssignDescriptorsOnce();
1533 ::google::protobuf::Metadata metadata;
1534 metadata.descriptor = ListValue_descriptor_;
1535 metadata.reflection = ListValue_reflection_;
1536 return metadata;
1537 }
1538
1539 #if PROTOBUF_INLINE_NOT_IN_HEADERS
1540 // ListValue
1541
1542 // repeated .google.protobuf.Value values = 1;
values_size() const1543 int ListValue::values_size() const {
1544 return values_.size();
1545 }
clear_values()1546 void ListValue::clear_values() {
1547 values_.Clear();
1548 }
values(int index) const1549 const ::google::protobuf::Value& ListValue::values(int index) const {
1550 // @@protoc_insertion_point(field_get:google.protobuf.ListValue.values)
1551 return values_.Get(index);
1552 }
mutable_values(int index)1553 ::google::protobuf::Value* ListValue::mutable_values(int index) {
1554 // @@protoc_insertion_point(field_mutable:google.protobuf.ListValue.values)
1555 return values_.Mutable(index);
1556 }
add_values()1557 ::google::protobuf::Value* ListValue::add_values() {
1558 // @@protoc_insertion_point(field_add:google.protobuf.ListValue.values)
1559 return values_.Add();
1560 }
1561 ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >*
mutable_values()1562 ListValue::mutable_values() {
1563 // @@protoc_insertion_point(field_mutable_list:google.protobuf.ListValue.values)
1564 return &values_;
1565 }
1566 const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >&
values() const1567 ListValue::values() const {
1568 // @@protoc_insertion_point(field_list:google.protobuf.ListValue.values)
1569 return values_;
1570 }
1571
1572 #endif // PROTOBUF_INLINE_NOT_IN_HEADERS
1573
1574 // @@protoc_insertion_point(namespace_scope)
1575
1576 } // namespace protobuf
1577 } // namespace google
1578
1579 // @@protoc_insertion_point(global_scope)
1580