struct.pb.cc 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491
  1. /*
  2. * Copyright 2018 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. // Generated by the protocol buffer compiler. DO NOT EDIT!
  17. // source: google/protobuf/struct.proto
  18. #include <google/protobuf/struct.pb.h>
  19. #include <algorithm>
  20. #include <google/protobuf/stubs/common.h>
  21. #include <google/protobuf/stubs/port.h>
  22. #include <google/protobuf/stubs/once.h>
  23. #include <google/protobuf/io/coded_stream.h>
  24. #include <google/protobuf/wire_format_lite_inl.h>
  25. #include <google/protobuf/descriptor.h>
  26. #include <google/protobuf/generated_message_reflection.h>
  27. #include <google/protobuf/reflection_ops.h>
  28. #include <google/protobuf/wire_format.h>
  29. // This is a temporary google only hack
  30. #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  31. #include "third_party/protobuf/version.h"
  32. #endif
  33. // @@protoc_insertion_point(includes)
  34. namespace google {
  35. namespace protobuf {
  36. class Struct_FieldsEntry_DoNotUseDefaultTypeInternal {
  37. public:
  38. ::google::protobuf::internal::ExplicitlyConstructed<Struct_FieldsEntry_DoNotUse>
  39. _instance;
  40. } _Struct_FieldsEntry_DoNotUse_default_instance_;
  41. class StructDefaultTypeInternal {
  42. public:
  43. ::google::protobuf::internal::ExplicitlyConstructed<Struct>
  44. _instance;
  45. } _Struct_default_instance_;
  46. class ValueDefaultTypeInternal {
  47. public:
  48. ::google::protobuf::internal::ExplicitlyConstructed<Value>
  49. _instance;
  50. int null_value_;
  51. double number_value_;
  52. ::google::protobuf::internal::ArenaStringPtr string_value_;
  53. bool bool_value_;
  54. const ::google::protobuf::Struct* struct_value_;
  55. const ::google::protobuf::ListValue* list_value_;
  56. } _Value_default_instance_;
  57. class ListValueDefaultTypeInternal {
  58. public:
  59. ::google::protobuf::internal::ExplicitlyConstructed<ListValue>
  60. _instance;
  61. } _ListValue_default_instance_;
  62. } // namespace protobuf
  63. } // namespace google
  64. namespace protobuf_google_2fprotobuf_2fstruct_2eproto {
  65. void InitDefaultsListValueImpl() {
  66. GOOGLE_PROTOBUF_VERIFY_VERSION;
  67. #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  68. ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
  69. #else
  70. ::google::protobuf::internal::InitProtobufDefaults();
  71. #endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  72. {
  73. void* ptr = &::google::protobuf::_Struct_FieldsEntry_DoNotUse_default_instance_;
  74. new (ptr) ::google::protobuf::Struct_FieldsEntry_DoNotUse();
  75. }
  76. {
  77. void* ptr = &::google::protobuf::_Struct_default_instance_;
  78. new (ptr) ::google::protobuf::Struct();
  79. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  80. }
  81. {
  82. void* ptr = &::google::protobuf::_Value_default_instance_;
  83. new (ptr) ::google::protobuf::Value();
  84. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  85. }
  86. {
  87. void* ptr = &::google::protobuf::_ListValue_default_instance_;
  88. new (ptr) ::google::protobuf::ListValue();
  89. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  90. }
  91. ::google::protobuf::Struct_FieldsEntry_DoNotUse::InitAsDefaultInstance();
  92. ::google::protobuf::Struct::InitAsDefaultInstance();
  93. ::google::protobuf::Value::InitAsDefaultInstance();
  94. ::google::protobuf::ListValue::InitAsDefaultInstance();
  95. }
  96. void InitDefaultsListValue() {
  97. static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  98. ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsListValueImpl);
  99. }
  100. ::google::protobuf::Metadata file_level_metadata[4];
  101. const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1];
  102. const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  103. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, _has_bits_),
  104. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, _internal_metadata_),
  105. ~0u, // no _extensions_
  106. ~0u, // no _oneof_case_
  107. ~0u, // no _weak_field_map_
  108. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, key_),
  109. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct_FieldsEntry_DoNotUse, value_),
  110. 0,
  111. 1,
  112. ~0u, // no _has_bits_
  113. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct, _internal_metadata_),
  114. ~0u, // no _extensions_
  115. ~0u, // no _oneof_case_
  116. ~0u, // no _weak_field_map_
  117. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Struct, fields_),
  118. ~0u, // no _has_bits_
  119. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Value, _internal_metadata_),
  120. ~0u, // no _extensions_
  121. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Value, _oneof_case_[0]),
  122. ~0u, // no _weak_field_map_
  123. offsetof(::google::protobuf::ValueDefaultTypeInternal, null_value_),
  124. offsetof(::google::protobuf::ValueDefaultTypeInternal, number_value_),
  125. offsetof(::google::protobuf::ValueDefaultTypeInternal, string_value_),
  126. offsetof(::google::protobuf::ValueDefaultTypeInternal, bool_value_),
  127. offsetof(::google::protobuf::ValueDefaultTypeInternal, struct_value_),
  128. offsetof(::google::protobuf::ValueDefaultTypeInternal, list_value_),
  129. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Value, kind_),
  130. ~0u, // no _has_bits_
  131. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ListValue, _internal_metadata_),
  132. ~0u, // no _extensions_
  133. ~0u, // no _oneof_case_
  134. ~0u, // no _weak_field_map_
  135. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::ListValue, values_),
  136. };
  137. static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  138. { 0, 7, sizeof(::google::protobuf::Struct_FieldsEntry_DoNotUse)},
  139. { 9, -1, sizeof(::google::protobuf::Struct)},
  140. { 15, -1, sizeof(::google::protobuf::Value)},
  141. { 27, -1, sizeof(::google::protobuf::ListValue)},
  142. };
  143. static ::google::protobuf::Message const * const file_default_instances[] = {
  144. reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Struct_FieldsEntry_DoNotUse_default_instance_),
  145. reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Struct_default_instance_),
  146. reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Value_default_instance_),
  147. reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_ListValue_default_instance_),
  148. };
  149. void protobuf_AssignDescriptors() {
  150. AddDescriptors();
  151. ::google::protobuf::MessageFactory* factory = NULL;
  152. AssignDescriptors(
  153. "google/protobuf/struct.proto", schemas, file_default_instances, TableStruct::offsets, factory,
  154. file_level_metadata, file_level_enum_descriptors, NULL);
  155. }
  156. void protobuf_AssignDescriptorsOnce() {
  157. static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  158. ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
  159. }
  160. void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
  161. void protobuf_RegisterTypes(const ::std::string&) {
  162. protobuf_AssignDescriptorsOnce();
  163. ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 4);
  164. }
  165. void AddDescriptorsImpl() {
  166. InitDefaults();
  167. static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  168. "\n\034google/protobuf/struct.proto\022\017google.p"
  169. "rotobuf\"\204\001\n\006Struct\0223\n\006fields\030\001 \003(\0132#.goo"
  170. "gle.protobuf.Struct.FieldsEntry\032E\n\013Field"
  171. "sEntry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026.goo"
  172. "gle.protobuf.Value:\0028\001\"\352\001\n\005Value\0220\n\nnull"
  173. "_value\030\001 \001(\0162\032.google.protobuf.NullValue"
  174. "H\000\022\026\n\014number_value\030\002 \001(\001H\000\022\026\n\014string_val"
  175. "ue\030\003 \001(\tH\000\022\024\n\nbool_value\030\004 \001(\010H\000\022/\n\014stru"
  176. "ct_value\030\005 \001(\0132\027.google.protobuf.StructH"
  177. "\000\0220\n\nlist_value\030\006 \001(\0132\032.google.protobuf."
  178. "ListValueH\000B\006\n\004kind\"3\n\tListValue\022&\n\006valu"
  179. "es\030\001 \003(\0132\026.google.protobuf.Value*\033\n\tNull"
  180. "Value\022\016\n\nNULL_VALUE\020\000B\201\001\n\023com.google.pro"
  181. "tobufB\013StructProtoP\001Z1github.com/golang/"
  182. "protobuf/ptypes/struct;structpb\370\001\001\242\002\003GPB"
  183. "\252\002\036Google.Protobuf.WellKnownTypesb\006proto"
  184. "3"
  185. };
  186. ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
  187. descriptor, 641);
  188. ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
  189. "google/protobuf/struct.proto", &protobuf_RegisterTypes);
  190. }
  191. void AddDescriptors() {
  192. static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  193. ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
  194. }
  195. // Force AddDescriptors() to be called at dynamic initialization time.
  196. struct StaticDescriptorInitializer {
  197. StaticDescriptorInitializer() {
  198. AddDescriptors();
  199. }
  200. } static_descriptor_initializer;
  201. } // namespace protobuf_google_2fprotobuf_2fstruct_2eproto
  202. namespace google {
  203. namespace protobuf {
  204. const ::google::protobuf::EnumDescriptor* NullValue_descriptor() {
  205. protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
  206. return protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_enum_descriptors[0];
  207. }
  208. bool NullValue_IsValid(int value) {
  209. switch (value) {
  210. case 0:
  211. return true;
  212. default:
  213. return false;
  214. }
  215. }
  216. // ===================================================================
  217. Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse() {}
  218. Struct_FieldsEntry_DoNotUse::Struct_FieldsEntry_DoNotUse(::google::protobuf::Arena* arena) : SuperType(arena) {}
  219. void Struct_FieldsEntry_DoNotUse::MergeFrom(const Struct_FieldsEntry_DoNotUse& other) {
  220. MergeFromInternal(other);
  221. }
  222. ::google::protobuf::Metadata Struct_FieldsEntry_DoNotUse::GetMetadata() const {
  223. ::protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
  224. return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[0];
  225. }
  226. void Struct_FieldsEntry_DoNotUse::MergeFrom(
  227. const ::google::protobuf::Message& other) {
  228. ::google::protobuf::Message::MergeFrom(other);
  229. }
  230. // ===================================================================
  231. void Struct::InitAsDefaultInstance() {
  232. }
  233. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  234. const int Struct::kFieldsFieldNumber;
  235. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  236. Struct::Struct()
  237. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  238. if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
  239. ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue();
  240. }
  241. SharedCtor();
  242. // @@protoc_insertion_point(constructor:google.protobuf.Struct)
  243. }
  244. Struct::Struct(::google::protobuf::Arena* arena)
  245. : ::google::protobuf::Message(),
  246. _internal_metadata_(arena),
  247. fields_(arena) {
  248. ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue();
  249. SharedCtor();
  250. RegisterArenaDtor(arena);
  251. // @@protoc_insertion_point(arena_constructor:google.protobuf.Struct)
  252. }
  253. Struct::Struct(const Struct& from)
  254. : ::google::protobuf::Message(),
  255. _internal_metadata_(NULL),
  256. _cached_size_(0) {
  257. _internal_metadata_.MergeFrom(from._internal_metadata_);
  258. fields_.MergeFrom(from.fields_);
  259. // @@protoc_insertion_point(copy_constructor:google.protobuf.Struct)
  260. }
  261. void Struct::SharedCtor() {
  262. _cached_size_ = 0;
  263. }
  264. Struct::~Struct() {
  265. // @@protoc_insertion_point(destructor:google.protobuf.Struct)
  266. SharedDtor();
  267. }
  268. void Struct::SharedDtor() {
  269. GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  270. }
  271. void Struct::ArenaDtor(void* object) {
  272. Struct* _this = reinterpret_cast< Struct* >(object);
  273. (void)_this;
  274. }
  275. void Struct::RegisterArenaDtor(::google::protobuf::Arena* arena) {
  276. }
  277. void Struct::SetCachedSize(int size) const {
  278. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  279. _cached_size_ = size;
  280. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  281. }
  282. const ::google::protobuf::Descriptor* Struct::descriptor() {
  283. ::protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
  284. return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  285. }
  286. const Struct& Struct::default_instance() {
  287. ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue();
  288. return *internal_default_instance();
  289. }
  290. Struct* Struct::New(::google::protobuf::Arena* arena) const {
  291. return ::google::protobuf::Arena::CreateMessage<Struct>(arena);
  292. }
  293. void Struct::Clear() {
  294. // @@protoc_insertion_point(message_clear_start:google.protobuf.Struct)
  295. ::google::protobuf::uint32 cached_has_bits = 0;
  296. // Prevent compiler warnings about cached_has_bits being unused
  297. (void) cached_has_bits;
  298. fields_.Clear();
  299. _internal_metadata_.Clear();
  300. }
  301. bool Struct::MergePartialFromCodedStream(
  302. ::google::protobuf::io::CodedInputStream* input) {
  303. #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  304. ::google::protobuf::uint32 tag;
  305. // @@protoc_insertion_point(parse_start:google.protobuf.Struct)
  306. for (;;) {
  307. ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
  308. tag = p.first;
  309. if (!p.second) goto handle_unusual;
  310. switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
  311. // map<string, .google.protobuf.Value> fields = 1;
  312. case 1: {
  313. if (static_cast< ::google::protobuf::uint8>(tag) ==
  314. static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
  315. Struct_FieldsEntry_DoNotUse::Parser< ::google::protobuf::internal::MapField<
  316. Struct_FieldsEntry_DoNotUse,
  317. ::std::string, ::google::protobuf::Value,
  318. ::google::protobuf::internal::WireFormatLite::TYPE_STRING,
  319. ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
  320. 0 >,
  321. ::google::protobuf::Map< ::std::string, ::google::protobuf::Value > > parser(&fields_);
  322. DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
  323. input, &parser));
  324. DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
  325. parser.key().data(), static_cast<int>(parser.key().length()),
  326. ::google::protobuf::internal::WireFormatLite::PARSE,
  327. "google.protobuf.Struct.FieldsEntry.key"));
  328. } else {
  329. goto handle_unusual;
  330. }
  331. break;
  332. }
  333. default: {
  334. handle_unusual:
  335. if (tag == 0) {
  336. goto success;
  337. }
  338. DO_(::google::protobuf::internal::WireFormat::SkipField(
  339. input, tag, _internal_metadata_.mutable_unknown_fields()));
  340. break;
  341. }
  342. }
  343. }
  344. success:
  345. // @@protoc_insertion_point(parse_success:google.protobuf.Struct)
  346. return true;
  347. failure:
  348. // @@protoc_insertion_point(parse_failure:google.protobuf.Struct)
  349. return false;
  350. #undef DO_
  351. }
  352. void Struct::SerializeWithCachedSizes(
  353. ::google::protobuf::io::CodedOutputStream* output) const {
  354. // @@protoc_insertion_point(serialize_start:google.protobuf.Struct)
  355. ::google::protobuf::uint32 cached_has_bits = 0;
  356. (void) cached_has_bits;
  357. // map<string, .google.protobuf.Value> fields = 1;
  358. if (!this->fields().empty()) {
  359. typedef ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_pointer
  360. ConstPtr;
  361. typedef ConstPtr SortItem;
  362. typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
  363. struct Utf8Check {
  364. static void Check(ConstPtr p) {
  365. ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
  366. p->first.data(), static_cast<int>(p->first.length()),
  367. ::google::protobuf::internal::WireFormatLite::SERIALIZE,
  368. "google.protobuf.Struct.FieldsEntry.key");
  369. }
  370. };
  371. if (output->IsSerializationDeterministic() &&
  372. this->fields().size() > 1) {
  373. ::google::protobuf::scoped_array<SortItem> items(
  374. new SortItem[this->fields().size()]);
  375. typedef ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::size_type size_type;
  376. size_type n = 0;
  377. for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
  378. it = this->fields().begin();
  379. it != this->fields().end(); ++it, ++n) {
  380. items[static_cast<ptrdiff_t>(n)] = SortItem(&*it);
  381. }
  382. ::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less());
  383. ::google::protobuf::scoped_ptr<Struct_FieldsEntry_DoNotUse> entry;
  384. for (size_type i = 0; i < n; i++) {
  385. entry.reset(fields_.NewEntryWrapper(
  386. items[static_cast<ptrdiff_t>(i)]->first, items[static_cast<ptrdiff_t>(i)]->second));
  387. ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
  388. 1, *entry, output);
  389. if (entry->GetArena() != NULL) {
  390. entry.release();
  391. }
  392. Utf8Check::Check(items[static_cast<ptrdiff_t>(i)]);
  393. }
  394. } else {
  395. ::google::protobuf::scoped_ptr<Struct_FieldsEntry_DoNotUse> entry;
  396. for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
  397. it = this->fields().begin();
  398. it != this->fields().end(); ++it) {
  399. entry.reset(fields_.NewEntryWrapper(
  400. it->first, it->second));
  401. ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
  402. 1, *entry, output);
  403. if (entry->GetArena() != NULL) {
  404. entry.release();
  405. }
  406. Utf8Check::Check(&*it);
  407. }
  408. }
  409. }
  410. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  411. ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
  412. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
  413. }
  414. // @@protoc_insertion_point(serialize_end:google.protobuf.Struct)
  415. }
  416. ::google::protobuf::uint8* Struct::InternalSerializeWithCachedSizesToArray(
  417. bool deterministic, ::google::protobuf::uint8* target) const {
  418. (void)deterministic; // Unused
  419. // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Struct)
  420. ::google::protobuf::uint32 cached_has_bits = 0;
  421. (void) cached_has_bits;
  422. // map<string, .google.protobuf.Value> fields = 1;
  423. if (!this->fields().empty()) {
  424. typedef ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_pointer
  425. ConstPtr;
  426. typedef ConstPtr SortItem;
  427. typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
  428. struct Utf8Check {
  429. static void Check(ConstPtr p) {
  430. ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
  431. p->first.data(), static_cast<int>(p->first.length()),
  432. ::google::protobuf::internal::WireFormatLite::SERIALIZE,
  433. "google.protobuf.Struct.FieldsEntry.key");
  434. }
  435. };
  436. if (deterministic &&
  437. this->fields().size() > 1) {
  438. ::google::protobuf::scoped_array<SortItem> items(
  439. new SortItem[this->fields().size()]);
  440. typedef ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::size_type size_type;
  441. size_type n = 0;
  442. for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
  443. it = this->fields().begin();
  444. it != this->fields().end(); ++it, ++n) {
  445. items[static_cast<ptrdiff_t>(n)] = SortItem(&*it);
  446. }
  447. ::std::sort(&items[0], &items[static_cast<ptrdiff_t>(n)], Less());
  448. ::google::protobuf::scoped_ptr<Struct_FieldsEntry_DoNotUse> entry;
  449. for (size_type i = 0; i < n; i++) {
  450. entry.reset(fields_.NewEntryWrapper(
  451. items[static_cast<ptrdiff_t>(i)]->first, items[static_cast<ptrdiff_t>(i)]->second));
  452. target = ::google::protobuf::internal::WireFormatLite::
  453. InternalWriteMessageNoVirtualToArray(
  454. 1, *entry, deterministic, target);
  455. ;
  456. if (entry->GetArena() != NULL) {
  457. entry.release();
  458. }
  459. Utf8Check::Check(items[static_cast<ptrdiff_t>(i)]);
  460. }
  461. } else {
  462. ::google::protobuf::scoped_ptr<Struct_FieldsEntry_DoNotUse> 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(
  467. it->first, it->second));
  468. target = ::google::protobuf::internal::WireFormatLite::
  469. InternalWriteMessageNoVirtualToArray(
  470. 1, *entry, deterministic, target);
  471. ;
  472. if (entry->GetArena() != NULL) {
  473. entry.release();
  474. }
  475. Utf8Check::Check(&*it);
  476. }
  477. }
  478. }
  479. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  480. target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
  481. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
  482. }
  483. // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Struct)
  484. return target;
  485. }
  486. size_t Struct::ByteSizeLong() const {
  487. // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Struct)
  488. size_t total_size = 0;
  489. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  490. total_size +=
  491. ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
  492. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
  493. }
  494. // map<string, .google.protobuf.Value> fields = 1;
  495. total_size += 1 *
  496. ::google::protobuf::internal::FromIntSize(this->fields_size());
  497. {
  498. ::google::protobuf::scoped_ptr<Struct_FieldsEntry_DoNotUse> entry;
  499. for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator
  500. it = this->fields().begin();
  501. it != this->fields().end(); ++it) {
  502. if (entry.get() != NULL && entry->GetArena() != NULL) {
  503. entry.release();
  504. }
  505. entry.reset(fields_.NewEntryWrapper(it->first, it->second));
  506. total_size += ::google::protobuf::internal::WireFormatLite::
  507. MessageSizeNoVirtual(*entry);
  508. }
  509. if (entry.get() != NULL && entry->GetArena() != NULL) {
  510. entry.release();
  511. }
  512. }
  513. int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  514. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  515. _cached_size_ = cached_size;
  516. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  517. return total_size;
  518. }
  519. void Struct::MergeFrom(const ::google::protobuf::Message& from) {
  520. // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Struct)
  521. GOOGLE_DCHECK_NE(&from, this);
  522. const Struct* source =
  523. ::google::protobuf::internal::DynamicCastToGenerated<const Struct>(
  524. &from);
  525. if (source == NULL) {
  526. // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Struct)
  527. ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  528. } else {
  529. // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Struct)
  530. MergeFrom(*source);
  531. }
  532. }
  533. void Struct::MergeFrom(const Struct& from) {
  534. // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Struct)
  535. GOOGLE_DCHECK_NE(&from, this);
  536. _internal_metadata_.MergeFrom(from._internal_metadata_);
  537. ::google::protobuf::uint32 cached_has_bits = 0;
  538. (void) cached_has_bits;
  539. fields_.MergeFrom(from.fields_);
  540. }
  541. void Struct::CopyFrom(const ::google::protobuf::Message& from) {
  542. // @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Struct)
  543. if (&from == this) return;
  544. Clear();
  545. MergeFrom(from);
  546. }
  547. void Struct::CopyFrom(const Struct& from) {
  548. // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Struct)
  549. if (&from == this) return;
  550. Clear();
  551. MergeFrom(from);
  552. }
  553. bool Struct::IsInitialized() const {
  554. return true;
  555. }
  556. void Struct::Swap(Struct* other) {
  557. if (other == this) return;
  558. if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
  559. InternalSwap(other);
  560. } else {
  561. Struct* temp = New(GetArenaNoVirtual());
  562. temp->MergeFrom(*other);
  563. other->CopyFrom(*this);
  564. InternalSwap(temp);
  565. if (GetArenaNoVirtual() == NULL) {
  566. delete temp;
  567. }
  568. }
  569. }
  570. void Struct::UnsafeArenaSwap(Struct* other) {
  571. if (other == this) return;
  572. GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  573. InternalSwap(other);
  574. }
  575. void Struct::InternalSwap(Struct* other) {
  576. using std::swap;
  577. fields_.Swap(&other->fields_);
  578. _internal_metadata_.Swap(&other->_internal_metadata_);
  579. swap(_cached_size_, other->_cached_size_);
  580. }
  581. ::google::protobuf::Metadata Struct::GetMetadata() const {
  582. protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
  583. return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages];
  584. }
  585. // ===================================================================
  586. void Value::InitAsDefaultInstance() {
  587. ::google::protobuf::_Value_default_instance_.null_value_ = 0;
  588. ::google::protobuf::_Value_default_instance_.number_value_ = 0;
  589. ::google::protobuf::_Value_default_instance_.string_value_.UnsafeSetDefault(
  590. &::google::protobuf::internal::GetEmptyStringAlreadyInited());
  591. ::google::protobuf::_Value_default_instance_.bool_value_ = false;
  592. ::google::protobuf::_Value_default_instance_.struct_value_ = const_cast< ::google::protobuf::Struct*>(
  593. ::google::protobuf::Struct::internal_default_instance());
  594. ::google::protobuf::_Value_default_instance_.list_value_ = const_cast< ::google::protobuf::ListValue*>(
  595. ::google::protobuf::ListValue::internal_default_instance());
  596. }
  597. void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) {
  598. ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
  599. clear_kind();
  600. if (struct_value) {
  601. ::google::protobuf::Arena* submessage_arena =
  602. ::google::protobuf::Arena::GetArena(struct_value);
  603. if (message_arena != submessage_arena) {
  604. struct_value = ::google::protobuf::internal::GetOwnedMessage(
  605. message_arena, struct_value, submessage_arena);
  606. }
  607. set_has_struct_value();
  608. kind_.struct_value_ = struct_value;
  609. }
  610. // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value)
  611. }
  612. void Value::set_allocated_list_value(::google::protobuf::ListValue* list_value) {
  613. ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
  614. clear_kind();
  615. if (list_value) {
  616. ::google::protobuf::Arena* submessage_arena =
  617. ::google::protobuf::Arena::GetArena(list_value);
  618. if (message_arena != submessage_arena) {
  619. list_value = ::google::protobuf::internal::GetOwnedMessage(
  620. message_arena, list_value, submessage_arena);
  621. }
  622. set_has_list_value();
  623. kind_.list_value_ = list_value;
  624. }
  625. // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.list_value)
  626. }
  627. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  628. const int Value::kNullValueFieldNumber;
  629. const int Value::kNumberValueFieldNumber;
  630. const int Value::kStringValueFieldNumber;
  631. const int Value::kBoolValueFieldNumber;
  632. const int Value::kStructValueFieldNumber;
  633. const int Value::kListValueFieldNumber;
  634. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  635. Value::Value()
  636. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  637. if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
  638. ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue();
  639. }
  640. SharedCtor();
  641. // @@protoc_insertion_point(constructor:google.protobuf.Value)
  642. }
  643. Value::Value(::google::protobuf::Arena* arena)
  644. : ::google::protobuf::Message(),
  645. _internal_metadata_(arena) {
  646. ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue();
  647. SharedCtor();
  648. RegisterArenaDtor(arena);
  649. // @@protoc_insertion_point(arena_constructor:google.protobuf.Value)
  650. }
  651. Value::Value(const Value& from)
  652. : ::google::protobuf::Message(),
  653. _internal_metadata_(NULL),
  654. _cached_size_(0) {
  655. _internal_metadata_.MergeFrom(from._internal_metadata_);
  656. clear_has_kind();
  657. switch (from.kind_case()) {
  658. case kNullValue: {
  659. set_null_value(from.null_value());
  660. break;
  661. }
  662. case kNumberValue: {
  663. set_number_value(from.number_value());
  664. break;
  665. }
  666. case kStringValue: {
  667. set_string_value(from.string_value());
  668. break;
  669. }
  670. case kBoolValue: {
  671. set_bool_value(from.bool_value());
  672. break;
  673. }
  674. case kStructValue: {
  675. mutable_struct_value()->::google::protobuf::Struct::MergeFrom(from.struct_value());
  676. break;
  677. }
  678. case kListValue: {
  679. mutable_list_value()->::google::protobuf::ListValue::MergeFrom(from.list_value());
  680. break;
  681. }
  682. case KIND_NOT_SET: {
  683. break;
  684. }
  685. }
  686. // @@protoc_insertion_point(copy_constructor:google.protobuf.Value)
  687. }
  688. void Value::SharedCtor() {
  689. clear_has_kind();
  690. _cached_size_ = 0;
  691. }
  692. Value::~Value() {
  693. // @@protoc_insertion_point(destructor:google.protobuf.Value)
  694. SharedDtor();
  695. }
  696. void Value::SharedDtor() {
  697. GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  698. if (has_kind()) {
  699. clear_kind();
  700. }
  701. }
  702. void Value::ArenaDtor(void* object) {
  703. Value* _this = reinterpret_cast< Value* >(object);
  704. (void)_this;
  705. }
  706. void Value::RegisterArenaDtor(::google::protobuf::Arena* arena) {
  707. }
  708. void Value::SetCachedSize(int size) const {
  709. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  710. _cached_size_ = size;
  711. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  712. }
  713. const ::google::protobuf::Descriptor* Value::descriptor() {
  714. ::protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
  715. return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  716. }
  717. const Value& Value::default_instance() {
  718. ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue();
  719. return *internal_default_instance();
  720. }
  721. Value* Value::New(::google::protobuf::Arena* arena) const {
  722. return ::google::protobuf::Arena::CreateMessage<Value>(arena);
  723. }
  724. void Value::clear_kind() {
  725. // @@protoc_insertion_point(one_of_clear_start:google.protobuf.Value)
  726. switch (kind_case()) {
  727. case kNullValue: {
  728. // No need to clear
  729. break;
  730. }
  731. case kNumberValue: {
  732. // No need to clear
  733. break;
  734. }
  735. case kStringValue: {
  736. kind_.string_value_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
  737. GetArenaNoVirtual());
  738. break;
  739. }
  740. case kBoolValue: {
  741. // No need to clear
  742. break;
  743. }
  744. case kStructValue: {
  745. if (GetArenaNoVirtual() == NULL) {
  746. delete kind_.struct_value_;
  747. }
  748. break;
  749. }
  750. case kListValue: {
  751. if (GetArenaNoVirtual() == NULL) {
  752. delete kind_.list_value_;
  753. }
  754. break;
  755. }
  756. case KIND_NOT_SET: {
  757. break;
  758. }
  759. }
  760. _oneof_case_[0] = KIND_NOT_SET;
  761. }
  762. void Value::Clear() {
  763. // @@protoc_insertion_point(message_clear_start:google.protobuf.Value)
  764. ::google::protobuf::uint32 cached_has_bits = 0;
  765. // Prevent compiler warnings about cached_has_bits being unused
  766. (void) cached_has_bits;
  767. clear_kind();
  768. _internal_metadata_.Clear();
  769. }
  770. bool Value::MergePartialFromCodedStream(
  771. ::google::protobuf::io::CodedInputStream* input) {
  772. #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  773. ::google::protobuf::uint32 tag;
  774. // @@protoc_insertion_point(parse_start:google.protobuf.Value)
  775. for (;;) {
  776. ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
  777. tag = p.first;
  778. if (!p.second) goto handle_unusual;
  779. switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
  780. // .google.protobuf.NullValue null_value = 1;
  781. case 1: {
  782. if (static_cast< ::google::protobuf::uint8>(tag) ==
  783. static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
  784. int value;
  785. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  786. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  787. input, &value)));
  788. set_null_value(static_cast< ::google::protobuf::NullValue >(value));
  789. } else {
  790. goto handle_unusual;
  791. }
  792. break;
  793. }
  794. // double number_value = 2;
  795. case 2: {
  796. if (static_cast< ::google::protobuf::uint8>(tag) ==
  797. static_cast< ::google::protobuf::uint8>(17u /* 17 & 0xFF */)) {
  798. clear_kind();
  799. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  800. double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
  801. input, &kind_.number_value_)));
  802. set_has_number_value();
  803. } else {
  804. goto handle_unusual;
  805. }
  806. break;
  807. }
  808. // string string_value = 3;
  809. case 3: {
  810. if (static_cast< ::google::protobuf::uint8>(tag) ==
  811. static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
  812. DO_(::google::protobuf::internal::WireFormatLite::ReadString(
  813. input, this->mutable_string_value()));
  814. DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
  815. this->string_value().data(), static_cast<int>(this->string_value().length()),
  816. ::google::protobuf::internal::WireFormatLite::PARSE,
  817. "google.protobuf.Value.string_value"));
  818. } else {
  819. goto handle_unusual;
  820. }
  821. break;
  822. }
  823. // bool bool_value = 4;
  824. case 4: {
  825. if (static_cast< ::google::protobuf::uint8>(tag) ==
  826. static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {
  827. clear_kind();
  828. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  829. bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
  830. input, &kind_.bool_value_)));
  831. set_has_bool_value();
  832. } else {
  833. goto handle_unusual;
  834. }
  835. break;
  836. }
  837. // .google.protobuf.Struct struct_value = 5;
  838. case 5: {
  839. if (static_cast< ::google::protobuf::uint8>(tag) ==
  840. static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) {
  841. DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
  842. input, mutable_struct_value()));
  843. } else {
  844. goto handle_unusual;
  845. }
  846. break;
  847. }
  848. // .google.protobuf.ListValue list_value = 6;
  849. case 6: {
  850. if (static_cast< ::google::protobuf::uint8>(tag) ==
  851. static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) {
  852. DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
  853. input, mutable_list_value()));
  854. } else {
  855. goto handle_unusual;
  856. }
  857. break;
  858. }
  859. default: {
  860. handle_unusual:
  861. if (tag == 0) {
  862. goto success;
  863. }
  864. DO_(::google::protobuf::internal::WireFormat::SkipField(
  865. input, tag, _internal_metadata_.mutable_unknown_fields()));
  866. break;
  867. }
  868. }
  869. }
  870. success:
  871. // @@protoc_insertion_point(parse_success:google.protobuf.Value)
  872. return true;
  873. failure:
  874. // @@protoc_insertion_point(parse_failure:google.protobuf.Value)
  875. return false;
  876. #undef DO_
  877. }
  878. void Value::SerializeWithCachedSizes(
  879. ::google::protobuf::io::CodedOutputStream* output) const {
  880. // @@protoc_insertion_point(serialize_start:google.protobuf.Value)
  881. ::google::protobuf::uint32 cached_has_bits = 0;
  882. (void) cached_has_bits;
  883. // .google.protobuf.NullValue null_value = 1;
  884. if (has_null_value()) {
  885. ::google::protobuf::internal::WireFormatLite::WriteEnum(
  886. 1, this->null_value(), output);
  887. }
  888. // double number_value = 2;
  889. if (has_number_value()) {
  890. ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->number_value(), output);
  891. }
  892. // string string_value = 3;
  893. if (has_string_value()) {
  894. ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
  895. this->string_value().data(), static_cast<int>(this->string_value().length()),
  896. ::google::protobuf::internal::WireFormatLite::SERIALIZE,
  897. "google.protobuf.Value.string_value");
  898. ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
  899. 3, this->string_value(), output);
  900. }
  901. // bool bool_value = 4;
  902. if (has_bool_value()) {
  903. ::google::protobuf::internal::WireFormatLite::WriteBool(4, this->bool_value(), output);
  904. }
  905. // .google.protobuf.Struct struct_value = 5;
  906. if (has_struct_value()) {
  907. ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
  908. 5, *kind_.struct_value_, output);
  909. }
  910. // .google.protobuf.ListValue list_value = 6;
  911. if (has_list_value()) {
  912. ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
  913. 6, *kind_.list_value_, output);
  914. }
  915. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  916. ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
  917. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
  918. }
  919. // @@protoc_insertion_point(serialize_end:google.protobuf.Value)
  920. }
  921. ::google::protobuf::uint8* Value::InternalSerializeWithCachedSizesToArray(
  922. bool deterministic, ::google::protobuf::uint8* target) const {
  923. (void)deterministic; // Unused
  924. // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Value)
  925. ::google::protobuf::uint32 cached_has_bits = 0;
  926. (void) cached_has_bits;
  927. // .google.protobuf.NullValue null_value = 1;
  928. if (has_null_value()) {
  929. target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
  930. 1, this->null_value(), target);
  931. }
  932. // double number_value = 2;
  933. if (has_number_value()) {
  934. target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(2, this->number_value(), target);
  935. }
  936. // string string_value = 3;
  937. if (has_string_value()) {
  938. ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
  939. this->string_value().data(), static_cast<int>(this->string_value().length()),
  940. ::google::protobuf::internal::WireFormatLite::SERIALIZE,
  941. "google.protobuf.Value.string_value");
  942. target =
  943. ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
  944. 3, this->string_value(), target);
  945. }
  946. // bool bool_value = 4;
  947. if (has_bool_value()) {
  948. target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(4, this->bool_value(), target);
  949. }
  950. // .google.protobuf.Struct struct_value = 5;
  951. if (has_struct_value()) {
  952. target = ::google::protobuf::internal::WireFormatLite::
  953. InternalWriteMessageToArray(
  954. 5, *kind_.struct_value_, deterministic, target);
  955. }
  956. // .google.protobuf.ListValue list_value = 6;
  957. if (has_list_value()) {
  958. target = ::google::protobuf::internal::WireFormatLite::
  959. InternalWriteMessageToArray(
  960. 6, *kind_.list_value_, deterministic, target);
  961. }
  962. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  963. target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
  964. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
  965. }
  966. // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Value)
  967. return target;
  968. }
  969. size_t Value::ByteSizeLong() const {
  970. // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Value)
  971. size_t total_size = 0;
  972. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  973. total_size +=
  974. ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
  975. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
  976. }
  977. switch (kind_case()) {
  978. // .google.protobuf.NullValue null_value = 1;
  979. case kNullValue: {
  980. total_size += 1 +
  981. ::google::protobuf::internal::WireFormatLite::EnumSize(this->null_value());
  982. break;
  983. }
  984. // double number_value = 2;
  985. case kNumberValue: {
  986. total_size += 1 + 8;
  987. break;
  988. }
  989. // string string_value = 3;
  990. case kStringValue: {
  991. total_size += 1 +
  992. ::google::protobuf::internal::WireFormatLite::StringSize(
  993. this->string_value());
  994. break;
  995. }
  996. // bool bool_value = 4;
  997. case kBoolValue: {
  998. total_size += 1 + 1;
  999. break;
  1000. }
  1001. // .google.protobuf.Struct struct_value = 5;
  1002. case kStructValue: {
  1003. total_size += 1 +
  1004. ::google::protobuf::internal::WireFormatLite::MessageSize(
  1005. *kind_.struct_value_);
  1006. break;
  1007. }
  1008. // .google.protobuf.ListValue list_value = 6;
  1009. case kListValue: {
  1010. total_size += 1 +
  1011. ::google::protobuf::internal::WireFormatLite::MessageSize(
  1012. *kind_.list_value_);
  1013. break;
  1014. }
  1015. case KIND_NOT_SET: {
  1016. break;
  1017. }
  1018. }
  1019. int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  1020. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  1021. _cached_size_ = cached_size;
  1022. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  1023. return total_size;
  1024. }
  1025. void Value::MergeFrom(const ::google::protobuf::Message& from) {
  1026. // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Value)
  1027. GOOGLE_DCHECK_NE(&from, this);
  1028. const Value* source =
  1029. ::google::protobuf::internal::DynamicCastToGenerated<const Value>(
  1030. &from);
  1031. if (source == NULL) {
  1032. // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Value)
  1033. ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  1034. } else {
  1035. // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Value)
  1036. MergeFrom(*source);
  1037. }
  1038. }
  1039. void Value::MergeFrom(const Value& from) {
  1040. // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Value)
  1041. GOOGLE_DCHECK_NE(&from, this);
  1042. _internal_metadata_.MergeFrom(from._internal_metadata_);
  1043. ::google::protobuf::uint32 cached_has_bits = 0;
  1044. (void) cached_has_bits;
  1045. switch (from.kind_case()) {
  1046. case kNullValue: {
  1047. set_null_value(from.null_value());
  1048. break;
  1049. }
  1050. case kNumberValue: {
  1051. set_number_value(from.number_value());
  1052. break;
  1053. }
  1054. case kStringValue: {
  1055. set_string_value(from.string_value());
  1056. break;
  1057. }
  1058. case kBoolValue: {
  1059. set_bool_value(from.bool_value());
  1060. break;
  1061. }
  1062. case kStructValue: {
  1063. mutable_struct_value()->::google::protobuf::Struct::MergeFrom(from.struct_value());
  1064. break;
  1065. }
  1066. case kListValue: {
  1067. mutable_list_value()->::google::protobuf::ListValue::MergeFrom(from.list_value());
  1068. break;
  1069. }
  1070. case KIND_NOT_SET: {
  1071. break;
  1072. }
  1073. }
  1074. }
  1075. void Value::CopyFrom(const ::google::protobuf::Message& from) {
  1076. // @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Value)
  1077. if (&from == this) return;
  1078. Clear();
  1079. MergeFrom(from);
  1080. }
  1081. void Value::CopyFrom(const Value& from) {
  1082. // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Value)
  1083. if (&from == this) return;
  1084. Clear();
  1085. MergeFrom(from);
  1086. }
  1087. bool Value::IsInitialized() const {
  1088. return true;
  1089. }
  1090. void Value::Swap(Value* other) {
  1091. if (other == this) return;
  1092. if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
  1093. InternalSwap(other);
  1094. } else {
  1095. Value* temp = New(GetArenaNoVirtual());
  1096. temp->MergeFrom(*other);
  1097. other->CopyFrom(*this);
  1098. InternalSwap(temp);
  1099. if (GetArenaNoVirtual() == NULL) {
  1100. delete temp;
  1101. }
  1102. }
  1103. }
  1104. void Value::UnsafeArenaSwap(Value* other) {
  1105. if (other == this) return;
  1106. GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  1107. InternalSwap(other);
  1108. }
  1109. void Value::InternalSwap(Value* other) {
  1110. using std::swap;
  1111. swap(kind_, other->kind_);
  1112. swap(_oneof_case_[0], other->_oneof_case_[0]);
  1113. _internal_metadata_.Swap(&other->_internal_metadata_);
  1114. swap(_cached_size_, other->_cached_size_);
  1115. }
  1116. ::google::protobuf::Metadata Value::GetMetadata() const {
  1117. protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
  1118. return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages];
  1119. }
  1120. // ===================================================================
  1121. void ListValue::InitAsDefaultInstance() {
  1122. }
  1123. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  1124. const int ListValue::kValuesFieldNumber;
  1125. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  1126. ListValue::ListValue()
  1127. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  1128. if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
  1129. ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue();
  1130. }
  1131. SharedCtor();
  1132. // @@protoc_insertion_point(constructor:google.protobuf.ListValue)
  1133. }
  1134. ListValue::ListValue(::google::protobuf::Arena* arena)
  1135. : ::google::protobuf::Message(),
  1136. _internal_metadata_(arena),
  1137. values_(arena) {
  1138. ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue();
  1139. SharedCtor();
  1140. RegisterArenaDtor(arena);
  1141. // @@protoc_insertion_point(arena_constructor:google.protobuf.ListValue)
  1142. }
  1143. ListValue::ListValue(const ListValue& from)
  1144. : ::google::protobuf::Message(),
  1145. _internal_metadata_(NULL),
  1146. values_(from.values_),
  1147. _cached_size_(0) {
  1148. _internal_metadata_.MergeFrom(from._internal_metadata_);
  1149. // @@protoc_insertion_point(copy_constructor:google.protobuf.ListValue)
  1150. }
  1151. void ListValue::SharedCtor() {
  1152. _cached_size_ = 0;
  1153. }
  1154. ListValue::~ListValue() {
  1155. // @@protoc_insertion_point(destructor:google.protobuf.ListValue)
  1156. SharedDtor();
  1157. }
  1158. void ListValue::SharedDtor() {
  1159. GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  1160. }
  1161. void ListValue::ArenaDtor(void* object) {
  1162. ListValue* _this = reinterpret_cast< ListValue* >(object);
  1163. (void)_this;
  1164. }
  1165. void ListValue::RegisterArenaDtor(::google::protobuf::Arena* arena) {
  1166. }
  1167. void ListValue::SetCachedSize(int size) const {
  1168. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  1169. _cached_size_ = size;
  1170. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  1171. }
  1172. const ::google::protobuf::Descriptor* ListValue::descriptor() {
  1173. ::protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
  1174. return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  1175. }
  1176. const ListValue& ListValue::default_instance() {
  1177. ::protobuf_google_2fprotobuf_2fstruct_2eproto::InitDefaultsListValue();
  1178. return *internal_default_instance();
  1179. }
  1180. ListValue* ListValue::New(::google::protobuf::Arena* arena) const {
  1181. return ::google::protobuf::Arena::CreateMessage<ListValue>(arena);
  1182. }
  1183. void ListValue::Clear() {
  1184. // @@protoc_insertion_point(message_clear_start:google.protobuf.ListValue)
  1185. ::google::protobuf::uint32 cached_has_bits = 0;
  1186. // Prevent compiler warnings about cached_has_bits being unused
  1187. (void) cached_has_bits;
  1188. values_.Clear();
  1189. _internal_metadata_.Clear();
  1190. }
  1191. bool ListValue::MergePartialFromCodedStream(
  1192. ::google::protobuf::io::CodedInputStream* input) {
  1193. #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  1194. ::google::protobuf::uint32 tag;
  1195. // @@protoc_insertion_point(parse_start:google.protobuf.ListValue)
  1196. for (;;) {
  1197. ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
  1198. tag = p.first;
  1199. if (!p.second) goto handle_unusual;
  1200. switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
  1201. // repeated .google.protobuf.Value values = 1;
  1202. case 1: {
  1203. if (static_cast< ::google::protobuf::uint8>(tag) ==
  1204. static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
  1205. DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_values()));
  1206. } else {
  1207. goto handle_unusual;
  1208. }
  1209. break;
  1210. }
  1211. default: {
  1212. handle_unusual:
  1213. if (tag == 0) {
  1214. goto success;
  1215. }
  1216. DO_(::google::protobuf::internal::WireFormat::SkipField(
  1217. input, tag, _internal_metadata_.mutable_unknown_fields()));
  1218. break;
  1219. }
  1220. }
  1221. }
  1222. success:
  1223. // @@protoc_insertion_point(parse_success:google.protobuf.ListValue)
  1224. return true;
  1225. failure:
  1226. // @@protoc_insertion_point(parse_failure:google.protobuf.ListValue)
  1227. return false;
  1228. #undef DO_
  1229. }
  1230. void ListValue::SerializeWithCachedSizes(
  1231. ::google::protobuf::io::CodedOutputStream* output) const {
  1232. // @@protoc_insertion_point(serialize_start:google.protobuf.ListValue)
  1233. ::google::protobuf::uint32 cached_has_bits = 0;
  1234. (void) cached_has_bits;
  1235. // repeated .google.protobuf.Value values = 1;
  1236. for (unsigned int i = 0,
  1237. n = static_cast<unsigned int>(this->values_size()); i < n; i++) {
  1238. ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
  1239. 1, this->values(static_cast<int>(i)), output);
  1240. }
  1241. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  1242. ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
  1243. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
  1244. }
  1245. // @@protoc_insertion_point(serialize_end:google.protobuf.ListValue)
  1246. }
  1247. ::google::protobuf::uint8* ListValue::InternalSerializeWithCachedSizesToArray(
  1248. bool deterministic, ::google::protobuf::uint8* target) const {
  1249. (void)deterministic; // Unused
  1250. // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ListValue)
  1251. ::google::protobuf::uint32 cached_has_bits = 0;
  1252. (void) cached_has_bits;
  1253. // repeated .google.protobuf.Value values = 1;
  1254. for (unsigned int i = 0,
  1255. n = static_cast<unsigned int>(this->values_size()); i < n; i++) {
  1256. target = ::google::protobuf::internal::WireFormatLite::
  1257. InternalWriteMessageToArray(
  1258. 1, this->values(static_cast<int>(i)), deterministic, target);
  1259. }
  1260. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  1261. target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
  1262. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
  1263. }
  1264. // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ListValue)
  1265. return target;
  1266. }
  1267. size_t ListValue::ByteSizeLong() const {
  1268. // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ListValue)
  1269. size_t total_size = 0;
  1270. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  1271. total_size +=
  1272. ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
  1273. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
  1274. }
  1275. // repeated .google.protobuf.Value values = 1;
  1276. {
  1277. unsigned int count = static_cast<unsigned int>(this->values_size());
  1278. total_size += 1UL * count;
  1279. for (unsigned int i = 0; i < count; i++) {
  1280. total_size +=
  1281. ::google::protobuf::internal::WireFormatLite::MessageSize(
  1282. this->values(static_cast<int>(i)));
  1283. }
  1284. }
  1285. int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  1286. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  1287. _cached_size_ = cached_size;
  1288. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  1289. return total_size;
  1290. }
  1291. void ListValue::MergeFrom(const ::google::protobuf::Message& from) {
  1292. // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.ListValue)
  1293. GOOGLE_DCHECK_NE(&from, this);
  1294. const ListValue* source =
  1295. ::google::protobuf::internal::DynamicCastToGenerated<const ListValue>(
  1296. &from);
  1297. if (source == NULL) {
  1298. // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.ListValue)
  1299. ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  1300. } else {
  1301. // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.ListValue)
  1302. MergeFrom(*source);
  1303. }
  1304. }
  1305. void ListValue::MergeFrom(const ListValue& from) {
  1306. // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ListValue)
  1307. GOOGLE_DCHECK_NE(&from, this);
  1308. _internal_metadata_.MergeFrom(from._internal_metadata_);
  1309. ::google::protobuf::uint32 cached_has_bits = 0;
  1310. (void) cached_has_bits;
  1311. values_.MergeFrom(from.values_);
  1312. }
  1313. void ListValue::CopyFrom(const ::google::protobuf::Message& from) {
  1314. // @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.ListValue)
  1315. if (&from == this) return;
  1316. Clear();
  1317. MergeFrom(from);
  1318. }
  1319. void ListValue::CopyFrom(const ListValue& from) {
  1320. // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.ListValue)
  1321. if (&from == this) return;
  1322. Clear();
  1323. MergeFrom(from);
  1324. }
  1325. bool ListValue::IsInitialized() const {
  1326. return true;
  1327. }
  1328. void ListValue::Swap(ListValue* other) {
  1329. if (other == this) return;
  1330. if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
  1331. InternalSwap(other);
  1332. } else {
  1333. ListValue* temp = New(GetArenaNoVirtual());
  1334. temp->MergeFrom(*other);
  1335. other->CopyFrom(*this);
  1336. InternalSwap(temp);
  1337. if (GetArenaNoVirtual() == NULL) {
  1338. delete temp;
  1339. }
  1340. }
  1341. }
  1342. void ListValue::UnsafeArenaSwap(ListValue* other) {
  1343. if (other == this) return;
  1344. GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  1345. InternalSwap(other);
  1346. }
  1347. void ListValue::InternalSwap(ListValue* other) {
  1348. using std::swap;
  1349. values_.InternalSwap(&other->values_);
  1350. _internal_metadata_.Swap(&other->_internal_metadata_);
  1351. swap(_cached_size_, other->_cached_size_);
  1352. }
  1353. ::google::protobuf::Metadata ListValue::GetMetadata() const {
  1354. protobuf_google_2fprotobuf_2fstruct_2eproto::protobuf_AssignDescriptorsOnce();
  1355. return ::protobuf_google_2fprotobuf_2fstruct_2eproto::file_level_metadata[kIndexInFileMessages];
  1356. }
  1357. // @@protoc_insertion_point(namespace_scope)
  1358. } // namespace protobuf
  1359. } // namespace google
  1360. // @@protoc_insertion_point(global_scope)