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