any_test.pb.cc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: google/protobuf/any_test.proto
  3. #include <google/protobuf/any_test.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_2fany_2eproto {
  19. extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2fany_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_Any;
  20. } // namespace protobuf_google_2fprotobuf_2fany_2eproto
  21. namespace protobuf_unittest {
  22. class TestAnyDefaultTypeInternal {
  23. public:
  24. ::google::protobuf::internal::ExplicitlyConstructed<TestAny>
  25. _instance;
  26. } _TestAny_default_instance_;
  27. } // namespace protobuf_unittest
  28. namespace protobuf_google_2fprotobuf_2fany_5ftest_2eproto {
  29. static void InitDefaultsTestAny() {
  30. GOOGLE_PROTOBUF_VERIFY_VERSION;
  31. {
  32. void* ptr = &::protobuf_unittest::_TestAny_default_instance_;
  33. new (ptr) ::protobuf_unittest::TestAny();
  34. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  35. }
  36. ::protobuf_unittest::TestAny::InitAsDefaultInstance();
  37. }
  38. ::google::protobuf::internal::SCCInfo<1> scc_info_TestAny =
  39. {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsTestAny}, {
  40. &protobuf_google_2fprotobuf_2fany_2eproto::scc_info_Any.base,}};
  41. void InitDefaults() {
  42. ::google::protobuf::internal::InitSCC(&scc_info_TestAny.base);
  43. }
  44. ::google::protobuf::Metadata file_level_metadata[1];
  45. const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  46. ~0u, // no _has_bits_
  47. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestAny, _internal_metadata_),
  48. ~0u, // no _extensions_
  49. ~0u, // no _oneof_case_
  50. ~0u, // no _weak_field_map_
  51. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestAny, int32_value_),
  52. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestAny, any_value_),
  53. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::protobuf_unittest::TestAny, repeated_any_value_),
  54. };
  55. static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  56. { 0, -1, sizeof(::protobuf_unittest::TestAny)},
  57. };
  58. static ::google::protobuf::Message const * const file_default_instances[] = {
  59. reinterpret_cast<const ::google::protobuf::Message*>(&::protobuf_unittest::_TestAny_default_instance_),
  60. };
  61. void protobuf_AssignDescriptors() {
  62. AddDescriptors();
  63. AssignDescriptors(
  64. "google/protobuf/any_test.proto", schemas, file_default_instances, TableStruct::offsets,
  65. file_level_metadata, NULL, NULL);
  66. }
  67. void protobuf_AssignDescriptorsOnce() {
  68. static ::google::protobuf::internal::once_flag once;
  69. ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
  70. }
  71. void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
  72. void protobuf_RegisterTypes(const ::std::string&) {
  73. protobuf_AssignDescriptorsOnce();
  74. ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
  75. }
  76. void AddDescriptorsImpl() {
  77. InitDefaults();
  78. static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  79. "\n\036google/protobuf/any_test.proto\022\021protob"
  80. "uf_unittest\032\031google/protobuf/any.proto\"y"
  81. "\n\007TestAny\022\023\n\013int32_value\030\001 \001(\005\022\'\n\tany_va"
  82. "lue\030\002 \001(\0132\024.google.protobuf.Any\0220\n\022repea"
  83. "ted_any_value\030\003 \003(\0132\024.google.protobuf.An"
  84. "yb\006proto3"
  85. };
  86. ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
  87. descriptor, 209);
  88. ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
  89. "google/protobuf/any_test.proto", &protobuf_RegisterTypes);
  90. ::protobuf_google_2fprotobuf_2fany_2eproto::AddDescriptors();
  91. }
  92. void AddDescriptors() {
  93. static ::google::protobuf::internal::once_flag once;
  94. ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
  95. }
  96. // Force AddDescriptors() to be called at dynamic initialization time.
  97. struct StaticDescriptorInitializer {
  98. StaticDescriptorInitializer() {
  99. AddDescriptors();
  100. }
  101. } static_descriptor_initializer;
  102. } // namespace protobuf_google_2fprotobuf_2fany_5ftest_2eproto
  103. namespace protobuf_unittest {
  104. // ===================================================================
  105. void TestAny::InitAsDefaultInstance() {
  106. ::protobuf_unittest::_TestAny_default_instance_._instance.get_mutable()->any_value_ = const_cast< ::google::protobuf::Any*>(
  107. ::google::protobuf::Any::internal_default_instance());
  108. }
  109. void TestAny::clear_any_value() {
  110. if (GetArenaNoVirtual() == NULL && any_value_ != NULL) {
  111. delete any_value_;
  112. }
  113. any_value_ = NULL;
  114. }
  115. void TestAny::clear_repeated_any_value() {
  116. repeated_any_value_.Clear();
  117. }
  118. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  119. const int TestAny::kInt32ValueFieldNumber;
  120. const int TestAny::kAnyValueFieldNumber;
  121. const int TestAny::kRepeatedAnyValueFieldNumber;
  122. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  123. TestAny::TestAny()
  124. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  125. ::google::protobuf::internal::InitSCC(
  126. &protobuf_google_2fprotobuf_2fany_5ftest_2eproto::scc_info_TestAny.base);
  127. SharedCtor();
  128. // @@protoc_insertion_point(constructor:protobuf_unittest.TestAny)
  129. }
  130. TestAny::TestAny(const TestAny& from)
  131. : ::google::protobuf::Message(),
  132. _internal_metadata_(NULL),
  133. repeated_any_value_(from.repeated_any_value_) {
  134. _internal_metadata_.MergeFrom(from._internal_metadata_);
  135. if (from.has_any_value()) {
  136. any_value_ = new ::google::protobuf::Any(*from.any_value_);
  137. } else {
  138. any_value_ = NULL;
  139. }
  140. int32_value_ = from.int32_value_;
  141. // @@protoc_insertion_point(copy_constructor:protobuf_unittest.TestAny)
  142. }
  143. void TestAny::SharedCtor() {
  144. ::memset(&any_value_, 0, static_cast<size_t>(
  145. reinterpret_cast<char*>(&int32_value_) -
  146. reinterpret_cast<char*>(&any_value_)) + sizeof(int32_value_));
  147. }
  148. TestAny::~TestAny() {
  149. // @@protoc_insertion_point(destructor:protobuf_unittest.TestAny)
  150. SharedDtor();
  151. }
  152. void TestAny::SharedDtor() {
  153. if (this != internal_default_instance()) delete any_value_;
  154. }
  155. void TestAny::SetCachedSize(int size) const {
  156. _cached_size_.Set(size);
  157. }
  158. const ::google::protobuf::Descriptor* TestAny::descriptor() {
  159. ::protobuf_google_2fprotobuf_2fany_5ftest_2eproto::protobuf_AssignDescriptorsOnce();
  160. return ::protobuf_google_2fprotobuf_2fany_5ftest_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  161. }
  162. const TestAny& TestAny::default_instance() {
  163. ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fany_5ftest_2eproto::scc_info_TestAny.base);
  164. return *internal_default_instance();
  165. }
  166. void TestAny::Clear() {
  167. // @@protoc_insertion_point(message_clear_start:protobuf_unittest.TestAny)
  168. ::google::protobuf::uint32 cached_has_bits = 0;
  169. // Prevent compiler warnings about cached_has_bits being unused
  170. (void) cached_has_bits;
  171. repeated_any_value_.Clear();
  172. if (GetArenaNoVirtual() == NULL && any_value_ != NULL) {
  173. delete any_value_;
  174. }
  175. any_value_ = NULL;
  176. int32_value_ = 0;
  177. _internal_metadata_.Clear();
  178. }
  179. bool TestAny::MergePartialFromCodedStream(
  180. ::google::protobuf::io::CodedInputStream* input) {
  181. #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  182. ::google::protobuf::uint32 tag;
  183. // @@protoc_insertion_point(parse_start:protobuf_unittest.TestAny)
  184. for (;;) {
  185. ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
  186. tag = p.first;
  187. if (!p.second) goto handle_unusual;
  188. switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
  189. // int32 int32_value = 1;
  190. case 1: {
  191. if (static_cast< ::google::protobuf::uint8>(tag) ==
  192. static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
  193. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  194. ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
  195. input, &int32_value_)));
  196. } else {
  197. goto handle_unusual;
  198. }
  199. break;
  200. }
  201. // .google.protobuf.Any any_value = 2;
  202. case 2: {
  203. if (static_cast< ::google::protobuf::uint8>(tag) ==
  204. static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
  205. DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
  206. input, mutable_any_value()));
  207. } else {
  208. goto handle_unusual;
  209. }
  210. break;
  211. }
  212. // repeated .google.protobuf.Any repeated_any_value = 3;
  213. case 3: {
  214. if (static_cast< ::google::protobuf::uint8>(tag) ==
  215. static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
  216. DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
  217. input, add_repeated_any_value()));
  218. } else {
  219. goto handle_unusual;
  220. }
  221. break;
  222. }
  223. default: {
  224. handle_unusual:
  225. if (tag == 0) {
  226. goto success;
  227. }
  228. DO_(::google::protobuf::internal::WireFormat::SkipField(
  229. input, tag, _internal_metadata_.mutable_unknown_fields()));
  230. break;
  231. }
  232. }
  233. }
  234. success:
  235. // @@protoc_insertion_point(parse_success:protobuf_unittest.TestAny)
  236. return true;
  237. failure:
  238. // @@protoc_insertion_point(parse_failure:protobuf_unittest.TestAny)
  239. return false;
  240. #undef DO_
  241. }
  242. void TestAny::SerializeWithCachedSizes(
  243. ::google::protobuf::io::CodedOutputStream* output) const {
  244. // @@protoc_insertion_point(serialize_start:protobuf_unittest.TestAny)
  245. ::google::protobuf::uint32 cached_has_bits = 0;
  246. (void) cached_has_bits;
  247. // int32 int32_value = 1;
  248. if (this->int32_value() != 0) {
  249. ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->int32_value(), output);
  250. }
  251. // .google.protobuf.Any any_value = 2;
  252. if (this->has_any_value()) {
  253. ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
  254. 2, this->_internal_any_value(), output);
  255. }
  256. // repeated .google.protobuf.Any repeated_any_value = 3;
  257. for (unsigned int i = 0,
  258. n = static_cast<unsigned int>(this->repeated_any_value_size()); i < n; i++) {
  259. ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
  260. 3,
  261. this->repeated_any_value(static_cast<int>(i)),
  262. output);
  263. }
  264. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  265. ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
  266. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
  267. }
  268. // @@protoc_insertion_point(serialize_end:protobuf_unittest.TestAny)
  269. }
  270. ::google::protobuf::uint8* TestAny::InternalSerializeWithCachedSizesToArray(
  271. bool deterministic, ::google::protobuf::uint8* target) const {
  272. (void)deterministic; // Unused
  273. // @@protoc_insertion_point(serialize_to_array_start:protobuf_unittest.TestAny)
  274. ::google::protobuf::uint32 cached_has_bits = 0;
  275. (void) cached_has_bits;
  276. // int32 int32_value = 1;
  277. if (this->int32_value() != 0) {
  278. target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->int32_value(), target);
  279. }
  280. // .google.protobuf.Any any_value = 2;
  281. if (this->has_any_value()) {
  282. target = ::google::protobuf::internal::WireFormatLite::
  283. InternalWriteMessageToArray(
  284. 2, this->_internal_any_value(), deterministic, target);
  285. }
  286. // repeated .google.protobuf.Any repeated_any_value = 3;
  287. for (unsigned int i = 0,
  288. n = static_cast<unsigned int>(this->repeated_any_value_size()); i < n; i++) {
  289. target = ::google::protobuf::internal::WireFormatLite::
  290. InternalWriteMessageToArray(
  291. 3, this->repeated_any_value(static_cast<int>(i)), deterministic, target);
  292. }
  293. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  294. target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
  295. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
  296. }
  297. // @@protoc_insertion_point(serialize_to_array_end:protobuf_unittest.TestAny)
  298. return target;
  299. }
  300. size_t TestAny::ByteSizeLong() const {
  301. // @@protoc_insertion_point(message_byte_size_start:protobuf_unittest.TestAny)
  302. size_t total_size = 0;
  303. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  304. total_size +=
  305. ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
  306. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
  307. }
  308. // repeated .google.protobuf.Any repeated_any_value = 3;
  309. {
  310. unsigned int count = static_cast<unsigned int>(this->repeated_any_value_size());
  311. total_size += 1UL * count;
  312. for (unsigned int i = 0; i < count; i++) {
  313. total_size +=
  314. ::google::protobuf::internal::WireFormatLite::MessageSize(
  315. this->repeated_any_value(static_cast<int>(i)));
  316. }
  317. }
  318. // .google.protobuf.Any any_value = 2;
  319. if (this->has_any_value()) {
  320. total_size += 1 +
  321. ::google::protobuf::internal::WireFormatLite::MessageSize(
  322. *any_value_);
  323. }
  324. // int32 int32_value = 1;
  325. if (this->int32_value() != 0) {
  326. total_size += 1 +
  327. ::google::protobuf::internal::WireFormatLite::Int32Size(
  328. this->int32_value());
  329. }
  330. int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  331. SetCachedSize(cached_size);
  332. return total_size;
  333. }
  334. void TestAny::MergeFrom(const ::google::protobuf::Message& from) {
  335. // @@protoc_insertion_point(generalized_merge_from_start:protobuf_unittest.TestAny)
  336. GOOGLE_DCHECK_NE(&from, this);
  337. const TestAny* source =
  338. ::google::protobuf::internal::DynamicCastToGenerated<const TestAny>(
  339. &from);
  340. if (source == NULL) {
  341. // @@protoc_insertion_point(generalized_merge_from_cast_fail:protobuf_unittest.TestAny)
  342. ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  343. } else {
  344. // @@protoc_insertion_point(generalized_merge_from_cast_success:protobuf_unittest.TestAny)
  345. MergeFrom(*source);
  346. }
  347. }
  348. void TestAny::MergeFrom(const TestAny& from) {
  349. // @@protoc_insertion_point(class_specific_merge_from_start:protobuf_unittest.TestAny)
  350. GOOGLE_DCHECK_NE(&from, this);
  351. _internal_metadata_.MergeFrom(from._internal_metadata_);
  352. ::google::protobuf::uint32 cached_has_bits = 0;
  353. (void) cached_has_bits;
  354. repeated_any_value_.MergeFrom(from.repeated_any_value_);
  355. if (from.has_any_value()) {
  356. mutable_any_value()->::google::protobuf::Any::MergeFrom(from.any_value());
  357. }
  358. if (from.int32_value() != 0) {
  359. set_int32_value(from.int32_value());
  360. }
  361. }
  362. void TestAny::CopyFrom(const ::google::protobuf::Message& from) {
  363. // @@protoc_insertion_point(generalized_copy_from_start:protobuf_unittest.TestAny)
  364. if (&from == this) return;
  365. Clear();
  366. MergeFrom(from);
  367. }
  368. void TestAny::CopyFrom(const TestAny& from) {
  369. // @@protoc_insertion_point(class_specific_copy_from_start:protobuf_unittest.TestAny)
  370. if (&from == this) return;
  371. Clear();
  372. MergeFrom(from);
  373. }
  374. bool TestAny::IsInitialized() const {
  375. return true;
  376. }
  377. void TestAny::Swap(TestAny* other) {
  378. if (other == this) return;
  379. InternalSwap(other);
  380. }
  381. void TestAny::InternalSwap(TestAny* other) {
  382. using std::swap;
  383. CastToBase(&repeated_any_value_)->InternalSwap(CastToBase(&other->repeated_any_value_));
  384. swap(any_value_, other->any_value_);
  385. swap(int32_value_, other->int32_value_);
  386. _internal_metadata_.Swap(&other->_internal_metadata_);
  387. }
  388. ::google::protobuf::Metadata TestAny::GetMetadata() const {
  389. protobuf_google_2fprotobuf_2fany_5ftest_2eproto::protobuf_AssignDescriptorsOnce();
  390. return ::protobuf_google_2fprotobuf_2fany_5ftest_2eproto::file_level_metadata[kIndexInFileMessages];
  391. }
  392. // @@protoc_insertion_point(namespace_scope)
  393. } // namespace protobuf_unittest
  394. namespace google {
  395. namespace protobuf {
  396. template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::protobuf_unittest::TestAny* Arena::CreateMaybeMessage< ::protobuf_unittest::TestAny >(Arena* arena) {
  397. return Arena::CreateInternal< ::protobuf_unittest::TestAny >(arena);
  398. }
  399. } // namespace protobuf
  400. } // namespace google
  401. // @@protoc_insertion_point(global_scope)