any.pb.cc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. /*
  2. * Copyright 2018 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. // Generated by the protocol buffer compiler. DO NOT EDIT!
  17. // source: google/protobuf/any.proto
  18. #include <google/protobuf/any.pb.h>
  19. #include <algorithm>
  20. #include <google/protobuf/stubs/common.h>
  21. #include <google/protobuf/stubs/port.h>
  22. #include <google/protobuf/stubs/once.h>
  23. #include <google/protobuf/io/coded_stream.h>
  24. #include <google/protobuf/wire_format_lite_inl.h>
  25. #include <google/protobuf/descriptor.h>
  26. #include <google/protobuf/generated_message_reflection.h>
  27. #include <google/protobuf/reflection_ops.h>
  28. #include <google/protobuf/wire_format.h>
  29. // This is a temporary google only hack
  30. #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  31. #include "third_party/protobuf/version.h"
  32. #endif
  33. // @@protoc_insertion_point(includes)
  34. namespace google {
  35. namespace protobuf {
  36. class AnyDefaultTypeInternal {
  37. public:
  38. ::google::protobuf::internal::ExplicitlyConstructed<Any>
  39. _instance;
  40. } _Any_default_instance_;
  41. } // namespace protobuf
  42. } // namespace google
  43. namespace protobuf_google_2fprotobuf_2fany_2eproto {
  44. void InitDefaultsAnyImpl() {
  45. GOOGLE_PROTOBUF_VERIFY_VERSION;
  46. #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  47. ::google::protobuf::internal::InitProtobufDefaultsForceUnique();
  48. #else
  49. ::google::protobuf::internal::InitProtobufDefaults();
  50. #endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
  51. {
  52. void* ptr = &::google::protobuf::_Any_default_instance_;
  53. new (ptr) ::google::protobuf::Any();
  54. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  55. }
  56. ::google::protobuf::Any::InitAsDefaultInstance();
  57. }
  58. void InitDefaultsAny() {
  59. static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  60. ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsAnyImpl);
  61. }
  62. ::google::protobuf::Metadata file_level_metadata[1];
  63. const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  64. ~0u, // no _has_bits_
  65. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Any, _internal_metadata_),
  66. ~0u, // no _extensions_
  67. ~0u, // no _oneof_case_
  68. ~0u, // no _weak_field_map_
  69. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Any, type_url_),
  70. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::google::protobuf::Any, value_),
  71. };
  72. static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  73. { 0, -1, sizeof(::google::protobuf::Any)},
  74. };
  75. static ::google::protobuf::Message const * const file_default_instances[] = {
  76. reinterpret_cast<const ::google::protobuf::Message*>(&::google::protobuf::_Any_default_instance_),
  77. };
  78. void protobuf_AssignDescriptors() {
  79. AddDescriptors();
  80. ::google::protobuf::MessageFactory* factory = NULL;
  81. AssignDescriptors(
  82. "google/protobuf/any.proto", schemas, file_default_instances, TableStruct::offsets, factory,
  83. file_level_metadata, NULL, NULL);
  84. }
  85. void protobuf_AssignDescriptorsOnce() {
  86. static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  87. ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
  88. }
  89. void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
  90. void protobuf_RegisterTypes(const ::std::string&) {
  91. protobuf_AssignDescriptorsOnce();
  92. ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
  93. }
  94. void AddDescriptorsImpl() {
  95. InitDefaults();
  96. static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  97. "\n\031google/protobuf/any.proto\022\017google.prot"
  98. "obuf\"&\n\003Any\022\020\n\010type_url\030\001 \001(\t\022\r\n\005value\030\002"
  99. " \001(\014Bo\n\023com.google.protobufB\010AnyProtoP\001Z"
  100. "%github.com/golang/protobuf/ptypes/any\242\002"
  101. "\003GPB\252\002\036Google.Protobuf.WellKnownTypesb\006p"
  102. "roto3"
  103. };
  104. ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
  105. descriptor, 205);
  106. ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
  107. "google/protobuf/any.proto", &protobuf_RegisterTypes);
  108. }
  109. void AddDescriptors() {
  110. static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  111. ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
  112. }
  113. // Force AddDescriptors() to be called at dynamic initialization time.
  114. struct StaticDescriptorInitializer {
  115. StaticDescriptorInitializer() {
  116. AddDescriptors();
  117. }
  118. } static_descriptor_initializer;
  119. } // namespace protobuf_google_2fprotobuf_2fany_2eproto
  120. namespace google {
  121. namespace protobuf {
  122. // ===================================================================
  123. void Any::InitAsDefaultInstance() {
  124. }
  125. void Any::PackFrom(const ::google::protobuf::Message& message) {
  126. _any_metadata_.PackFrom(message);
  127. }
  128. void Any::PackFrom(const ::google::protobuf::Message& message,
  129. const ::std::string& type_url_prefix) {
  130. _any_metadata_.PackFrom(message, type_url_prefix);
  131. }
  132. bool Any::UnpackTo(::google::protobuf::Message* message) const {
  133. return _any_metadata_.UnpackTo(message);
  134. }
  135. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  136. const int Any::kTypeUrlFieldNumber;
  137. const int Any::kValueFieldNumber;
  138. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  139. Any::Any()
  140. : ::google::protobuf::Message(), _internal_metadata_(NULL), _any_metadata_(&type_url_, &value_) {
  141. if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
  142. ::protobuf_google_2fprotobuf_2fany_2eproto::InitDefaultsAny();
  143. }
  144. SharedCtor();
  145. // @@protoc_insertion_point(constructor:google.protobuf.Any)
  146. }
  147. Any::Any(const Any& from)
  148. : ::google::protobuf::Message(),
  149. _internal_metadata_(NULL),
  150. _cached_size_(0),
  151. _any_metadata_(&type_url_, &value_) {
  152. _internal_metadata_.MergeFrom(from._internal_metadata_);
  153. type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  154. if (from.type_url().size() > 0) {
  155. type_url_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_url_);
  156. }
  157. value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  158. if (from.value().size() > 0) {
  159. value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.value_);
  160. }
  161. // @@protoc_insertion_point(copy_constructor:google.protobuf.Any)
  162. }
  163. void Any::SharedCtor() {
  164. type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  165. value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  166. _cached_size_ = 0;
  167. }
  168. Any::~Any() {
  169. // @@protoc_insertion_point(destructor:google.protobuf.Any)
  170. SharedDtor();
  171. }
  172. void Any::SharedDtor() {
  173. type_url_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  174. value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  175. }
  176. void Any::SetCachedSize(int size) const {
  177. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  178. _cached_size_ = size;
  179. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  180. }
  181. const ::google::protobuf::Descriptor* Any::descriptor() {
  182. ::protobuf_google_2fprotobuf_2fany_2eproto::protobuf_AssignDescriptorsOnce();
  183. return ::protobuf_google_2fprotobuf_2fany_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  184. }
  185. const Any& Any::default_instance() {
  186. ::protobuf_google_2fprotobuf_2fany_2eproto::InitDefaultsAny();
  187. return *internal_default_instance();
  188. }
  189. Any* Any::New(::google::protobuf::Arena* arena) const {
  190. Any* n = new Any;
  191. if (arena != NULL) {
  192. arena->Own(n);
  193. }
  194. return n;
  195. }
  196. void Any::Clear() {
  197. // @@protoc_insertion_point(message_clear_start:google.protobuf.Any)
  198. ::google::protobuf::uint32 cached_has_bits = 0;
  199. // Prevent compiler warnings about cached_has_bits being unused
  200. (void) cached_has_bits;
  201. type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  202. value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  203. _internal_metadata_.Clear();
  204. }
  205. bool Any::MergePartialFromCodedStream(
  206. ::google::protobuf::io::CodedInputStream* input) {
  207. #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  208. ::google::protobuf::uint32 tag;
  209. // @@protoc_insertion_point(parse_start:google.protobuf.Any)
  210. for (;;) {
  211. ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
  212. tag = p.first;
  213. if (!p.second) goto handle_unusual;
  214. switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
  215. // string type_url = 1;
  216. case 1: {
  217. if (static_cast< ::google::protobuf::uint8>(tag) ==
  218. static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
  219. DO_(::google::protobuf::internal::WireFormatLite::ReadString(
  220. input, this->mutable_type_url()));
  221. DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
  222. this->type_url().data(), static_cast<int>(this->type_url().length()),
  223. ::google::protobuf::internal::WireFormatLite::PARSE,
  224. "google.protobuf.Any.type_url"));
  225. } else {
  226. goto handle_unusual;
  227. }
  228. break;
  229. }
  230. // bytes value = 2;
  231. case 2: {
  232. if (static_cast< ::google::protobuf::uint8>(tag) ==
  233. static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
  234. DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
  235. input, this->mutable_value()));
  236. } else {
  237. goto handle_unusual;
  238. }
  239. break;
  240. }
  241. default: {
  242. handle_unusual:
  243. if (tag == 0) {
  244. goto success;
  245. }
  246. DO_(::google::protobuf::internal::WireFormat::SkipField(
  247. input, tag, _internal_metadata_.mutable_unknown_fields()));
  248. break;
  249. }
  250. }
  251. }
  252. success:
  253. // @@protoc_insertion_point(parse_success:google.protobuf.Any)
  254. return true;
  255. failure:
  256. // @@protoc_insertion_point(parse_failure:google.protobuf.Any)
  257. return false;
  258. #undef DO_
  259. }
  260. void Any::SerializeWithCachedSizes(
  261. ::google::protobuf::io::CodedOutputStream* output) const {
  262. // @@protoc_insertion_point(serialize_start:google.protobuf.Any)
  263. ::google::protobuf::uint32 cached_has_bits = 0;
  264. (void) cached_has_bits;
  265. // string type_url = 1;
  266. if (this->type_url().size() > 0) {
  267. ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
  268. this->type_url().data(), static_cast<int>(this->type_url().length()),
  269. ::google::protobuf::internal::WireFormatLite::SERIALIZE,
  270. "google.protobuf.Any.type_url");
  271. ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
  272. 1, this->type_url(), output);
  273. }
  274. // bytes value = 2;
  275. if (this->value().size() > 0) {
  276. ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
  277. 2, this->value(), output);
  278. }
  279. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  280. ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
  281. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
  282. }
  283. // @@protoc_insertion_point(serialize_end:google.protobuf.Any)
  284. }
  285. ::google::protobuf::uint8* Any::InternalSerializeWithCachedSizesToArray(
  286. bool deterministic, ::google::protobuf::uint8* target) const {
  287. (void)deterministic; // Unused
  288. // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Any)
  289. ::google::protobuf::uint32 cached_has_bits = 0;
  290. (void) cached_has_bits;
  291. // string type_url = 1;
  292. if (this->type_url().size() > 0) {
  293. ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
  294. this->type_url().data(), static_cast<int>(this->type_url().length()),
  295. ::google::protobuf::internal::WireFormatLite::SERIALIZE,
  296. "google.protobuf.Any.type_url");
  297. target =
  298. ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
  299. 1, this->type_url(), target);
  300. }
  301. // bytes value = 2;
  302. if (this->value().size() > 0) {
  303. target =
  304. ::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
  305. 2, this->value(), target);
  306. }
  307. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  308. target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
  309. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
  310. }
  311. // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Any)
  312. return target;
  313. }
  314. size_t Any::ByteSizeLong() const {
  315. // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Any)
  316. size_t total_size = 0;
  317. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  318. total_size +=
  319. ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
  320. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
  321. }
  322. // string type_url = 1;
  323. if (this->type_url().size() > 0) {
  324. total_size += 1 +
  325. ::google::protobuf::internal::WireFormatLite::StringSize(
  326. this->type_url());
  327. }
  328. // bytes value = 2;
  329. if (this->value().size() > 0) {
  330. total_size += 1 +
  331. ::google::protobuf::internal::WireFormatLite::BytesSize(
  332. this->value());
  333. }
  334. int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  335. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  336. _cached_size_ = cached_size;
  337. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  338. return total_size;
  339. }
  340. void Any::MergeFrom(const ::google::protobuf::Message& from) {
  341. // @@protoc_insertion_point(generalized_merge_from_start:google.protobuf.Any)
  342. GOOGLE_DCHECK_NE(&from, this);
  343. const Any* source =
  344. ::google::protobuf::internal::DynamicCastToGenerated<const Any>(
  345. &from);
  346. if (source == NULL) {
  347. // @@protoc_insertion_point(generalized_merge_from_cast_fail:google.protobuf.Any)
  348. ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  349. } else {
  350. // @@protoc_insertion_point(generalized_merge_from_cast_success:google.protobuf.Any)
  351. MergeFrom(*source);
  352. }
  353. }
  354. void Any::MergeFrom(const Any& from) {
  355. // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Any)
  356. GOOGLE_DCHECK_NE(&from, this);
  357. _internal_metadata_.MergeFrom(from._internal_metadata_);
  358. ::google::protobuf::uint32 cached_has_bits = 0;
  359. (void) cached_has_bits;
  360. if (from.type_url().size() > 0) {
  361. type_url_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_url_);
  362. }
  363. if (from.value().size() > 0) {
  364. value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.value_);
  365. }
  366. }
  367. void Any::CopyFrom(const ::google::protobuf::Message& from) {
  368. // @@protoc_insertion_point(generalized_copy_from_start:google.protobuf.Any)
  369. if (&from == this) return;
  370. Clear();
  371. MergeFrom(from);
  372. }
  373. void Any::CopyFrom(const Any& from) {
  374. // @@protoc_insertion_point(class_specific_copy_from_start:google.protobuf.Any)
  375. if (&from == this) return;
  376. Clear();
  377. MergeFrom(from);
  378. }
  379. bool Any::IsInitialized() const {
  380. return true;
  381. }
  382. void Any::Swap(Any* other) {
  383. if (other == this) return;
  384. InternalSwap(other);
  385. }
  386. void Any::InternalSwap(Any* other) {
  387. using std::swap;
  388. type_url_.Swap(&other->type_url_);
  389. value_.Swap(&other->value_);
  390. _internal_metadata_.Swap(&other->_internal_metadata_);
  391. swap(_cached_size_, other->_cached_size_);
  392. }
  393. ::google::protobuf::Metadata Any::GetMetadata() const {
  394. protobuf_google_2fprotobuf_2fany_2eproto::protobuf_AssignDescriptorsOnce();
  395. return ::protobuf_google_2fprotobuf_2fany_2eproto::file_level_metadata[kIndexInFileMessages];
  396. }
  397. // @@protoc_insertion_point(namespace_scope)
  398. } // namespace protobuf
  399. } // namespace google
  400. // @@protoc_insertion_point(global_scope)