struct.pb.cc 53 KB

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