struct.pb.cc 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460
  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)