unittest_preserve_unknown_enum.pb.cc 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: google/protobuf/unittest_preserve_unknown_enum.proto
  3. #include <google/protobuf/unittest_preserve_unknown_enum.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 proto3_preserve_unknown_enum_unittest {
  19. class MyMessageDefaultTypeInternal {
  20. public:
  21. ::google::protobuf::internal::ExplicitlyConstructed<MyMessage>
  22. _instance;
  23. int oneof_e_1_;
  24. int oneof_e_2_;
  25. } _MyMessage_default_instance_;
  26. class MyMessagePlusExtraDefaultTypeInternal {
  27. public:
  28. ::google::protobuf::internal::ExplicitlyConstructed<MyMessagePlusExtra>
  29. _instance;
  30. int oneof_e_1_;
  31. int oneof_e_2_;
  32. } _MyMessagePlusExtra_default_instance_;
  33. } // namespace proto3_preserve_unknown_enum_unittest
  34. namespace protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto {
  35. static void InitDefaultsMyMessage() {
  36. GOOGLE_PROTOBUF_VERIFY_VERSION;
  37. {
  38. void* ptr = &::proto3_preserve_unknown_enum_unittest::_MyMessage_default_instance_;
  39. new (ptr) ::proto3_preserve_unknown_enum_unittest::MyMessage();
  40. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  41. }
  42. ::proto3_preserve_unknown_enum_unittest::MyMessage::InitAsDefaultInstance();
  43. }
  44. ::google::protobuf::internal::SCCInfo<0> scc_info_MyMessage =
  45. {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsMyMessage}, {}};
  46. static void InitDefaultsMyMessagePlusExtra() {
  47. GOOGLE_PROTOBUF_VERIFY_VERSION;
  48. {
  49. void* ptr = &::proto3_preserve_unknown_enum_unittest::_MyMessagePlusExtra_default_instance_;
  50. new (ptr) ::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra();
  51. ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
  52. }
  53. ::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra::InitAsDefaultInstance();
  54. }
  55. ::google::protobuf::internal::SCCInfo<0> scc_info_MyMessagePlusExtra =
  56. {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsMyMessagePlusExtra}, {}};
  57. void InitDefaults() {
  58. ::google::protobuf::internal::InitSCC(&scc_info_MyMessage.base);
  59. ::google::protobuf::internal::InitSCC(&scc_info_MyMessagePlusExtra.base);
  60. }
  61. ::google::protobuf::Metadata file_level_metadata[2];
  62. const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[2];
  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(::proto3_preserve_unknown_enum_unittest::MyMessage, _internal_metadata_),
  66. ~0u, // no _extensions_
  67. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessage, _oneof_case_[0]),
  68. ~0u, // no _weak_field_map_
  69. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessage, e_),
  70. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessage, repeated_e_),
  71. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessage, repeated_packed_e_),
  72. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessage, repeated_packed_unexpected_e_),
  73. offsetof(::proto3_preserve_unknown_enum_unittest::MyMessageDefaultTypeInternal, oneof_e_1_),
  74. offsetof(::proto3_preserve_unknown_enum_unittest::MyMessageDefaultTypeInternal, oneof_e_2_),
  75. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessage, o_),
  76. ~0u, // no _has_bits_
  77. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, _internal_metadata_),
  78. ~0u, // no _extensions_
  79. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, _oneof_case_[0]),
  80. ~0u, // no _weak_field_map_
  81. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, e_),
  82. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, repeated_e_),
  83. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, repeated_packed_e_),
  84. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, repeated_packed_unexpected_e_),
  85. offsetof(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtraDefaultTypeInternal, oneof_e_1_),
  86. offsetof(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtraDefaultTypeInternal, oneof_e_2_),
  87. GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra, o_),
  88. };
  89. static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  90. { 0, -1, sizeof(::proto3_preserve_unknown_enum_unittest::MyMessage)},
  91. { 12, -1, sizeof(::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra)},
  92. };
  93. static ::google::protobuf::Message const * const file_default_instances[] = {
  94. reinterpret_cast<const ::google::protobuf::Message*>(&::proto3_preserve_unknown_enum_unittest::_MyMessage_default_instance_),
  95. reinterpret_cast<const ::google::protobuf::Message*>(&::proto3_preserve_unknown_enum_unittest::_MyMessagePlusExtra_default_instance_),
  96. };
  97. void protobuf_AssignDescriptors() {
  98. AddDescriptors();
  99. AssignDescriptors(
  100. "google/protobuf/unittest_preserve_unknown_enum.proto", schemas, file_default_instances, TableStruct::offsets,
  101. file_level_metadata, file_level_enum_descriptors, NULL);
  102. }
  103. void protobuf_AssignDescriptorsOnce() {
  104. static ::google::protobuf::internal::once_flag once;
  105. ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors);
  106. }
  107. void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
  108. void protobuf_RegisterTypes(const ::std::string&) {
  109. protobuf_AssignDescriptorsOnce();
  110. ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 2);
  111. }
  112. void AddDescriptorsImpl() {
  113. InitDefaults();
  114. static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  115. "\n4google/protobuf/unittest_preserve_unkn"
  116. "own_enum.proto\022%proto3_preserve_unknown_"
  117. "enum_unittest\"\301\003\n\tMyMessage\0228\n\001e\030\001 \001(\0162-"
  118. ".proto3_preserve_unknown_enum_unittest.M"
  119. "yEnum\022A\n\nrepeated_e\030\002 \003(\0162-.proto3_prese"
  120. "rve_unknown_enum_unittest.MyEnum\022L\n\021repe"
  121. "ated_packed_e\030\003 \003(\0162-.proto3_preserve_un"
  122. "known_enum_unittest.MyEnumB\002\020\001\022\\\n\034repeat"
  123. "ed_packed_unexpected_e\030\004 \003(\01626.proto3_pr"
  124. "eserve_unknown_enum_unittest.MyEnumPlusE"
  125. "xtra\022B\n\toneof_e_1\030\005 \001(\0162-.proto3_preserv"
  126. "e_unknown_enum_unittest.MyEnumH\000\022B\n\toneo"
  127. "f_e_2\030\006 \001(\0162-.proto3_preserve_unknown_en"
  128. "um_unittest.MyEnumH\000B\003\n\001o\"\373\003\n\022MyMessageP"
  129. "lusExtra\022A\n\001e\030\001 \001(\01626.proto3_preserve_un"
  130. "known_enum_unittest.MyEnumPlusExtra\022J\n\nr"
  131. "epeated_e\030\002 \003(\01626.proto3_preserve_unknow"
  132. "n_enum_unittest.MyEnumPlusExtra\022U\n\021repea"
  133. "ted_packed_e\030\003 \003(\01626.proto3_preserve_unk"
  134. "nown_enum_unittest.MyEnumPlusExtraB\002\020\001\022`"
  135. "\n\034repeated_packed_unexpected_e\030\004 \003(\01626.p"
  136. "roto3_preserve_unknown_enum_unittest.MyE"
  137. "numPlusExtraB\002\020\001\022K\n\toneof_e_1\030\005 \001(\01626.pr"
  138. "oto3_preserve_unknown_enum_unittest.MyEn"
  139. "umPlusExtraH\000\022K\n\toneof_e_2\030\006 \001(\01626.proto"
  140. "3_preserve_unknown_enum_unittest.MyEnumP"
  141. "lusExtraH\000B\003\n\001o*#\n\006MyEnum\022\007\n\003FOO\020\000\022\007\n\003BA"
  142. "R\020\001\022\007\n\003BAZ\020\002*\?\n\017MyEnumPlusExtra\022\t\n\005E_FOO"
  143. "\020\000\022\t\n\005E_BAR\020\001\022\t\n\005E_BAZ\020\002\022\013\n\007E_EXTRA\020\003B,\242"
  144. "\002\014UnknownEnums\252\002\032Google.Protobuf.TestPro"
  145. "tosb\006proto3"
  146. };
  147. ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
  148. descriptor, 1211);
  149. ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
  150. "google/protobuf/unittest_preserve_unknown_enum.proto", &protobuf_RegisterTypes);
  151. }
  152. void AddDescriptors() {
  153. static ::google::protobuf::internal::once_flag once;
  154. ::google::protobuf::internal::call_once(once, AddDescriptorsImpl);
  155. }
  156. // Force AddDescriptors() to be called at dynamic initialization time.
  157. struct StaticDescriptorInitializer {
  158. StaticDescriptorInitializer() {
  159. AddDescriptors();
  160. }
  161. } static_descriptor_initializer;
  162. } // namespace protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto
  163. namespace proto3_preserve_unknown_enum_unittest {
  164. const ::google::protobuf::EnumDescriptor* MyEnum_descriptor() {
  165. protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::protobuf_AssignDescriptorsOnce();
  166. return protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::file_level_enum_descriptors[0];
  167. }
  168. bool MyEnum_IsValid(int value) {
  169. switch (value) {
  170. case 0:
  171. case 1:
  172. case 2:
  173. return true;
  174. default:
  175. return false;
  176. }
  177. }
  178. const ::google::protobuf::EnumDescriptor* MyEnumPlusExtra_descriptor() {
  179. protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::protobuf_AssignDescriptorsOnce();
  180. return protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::file_level_enum_descriptors[1];
  181. }
  182. bool MyEnumPlusExtra_IsValid(int value) {
  183. switch (value) {
  184. case 0:
  185. case 1:
  186. case 2:
  187. case 3:
  188. return true;
  189. default:
  190. return false;
  191. }
  192. }
  193. // ===================================================================
  194. void MyMessage::InitAsDefaultInstance() {
  195. ::proto3_preserve_unknown_enum_unittest::_MyMessage_default_instance_.oneof_e_1_ = 0;
  196. ::proto3_preserve_unknown_enum_unittest::_MyMessage_default_instance_.oneof_e_2_ = 0;
  197. }
  198. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  199. const int MyMessage::kEFieldNumber;
  200. const int MyMessage::kRepeatedEFieldNumber;
  201. const int MyMessage::kRepeatedPackedEFieldNumber;
  202. const int MyMessage::kRepeatedPackedUnexpectedEFieldNumber;
  203. const int MyMessage::kOneofE1FieldNumber;
  204. const int MyMessage::kOneofE2FieldNumber;
  205. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  206. MyMessage::MyMessage()
  207. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  208. ::google::protobuf::internal::InitSCC(
  209. &protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::scc_info_MyMessage.base);
  210. SharedCtor();
  211. // @@protoc_insertion_point(constructor:proto3_preserve_unknown_enum_unittest.MyMessage)
  212. }
  213. MyMessage::MyMessage(const MyMessage& from)
  214. : ::google::protobuf::Message(),
  215. _internal_metadata_(NULL),
  216. repeated_e_(from.repeated_e_),
  217. repeated_packed_e_(from.repeated_packed_e_),
  218. repeated_packed_unexpected_e_(from.repeated_packed_unexpected_e_) {
  219. _internal_metadata_.MergeFrom(from._internal_metadata_);
  220. e_ = from.e_;
  221. clear_has_o();
  222. switch (from.o_case()) {
  223. case kOneofE1: {
  224. set_oneof_e_1(from.oneof_e_1());
  225. break;
  226. }
  227. case kOneofE2: {
  228. set_oneof_e_2(from.oneof_e_2());
  229. break;
  230. }
  231. case O_NOT_SET: {
  232. break;
  233. }
  234. }
  235. // @@protoc_insertion_point(copy_constructor:proto3_preserve_unknown_enum_unittest.MyMessage)
  236. }
  237. void MyMessage::SharedCtor() {
  238. e_ = 0;
  239. clear_has_o();
  240. }
  241. MyMessage::~MyMessage() {
  242. // @@protoc_insertion_point(destructor:proto3_preserve_unknown_enum_unittest.MyMessage)
  243. SharedDtor();
  244. }
  245. void MyMessage::SharedDtor() {
  246. if (has_o()) {
  247. clear_o();
  248. }
  249. }
  250. void MyMessage::SetCachedSize(int size) const {
  251. _cached_size_.Set(size);
  252. }
  253. const ::google::protobuf::Descriptor* MyMessage::descriptor() {
  254. ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::protobuf_AssignDescriptorsOnce();
  255. return ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  256. }
  257. const MyMessage& MyMessage::default_instance() {
  258. ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::scc_info_MyMessage.base);
  259. return *internal_default_instance();
  260. }
  261. void MyMessage::clear_o() {
  262. // @@protoc_insertion_point(one_of_clear_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  263. switch (o_case()) {
  264. case kOneofE1: {
  265. // No need to clear
  266. break;
  267. }
  268. case kOneofE2: {
  269. // No need to clear
  270. break;
  271. }
  272. case O_NOT_SET: {
  273. break;
  274. }
  275. }
  276. _oneof_case_[0] = O_NOT_SET;
  277. }
  278. void MyMessage::Clear() {
  279. // @@protoc_insertion_point(message_clear_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  280. ::google::protobuf::uint32 cached_has_bits = 0;
  281. // Prevent compiler warnings about cached_has_bits being unused
  282. (void) cached_has_bits;
  283. repeated_e_.Clear();
  284. repeated_packed_e_.Clear();
  285. repeated_packed_unexpected_e_.Clear();
  286. e_ = 0;
  287. clear_o();
  288. _internal_metadata_.Clear();
  289. }
  290. bool MyMessage::MergePartialFromCodedStream(
  291. ::google::protobuf::io::CodedInputStream* input) {
  292. #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  293. ::google::protobuf::uint32 tag;
  294. // @@protoc_insertion_point(parse_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  295. for (;;) {
  296. ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
  297. tag = p.first;
  298. if (!p.second) goto handle_unusual;
  299. switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
  300. // .proto3_preserve_unknown_enum_unittest.MyEnum e = 1;
  301. case 1: {
  302. if (static_cast< ::google::protobuf::uint8>(tag) ==
  303. static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
  304. int value;
  305. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  306. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  307. input, &value)));
  308. set_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
  309. } else {
  310. goto handle_unusual;
  311. }
  312. break;
  313. }
  314. // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_e = 2;
  315. case 2: {
  316. if (static_cast< ::google::protobuf::uint8>(tag) ==
  317. static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
  318. ::google::protobuf::uint32 length;
  319. DO_(input->ReadVarint32(&length));
  320. ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(static_cast<int>(length));
  321. while (input->BytesUntilLimit() > 0) {
  322. int value;
  323. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  324. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  325. input, &value)));
  326. add_repeated_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
  327. }
  328. input->PopLimit(limit);
  329. } else if (
  330. static_cast< ::google::protobuf::uint8>(tag) ==
  331. static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
  332. int value;
  333. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  334. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  335. input, &value)));
  336. add_repeated_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
  337. } else {
  338. goto handle_unusual;
  339. }
  340. break;
  341. }
  342. // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_packed_e = 3 [packed = true];
  343. case 3: {
  344. if (static_cast< ::google::protobuf::uint8>(tag) ==
  345. static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
  346. ::google::protobuf::uint32 length;
  347. DO_(input->ReadVarint32(&length));
  348. ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(static_cast<int>(length));
  349. while (input->BytesUntilLimit() > 0) {
  350. int value;
  351. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  352. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  353. input, &value)));
  354. add_repeated_packed_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
  355. }
  356. input->PopLimit(limit);
  357. } else if (
  358. static_cast< ::google::protobuf::uint8>(tag) ==
  359. static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
  360. int value;
  361. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  362. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  363. input, &value)));
  364. add_repeated_packed_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
  365. } else {
  366. goto handle_unusual;
  367. }
  368. break;
  369. }
  370. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4;
  371. case 4: {
  372. if (static_cast< ::google::protobuf::uint8>(tag) ==
  373. static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
  374. ::google::protobuf::uint32 length;
  375. DO_(input->ReadVarint32(&length));
  376. ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(static_cast<int>(length));
  377. while (input->BytesUntilLimit() > 0) {
  378. int value;
  379. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  380. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  381. input, &value)));
  382. add_repeated_packed_unexpected_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
  383. }
  384. input->PopLimit(limit);
  385. } else if (
  386. static_cast< ::google::protobuf::uint8>(tag) ==
  387. static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {
  388. int value;
  389. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  390. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  391. input, &value)));
  392. add_repeated_packed_unexpected_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
  393. } else {
  394. goto handle_unusual;
  395. }
  396. break;
  397. }
  398. // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_1 = 5;
  399. case 5: {
  400. if (static_cast< ::google::protobuf::uint8>(tag) ==
  401. static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) {
  402. int value;
  403. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  404. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  405. input, &value)));
  406. set_oneof_e_1(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
  407. } else {
  408. goto handle_unusual;
  409. }
  410. break;
  411. }
  412. // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_2 = 6;
  413. case 6: {
  414. if (static_cast< ::google::protobuf::uint8>(tag) ==
  415. static_cast< ::google::protobuf::uint8>(48u /* 48 & 0xFF */)) {
  416. int value;
  417. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  418. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  419. input, &value)));
  420. set_oneof_e_2(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnum >(value));
  421. } else {
  422. goto handle_unusual;
  423. }
  424. break;
  425. }
  426. default: {
  427. handle_unusual:
  428. if (tag == 0) {
  429. goto success;
  430. }
  431. DO_(::google::protobuf::internal::WireFormat::SkipField(
  432. input, tag, _internal_metadata_.mutable_unknown_fields()));
  433. break;
  434. }
  435. }
  436. }
  437. success:
  438. // @@protoc_insertion_point(parse_success:proto3_preserve_unknown_enum_unittest.MyMessage)
  439. return true;
  440. failure:
  441. // @@protoc_insertion_point(parse_failure:proto3_preserve_unknown_enum_unittest.MyMessage)
  442. return false;
  443. #undef DO_
  444. }
  445. void MyMessage::SerializeWithCachedSizes(
  446. ::google::protobuf::io::CodedOutputStream* output) const {
  447. // @@protoc_insertion_point(serialize_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  448. ::google::protobuf::uint32 cached_has_bits = 0;
  449. (void) cached_has_bits;
  450. // .proto3_preserve_unknown_enum_unittest.MyEnum e = 1;
  451. if (this->e() != 0) {
  452. ::google::protobuf::internal::WireFormatLite::WriteEnum(
  453. 1, this->e(), output);
  454. }
  455. // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_e = 2;
  456. if (this->repeated_e_size() > 0) {
  457. ::google::protobuf::internal::WireFormatLite::WriteTag(
  458. 2,
  459. ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
  460. output);
  461. output->WriteVarint32(
  462. static_cast< ::google::protobuf::uint32>(_repeated_e_cached_byte_size_));
  463. }
  464. for (int i = 0, n = this->repeated_e_size(); i < n; i++) {
  465. ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag(
  466. this->repeated_e(i), output);
  467. }
  468. // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_packed_e = 3 [packed = true];
  469. if (this->repeated_packed_e_size() > 0) {
  470. ::google::protobuf::internal::WireFormatLite::WriteTag(
  471. 3,
  472. ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
  473. output);
  474. output->WriteVarint32(
  475. static_cast< ::google::protobuf::uint32>(_repeated_packed_e_cached_byte_size_));
  476. }
  477. for (int i = 0, n = this->repeated_packed_e_size(); i < n; i++) {
  478. ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag(
  479. this->repeated_packed_e(i), output);
  480. }
  481. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4;
  482. if (this->repeated_packed_unexpected_e_size() > 0) {
  483. ::google::protobuf::internal::WireFormatLite::WriteTag(
  484. 4,
  485. ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
  486. output);
  487. output->WriteVarint32(
  488. static_cast< ::google::protobuf::uint32>(_repeated_packed_unexpected_e_cached_byte_size_));
  489. }
  490. for (int i = 0, n = this->repeated_packed_unexpected_e_size(); i < n; i++) {
  491. ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag(
  492. this->repeated_packed_unexpected_e(i), output);
  493. }
  494. // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_1 = 5;
  495. if (has_oneof_e_1()) {
  496. ::google::protobuf::internal::WireFormatLite::WriteEnum(
  497. 5, this->oneof_e_1(), output);
  498. }
  499. // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_2 = 6;
  500. if (has_oneof_e_2()) {
  501. ::google::protobuf::internal::WireFormatLite::WriteEnum(
  502. 6, this->oneof_e_2(), output);
  503. }
  504. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  505. ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
  506. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
  507. }
  508. // @@protoc_insertion_point(serialize_end:proto3_preserve_unknown_enum_unittest.MyMessage)
  509. }
  510. ::google::protobuf::uint8* MyMessage::InternalSerializeWithCachedSizesToArray(
  511. bool deterministic, ::google::protobuf::uint8* target) const {
  512. (void)deterministic; // Unused
  513. // @@protoc_insertion_point(serialize_to_array_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  514. ::google::protobuf::uint32 cached_has_bits = 0;
  515. (void) cached_has_bits;
  516. // .proto3_preserve_unknown_enum_unittest.MyEnum e = 1;
  517. if (this->e() != 0) {
  518. target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
  519. 1, this->e(), target);
  520. }
  521. // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_e = 2;
  522. if (this->repeated_e_size() > 0) {
  523. target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
  524. 2,
  525. ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
  526. target);
  527. target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( static_cast< ::google::protobuf::uint32>(
  528. _repeated_e_cached_byte_size_), target);
  529. target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(
  530. this->repeated_e_, target);
  531. }
  532. // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_packed_e = 3 [packed = true];
  533. if (this->repeated_packed_e_size() > 0) {
  534. target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
  535. 3,
  536. ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
  537. target);
  538. target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( static_cast< ::google::protobuf::uint32>(
  539. _repeated_packed_e_cached_byte_size_), target);
  540. target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(
  541. this->repeated_packed_e_, target);
  542. }
  543. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4;
  544. if (this->repeated_packed_unexpected_e_size() > 0) {
  545. target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
  546. 4,
  547. ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
  548. target);
  549. target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( static_cast< ::google::protobuf::uint32>(
  550. _repeated_packed_unexpected_e_cached_byte_size_), target);
  551. target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(
  552. this->repeated_packed_unexpected_e_, target);
  553. }
  554. // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_1 = 5;
  555. if (has_oneof_e_1()) {
  556. target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
  557. 5, this->oneof_e_1(), target);
  558. }
  559. // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_2 = 6;
  560. if (has_oneof_e_2()) {
  561. target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
  562. 6, this->oneof_e_2(), target);
  563. }
  564. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  565. target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
  566. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
  567. }
  568. // @@protoc_insertion_point(serialize_to_array_end:proto3_preserve_unknown_enum_unittest.MyMessage)
  569. return target;
  570. }
  571. size_t MyMessage::ByteSizeLong() const {
  572. // @@protoc_insertion_point(message_byte_size_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  573. size_t total_size = 0;
  574. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  575. total_size +=
  576. ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
  577. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
  578. }
  579. // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_e = 2;
  580. {
  581. size_t data_size = 0;
  582. unsigned int count = static_cast<unsigned int>(this->repeated_e_size());for (unsigned int i = 0; i < count; i++) {
  583. data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
  584. this->repeated_e(static_cast<int>(i)));
  585. }
  586. if (data_size > 0) {
  587. total_size += 1 +
  588. ::google::protobuf::internal::WireFormatLite::Int32Size(
  589. static_cast< ::google::protobuf::int32>(data_size));
  590. }
  591. int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
  592. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  593. _repeated_e_cached_byte_size_ = cached_size;
  594. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  595. total_size += data_size;
  596. }
  597. // repeated .proto3_preserve_unknown_enum_unittest.MyEnum repeated_packed_e = 3 [packed = true];
  598. {
  599. size_t data_size = 0;
  600. unsigned int count = static_cast<unsigned int>(this->repeated_packed_e_size());for (unsigned int i = 0; i < count; i++) {
  601. data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
  602. this->repeated_packed_e(static_cast<int>(i)));
  603. }
  604. if (data_size > 0) {
  605. total_size += 1 +
  606. ::google::protobuf::internal::WireFormatLite::Int32Size(
  607. static_cast< ::google::protobuf::int32>(data_size));
  608. }
  609. int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
  610. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  611. _repeated_packed_e_cached_byte_size_ = cached_size;
  612. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  613. total_size += data_size;
  614. }
  615. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4;
  616. {
  617. size_t data_size = 0;
  618. unsigned int count = static_cast<unsigned int>(this->repeated_packed_unexpected_e_size());for (unsigned int i = 0; i < count; i++) {
  619. data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
  620. this->repeated_packed_unexpected_e(static_cast<int>(i)));
  621. }
  622. if (data_size > 0) {
  623. total_size += 1 +
  624. ::google::protobuf::internal::WireFormatLite::Int32Size(
  625. static_cast< ::google::protobuf::int32>(data_size));
  626. }
  627. int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
  628. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  629. _repeated_packed_unexpected_e_cached_byte_size_ = cached_size;
  630. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  631. total_size += data_size;
  632. }
  633. // .proto3_preserve_unknown_enum_unittest.MyEnum e = 1;
  634. if (this->e() != 0) {
  635. total_size += 1 +
  636. ::google::protobuf::internal::WireFormatLite::EnumSize(this->e());
  637. }
  638. switch (o_case()) {
  639. // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_1 = 5;
  640. case kOneofE1: {
  641. total_size += 1 +
  642. ::google::protobuf::internal::WireFormatLite::EnumSize(this->oneof_e_1());
  643. break;
  644. }
  645. // .proto3_preserve_unknown_enum_unittest.MyEnum oneof_e_2 = 6;
  646. case kOneofE2: {
  647. total_size += 1 +
  648. ::google::protobuf::internal::WireFormatLite::EnumSize(this->oneof_e_2());
  649. break;
  650. }
  651. case O_NOT_SET: {
  652. break;
  653. }
  654. }
  655. int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  656. SetCachedSize(cached_size);
  657. return total_size;
  658. }
  659. void MyMessage::MergeFrom(const ::google::protobuf::Message& from) {
  660. // @@protoc_insertion_point(generalized_merge_from_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  661. GOOGLE_DCHECK_NE(&from, this);
  662. const MyMessage* source =
  663. ::google::protobuf::internal::DynamicCastToGenerated<const MyMessage>(
  664. &from);
  665. if (source == NULL) {
  666. // @@protoc_insertion_point(generalized_merge_from_cast_fail:proto3_preserve_unknown_enum_unittest.MyMessage)
  667. ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  668. } else {
  669. // @@protoc_insertion_point(generalized_merge_from_cast_success:proto3_preserve_unknown_enum_unittest.MyMessage)
  670. MergeFrom(*source);
  671. }
  672. }
  673. void MyMessage::MergeFrom(const MyMessage& from) {
  674. // @@protoc_insertion_point(class_specific_merge_from_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  675. GOOGLE_DCHECK_NE(&from, this);
  676. _internal_metadata_.MergeFrom(from._internal_metadata_);
  677. ::google::protobuf::uint32 cached_has_bits = 0;
  678. (void) cached_has_bits;
  679. repeated_e_.MergeFrom(from.repeated_e_);
  680. repeated_packed_e_.MergeFrom(from.repeated_packed_e_);
  681. repeated_packed_unexpected_e_.MergeFrom(from.repeated_packed_unexpected_e_);
  682. if (from.e() != 0) {
  683. set_e(from.e());
  684. }
  685. switch (from.o_case()) {
  686. case kOneofE1: {
  687. set_oneof_e_1(from.oneof_e_1());
  688. break;
  689. }
  690. case kOneofE2: {
  691. set_oneof_e_2(from.oneof_e_2());
  692. break;
  693. }
  694. case O_NOT_SET: {
  695. break;
  696. }
  697. }
  698. }
  699. void MyMessage::CopyFrom(const ::google::protobuf::Message& from) {
  700. // @@protoc_insertion_point(generalized_copy_from_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  701. if (&from == this) return;
  702. Clear();
  703. MergeFrom(from);
  704. }
  705. void MyMessage::CopyFrom(const MyMessage& from) {
  706. // @@protoc_insertion_point(class_specific_copy_from_start:proto3_preserve_unknown_enum_unittest.MyMessage)
  707. if (&from == this) return;
  708. Clear();
  709. MergeFrom(from);
  710. }
  711. bool MyMessage::IsInitialized() const {
  712. return true;
  713. }
  714. void MyMessage::Swap(MyMessage* other) {
  715. if (other == this) return;
  716. InternalSwap(other);
  717. }
  718. void MyMessage::InternalSwap(MyMessage* other) {
  719. using std::swap;
  720. repeated_e_.InternalSwap(&other->repeated_e_);
  721. repeated_packed_e_.InternalSwap(&other->repeated_packed_e_);
  722. repeated_packed_unexpected_e_.InternalSwap(&other->repeated_packed_unexpected_e_);
  723. swap(e_, other->e_);
  724. swap(o_, other->o_);
  725. swap(_oneof_case_[0], other->_oneof_case_[0]);
  726. _internal_metadata_.Swap(&other->_internal_metadata_);
  727. }
  728. ::google::protobuf::Metadata MyMessage::GetMetadata() const {
  729. protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::protobuf_AssignDescriptorsOnce();
  730. return ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::file_level_metadata[kIndexInFileMessages];
  731. }
  732. // ===================================================================
  733. void MyMessagePlusExtra::InitAsDefaultInstance() {
  734. ::proto3_preserve_unknown_enum_unittest::_MyMessagePlusExtra_default_instance_.oneof_e_1_ = 0;
  735. ::proto3_preserve_unknown_enum_unittest::_MyMessagePlusExtra_default_instance_.oneof_e_2_ = 0;
  736. }
  737. #if !defined(_MSC_VER) || _MSC_VER >= 1900
  738. const int MyMessagePlusExtra::kEFieldNumber;
  739. const int MyMessagePlusExtra::kRepeatedEFieldNumber;
  740. const int MyMessagePlusExtra::kRepeatedPackedEFieldNumber;
  741. const int MyMessagePlusExtra::kRepeatedPackedUnexpectedEFieldNumber;
  742. const int MyMessagePlusExtra::kOneofE1FieldNumber;
  743. const int MyMessagePlusExtra::kOneofE2FieldNumber;
  744. #endif // !defined(_MSC_VER) || _MSC_VER >= 1900
  745. MyMessagePlusExtra::MyMessagePlusExtra()
  746. : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  747. ::google::protobuf::internal::InitSCC(
  748. &protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::scc_info_MyMessagePlusExtra.base);
  749. SharedCtor();
  750. // @@protoc_insertion_point(constructor:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  751. }
  752. MyMessagePlusExtra::MyMessagePlusExtra(const MyMessagePlusExtra& from)
  753. : ::google::protobuf::Message(),
  754. _internal_metadata_(NULL),
  755. repeated_e_(from.repeated_e_),
  756. repeated_packed_e_(from.repeated_packed_e_),
  757. repeated_packed_unexpected_e_(from.repeated_packed_unexpected_e_) {
  758. _internal_metadata_.MergeFrom(from._internal_metadata_);
  759. e_ = from.e_;
  760. clear_has_o();
  761. switch (from.o_case()) {
  762. case kOneofE1: {
  763. set_oneof_e_1(from.oneof_e_1());
  764. break;
  765. }
  766. case kOneofE2: {
  767. set_oneof_e_2(from.oneof_e_2());
  768. break;
  769. }
  770. case O_NOT_SET: {
  771. break;
  772. }
  773. }
  774. // @@protoc_insertion_point(copy_constructor:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  775. }
  776. void MyMessagePlusExtra::SharedCtor() {
  777. e_ = 0;
  778. clear_has_o();
  779. }
  780. MyMessagePlusExtra::~MyMessagePlusExtra() {
  781. // @@protoc_insertion_point(destructor:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  782. SharedDtor();
  783. }
  784. void MyMessagePlusExtra::SharedDtor() {
  785. if (has_o()) {
  786. clear_o();
  787. }
  788. }
  789. void MyMessagePlusExtra::SetCachedSize(int size) const {
  790. _cached_size_.Set(size);
  791. }
  792. const ::google::protobuf::Descriptor* MyMessagePlusExtra::descriptor() {
  793. ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::protobuf_AssignDescriptorsOnce();
  794. return ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
  795. }
  796. const MyMessagePlusExtra& MyMessagePlusExtra::default_instance() {
  797. ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::scc_info_MyMessagePlusExtra.base);
  798. return *internal_default_instance();
  799. }
  800. void MyMessagePlusExtra::clear_o() {
  801. // @@protoc_insertion_point(one_of_clear_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  802. switch (o_case()) {
  803. case kOneofE1: {
  804. // No need to clear
  805. break;
  806. }
  807. case kOneofE2: {
  808. // No need to clear
  809. break;
  810. }
  811. case O_NOT_SET: {
  812. break;
  813. }
  814. }
  815. _oneof_case_[0] = O_NOT_SET;
  816. }
  817. void MyMessagePlusExtra::Clear() {
  818. // @@protoc_insertion_point(message_clear_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  819. ::google::protobuf::uint32 cached_has_bits = 0;
  820. // Prevent compiler warnings about cached_has_bits being unused
  821. (void) cached_has_bits;
  822. repeated_e_.Clear();
  823. repeated_packed_e_.Clear();
  824. repeated_packed_unexpected_e_.Clear();
  825. e_ = 0;
  826. clear_o();
  827. _internal_metadata_.Clear();
  828. }
  829. bool MyMessagePlusExtra::MergePartialFromCodedStream(
  830. ::google::protobuf::io::CodedInputStream* input) {
  831. #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  832. ::google::protobuf::uint32 tag;
  833. // @@protoc_insertion_point(parse_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  834. for (;;) {
  835. ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
  836. tag = p.first;
  837. if (!p.second) goto handle_unusual;
  838. switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
  839. // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra e = 1;
  840. case 1: {
  841. if (static_cast< ::google::protobuf::uint8>(tag) ==
  842. static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
  843. int value;
  844. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  845. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  846. input, &value)));
  847. set_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
  848. } else {
  849. goto handle_unusual;
  850. }
  851. break;
  852. }
  853. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_e = 2;
  854. case 2: {
  855. if (static_cast< ::google::protobuf::uint8>(tag) ==
  856. static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
  857. ::google::protobuf::uint32 length;
  858. DO_(input->ReadVarint32(&length));
  859. ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(static_cast<int>(length));
  860. while (input->BytesUntilLimit() > 0) {
  861. int value;
  862. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  863. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  864. input, &value)));
  865. add_repeated_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
  866. }
  867. input->PopLimit(limit);
  868. } else if (
  869. static_cast< ::google::protobuf::uint8>(tag) ==
  870. static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
  871. int value;
  872. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  873. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  874. input, &value)));
  875. add_repeated_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
  876. } else {
  877. goto handle_unusual;
  878. }
  879. break;
  880. }
  881. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_e = 3 [packed = true];
  882. case 3: {
  883. if (static_cast< ::google::protobuf::uint8>(tag) ==
  884. static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
  885. ::google::protobuf::uint32 length;
  886. DO_(input->ReadVarint32(&length));
  887. ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(static_cast<int>(length));
  888. while (input->BytesUntilLimit() > 0) {
  889. int value;
  890. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  891. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  892. input, &value)));
  893. add_repeated_packed_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
  894. }
  895. input->PopLimit(limit);
  896. } else if (
  897. static_cast< ::google::protobuf::uint8>(tag) ==
  898. static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
  899. int value;
  900. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  901. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  902. input, &value)));
  903. add_repeated_packed_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
  904. } else {
  905. goto handle_unusual;
  906. }
  907. break;
  908. }
  909. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4 [packed = true];
  910. case 4: {
  911. if (static_cast< ::google::protobuf::uint8>(tag) ==
  912. static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) {
  913. ::google::protobuf::uint32 length;
  914. DO_(input->ReadVarint32(&length));
  915. ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(static_cast<int>(length));
  916. while (input->BytesUntilLimit() > 0) {
  917. int value;
  918. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  919. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  920. input, &value)));
  921. add_repeated_packed_unexpected_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
  922. }
  923. input->PopLimit(limit);
  924. } else if (
  925. static_cast< ::google::protobuf::uint8>(tag) ==
  926. static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {
  927. int value;
  928. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  929. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  930. input, &value)));
  931. add_repeated_packed_unexpected_e(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
  932. } else {
  933. goto handle_unusual;
  934. }
  935. break;
  936. }
  937. // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_1 = 5;
  938. case 5: {
  939. if (static_cast< ::google::protobuf::uint8>(tag) ==
  940. static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) {
  941. int value;
  942. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  943. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  944. input, &value)));
  945. set_oneof_e_1(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
  946. } else {
  947. goto handle_unusual;
  948. }
  949. break;
  950. }
  951. // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_2 = 6;
  952. case 6: {
  953. if (static_cast< ::google::protobuf::uint8>(tag) ==
  954. static_cast< ::google::protobuf::uint8>(48u /* 48 & 0xFF */)) {
  955. int value;
  956. DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
  957. int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
  958. input, &value)));
  959. set_oneof_e_2(static_cast< ::proto3_preserve_unknown_enum_unittest::MyEnumPlusExtra >(value));
  960. } else {
  961. goto handle_unusual;
  962. }
  963. break;
  964. }
  965. default: {
  966. handle_unusual:
  967. if (tag == 0) {
  968. goto success;
  969. }
  970. DO_(::google::protobuf::internal::WireFormat::SkipField(
  971. input, tag, _internal_metadata_.mutable_unknown_fields()));
  972. break;
  973. }
  974. }
  975. }
  976. success:
  977. // @@protoc_insertion_point(parse_success:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  978. return true;
  979. failure:
  980. // @@protoc_insertion_point(parse_failure:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  981. return false;
  982. #undef DO_
  983. }
  984. void MyMessagePlusExtra::SerializeWithCachedSizes(
  985. ::google::protobuf::io::CodedOutputStream* output) const {
  986. // @@protoc_insertion_point(serialize_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  987. ::google::protobuf::uint32 cached_has_bits = 0;
  988. (void) cached_has_bits;
  989. // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra e = 1;
  990. if (this->e() != 0) {
  991. ::google::protobuf::internal::WireFormatLite::WriteEnum(
  992. 1, this->e(), output);
  993. }
  994. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_e = 2;
  995. if (this->repeated_e_size() > 0) {
  996. ::google::protobuf::internal::WireFormatLite::WriteTag(
  997. 2,
  998. ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
  999. output);
  1000. output->WriteVarint32(
  1001. static_cast< ::google::protobuf::uint32>(_repeated_e_cached_byte_size_));
  1002. }
  1003. for (int i = 0, n = this->repeated_e_size(); i < n; i++) {
  1004. ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag(
  1005. this->repeated_e(i), output);
  1006. }
  1007. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_e = 3 [packed = true];
  1008. if (this->repeated_packed_e_size() > 0) {
  1009. ::google::protobuf::internal::WireFormatLite::WriteTag(
  1010. 3,
  1011. ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
  1012. output);
  1013. output->WriteVarint32(
  1014. static_cast< ::google::protobuf::uint32>(_repeated_packed_e_cached_byte_size_));
  1015. }
  1016. for (int i = 0, n = this->repeated_packed_e_size(); i < n; i++) {
  1017. ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag(
  1018. this->repeated_packed_e(i), output);
  1019. }
  1020. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4 [packed = true];
  1021. if (this->repeated_packed_unexpected_e_size() > 0) {
  1022. ::google::protobuf::internal::WireFormatLite::WriteTag(
  1023. 4,
  1024. ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
  1025. output);
  1026. output->WriteVarint32(
  1027. static_cast< ::google::protobuf::uint32>(_repeated_packed_unexpected_e_cached_byte_size_));
  1028. }
  1029. for (int i = 0, n = this->repeated_packed_unexpected_e_size(); i < n; i++) {
  1030. ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag(
  1031. this->repeated_packed_unexpected_e(i), output);
  1032. }
  1033. // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_1 = 5;
  1034. if (has_oneof_e_1()) {
  1035. ::google::protobuf::internal::WireFormatLite::WriteEnum(
  1036. 5, this->oneof_e_1(), output);
  1037. }
  1038. // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_2 = 6;
  1039. if (has_oneof_e_2()) {
  1040. ::google::protobuf::internal::WireFormatLite::WriteEnum(
  1041. 6, this->oneof_e_2(), output);
  1042. }
  1043. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  1044. ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
  1045. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
  1046. }
  1047. // @@protoc_insertion_point(serialize_end:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  1048. }
  1049. ::google::protobuf::uint8* MyMessagePlusExtra::InternalSerializeWithCachedSizesToArray(
  1050. bool deterministic, ::google::protobuf::uint8* target) const {
  1051. (void)deterministic; // Unused
  1052. // @@protoc_insertion_point(serialize_to_array_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  1053. ::google::protobuf::uint32 cached_has_bits = 0;
  1054. (void) cached_has_bits;
  1055. // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra e = 1;
  1056. if (this->e() != 0) {
  1057. target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
  1058. 1, this->e(), target);
  1059. }
  1060. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_e = 2;
  1061. if (this->repeated_e_size() > 0) {
  1062. target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
  1063. 2,
  1064. ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
  1065. target);
  1066. target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( static_cast< ::google::protobuf::uint32>(
  1067. _repeated_e_cached_byte_size_), target);
  1068. target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(
  1069. this->repeated_e_, target);
  1070. }
  1071. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_e = 3 [packed = true];
  1072. if (this->repeated_packed_e_size() > 0) {
  1073. target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
  1074. 3,
  1075. ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
  1076. target);
  1077. target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( static_cast< ::google::protobuf::uint32>(
  1078. _repeated_packed_e_cached_byte_size_), target);
  1079. target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(
  1080. this->repeated_packed_e_, target);
  1081. }
  1082. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4 [packed = true];
  1083. if (this->repeated_packed_unexpected_e_size() > 0) {
  1084. target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
  1085. 4,
  1086. ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
  1087. target);
  1088. target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( static_cast< ::google::protobuf::uint32>(
  1089. _repeated_packed_unexpected_e_cached_byte_size_), target);
  1090. target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray(
  1091. this->repeated_packed_unexpected_e_, target);
  1092. }
  1093. // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_1 = 5;
  1094. if (has_oneof_e_1()) {
  1095. target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
  1096. 5, this->oneof_e_1(), target);
  1097. }
  1098. // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_2 = 6;
  1099. if (has_oneof_e_2()) {
  1100. target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
  1101. 6, this->oneof_e_2(), target);
  1102. }
  1103. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  1104. target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
  1105. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
  1106. }
  1107. // @@protoc_insertion_point(serialize_to_array_end:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  1108. return target;
  1109. }
  1110. size_t MyMessagePlusExtra::ByteSizeLong() const {
  1111. // @@protoc_insertion_point(message_byte_size_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  1112. size_t total_size = 0;
  1113. if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
  1114. total_size +=
  1115. ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
  1116. (::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
  1117. }
  1118. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_e = 2;
  1119. {
  1120. size_t data_size = 0;
  1121. unsigned int count = static_cast<unsigned int>(this->repeated_e_size());for (unsigned int i = 0; i < count; i++) {
  1122. data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
  1123. this->repeated_e(static_cast<int>(i)));
  1124. }
  1125. if (data_size > 0) {
  1126. total_size += 1 +
  1127. ::google::protobuf::internal::WireFormatLite::Int32Size(
  1128. static_cast< ::google::protobuf::int32>(data_size));
  1129. }
  1130. int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
  1131. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  1132. _repeated_e_cached_byte_size_ = cached_size;
  1133. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  1134. total_size += data_size;
  1135. }
  1136. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_e = 3 [packed = true];
  1137. {
  1138. size_t data_size = 0;
  1139. unsigned int count = static_cast<unsigned int>(this->repeated_packed_e_size());for (unsigned int i = 0; i < count; i++) {
  1140. data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
  1141. this->repeated_packed_e(static_cast<int>(i)));
  1142. }
  1143. if (data_size > 0) {
  1144. total_size += 1 +
  1145. ::google::protobuf::internal::WireFormatLite::Int32Size(
  1146. static_cast< ::google::protobuf::int32>(data_size));
  1147. }
  1148. int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
  1149. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  1150. _repeated_packed_e_cached_byte_size_ = cached_size;
  1151. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  1152. total_size += data_size;
  1153. }
  1154. // repeated .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra repeated_packed_unexpected_e = 4 [packed = true];
  1155. {
  1156. size_t data_size = 0;
  1157. unsigned int count = static_cast<unsigned int>(this->repeated_packed_unexpected_e_size());for (unsigned int i = 0; i < count; i++) {
  1158. data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
  1159. this->repeated_packed_unexpected_e(static_cast<int>(i)));
  1160. }
  1161. if (data_size > 0) {
  1162. total_size += 1 +
  1163. ::google::protobuf::internal::WireFormatLite::Int32Size(
  1164. static_cast< ::google::protobuf::int32>(data_size));
  1165. }
  1166. int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
  1167. GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  1168. _repeated_packed_unexpected_e_cached_byte_size_ = cached_size;
  1169. GOOGLE_SAFE_CONCURRENT_WRITES_END();
  1170. total_size += data_size;
  1171. }
  1172. // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra e = 1;
  1173. if (this->e() != 0) {
  1174. total_size += 1 +
  1175. ::google::protobuf::internal::WireFormatLite::EnumSize(this->e());
  1176. }
  1177. switch (o_case()) {
  1178. // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_1 = 5;
  1179. case kOneofE1: {
  1180. total_size += 1 +
  1181. ::google::protobuf::internal::WireFormatLite::EnumSize(this->oneof_e_1());
  1182. break;
  1183. }
  1184. // .proto3_preserve_unknown_enum_unittest.MyEnumPlusExtra oneof_e_2 = 6;
  1185. case kOneofE2: {
  1186. total_size += 1 +
  1187. ::google::protobuf::internal::WireFormatLite::EnumSize(this->oneof_e_2());
  1188. break;
  1189. }
  1190. case O_NOT_SET: {
  1191. break;
  1192. }
  1193. }
  1194. int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  1195. SetCachedSize(cached_size);
  1196. return total_size;
  1197. }
  1198. void MyMessagePlusExtra::MergeFrom(const ::google::protobuf::Message& from) {
  1199. // @@protoc_insertion_point(generalized_merge_from_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  1200. GOOGLE_DCHECK_NE(&from, this);
  1201. const MyMessagePlusExtra* source =
  1202. ::google::protobuf::internal::DynamicCastToGenerated<const MyMessagePlusExtra>(
  1203. &from);
  1204. if (source == NULL) {
  1205. // @@protoc_insertion_point(generalized_merge_from_cast_fail:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  1206. ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  1207. } else {
  1208. // @@protoc_insertion_point(generalized_merge_from_cast_success:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  1209. MergeFrom(*source);
  1210. }
  1211. }
  1212. void MyMessagePlusExtra::MergeFrom(const MyMessagePlusExtra& from) {
  1213. // @@protoc_insertion_point(class_specific_merge_from_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  1214. GOOGLE_DCHECK_NE(&from, this);
  1215. _internal_metadata_.MergeFrom(from._internal_metadata_);
  1216. ::google::protobuf::uint32 cached_has_bits = 0;
  1217. (void) cached_has_bits;
  1218. repeated_e_.MergeFrom(from.repeated_e_);
  1219. repeated_packed_e_.MergeFrom(from.repeated_packed_e_);
  1220. repeated_packed_unexpected_e_.MergeFrom(from.repeated_packed_unexpected_e_);
  1221. if (from.e() != 0) {
  1222. set_e(from.e());
  1223. }
  1224. switch (from.o_case()) {
  1225. case kOneofE1: {
  1226. set_oneof_e_1(from.oneof_e_1());
  1227. break;
  1228. }
  1229. case kOneofE2: {
  1230. set_oneof_e_2(from.oneof_e_2());
  1231. break;
  1232. }
  1233. case O_NOT_SET: {
  1234. break;
  1235. }
  1236. }
  1237. }
  1238. void MyMessagePlusExtra::CopyFrom(const ::google::protobuf::Message& from) {
  1239. // @@protoc_insertion_point(generalized_copy_from_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  1240. if (&from == this) return;
  1241. Clear();
  1242. MergeFrom(from);
  1243. }
  1244. void MyMessagePlusExtra::CopyFrom(const MyMessagePlusExtra& from) {
  1245. // @@protoc_insertion_point(class_specific_copy_from_start:proto3_preserve_unknown_enum_unittest.MyMessagePlusExtra)
  1246. if (&from == this) return;
  1247. Clear();
  1248. MergeFrom(from);
  1249. }
  1250. bool MyMessagePlusExtra::IsInitialized() const {
  1251. return true;
  1252. }
  1253. void MyMessagePlusExtra::Swap(MyMessagePlusExtra* other) {
  1254. if (other == this) return;
  1255. InternalSwap(other);
  1256. }
  1257. void MyMessagePlusExtra::InternalSwap(MyMessagePlusExtra* other) {
  1258. using std::swap;
  1259. repeated_e_.InternalSwap(&other->repeated_e_);
  1260. repeated_packed_e_.InternalSwap(&other->repeated_packed_e_);
  1261. repeated_packed_unexpected_e_.InternalSwap(&other->repeated_packed_unexpected_e_);
  1262. swap(e_, other->e_);
  1263. swap(o_, other->o_);
  1264. swap(_oneof_case_[0], other->_oneof_case_[0]);
  1265. _internal_metadata_.Swap(&other->_internal_metadata_);
  1266. }
  1267. ::google::protobuf::Metadata MyMessagePlusExtra::GetMetadata() const {
  1268. protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::protobuf_AssignDescriptorsOnce();
  1269. return ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum_2eproto::file_level_metadata[kIndexInFileMessages];
  1270. }
  1271. // @@protoc_insertion_point(namespace_scope)
  1272. } // namespace proto3_preserve_unknown_enum_unittest
  1273. namespace google {
  1274. namespace protobuf {
  1275. template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::proto3_preserve_unknown_enum_unittest::MyMessage* Arena::CreateMaybeMessage< ::proto3_preserve_unknown_enum_unittest::MyMessage >(Arena* arena) {
  1276. return Arena::CreateInternal< ::proto3_preserve_unknown_enum_unittest::MyMessage >(arena);
  1277. }
  1278. template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra* Arena::CreateMaybeMessage< ::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra >(Arena* arena) {
  1279. return Arena::CreateInternal< ::proto3_preserve_unknown_enum_unittest::MyMessagePlusExtra >(arena);
  1280. }
  1281. } // namespace protobuf
  1282. } // namespace google
  1283. // @@protoc_insertion_point(global_scope)