diff options
Diffstat (limited to 'src/google/protobuf/type.pb.cc')
-rw-r--r-- | src/google/protobuf/type.pb.cc | 180 |
1 files changed, 82 insertions, 98 deletions
diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc index 2cdb0146..92f6589c 100644 --- a/src/google/protobuf/type.pb.cc +++ b/src/google/protobuf/type.pb.cc @@ -14,6 +14,10 @@ #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) namespace google { namespace protobuf { @@ -48,7 +52,11 @@ namespace protobuf_google_2fprotobuf_2ftype_2eproto { void InitDefaultsTypeImpl() { GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsField(); protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOption(); protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaultsSourceContext(); @@ -68,7 +76,11 @@ void InitDefaultsType() { void InitDefaultsFieldImpl() { GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOption(); { void* ptr = &::google::protobuf::_Field_default_instance_; @@ -86,7 +98,11 @@ void InitDefaultsField() { void InitDefaultsEnumImpl() { GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsEnumValue(); protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOption(); protobuf_google_2fprotobuf_2fsource_5fcontext_2eproto::InitDefaultsSourceContext(); @@ -106,7 +122,11 @@ void InitDefaultsEnum() { void InitDefaultsEnumValueImpl() { GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS protobuf_google_2fprotobuf_2ftype_2eproto::InitDefaultsOption(); { void* ptr = &::google::protobuf::_EnumValue_default_instance_; @@ -124,7 +144,11 @@ void InitDefaultsEnumValue() { void InitDefaultsOptionImpl() { GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS protobuf_google_2fprotobuf_2fany_2eproto::InitDefaultsAny(); { void* ptr = &::google::protobuf::_Option_default_instance_; @@ -400,15 +424,6 @@ void Type::_slow_mutable_source_context() { source_context_ = ::google::protobuf::Arena::Create< ::google::protobuf::SourceContext >( GetArenaNoVirtual()); } -::google::protobuf::SourceContext* Type::_slow_release_source_context() { - if (source_context_ == NULL) { - return NULL; - } else { - ::google::protobuf::SourceContext* temp = new ::google::protobuf::SourceContext(*source_context_); - source_context_ = NULL; - return temp; - } -} void Type::unsafe_arena_set_allocated_source_context( ::google::protobuf::SourceContext* source_context) { if (GetArenaNoVirtual() == NULL) { @@ -422,6 +437,12 @@ void Type::unsafe_arena_set_allocated_source_context( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Type.source_context) } +void Type::clear_source_context() { + if (GetArenaNoVirtual() == NULL && source_context_ != NULL) { + delete source_context_; + } + source_context_ = NULL; +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Type::kNameFieldNumber; const int Type::kFieldsFieldNumber; @@ -486,13 +507,8 @@ Type::~Type() { } void Type::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - - name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete source_context_; } @@ -569,8 +585,7 @@ bool Type::MergePartialFromCodedStream( case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_fields())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_fields())); } else { goto handle_unusual; } @@ -598,8 +613,7 @@ bool Type::MergePartialFromCodedStream( case 4: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); } else { goto handle_unusual; } @@ -610,7 +624,7 @@ bool Type::MergePartialFromCodedStream( case 5: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_source_context())); } else { goto handle_unusual; @@ -734,7 +748,7 @@ void Type::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->fields_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 2, this->fields(static_cast<int>(i)), deterministic, target); } @@ -752,14 +766,14 @@ void Type::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 4, this->options(static_cast<int>(i)), deterministic, target); } // .google.protobuf.SourceContext source_context = 5; if (this->has_source_context()) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 5, *this->source_context_, deterministic, target); } @@ -792,7 +806,7 @@ size_t Type::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->fields(static_cast<int>(i))); } } @@ -811,7 +825,7 @@ size_t Type::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->options(static_cast<int>(i))); } } @@ -826,7 +840,7 @@ size_t Type::ByteSizeLong() const { // .google.protobuf.SourceContext source_context = 5; if (this->has_source_context()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->source_context_); } @@ -1017,16 +1031,11 @@ Field::~Field() { } void Field::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - - name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); - type_url_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); - json_name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); - default_value_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + type_url_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + json_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + default_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } void Field::ArenaDtor(void* object) { @@ -1189,8 +1198,7 @@ bool Field::MergePartialFromCodedStream( case 9: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(74u /* 74 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); } else { goto handle_unusual; } @@ -1396,7 +1404,7 @@ void Field::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 9, this->options(static_cast<int>(i)), deterministic, target); } @@ -1445,7 +1453,7 @@ size_t Field::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->options(static_cast<int>(i))); } } @@ -1637,15 +1645,6 @@ void Enum::_slow_mutable_source_context() { source_context_ = ::google::protobuf::Arena::Create< ::google::protobuf::SourceContext >( GetArenaNoVirtual()); } -::google::protobuf::SourceContext* Enum::_slow_release_source_context() { - if (source_context_ == NULL) { - return NULL; - } else { - ::google::protobuf::SourceContext* temp = new ::google::protobuf::SourceContext(*source_context_); - source_context_ = NULL; - return temp; - } -} void Enum::unsafe_arena_set_allocated_source_context( ::google::protobuf::SourceContext* source_context) { if (GetArenaNoVirtual() == NULL) { @@ -1659,6 +1658,12 @@ void Enum::unsafe_arena_set_allocated_source_context( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Enum.source_context) } +void Enum::clear_source_context() { + if (GetArenaNoVirtual() == NULL && source_context_ != NULL) { + delete source_context_; + } + source_context_ = NULL; +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Enum::kNameFieldNumber; const int Enum::kEnumvalueFieldNumber; @@ -1720,13 +1725,8 @@ Enum::~Enum() { } void Enum::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - - name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete source_context_; } @@ -1802,8 +1802,7 @@ bool Enum::MergePartialFromCodedStream( case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_enumvalue())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_enumvalue())); } else { goto handle_unusual; } @@ -1814,8 +1813,7 @@ bool Enum::MergePartialFromCodedStream( case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); } else { goto handle_unusual; } @@ -1826,7 +1824,7 @@ bool Enum::MergePartialFromCodedStream( case 4: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_source_context())); } else { goto handle_unusual; @@ -1940,7 +1938,7 @@ void Enum::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->enumvalue_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 2, this->enumvalue(static_cast<int>(i)), deterministic, target); } @@ -1948,14 +1946,14 @@ void Enum::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 3, this->options(static_cast<int>(i)), deterministic, target); } // .google.protobuf.SourceContext source_context = 4; if (this->has_source_context()) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 4, *this->source_context_, deterministic, target); } @@ -1988,7 +1986,7 @@ size_t Enum::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->enumvalue(static_cast<int>(i))); } } @@ -1999,7 +1997,7 @@ size_t Enum::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->options(static_cast<int>(i))); } } @@ -2014,7 +2012,7 @@ size_t Enum::ByteSizeLong() const { // .google.protobuf.SourceContext source_context = 4; if (this->has_source_context()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->source_context_); } @@ -2174,13 +2172,8 @@ EnumValue::~EnumValue() { } void EnumValue::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - - name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } void EnumValue::ArenaDtor(void* object) { @@ -2264,8 +2257,7 @@ bool EnumValue::MergePartialFromCodedStream( case 3: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_options())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_options())); } else { goto handle_unusual; } @@ -2354,7 +2346,7 @@ void EnumValue::SerializeWithCachedSizes( for (unsigned int i = 0, n = static_cast<unsigned int>(this->options_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 3, this->options(static_cast<int>(i)), deterministic, target); } @@ -2381,7 +2373,7 @@ size_t EnumValue::ByteSizeLong() const { total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->options(static_cast<int>(i))); } } @@ -2500,15 +2492,6 @@ void Option::_slow_mutable_value() { value_ = ::google::protobuf::Arena::Create< ::google::protobuf::Any >( GetArenaNoVirtual()); } -::google::protobuf::Any* Option::_slow_release_value() { - if (value_ == NULL) { - return NULL; - } else { - ::google::protobuf::Any* temp = new ::google::protobuf::Any(*value_); - value_ = NULL; - return temp; - } -} void Option::unsafe_arena_set_allocated_value( ::google::protobuf::Any* value) { if (GetArenaNoVirtual() == NULL) { @@ -2522,6 +2505,12 @@ void Option::unsafe_arena_set_allocated_value( } // @@protoc_insertion_point(field_unsafe_arena_set_allocated:google.protobuf.Option.value) } +void Option::clear_value() { + if (GetArenaNoVirtual() == NULL && value_ != NULL) { + delete value_; + } + value_ = NULL; +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int Option::kNameFieldNumber; const int Option::kValueFieldNumber; @@ -2573,13 +2562,8 @@ Option::~Option() { } void Option::SharedDtor() { - ::google::protobuf::Arena* arena = GetArenaNoVirtual(); - GOOGLE_DCHECK(arena == NULL); - if (arena != NULL) { - return; - } - - name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena); + GOOGLE_DCHECK(GetArenaNoVirtual() == NULL); + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete value_; } @@ -2652,7 +2636,7 @@ bool Option::MergePartialFromCodedStream( case 2: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( input, mutable_value())); } else { goto handle_unusual; @@ -2730,7 +2714,7 @@ void Option::SerializeWithCachedSizes( // .google.protobuf.Any value = 2; if (this->has_value()) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 2, *this->value_, deterministic, target); } @@ -2761,7 +2745,7 @@ size_t Option::ByteSizeLong() const { // .google.protobuf.Any value = 2; if (this->has_value()) { total_size += 1 + - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( *this->value_); } |