// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/protobuf/unittest_preserve_unknown_enum2.proto #include #include #include #include #include #include #include #include #include #include // This is a temporary google only hack #ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS #include "third_party/protobuf/version.h" #endif // @@protoc_insertion_point(includes) namespace proto2_preserve_unknown_enum_unittest { class MyMessageDefaultTypeInternal { public: ::google::protobuf::internal::ExplicitlyConstructed _instance; int oneof_e_1_; int oneof_e_2_; } _MyMessage_default_instance_; } // namespace proto2_preserve_unknown_enum_unittest namespace protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum2_2eproto { static void InitDefaultsMyMessage() { GOOGLE_PROTOBUF_VERIFY_VERSION; { void* ptr = &::proto2_preserve_unknown_enum_unittest::_MyMessage_default_instance_; new (ptr) ::proto2_preserve_unknown_enum_unittest::MyMessage(); ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); } ::proto2_preserve_unknown_enum_unittest::MyMessage::InitAsDefaultInstance(); } ::google::protobuf::internal::SCCInfo<0> scc_info_MyMessage = {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsMyMessage}, {}}; void InitDefaults() { ::google::protobuf::internal::InitSCC(&scc_info_MyMessage.base); } ::google::protobuf::Metadata file_level_metadata[1]; const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1]; const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_preserve_unknown_enum_unittest::MyMessage, _has_bits_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_preserve_unknown_enum_unittest::MyMessage, _internal_metadata_), ~0u, // no _extensions_ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_preserve_unknown_enum_unittest::MyMessage, _oneof_case_[0]), ~0u, // no _weak_field_map_ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_preserve_unknown_enum_unittest::MyMessage, e_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_preserve_unknown_enum_unittest::MyMessage, repeated_e_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_preserve_unknown_enum_unittest::MyMessage, repeated_packed_e_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_preserve_unknown_enum_unittest::MyMessage, repeated_packed_unexpected_e_), offsetof(::proto2_preserve_unknown_enum_unittest::MyMessageDefaultTypeInternal, oneof_e_1_), offsetof(::proto2_preserve_unknown_enum_unittest::MyMessageDefaultTypeInternal, oneof_e_2_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::proto2_preserve_unknown_enum_unittest::MyMessage, o_), 0, ~0u, ~0u, ~0u, ~0u, ~0u, }; static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { { 0, 12, sizeof(::proto2_preserve_unknown_enum_unittest::MyMessage)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { reinterpret_cast(&::proto2_preserve_unknown_enum_unittest::_MyMessage_default_instance_), }; void protobuf_AssignDescriptors() { AddDescriptors(); AssignDescriptors( "google/protobuf/unittest_preserve_unknown_enum2.proto", schemas, file_default_instances, TableStruct::offsets, file_level_metadata, file_level_enum_descriptors, NULL); } void protobuf_AssignDescriptorsOnce() { static ::google::protobuf::internal::once_flag once; ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors); } void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1); } void AddDescriptorsImpl() { InitDefaults(); static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n5google/protobuf/unittest_preserve_unkn" "own_enum2.proto\022%proto2_preserve_unknown" "_enum_unittest\"\270\003\n\tMyMessage\0228\n\001e\030\001 \001(\0162" "-.proto2_preserve_unknown_enum_unittest." "MyEnum\022A\n\nrepeated_e\030\002 \003(\0162-.proto2_pres" "erve_unknown_enum_unittest.MyEnum\022L\n\021rep" "eated_packed_e\030\003 \003(\0162-.proto2_preserve_u" "nknown_enum_unittest.MyEnumB\002\020\001\022S\n\034repea" "ted_packed_unexpected_e\030\004 \003(\0162-.proto2_p" "reserve_unknown_enum_unittest.MyEnum\022B\n\t" "oneof_e_1\030\005 \001(\0162-.proto2_preserve_unknow" "n_enum_unittest.MyEnumH\000\022B\n\toneof_e_2\030\006 " "\001(\0162-.proto2_preserve_unknown_enum_unitt" "est.MyEnumH\000B\003\n\001o*#\n\006MyEnum\022\007\n\003FOO\020\000\022\007\n\003" "BAR\020\001\022\007\n\003BAZ\020\002" }; ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( descriptor, 574); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/unittest_preserve_unknown_enum2.proto", &protobuf_RegisterTypes); } void AddDescriptors() { static ::google::protobuf::internal::once_flag once; ::google::protobuf::internal::call_once(once, AddDescriptorsImpl); } // Force AddDescriptors() to be called at dynamic initialization time. struct StaticDescriptorInitializer { StaticDescriptorInitializer() { AddDescriptors(); } } static_descriptor_initializer; } // namespace protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum2_2eproto namespace proto2_preserve_unknown_enum_unittest { const ::google::protobuf::EnumDescriptor* MyEnum_descriptor() { protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum2_2eproto::protobuf_AssignDescriptorsOnce(); return protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum2_2eproto::file_level_enum_descriptors[0]; } bool MyEnum_IsValid(int value) { switch (value) { case 0: case 1: case 2: return true; default: return false; } } // =================================================================== void MyMessage::InitAsDefaultInstance() { ::proto2_preserve_unknown_enum_unittest::_MyMessage_default_instance_.oneof_e_1_ = 0; ::proto2_preserve_unknown_enum_unittest::_MyMessage_default_instance_.oneof_e_2_ = 0; } #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int MyMessage::kEFieldNumber; const int MyMessage::kRepeatedEFieldNumber; const int MyMessage::kRepeatedPackedEFieldNumber; const int MyMessage::kRepeatedPackedUnexpectedEFieldNumber; const int MyMessage::kOneofE1FieldNumber; const int MyMessage::kOneofE2FieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 MyMessage::MyMessage() : ::google::protobuf::Message(), _internal_metadata_(NULL) { ::google::protobuf::internal::InitSCC( &protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum2_2eproto::scc_info_MyMessage.base); SharedCtor(); // @@protoc_insertion_point(constructor:proto2_preserve_unknown_enum_unittest.MyMessage) } MyMessage::MyMessage(const MyMessage& from) : ::google::protobuf::Message(), _internal_metadata_(NULL), _has_bits_(from._has_bits_), repeated_e_(from.repeated_e_), repeated_packed_e_(from.repeated_packed_e_), repeated_packed_unexpected_e_(from.repeated_packed_unexpected_e_) { _internal_metadata_.MergeFrom(from._internal_metadata_); e_ = from.e_; clear_has_o(); switch (from.o_case()) { case kOneofE1: { set_oneof_e_1(from.oneof_e_1()); break; } case kOneofE2: { set_oneof_e_2(from.oneof_e_2()); break; } case O_NOT_SET: { break; } } // @@protoc_insertion_point(copy_constructor:proto2_preserve_unknown_enum_unittest.MyMessage) } void MyMessage::SharedCtor() { e_ = 0; clear_has_o(); } MyMessage::~MyMessage() { // @@protoc_insertion_point(destructor:proto2_preserve_unknown_enum_unittest.MyMessage) SharedDtor(); } void MyMessage::SharedDtor() { if (has_o()) { clear_o(); } } void MyMessage::SetCachedSize(int size) const { _cached_size_.Set(size); } const ::google::protobuf::Descriptor* MyMessage::descriptor() { ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum2_2eproto::protobuf_AssignDescriptorsOnce(); return ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum2_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const MyMessage& MyMessage::default_instance() { ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum2_2eproto::scc_info_MyMessage.base); return *internal_default_instance(); } void MyMessage::clear_o() { // @@protoc_insertion_point(one_of_clear_start:proto2_preserve_unknown_enum_unittest.MyMessage) switch (o_case()) { case kOneofE1: { // No need to clear break; } case kOneofE2: { // No need to clear break; } case O_NOT_SET: { break; } } _oneof_case_[0] = O_NOT_SET; } void MyMessage::Clear() { // @@protoc_insertion_point(message_clear_start:proto2_preserve_unknown_enum_unittest.MyMessage) ::google::protobuf::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; repeated_e_.Clear(); repeated_packed_e_.Clear(); repeated_packed_unexpected_e_.Clear(); e_ = 0; clear_o(); _has_bits_.Clear(); _internal_metadata_.Clear(); } bool MyMessage::MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:proto2_preserve_unknown_enum_unittest.MyMessage) for (;;) { ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); tag = p.first; if (!p.second) goto handle_unusual; switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional .proto2_preserve_unknown_enum_unittest.MyEnum e = 1; case 1: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); if (::proto2_preserve_unknown_enum_unittest::MyEnum_IsValid(value)) { set_e(static_cast< ::proto2_preserve_unknown_enum_unittest::MyEnum >(value)); } else { mutable_unknown_fields()->AddVarint( 1, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; } break; } // repeated .proto2_preserve_unknown_enum_unittest.MyEnum repeated_e = 2; case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); if (::proto2_preserve_unknown_enum_unittest::MyEnum_IsValid(value)) { add_repeated_e(static_cast< ::proto2_preserve_unknown_enum_unittest::MyEnum >(value)); } else { mutable_unknown_fields()->AddVarint( 2, static_cast< ::google::protobuf::uint64>(value)); } } else if ( static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { DO_((::google::protobuf::internal::WireFormat::ReadPackedEnumPreserveUnknowns( input, 2, ::proto2_preserve_unknown_enum_unittest::MyEnum_IsValid, mutable_unknown_fields(), this->mutable_repeated_e()))); } else { goto handle_unusual; } break; } // repeated .proto2_preserve_unknown_enum_unittest.MyEnum repeated_packed_e = 3 [packed = true]; case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { ::google::protobuf::uint32 length; DO_(input->ReadVarint32(&length)); ::google::protobuf::io::CodedInputStream::Limit limit = input->PushLimit(static_cast(length)); while (input->BytesUntilLimit() > 0) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); if (::proto2_preserve_unknown_enum_unittest::MyEnum_IsValid(value)) { add_repeated_packed_e(static_cast< ::proto2_preserve_unknown_enum_unittest::MyEnum >(value)); } else { mutable_unknown_fields()->AddVarint( 3, static_cast< ::google::protobuf::uint64>(value)); } } input->PopLimit(limit); } else if ( static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); if (::proto2_preserve_unknown_enum_unittest::MyEnum_IsValid(value)) { add_repeated_packed_e(static_cast< ::proto2_preserve_unknown_enum_unittest::MyEnum >(value)); } else { mutable_unknown_fields()->AddVarint( 3, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; } break; } // repeated .proto2_preserve_unknown_enum_unittest.MyEnum repeated_packed_unexpected_e = 4; case 4: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); if (::proto2_preserve_unknown_enum_unittest::MyEnum_IsValid(value)) { add_repeated_packed_unexpected_e(static_cast< ::proto2_preserve_unknown_enum_unittest::MyEnum >(value)); } else { mutable_unknown_fields()->AddVarint( 4, static_cast< ::google::protobuf::uint64>(value)); } } else if ( static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) { DO_((::google::protobuf::internal::WireFormat::ReadPackedEnumPreserveUnknowns( input, 4, ::proto2_preserve_unknown_enum_unittest::MyEnum_IsValid, mutable_unknown_fields(), this->mutable_repeated_packed_unexpected_e()))); } else { goto handle_unusual; } break; } // optional .proto2_preserve_unknown_enum_unittest.MyEnum oneof_e_1 = 5; case 5: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); if (::proto2_preserve_unknown_enum_unittest::MyEnum_IsValid(value)) { set_oneof_e_1(static_cast< ::proto2_preserve_unknown_enum_unittest::MyEnum >(value)); } else { mutable_unknown_fields()->AddVarint( 5, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; } break; } // optional .proto2_preserve_unknown_enum_unittest.MyEnum oneof_e_2 = 6; case 6: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(48u /* 48 & 0xFF */)) { int value; DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( input, &value))); if (::proto2_preserve_unknown_enum_unittest::MyEnum_IsValid(value)) { set_oneof_e_2(static_cast< ::proto2_preserve_unknown_enum_unittest::MyEnum >(value)); } else { mutable_unknown_fields()->AddVarint( 6, static_cast< ::google::protobuf::uint64>(value)); } } else { goto handle_unusual; } break; } default: { handle_unusual: if (tag == 0) { goto success; } DO_(::google::protobuf::internal::WireFormat::SkipField( input, tag, _internal_metadata_.mutable_unknown_fields())); break; } } } success: // @@protoc_insertion_point(parse_success:proto2_preserve_unknown_enum_unittest.MyMessage) return true; failure: // @@protoc_insertion_point(parse_failure:proto2_preserve_unknown_enum_unittest.MyMessage) return false; #undef DO_ } void MyMessage::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // @@protoc_insertion_point(serialize_start:proto2_preserve_unknown_enum_unittest.MyMessage) ::google::protobuf::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional .proto2_preserve_unknown_enum_unittest.MyEnum e = 1; if (cached_has_bits & 0x00000001u) { ::google::protobuf::internal::WireFormatLite::WriteEnum( 1, this->e(), output); } // repeated .proto2_preserve_unknown_enum_unittest.MyEnum repeated_e = 2; for (int i = 0, n = this->repeated_e_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteEnum( 2, this->repeated_e(i), output); } // repeated .proto2_preserve_unknown_enum_unittest.MyEnum repeated_packed_e = 3 [packed = true]; if (this->repeated_packed_e_size() > 0) { ::google::protobuf::internal::WireFormatLite::WriteTag( 3, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); output->WriteVarint32( static_cast< ::google::protobuf::uint32>(_repeated_packed_e_cached_byte_size_)); } for (int i = 0, n = this->repeated_packed_e_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteEnumNoTag( this->repeated_packed_e(i), output); } // repeated .proto2_preserve_unknown_enum_unittest.MyEnum repeated_packed_unexpected_e = 4; for (int i = 0, n = this->repeated_packed_unexpected_e_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteEnum( 4, this->repeated_packed_unexpected_e(i), output); } switch (o_case()) { case kOneofE1: ::google::protobuf::internal::WireFormatLite::WriteEnum( 5, this->oneof_e_1(), output); break; case kOneofE2: ::google::protobuf::internal::WireFormatLite::WriteEnum( 6, this->oneof_e_2(), output); break; default: ; } if (_internal_metadata_.have_unknown_fields()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( _internal_metadata_.unknown_fields(), output); } // @@protoc_insertion_point(serialize_end:proto2_preserve_unknown_enum_unittest.MyMessage) } ::google::protobuf::uint8* MyMessage::InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const { (void)deterministic; // Unused // @@protoc_insertion_point(serialize_to_array_start:proto2_preserve_unknown_enum_unittest.MyMessage) ::google::protobuf::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional .proto2_preserve_unknown_enum_unittest.MyEnum e = 1; if (cached_has_bits & 0x00000001u) { target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( 1, this->e(), target); } // repeated .proto2_preserve_unknown_enum_unittest.MyEnum repeated_e = 2; target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( 2, this->repeated_e_, target); // repeated .proto2_preserve_unknown_enum_unittest.MyEnum repeated_packed_e = 3 [packed = true]; if (this->repeated_packed_e_size() > 0) { target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( 3, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, target); target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( static_cast< ::google::protobuf::uint32>( _repeated_packed_e_cached_byte_size_), target); target = ::google::protobuf::internal::WireFormatLite::WriteEnumNoTagToArray( this->repeated_packed_e_, target); } // repeated .proto2_preserve_unknown_enum_unittest.MyEnum repeated_packed_unexpected_e = 4; target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( 4, this->repeated_packed_unexpected_e_, target); switch (o_case()) { case kOneofE1: target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( 5, this->oneof_e_1(), target); break; case kOneofE2: target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( 6, this->oneof_e_2(), target); break; default: ; } if (_internal_metadata_.have_unknown_fields()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields(), target); } // @@protoc_insertion_point(serialize_to_array_end:proto2_preserve_unknown_enum_unittest.MyMessage) return target; } size_t MyMessage::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:proto2_preserve_unknown_enum_unittest.MyMessage) size_t total_size = 0; if (_internal_metadata_.have_unknown_fields()) { total_size += ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( _internal_metadata_.unknown_fields()); } // repeated .proto2_preserve_unknown_enum_unittest.MyEnum repeated_e = 2; { size_t data_size = 0; unsigned int count = static_cast(this->repeated_e_size());for (unsigned int i = 0; i < count; i++) { data_size += ::google::protobuf::internal::WireFormatLite::EnumSize( this->repeated_e(static_cast(i))); } total_size += (1UL * count) + data_size; } // repeated .proto2_preserve_unknown_enum_unittest.MyEnum repeated_packed_e = 3 [packed = true]; { size_t data_size = 0; unsigned int count = static_cast(this->repeated_packed_e_size());for (unsigned int i = 0; i < count; i++) { data_size += ::google::protobuf::internal::WireFormatLite::EnumSize( this->repeated_packed_e(static_cast(i))); } if (data_size > 0) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::Int32Size( static_cast< ::google::protobuf::int32>(data_size)); } int cached_size = ::google::protobuf::internal::ToCachedSize(data_size); GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _repeated_packed_e_cached_byte_size_ = cached_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); total_size += data_size; } // repeated .proto2_preserve_unknown_enum_unittest.MyEnum repeated_packed_unexpected_e = 4; { size_t data_size = 0; unsigned int count = static_cast(this->repeated_packed_unexpected_e_size());for (unsigned int i = 0; i < count; i++) { data_size += ::google::protobuf::internal::WireFormatLite::EnumSize( this->repeated_packed_unexpected_e(static_cast(i))); } total_size += (1UL * count) + data_size; } // optional .proto2_preserve_unknown_enum_unittest.MyEnum e = 1; if (has_e()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize(this->e()); } switch (o_case()) { // optional .proto2_preserve_unknown_enum_unittest.MyEnum oneof_e_1 = 5; case kOneofE1: { total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize(this->oneof_e_1()); break; } // optional .proto2_preserve_unknown_enum_unittest.MyEnum oneof_e_2 = 6; case kOneofE2: { total_size += 1 + ::google::protobuf::internal::WireFormatLite::EnumSize(this->oneof_e_2()); break; } case O_NOT_SET: { break; } } int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } void MyMessage::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:proto2_preserve_unknown_enum_unittest.MyMessage) GOOGLE_DCHECK_NE(&from, this); const MyMessage* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == NULL) { // @@protoc_insertion_point(generalized_merge_from_cast_fail:proto2_preserve_unknown_enum_unittest.MyMessage) ::google::protobuf::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:proto2_preserve_unknown_enum_unittest.MyMessage) MergeFrom(*source); } } void MyMessage::MergeFrom(const MyMessage& from) { // @@protoc_insertion_point(class_specific_merge_from_start:proto2_preserve_unknown_enum_unittest.MyMessage) GOOGLE_DCHECK_NE(&from, this); _internal_metadata_.MergeFrom(from._internal_metadata_); ::google::protobuf::uint32 cached_has_bits = 0; (void) cached_has_bits; repeated_e_.MergeFrom(from.repeated_e_); repeated_packed_e_.MergeFrom(from.repeated_packed_e_); repeated_packed_unexpected_e_.MergeFrom(from.repeated_packed_unexpected_e_); if (from.has_e()) { set_e(from.e()); } switch (from.o_case()) { case kOneofE1: { set_oneof_e_1(from.oneof_e_1()); break; } case kOneofE2: { set_oneof_e_2(from.oneof_e_2()); break; } case O_NOT_SET: { break; } } } void MyMessage::CopyFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_copy_from_start:proto2_preserve_unknown_enum_unittest.MyMessage) if (&from == this) return; Clear(); MergeFrom(from); } void MyMessage::CopyFrom(const MyMessage& from) { // @@protoc_insertion_point(class_specific_copy_from_start:proto2_preserve_unknown_enum_unittest.MyMessage) if (&from == this) return; Clear(); MergeFrom(from); } bool MyMessage::IsInitialized() const { return true; } void MyMessage::Swap(MyMessage* other) { if (other == this) return; InternalSwap(other); } void MyMessage::InternalSwap(MyMessage* other) { using std::swap; repeated_e_.InternalSwap(&other->repeated_e_); repeated_packed_e_.InternalSwap(&other->repeated_packed_e_); repeated_packed_unexpected_e_.InternalSwap(&other->repeated_packed_unexpected_e_); swap(e_, other->e_); swap(o_, other->o_); swap(_oneof_case_[0], other->_oneof_case_[0]); swap(_has_bits_[0], other->_has_bits_[0]); _internal_metadata_.Swap(&other->_internal_metadata_); } ::google::protobuf::Metadata MyMessage::GetMetadata() const { protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum2_2eproto::protobuf_AssignDescriptorsOnce(); return ::protobuf_google_2fprotobuf_2funittest_5fpreserve_5funknown_5fenum2_2eproto::file_level_metadata[kIndexInFileMessages]; } // @@protoc_insertion_point(namespace_scope) } // namespace proto2_preserve_unknown_enum_unittest namespace google { namespace protobuf { template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::proto2_preserve_unknown_enum_unittest::MyMessage* Arena::CreateMaybeMessage< ::proto2_preserve_unknown_enum_unittest::MyMessage >(Arena* arena) { return Arena::CreateInternal< ::proto2_preserve_unknown_enum_unittest::MyMessage >(arena); } } // namespace protobuf } // namespace google // @@protoc_insertion_point(global_scope)