unittest_mset_wire_format.pb.cc 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: google/protobuf/unittest_mset_wire_format.proto
  3. #include <google/protobuf/unittest_mset_wire_format.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_2funittest_5fmset_5fwire_5fformat_2eproto {
  19. extern PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto ::google::protobuf::internal::SCCInfo<0> scc_info_TestMessageSet;
  20. } // namespace protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto
  21. namespace proto2_wireformat_unittest {
  22. class TestMessageSetDefaultTypeInternal {
  23. public:
  24. ::google::protobuf::internal::ExplicitlyConstructed<TestMessageSet>
  25. _instance;
  26. } _TestMessageSet_default_instance_;
  27. class TestMessageSetWireFormatContainerDefaultTypeInternal {
  28. public:
  29. ::google::protobuf::internal::ExplicitlyConstructed<TestMessageSetWireFormatContainer>
  30. _instance;
  31. } _TestMessageSetWireFormatContainer_default_instance_;
  32. } // namespace proto2_wireformat_unittest
  33. namespace protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto {
  34. static void InitDefaultsTestMessageSet() {
  35. GOOGLE_PROTOBUF_VERIFY_VERSION;
  36. {
  37. void* ptr = &::proto2_wireformat_unittest::_TestMessageSet_default_instance_;
  38. new (ptr) ::proto2_wireformat_unittest::TestMessageSet();
  39. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  40. }
  41. ::proto2_wireformat_unittest::TestMessageSet::InitAsDefaultInstance();
  42. }
  43. ::google::protobuf::internal::SCCInfo<0> scc_info_TestMessageSet =
  44. {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsTestMessageSet}, {}};
  45. static void InitDefaultsTestMessageSetWireFormatContainer() {
  46. GOOGLE_PROTOBUF_VERIFY_VERSION;
  47. {
  48. void* ptr = &::proto2_wireformat_unittest::_TestMessageSetWireFormatContainer_default_instance_;
  49. new (ptr) ::proto2_wireformat_unittest::TestMessageSetWireFormatContainer();
  50. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  51. }
  52. ::proto2_wireformat_unittest::TestMessageSetWireFormatContainer::InitAsDefaultInstance();
  53. }
  54. ::google::protobuf::internal::SCCInfo<1> scc_info_TestMessageSetWireFormatContainer =
  55. {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsTestMessageSetWireFormatContainer}, {
  56. &protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::scc_info_TestMessageSet.base,}};
  57. void InitDefaults() {
  58. ::google::protobuf::internal::InitSCC(&scc_info_TestMessageSet.base);
  59. ::google::protobuf::internal::InitSCC(&scc_info_TestMessageSetWireFormatContainer.base);
  60. }
  61. ::google::protobuf::Metadata file_level_metadata[2];
  62. const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  63. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_wireformat_unittest::TestMessageSet, _has_bits_),
  64. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_wireformat_unittest::TestMessageSet, _internal_metadata_),
  65. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_wireformat_unittest::TestMessageSet, _extensions_),
  66. ~0u, // no _oneof_case_
  67. ~0u, // no _weak_field_map_
  68. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_wireformat_unittest::TestMessageSetWireFormatContainer, _has_bits_),
  69. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_wireformat_unittest::TestMessageSetWireFormatContainer, _internal_metadata_),
  70. ~0u, // no _extensions_
  71. ~0u, // no _oneof_case_
  72. ~0u, // no _weak_field_map_
  73. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_wireformat_unittest::TestMessageSetWireFormatContainer, message_set_),
  74. 0,
  75. };
  76. static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  77. { 0, 5, sizeof(::proto2_wireformat_unittest::TestMessageSet)},
  78. { 5, 11, sizeof(::proto2_wireformat_unittest::TestMessageSetWireFormatContainer)},
  79. };
  80. static ::google::protobuf::Message const * const file_default_instances[] = {
  81. reinterpret_cast<const ::google::protobuf::Message*>(&::proto2_wireformat_unittest::_TestMessageSet_default_instance_),
  82. reinterpret_cast<const ::google::protobuf::Message*>(&::proto2_wireformat_unittest::_TestMessageSetWireFormatContainer_default_instance_),
  83. };
  84. void protobuf_AssignDescriptors() {
  85. AddDescriptors();
  86. AssignDescriptors(
  87. "google/protobuf/unittest_mset_wire_format.proto", schemas, file_default_instances, TableStruct::offsets,
  88. file_level_metadata, NULL, NULL);
  89. }
  90. void protobuf_AssignDescriptorsOnce() {
  91. static ::google::protobuf::internal::once_flag once;
  92. ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
  93. }
  94. void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
  95. void protobuf_RegisterTypes(const ::std::string&) {
  96. protobuf_AssignDescriptorsOnce();
  97. ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 2);
  98. }
  99. void AddDescriptorsImpl() {
  100. InitDefaults();
  101. static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  102. "\n/google/protobuf/unittest_mset_wire_for"
  103. "mat.proto\022\032proto2_wireformat_unittest\"\036\n"
  104. "\016TestMessageSet*\010\010\004\020\377\377\377\377\007:\002\010\001\"d\n!TestMes"
  105. "sageSetWireFormatContainer\022\?\n\013message_se"
  106. "t\030\001 \001(\0132*.proto2_wireformat_unittest.Tes"
  107. "tMessageSetB)H\001\370\001\001\252\002!Google.ProtocolBuff"
  108. "ers.TestProtos"
  109. };
  110. ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
  111. descriptor, 254);
  112. ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
  113. "google/protobuf/unittest_mset_wire_format.proto", &protobuf_RegisterTypes);
  114. }
  115. void AddDescriptors() {
  116. static ::google::protobuf::internal::once_flag once;
  117. ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
  118. }
  119. // Force AddDescriptors() to be called at dynamic initialization time.
  120. struct StaticDescriptorInitializer {
  121. StaticDescriptorInitializer() {
  122. AddDescriptors();
  123. }
  124. } static_descriptor_initializer;
  125. } // namespace protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto
  126. namespace proto2_wireformat_unittest {
  127. // ===================================================================
  128. void TestMessageSet::InitAsDefaultInstance() {
  129. }
  130. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  131. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  132. TestMessageSet::TestMessageSet()
  133. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  134. ::google::protobuf::internal::InitSCC(
  135. &protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::scc_info_TestMessageSet.base);
  136. SharedCtor();
  137. // @@protoc_insertion_point(constructor:proto2_wireformat_unittest.TestMessageSet)
  138. }
  139. TestMessageSet::TestMessageSet(::google::protobuf::Arena* arena)
  140. : ::google::protobuf::Message(),
  141. _extensions_(arena),
  142. _internal_metadata_(arena) {
  143. ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::scc_info_TestMessageSet.base);
  144. SharedCtor();
  145. RegisterArenaDtor(arena);
  146. // @@protoc_insertion_point(arena_constructor:proto2_wireformat_unittest.TestMessageSet)
  147. }
  148. TestMessageSet::TestMessageSet(const TestMessageSet& from)
  149. : ::google::protobuf::Message(),
  150. _internal_metadata_(NULL),
  151. _has_bits_(from._has_bits_) {
  152. _internal_metadata_.MergeFrom(from._internal_metadata_);
  153. _extensions_.MergeFrom(from._extensions_);
  154. // @@protoc_insertion_point(copy_constructor:proto2_wireformat_unittest.TestMessageSet)
  155. }
  156. void TestMessageSet::SharedCtor() {
  157. }
  158. TestMessageSet::~TestMessageSet() {
  159. // @@protoc_insertion_point(destructor:proto2_wireformat_unittest.TestMessageSet)
  160. SharedDtor();
  161. }
  162. void TestMessageSet::SharedDtor() {
  163. GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  164. }
  165. void TestMessageSet::ArenaDtor(void* object) {
  166. TestMessageSet* _this = reinterpret_cast< TestMessageSet* >(object);
  167. (void)_this;
  168. }
  169. void TestMessageSet::RegisterArenaDtor(::google::protobuf::Arena* arena) {
  170. }
  171. void TestMessageSet::SetCachedSize(int size) const {
  172. _cached_size_.Set(size);
  173. }
  174. const ::google::protobuf::Descriptor* TestMessageSet::descriptor() {
  175. ::protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::protobuf_AssignDescriptorsOnce();
  176. return ::protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  177. }
  178. const TestMessageSet& TestMessageSet::default_instance() {
  179. ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::scc_info_TestMessageSet.base);
  180. return *internal_default_instance();
  181. }
  182. void TestMessageSet::Clear() {
  183. // @@protoc_insertion_point(message_clear_start:proto2_wireformat_unittest.TestMessageSet)
  184. ::google::protobuf::uint32 cached_has_bits = 0;
  185. // Prevent compiler warnings about cached_has_bits being unused
  186. (void) cached_has_bits;
  187. _extensions_.Clear();
  188. _has_bits_.Clear();
  189. _internal_metadata_.Clear();
  190. }
  191. bool TestMessageSet::MergePartialFromCodedStream(
  192. ::google::protobuf::io::CodedInputStream* input) {
  193. return _extensions_.ParseMessageSet(input,
  194. internal_default_instance(), _internal_metadata_.mutable_unknown_fields());
  195. }
  196. void TestMessageSet::SerializeWithCachedSizes(
  197. ::google::protobuf::io::CodedOutputStream* output) const {
  198. _extensions_.SerializeMessageSetWithCachedSizes(output);
  199. ::google::protobuf::internal::WireFormat::SerializeUnknownMessageSetItems(
  200. _internal_metadata_.unknown_fields(), output);
  201. }
  202. ::google::protobuf::uint8* TestMessageSet::InternalSerializeWithCachedSizesToArray(
  203. bool deterministic, ::google::protobuf::uint8* target) const {
  204. target = _extensions_.InternalSerializeMessageSetWithCachedSizesToArray(
  205. deterministic, target);
  206. target = ::google::protobuf::internal::WireFormat::
  207. SerializeUnknownMessageSetItemsToArray(
  208. _internal_metadata_.unknown_fields(), target);
  209. return target;
  210. }
  211. size_t TestMessageSet::ByteSizeLong() const {
  212. // @@protoc_insertion_point(message_set_byte_size_start:proto2_wireformat_unittest.TestMessageSet)
  213. size_t total_size = _extensions_.MessageSetByteSize();
  214. if (_internal_metadata_.have_unknown_fields()) {
  215. total_size += ::google::protobuf::internal::WireFormat::
  216. ComputeUnknownMessageSetItemsSize(_internal_metadata_.unknown_fields());
  217. }
  218. int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  219. SetCachedSize(cached_size);
  220. return total_size;
  221. }
  222. void TestMessageSet::MergeFrom(const ::google::protobuf::Message& from) {
  223. // @@protoc_insertion_point(generalized_merge_from_start:proto2_wireformat_unittest.TestMessageSet)
  224. GOOGLE_DCHECK_NE(&from, this);
  225. const TestMessageSet* source =
  226. ::google::protobuf::internal::DynamicCastToGenerated<const TestMessageSet>(
  227. &from);
  228. if (source == NULL) {
  229. // @@protoc_insertion_point(generalized_merge_from_cast_fail:proto2_wireformat_unittest.TestMessageSet)
  230. ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  231. } else {
  232. // @@protoc_insertion_point(generalized_merge_from_cast_success:proto2_wireformat_unittest.TestMessageSet)
  233. MergeFrom(*source);
  234. }
  235. }
  236. void TestMessageSet::MergeFrom(const TestMessageSet& from) {
  237. // @@protoc_insertion_point(class_specific_merge_from_start:proto2_wireformat_unittest.TestMessageSet)
  238. GOOGLE_DCHECK_NE(&from, this);
  239. _extensions_.MergeFrom(from._extensions_);
  240. _internal_metadata_.MergeFrom(from._internal_metadata_);
  241. ::google::protobuf::uint32 cached_has_bits = 0;
  242. (void) cached_has_bits;
  243. }
  244. void TestMessageSet::CopyFrom(const ::google::protobuf::Message& from) {
  245. // @@protoc_insertion_point(generalized_copy_from_start:proto2_wireformat_unittest.TestMessageSet)
  246. if (&from == this) return;
  247. Clear();
  248. MergeFrom(from);
  249. }
  250. void TestMessageSet::CopyFrom(const TestMessageSet& from) {
  251. // @@protoc_insertion_point(class_specific_copy_from_start:proto2_wireformat_unittest.TestMessageSet)
  252. if (&from == this) return;
  253. Clear();
  254. MergeFrom(from);
  255. }
  256. bool TestMessageSet::IsInitialized() const {
  257. if (!_extensions_.IsInitialized()) {
  258. return false;
  259. }
  260. return true;
  261. }
  262. void TestMessageSet::Swap(TestMessageSet* other) {
  263. if (other == this) return;
  264. if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
  265. InternalSwap(other);
  266. } else {
  267. TestMessageSet* temp = New(GetArenaNoVirtual());
  268. temp->MergeFrom(*other);
  269. other->CopyFrom(*this);
  270. InternalSwap(temp);
  271. if (GetArenaNoVirtual() == NULL) {
  272. delete temp;
  273. }
  274. }
  275. }
  276. void TestMessageSet::UnsafeArenaSwap(TestMessageSet* other) {
  277. if (other == this) return;
  278. GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  279. InternalSwap(other);
  280. }
  281. void TestMessageSet::InternalSwap(TestMessageSet* other) {
  282. using std::swap;
  283. swap(_has_bits_[0], other->_has_bits_[0]);
  284. _internal_metadata_.Swap(&other->_internal_metadata_);
  285. _extensions_.Swap(&other->_extensions_);
  286. }
  287. ::google::protobuf::Metadata TestMessageSet::GetMetadata() const {
  288. protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::protobuf_AssignDescriptorsOnce();
  289. return ::protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::file_level_metadata[kIndexInFileMessages];
  290. }
  291. // ===================================================================
  292. void TestMessageSetWireFormatContainer::InitAsDefaultInstance() {
  293. ::proto2_wireformat_unittest::_TestMessageSetWireFormatContainer_default_instance_._instance.get_mutable()->message_set_ = const_cast< ::proto2_wireformat_unittest::TestMessageSet*>(
  294. ::proto2_wireformat_unittest::TestMessageSet::internal_default_instance());
  295. }
  296. void TestMessageSetWireFormatContainer::unsafe_arena_set_allocated_message_set(
  297. ::proto2_wireformat_unittest::TestMessageSet* message_set) {
  298. if (GetArenaNoVirtual() == NULL) {
  299. delete message_set_;
  300. }
  301. message_set_ = message_set;
  302. if (message_set) {
  303. set_has_message_set();
  304. } else {
  305. clear_has_message_set();
  306. }
  307. // @@protoc_insertion_point(field_unsafe_arena_set_allocated:proto2_wireformat_unittest.TestMessageSetWireFormatContainer.message_set)
  308. }
  309. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  310. const int TestMessageSetWireFormatContainer::kMessageSetFieldNumber;
  311. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  312. TestMessageSetWireFormatContainer::TestMessageSetWireFormatContainer()
  313. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  314. ::google::protobuf::internal::InitSCC(
  315. &protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::scc_info_TestMessageSetWireFormatContainer.base);
  316. SharedCtor();
  317. // @@protoc_insertion_point(constructor:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  318. }
  319. TestMessageSetWireFormatContainer::TestMessageSetWireFormatContainer(::google::protobuf::Arena* arena)
  320. : ::google::protobuf::Message(),
  321. _internal_metadata_(arena) {
  322. ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::scc_info_TestMessageSetWireFormatContainer.base);
  323. SharedCtor();
  324. RegisterArenaDtor(arena);
  325. // @@protoc_insertion_point(arena_constructor:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  326. }
  327. TestMessageSetWireFormatContainer::TestMessageSetWireFormatContainer(const TestMessageSetWireFormatContainer& from)
  328. : ::google::protobuf::Message(),
  329. _internal_metadata_(NULL),
  330. _has_bits_(from._has_bits_) {
  331. _internal_metadata_.MergeFrom(from._internal_metadata_);
  332. if (from.has_message_set()) {
  333. message_set_ = new ::proto2_wireformat_unittest::TestMessageSet(*from.message_set_);
  334. } else {
  335. message_set_ = NULL;
  336. }
  337. // @@protoc_insertion_point(copy_constructor:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  338. }
  339. void TestMessageSetWireFormatContainer::SharedCtor() {
  340. message_set_ = NULL;
  341. }
  342. TestMessageSetWireFormatContainer::~TestMessageSetWireFormatContainer() {
  343. // @@protoc_insertion_point(destructor:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  344. SharedDtor();
  345. }
  346. void TestMessageSetWireFormatContainer::SharedDtor() {
  347. GOOGLE_DCHECK(GetArenaNoVirtual() == NULL);
  348. if (this != internal_default_instance()) delete message_set_;
  349. }
  350. void TestMessageSetWireFormatContainer::ArenaDtor(void* object) {
  351. TestMessageSetWireFormatContainer* _this = reinterpret_cast< TestMessageSetWireFormatContainer* >(object);
  352. (void)_this;
  353. }
  354. void TestMessageSetWireFormatContainer::RegisterArenaDtor(::google::protobuf::Arena* arena) {
  355. }
  356. void TestMessageSetWireFormatContainer::SetCachedSize(int size) const {
  357. _cached_size_.Set(size);
  358. }
  359. const ::google::protobuf::Descriptor* TestMessageSetWireFormatContainer::descriptor() {
  360. ::protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::protobuf_AssignDescriptorsOnce();
  361. return ::protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  362. }
  363. const TestMessageSetWireFormatContainer& TestMessageSetWireFormatContainer::default_instance() {
  364. ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::scc_info_TestMessageSetWireFormatContainer.base);
  365. return *internal_default_instance();
  366. }
  367. void TestMessageSetWireFormatContainer::Clear() {
  368. // @@protoc_insertion_point(message_clear_start:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  369. ::google::protobuf::uint32 cached_has_bits = 0;
  370. // Prevent compiler warnings about cached_has_bits being unused
  371. (void) cached_has_bits;
  372. cached_has_bits = _has_bits_[0];
  373. if (cached_has_bits & 0x00000001u) {
  374. GOOGLE_DCHECK(message_set_ != NULL);
  375. message_set_->Clear();
  376. }
  377. _has_bits_.Clear();
  378. _internal_metadata_.Clear();
  379. }
  380. bool TestMessageSetWireFormatContainer::MergePartialFromCodedStream(
  381. ::google::protobuf::io::CodedInputStream* input) {
  382. #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  383. ::google::protobuf::uint32 tag;
  384. // @@protoc_insertion_point(parse_start:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  385. for (;;) {
  386. ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
  387. tag = p.first;
  388. if (!p.second) goto handle_unusual;
  389. switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
  390. // optional .proto2_wireformat_unittest.TestMessageSet message_set = 1;
  391. case 1: {
  392. if (static_cast< ::google::protobuf::uint8>(tag) ==
  393. static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) {
  394. DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
  395. input, mutable_message_set()));
  396. } else {
  397. goto handle_unusual;
  398. }
  399. break;
  400. }
  401. default: {
  402. handle_unusual:
  403. if (tag == 0) {
  404. goto success;
  405. }
  406. DO_(::google::protobuf::internal::WireFormat::SkipField(
  407. input, tag, _internal_metadata_.mutable_unknown_fields()));
  408. break;
  409. }
  410. }
  411. }
  412. success:
  413. // @@protoc_insertion_point(parse_success:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  414. return true;
  415. failure:
  416. // @@protoc_insertion_point(parse_failure:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  417. return false;
  418. #undef DO_
  419. }
  420. void TestMessageSetWireFormatContainer::SerializeWithCachedSizes(
  421. ::google::protobuf::io::CodedOutputStream* output) const {
  422. // @@protoc_insertion_point(serialize_start:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  423. ::google::protobuf::uint32 cached_has_bits = 0;
  424. (void) cached_has_bits;
  425. cached_has_bits = _has_bits_[0];
  426. // optional .proto2_wireformat_unittest.TestMessageSet message_set = 1;
  427. if (cached_has_bits & 0x00000001u) {
  428. ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
  429. 1, this->_internal_message_set(), output);
  430. }
  431. if (_internal_metadata_.have_unknown_fields()) {
  432. ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
  433. _internal_metadata_.unknown_fields(), output);
  434. }
  435. // @@protoc_insertion_point(serialize_end:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  436. }
  437. ::google::protobuf::uint8* TestMessageSetWireFormatContainer::InternalSerializeWithCachedSizesToArray(
  438. bool deterministic, ::google::protobuf::uint8* target) const {
  439. (void)deterministic; // Unused
  440. // @@protoc_insertion_point(serialize_to_array_start:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  441. ::google::protobuf::uint32 cached_has_bits = 0;
  442. (void) cached_has_bits;
  443. cached_has_bits = _has_bits_[0];
  444. // optional .proto2_wireformat_unittest.TestMessageSet message_set = 1;
  445. if (cached_has_bits & 0x00000001u) {
  446. target = ::google::protobuf::internal::WireFormatLite::
  447. InternalWriteMessageToArray(
  448. 1, this->_internal_message_set(), deterministic, target);
  449. }
  450. if (_internal_metadata_.have_unknown_fields()) {
  451. target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
  452. _internal_metadata_.unknown_fields(), target);
  453. }
  454. // @@protoc_insertion_point(serialize_to_array_end:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  455. return target;
  456. }
  457. size_t TestMessageSetWireFormatContainer::ByteSizeLong() const {
  458. // @@protoc_insertion_point(message_byte_size_start:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  459. size_t total_size = 0;
  460. if (_internal_metadata_.have_unknown_fields()) {
  461. total_size +=
  462. ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
  463. _internal_metadata_.unknown_fields());
  464. }
  465. // optional .proto2_wireformat_unittest.TestMessageSet message_set = 1;
  466. if (has_message_set()) {
  467. total_size += 1 +
  468. ::google::protobuf::internal::WireFormatLite::MessageSize(
  469. *message_set_);
  470. }
  471. int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  472. SetCachedSize(cached_size);
  473. return total_size;
  474. }
  475. void TestMessageSetWireFormatContainer::MergeFrom(const ::google::protobuf::Message& from) {
  476. // @@protoc_insertion_point(generalized_merge_from_start:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  477. GOOGLE_DCHECK_NE(&from, this);
  478. const TestMessageSetWireFormatContainer* source =
  479. ::google::protobuf::internal::DynamicCastToGenerated<const TestMessageSetWireFormatContainer>(
  480. &from);
  481. if (source == NULL) {
  482. // @@protoc_insertion_point(generalized_merge_from_cast_fail:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  483. ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  484. } else {
  485. // @@protoc_insertion_point(generalized_merge_from_cast_success:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  486. MergeFrom(*source);
  487. }
  488. }
  489. void TestMessageSetWireFormatContainer::MergeFrom(const TestMessageSetWireFormatContainer& from) {
  490. // @@protoc_insertion_point(class_specific_merge_from_start:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  491. GOOGLE_DCHECK_NE(&from, this);
  492. _internal_metadata_.MergeFrom(from._internal_metadata_);
  493. ::google::protobuf::uint32 cached_has_bits = 0;
  494. (void) cached_has_bits;
  495. if (from.has_message_set()) {
  496. mutable_message_set()->::proto2_wireformat_unittest::TestMessageSet::MergeFrom(from.message_set());
  497. }
  498. }
  499. void TestMessageSetWireFormatContainer::CopyFrom(const ::google::protobuf::Message& from) {
  500. // @@protoc_insertion_point(generalized_copy_from_start:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  501. if (&from == this) return;
  502. Clear();
  503. MergeFrom(from);
  504. }
  505. void TestMessageSetWireFormatContainer::CopyFrom(const TestMessageSetWireFormatContainer& from) {
  506. // @@protoc_insertion_point(class_specific_copy_from_start:proto2_wireformat_unittest.TestMessageSetWireFormatContainer)
  507. if (&from == this) return;
  508. Clear();
  509. MergeFrom(from);
  510. }
  511. bool TestMessageSetWireFormatContainer::IsInitialized() const {
  512. if (has_message_set()) {
  513. if (!this->message_set_->IsInitialized()) return false;
  514. }
  515. return true;
  516. }
  517. void TestMessageSetWireFormatContainer::Swap(TestMessageSetWireFormatContainer* other) {
  518. if (other == this) return;
  519. if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
  520. InternalSwap(other);
  521. } else {
  522. TestMessageSetWireFormatContainer* temp = New(GetArenaNoVirtual());
  523. temp->MergeFrom(*other);
  524. other->CopyFrom(*this);
  525. InternalSwap(temp);
  526. if (GetArenaNoVirtual() == NULL) {
  527. delete temp;
  528. }
  529. }
  530. }
  531. void TestMessageSetWireFormatContainer::UnsafeArenaSwap(TestMessageSetWireFormatContainer* other) {
  532. if (other == this) return;
  533. GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
  534. InternalSwap(other);
  535. }
  536. void TestMessageSetWireFormatContainer::InternalSwap(TestMessageSetWireFormatContainer* other) {
  537. using std::swap;
  538. swap(message_set_, other->message_set_);
  539. swap(_has_bits_[0], other->_has_bits_[0]);
  540. _internal_metadata_.Swap(&other->_internal_metadata_);
  541. }
  542. ::google::protobuf::Metadata TestMessageSetWireFormatContainer::GetMetadata() const {
  543. protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::protobuf_AssignDescriptorsOnce();
  544. return ::protobuf_google_2fprotobuf_2funittest_5fmset_5fwire_5fformat_2eproto::file_level_metadata[kIndexInFileMessages];
  545. }
  546. // @@protoc_insertion_point(namespace_scope)
  547. } // namespace proto2_wireformat_unittest
  548. namespace google {
  549. namespace protobuf {
  550. template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::proto2_wireformat_unittest::TestMessageSet* Arena::CreateMaybeMessage< ::proto2_wireformat_unittest::TestMessageSet >(Arena* arena) {
  551. return Arena::CreateMessageInternal< ::proto2_wireformat_unittest::TestMessageSet >(arena);
  552. }
  553. template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::proto2_wireformat_unittest::TestMessageSetWireFormatContainer* Arena::CreateMaybeMessage< ::proto2_wireformat_unittest::TestMessageSetWireFormatContainer >(Arena* arena) {
  554. return Arena::CreateMessageInternal< ::proto2_wireformat_unittest::TestMessageSetWireFormatContainer >(arena);
  555. }
  556. } // namespace protobuf
  557. } // namespace google
  558. // @@protoc_insertion_point(global_scope)