123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767 |
- // Generated by the protocol buffer compiler. DO NOT EDIT!
- // source: google/protobuf/unittest_optimize_for.proto
- #ifndef PROTOBUF_INCLUDED_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto
- #define PROTOBUF_INCLUDED_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto
- #include <string>
- #include <google/protobuf/stubs/common.h>
- #if GOOGLE_PROTOBUF_VERSION < 3006001
- #error This file was generated by a newer version of protoc which is
- #error incompatible with your Protocol Buffer headers. Please update
- #error your headers.
- #endif
- #if 3006001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
- #error This file was generated by an older version of protoc which is
- #error incompatible with your Protocol Buffer headers. Please
- #error regenerate this file with a newer version of protoc.
- #endif
- #include <google/protobuf/io/coded_stream.h>
- #include <google/protobuf/arena.h>
- #include <google/protobuf/arenastring.h>
- #include <google/protobuf/generated_message_table_driven.h>
- #include <google/protobuf/generated_message_util.h>
- #include <google/protobuf/inlined_string_field.h>
- #include <google/protobuf/metadata.h>
- #include <google/protobuf/message.h>
- #include <google/protobuf/repeated_field.h> // IWYU pragma: export
- #include <google/protobuf/extension_set.h> // IWYU pragma: export
- #include <google/protobuf/unknown_field_set.h>
- #include <google/protobuf/unittest.pb.h>
- // @@protoc_insertion_point(includes)
- #define PROTOBUF_INTERNAL_EXPORT_protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto
- namespace protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto {
- // Internal implementation detail -- do not use these members.
- struct TableStruct {
- static const ::google::protobuf::internal::ParseTableField entries[];
- static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
- static const ::google::protobuf::internal::ParseTable schema[3];
- static const ::google::protobuf::internal::FieldMetadata field_metadata[];
- static const ::google::protobuf::internal::SerializationTable serialization_table[];
- static const ::google::protobuf::uint32 offsets[];
- };
- void AddDescriptors();
- } // namespace protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto
- namespace protobuf_unittest {
- class TestOptimizedForSize;
- class TestOptimizedForSizeDefaultTypeInternal;
- extern TestOptimizedForSizeDefaultTypeInternal _TestOptimizedForSize_default_instance_;
- class TestOptionalOptimizedForSize;
- class TestOptionalOptimizedForSizeDefaultTypeInternal;
- extern TestOptionalOptimizedForSizeDefaultTypeInternal _TestOptionalOptimizedForSize_default_instance_;
- class TestRequiredOptimizedForSize;
- class TestRequiredOptimizedForSizeDefaultTypeInternal;
- extern TestRequiredOptimizedForSizeDefaultTypeInternal _TestRequiredOptimizedForSize_default_instance_;
- } // namespace protobuf_unittest
- namespace google {
- namespace protobuf {
- template<> ::protobuf_unittest::TestOptimizedForSize* Arena::CreateMaybeMessage<::protobuf_unittest::TestOptimizedForSize>(Arena*);
- template<> ::protobuf_unittest::TestOptionalOptimizedForSize* Arena::CreateMaybeMessage<::protobuf_unittest::TestOptionalOptimizedForSize>(Arena*);
- template<> ::protobuf_unittest::TestRequiredOptimizedForSize* Arena::CreateMaybeMessage<::protobuf_unittest::TestRequiredOptimizedForSize>(Arena*);
- } // namespace protobuf
- } // namespace google
- namespace protobuf_unittest {
- // ===================================================================
- class TestOptimizedForSize : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:protobuf_unittest.TestOptimizedForSize) */ {
- public:
- TestOptimizedForSize();
- virtual ~TestOptimizedForSize();
- TestOptimizedForSize(const TestOptimizedForSize& from);
- inline TestOptimizedForSize& operator=(const TestOptimizedForSize& from) {
- CopyFrom(from);
- return *this;
- }
- #if LANG_CXX11
- TestOptimizedForSize(TestOptimizedForSize&& from) noexcept
- : TestOptimizedForSize() {
- *this = ::std::move(from);
- }
- inline TestOptimizedForSize& operator=(TestOptimizedForSize&& from) noexcept {
- if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
- if (this != &from) InternalSwap(&from);
- } else {
- CopyFrom(from);
- }
- return *this;
- }
- #endif
- inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
- return _internal_metadata_.unknown_fields();
- }
- inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
- return _internal_metadata_.mutable_unknown_fields();
- }
- static const ::google::protobuf::Descriptor* descriptor();
- static const TestOptimizedForSize& default_instance();
- enum FooCase {
- kIntegerField = 2,
- kStringField = 3,
- FOO_NOT_SET = 0,
- };
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
- static inline const TestOptimizedForSize* internal_default_instance() {
- return reinterpret_cast<const TestOptimizedForSize*>(
- &_TestOptimizedForSize_default_instance_);
- }
- static constexpr int kIndexInFileMessages =
- 0;
- void Swap(TestOptimizedForSize* other);
- friend void swap(TestOptimizedForSize& a, TestOptimizedForSize& b) {
- a.Swap(&b);
- }
- // implements Message ----------------------------------------------
- inline TestOptimizedForSize* New() const final {
- return CreateMaybeMessage<TestOptimizedForSize>(NULL);
- }
- TestOptimizedForSize* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<TestOptimizedForSize>(arena);
- }
- int GetCachedSize() const final { return _cached_size_.Get(); }
- private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const final;
- void InternalSwap(TestOptimizedForSize* other);
- private:
- inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return NULL;
- }
- inline void* MaybeArenaPtr() const {
- return NULL;
- }
- public:
- ::google::protobuf::Metadata GetMetadata() const final;
- // nested types ----------------------------------------------------
- // accessors -------------------------------------------------------
- // optional .protobuf_unittest.ForeignMessage msg = 19;
- bool has_msg() const;
- void clear_msg();
- static const int kMsgFieldNumber = 19;
- private:
- const ::protobuf_unittest::ForeignMessage& _internal_msg() const;
- public:
- const ::protobuf_unittest::ForeignMessage& msg() const;
- ::protobuf_unittest::ForeignMessage* release_msg();
- ::protobuf_unittest::ForeignMessage* mutable_msg();
- void set_allocated_msg(::protobuf_unittest::ForeignMessage* msg);
- // optional int32 i = 1;
- bool has_i() const;
- void clear_i();
- static const int kIFieldNumber = 1;
- ::google::protobuf::int32 i() const;
- void set_i(::google::protobuf::int32 value);
- // optional int32 integer_field = 2;
- bool has_integer_field() const;
- void clear_integer_field();
- static const int kIntegerFieldFieldNumber = 2;
- ::google::protobuf::int32 integer_field() const;
- void set_integer_field(::google::protobuf::int32 value);
- // optional string string_field = 3;
- bool has_string_field() const;
- void clear_string_field();
- static const int kStringFieldFieldNumber = 3;
- const ::std::string& string_field() const;
- void set_string_field(const ::std::string& value);
- #if LANG_CXX11
- void set_string_field(::std::string&& value);
- #endif
- void set_string_field(const char* value);
- void set_string_field(const char* value, size_t size);
- ::std::string* mutable_string_field();
- ::std::string* release_string_field();
- void set_allocated_string_field(::std::string* string_field);
- GOOGLE_PROTOBUF_EXTENSION_ACCESSORS(TestOptimizedForSize)
- void clear_foo();
- FooCase foo_case() const;
- static const int kTestExtensionFieldNumber = 1234;
- static ::google::protobuf::internal::ExtensionIdentifier< ::protobuf_unittest::TestOptimizedForSize,
- ::google::protobuf::internal::PrimitiveTypeTraits< ::google::protobuf::int32 >, 5, false >
- test_extension;
- static const int kTestExtension2FieldNumber = 1235;
- static ::google::protobuf::internal::ExtensionIdentifier< ::protobuf_unittest::TestOptimizedForSize,
- ::google::protobuf::internal::MessageTypeTraits< ::protobuf_unittest::TestRequiredOptimizedForSize >, 11, false >
- test_extension2;
- // @@protoc_insertion_point(class_scope:protobuf_unittest.TestOptimizedForSize)
- private:
- void set_has_i();
- void clear_has_i();
- void set_has_msg();
- void clear_has_msg();
- void set_has_integer_field();
- void set_has_string_field();
- inline bool has_foo() const;
- inline void clear_has_foo();
- ::google::protobuf::internal::ExtensionSet _extensions_;
- ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- ::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- ::protobuf_unittest::ForeignMessage* msg_;
- ::google::protobuf::int32 i_;
- union FooUnion {
- FooUnion() {}
- ::google::protobuf::int32 integer_field_;
- ::google::protobuf::internal::ArenaStringPtr string_field_;
- } foo_;
- ::google::protobuf::uint32 _oneof_case_[1];
- friend struct ::protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::TableStruct;
- };
- // -------------------------------------------------------------------
- class TestRequiredOptimizedForSize : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:protobuf_unittest.TestRequiredOptimizedForSize) */ {
- public:
- TestRequiredOptimizedForSize();
- virtual ~TestRequiredOptimizedForSize();
- TestRequiredOptimizedForSize(const TestRequiredOptimizedForSize& from);
- inline TestRequiredOptimizedForSize& operator=(const TestRequiredOptimizedForSize& from) {
- CopyFrom(from);
- return *this;
- }
- #if LANG_CXX11
- TestRequiredOptimizedForSize(TestRequiredOptimizedForSize&& from) noexcept
- : TestRequiredOptimizedForSize() {
- *this = ::std::move(from);
- }
- inline TestRequiredOptimizedForSize& operator=(TestRequiredOptimizedForSize&& from) noexcept {
- if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
- if (this != &from) InternalSwap(&from);
- } else {
- CopyFrom(from);
- }
- return *this;
- }
- #endif
- inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
- return _internal_metadata_.unknown_fields();
- }
- inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
- return _internal_metadata_.mutable_unknown_fields();
- }
- static const ::google::protobuf::Descriptor* descriptor();
- static const TestRequiredOptimizedForSize& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
- static inline const TestRequiredOptimizedForSize* internal_default_instance() {
- return reinterpret_cast<const TestRequiredOptimizedForSize*>(
- &_TestRequiredOptimizedForSize_default_instance_);
- }
- static constexpr int kIndexInFileMessages =
- 1;
- void Swap(TestRequiredOptimizedForSize* other);
- friend void swap(TestRequiredOptimizedForSize& a, TestRequiredOptimizedForSize& b) {
- a.Swap(&b);
- }
- // implements Message ----------------------------------------------
- inline TestRequiredOptimizedForSize* New() const final {
- return CreateMaybeMessage<TestRequiredOptimizedForSize>(NULL);
- }
- TestRequiredOptimizedForSize* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<TestRequiredOptimizedForSize>(arena);
- }
- int GetCachedSize() const final { return _cached_size_.Get(); }
- private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const final;
- void InternalSwap(TestRequiredOptimizedForSize* other);
- private:
- inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return NULL;
- }
- inline void* MaybeArenaPtr() const {
- return NULL;
- }
- public:
- ::google::protobuf::Metadata GetMetadata() const final;
- // nested types ----------------------------------------------------
- // accessors -------------------------------------------------------
- // required int32 x = 1;
- bool has_x() const;
- void clear_x();
- static const int kXFieldNumber = 1;
- ::google::protobuf::int32 x() const;
- void set_x(::google::protobuf::int32 value);
- // @@protoc_insertion_point(class_scope:protobuf_unittest.TestRequiredOptimizedForSize)
- private:
- void set_has_x();
- void clear_has_x();
- ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- ::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- ::google::protobuf::int32 x_;
- friend struct ::protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::TableStruct;
- };
- // -------------------------------------------------------------------
- class TestOptionalOptimizedForSize : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:protobuf_unittest.TestOptionalOptimizedForSize) */ {
- public:
- TestOptionalOptimizedForSize();
- virtual ~TestOptionalOptimizedForSize();
- TestOptionalOptimizedForSize(const TestOptionalOptimizedForSize& from);
- inline TestOptionalOptimizedForSize& operator=(const TestOptionalOptimizedForSize& from) {
- CopyFrom(from);
- return *this;
- }
- #if LANG_CXX11
- TestOptionalOptimizedForSize(TestOptionalOptimizedForSize&& from) noexcept
- : TestOptionalOptimizedForSize() {
- *this = ::std::move(from);
- }
- inline TestOptionalOptimizedForSize& operator=(TestOptionalOptimizedForSize&& from) noexcept {
- if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
- if (this != &from) InternalSwap(&from);
- } else {
- CopyFrom(from);
- }
- return *this;
- }
- #endif
- inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
- return _internal_metadata_.unknown_fields();
- }
- inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
- return _internal_metadata_.mutable_unknown_fields();
- }
- static const ::google::protobuf::Descriptor* descriptor();
- static const TestOptionalOptimizedForSize& default_instance();
- static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
- static inline const TestOptionalOptimizedForSize* internal_default_instance() {
- return reinterpret_cast<const TestOptionalOptimizedForSize*>(
- &_TestOptionalOptimizedForSize_default_instance_);
- }
- static constexpr int kIndexInFileMessages =
- 2;
- void Swap(TestOptionalOptimizedForSize* other);
- friend void swap(TestOptionalOptimizedForSize& a, TestOptionalOptimizedForSize& b) {
- a.Swap(&b);
- }
- // implements Message ----------------------------------------------
- inline TestOptionalOptimizedForSize* New() const final {
- return CreateMaybeMessage<TestOptionalOptimizedForSize>(NULL);
- }
- TestOptionalOptimizedForSize* New(::google::protobuf::Arena* arena) const final {
- return CreateMaybeMessage<TestOptionalOptimizedForSize>(arena);
- }
- int GetCachedSize() const final { return _cached_size_.Get(); }
- private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const final;
- void InternalSwap(TestOptionalOptimizedForSize* other);
- private:
- inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
- return NULL;
- }
- inline void* MaybeArenaPtr() const {
- return NULL;
- }
- public:
- ::google::protobuf::Metadata GetMetadata() const final;
- // nested types ----------------------------------------------------
- // accessors -------------------------------------------------------
- // optional .protobuf_unittest.TestRequiredOptimizedForSize o = 1;
- bool has_o() const;
- void clear_o();
- static const int kOFieldNumber = 1;
- private:
- const ::protobuf_unittest::TestRequiredOptimizedForSize& _internal_o() const;
- public:
- const ::protobuf_unittest::TestRequiredOptimizedForSize& o() const;
- ::protobuf_unittest::TestRequiredOptimizedForSize* release_o();
- ::protobuf_unittest::TestRequiredOptimizedForSize* mutable_o();
- void set_allocated_o(::protobuf_unittest::TestRequiredOptimizedForSize* o);
- // @@protoc_insertion_point(class_scope:protobuf_unittest.TestOptionalOptimizedForSize)
- private:
- void set_has_o();
- void clear_has_o();
- ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
- ::google::protobuf::internal::HasBits<1> _has_bits_;
- mutable ::google::protobuf::internal::CachedSize _cached_size_;
- ::protobuf_unittest::TestRequiredOptimizedForSize* o_;
- friend struct ::protobuf_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto::TableStruct;
- };
- // ===================================================================
- // ===================================================================
- #ifdef __GNUC__
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wstrict-aliasing"
- #endif // __GNUC__
- // TestOptimizedForSize
- // optional int32 i = 1;
- inline bool TestOptimizedForSize::has_i() const {
- return (_has_bits_[0] & 0x00000002u) != 0;
- }
- inline void TestOptimizedForSize::set_has_i() {
- _has_bits_[0] |= 0x00000002u;
- }
- inline void TestOptimizedForSize::clear_has_i() {
- _has_bits_[0] &= ~0x00000002u;
- }
- inline void TestOptimizedForSize::clear_i() {
- i_ = 0;
- clear_has_i();
- }
- inline ::google::protobuf::int32 TestOptimizedForSize::i() const {
- // @@protoc_insertion_point(field_get:protobuf_unittest.TestOptimizedForSize.i)
- return i_;
- }
- inline void TestOptimizedForSize::set_i(::google::protobuf::int32 value) {
- set_has_i();
- i_ = value;
- // @@protoc_insertion_point(field_set:protobuf_unittest.TestOptimizedForSize.i)
- }
- // optional .protobuf_unittest.ForeignMessage msg = 19;
- inline bool TestOptimizedForSize::has_msg() const {
- return (_has_bits_[0] & 0x00000001u) != 0;
- }
- inline void TestOptimizedForSize::set_has_msg() {
- _has_bits_[0] |= 0x00000001u;
- }
- inline void TestOptimizedForSize::clear_has_msg() {
- _has_bits_[0] &= ~0x00000001u;
- }
- inline const ::protobuf_unittest::ForeignMessage& TestOptimizedForSize::_internal_msg() const {
- return *msg_;
- }
- inline const ::protobuf_unittest::ForeignMessage& TestOptimizedForSize::msg() const {
- const ::protobuf_unittest::ForeignMessage* p = msg_;
- // @@protoc_insertion_point(field_get:protobuf_unittest.TestOptimizedForSize.msg)
- return p != NULL ? *p : *reinterpret_cast<const ::protobuf_unittest::ForeignMessage*>(
- &::protobuf_unittest::_ForeignMessage_default_instance_);
- }
- inline ::protobuf_unittest::ForeignMessage* TestOptimizedForSize::release_msg() {
- // @@protoc_insertion_point(field_release:protobuf_unittest.TestOptimizedForSize.msg)
- clear_has_msg();
- ::protobuf_unittest::ForeignMessage* temp = msg_;
- msg_ = NULL;
- return temp;
- }
- inline ::protobuf_unittest::ForeignMessage* TestOptimizedForSize::mutable_msg() {
- set_has_msg();
- if (msg_ == NULL) {
- auto* p = CreateMaybeMessage<::protobuf_unittest::ForeignMessage>(GetArenaNoVirtual());
- msg_ = p;
- }
- // @@protoc_insertion_point(field_mutable:protobuf_unittest.TestOptimizedForSize.msg)
- return msg_;
- }
- inline void TestOptimizedForSize::set_allocated_msg(::protobuf_unittest::ForeignMessage* msg) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete reinterpret_cast< ::google::protobuf::MessageLite*>(msg_);
- }
- if (msg) {
- ::google::protobuf::Arena* submessage_arena =
- reinterpret_cast<::google::protobuf::MessageLite*>(msg)->GetArena();
- if (message_arena != submessage_arena) {
- msg = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, msg, submessage_arena);
- }
- set_has_msg();
- } else {
- clear_has_msg();
- }
- msg_ = msg;
- // @@protoc_insertion_point(field_set_allocated:protobuf_unittest.TestOptimizedForSize.msg)
- }
- // optional int32 integer_field = 2;
- inline bool TestOptimizedForSize::has_integer_field() const {
- return foo_case() == kIntegerField;
- }
- inline void TestOptimizedForSize::set_has_integer_field() {
- _oneof_case_[0] = kIntegerField;
- }
- inline void TestOptimizedForSize::clear_integer_field() {
- if (has_integer_field()) {
- foo_.integer_field_ = 0;
- clear_has_foo();
- }
- }
- inline ::google::protobuf::int32 TestOptimizedForSize::integer_field() const {
- // @@protoc_insertion_point(field_get:protobuf_unittest.TestOptimizedForSize.integer_field)
- if (has_integer_field()) {
- return foo_.integer_field_;
- }
- return 0;
- }
- inline void TestOptimizedForSize::set_integer_field(::google::protobuf::int32 value) {
- if (!has_integer_field()) {
- clear_foo();
- set_has_integer_field();
- }
- foo_.integer_field_ = value;
- // @@protoc_insertion_point(field_set:protobuf_unittest.TestOptimizedForSize.integer_field)
- }
- // optional string string_field = 3;
- inline bool TestOptimizedForSize::has_string_field() const {
- return foo_case() == kStringField;
- }
- inline void TestOptimizedForSize::set_has_string_field() {
- _oneof_case_[0] = kStringField;
- }
- inline void TestOptimizedForSize::clear_string_field() {
- if (has_string_field()) {
- foo_.string_field_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- clear_has_foo();
- }
- }
- inline const ::std::string& TestOptimizedForSize::string_field() const {
- // @@protoc_insertion_point(field_get:protobuf_unittest.TestOptimizedForSize.string_field)
- if (has_string_field()) {
- return foo_.string_field_.GetNoArena();
- }
- return *&::google::protobuf::internal::GetEmptyStringAlreadyInited();
- }
- inline void TestOptimizedForSize::set_string_field(const ::std::string& value) {
- // @@protoc_insertion_point(field_set:protobuf_unittest.TestOptimizedForSize.string_field)
- if (!has_string_field()) {
- clear_foo();
- set_has_string_field();
- foo_.string_field_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- }
- foo_.string_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
- // @@protoc_insertion_point(field_set:protobuf_unittest.TestOptimizedForSize.string_field)
- }
- #if LANG_CXX11
- inline void TestOptimizedForSize::set_string_field(::std::string&& value) {
- // @@protoc_insertion_point(field_set:protobuf_unittest.TestOptimizedForSize.string_field)
- if (!has_string_field()) {
- clear_foo();
- set_has_string_field();
- foo_.string_field_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- }
- foo_.string_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
- // @@protoc_insertion_point(field_set_rvalue:protobuf_unittest.TestOptimizedForSize.string_field)
- }
- #endif
- inline void TestOptimizedForSize::set_string_field(const char* value) {
- GOOGLE_DCHECK(value != NULL);
- if (!has_string_field()) {
- clear_foo();
- set_has_string_field();
- foo_.string_field_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- }
- foo_.string_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
- ::std::string(value));
- // @@protoc_insertion_point(field_set_char:protobuf_unittest.TestOptimizedForSize.string_field)
- }
- inline void TestOptimizedForSize::set_string_field(const char* value, size_t size) {
- if (!has_string_field()) {
- clear_foo();
- set_has_string_field();
- foo_.string_field_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- }
- foo_.string_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
- reinterpret_cast<const char*>(value), size));
- // @@protoc_insertion_point(field_set_pointer:protobuf_unittest.TestOptimizedForSize.string_field)
- }
- inline ::std::string* TestOptimizedForSize::mutable_string_field() {
- if (!has_string_field()) {
- clear_foo();
- set_has_string_field();
- foo_.string_field_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- }
- // @@protoc_insertion_point(field_mutable:protobuf_unittest.TestOptimizedForSize.string_field)
- return foo_.string_field_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- }
- inline ::std::string* TestOptimizedForSize::release_string_field() {
- // @@protoc_insertion_point(field_release:protobuf_unittest.TestOptimizedForSize.string_field)
- if (has_string_field()) {
- clear_has_foo();
- return foo_.string_field_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- } else {
- return NULL;
- }
- }
- inline void TestOptimizedForSize::set_allocated_string_field(::std::string* string_field) {
- if (!has_string_field()) {
- foo_.string_field_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
- }
- clear_foo();
- if (string_field != NULL) {
- set_has_string_field();
- foo_.string_field_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_field);
- }
- // @@protoc_insertion_point(field_set_allocated:protobuf_unittest.TestOptimizedForSize.string_field)
- }
- inline bool TestOptimizedForSize::has_foo() const {
- return foo_case() != FOO_NOT_SET;
- }
- inline void TestOptimizedForSize::clear_has_foo() {
- _oneof_case_[0] = FOO_NOT_SET;
- }
- inline TestOptimizedForSize::FooCase TestOptimizedForSize::foo_case() const {
- return TestOptimizedForSize::FooCase(_oneof_case_[0]);
- }
- // -------------------------------------------------------------------
- // TestRequiredOptimizedForSize
- // required int32 x = 1;
- inline bool TestRequiredOptimizedForSize::has_x() const {
- return (_has_bits_[0] & 0x00000001u) != 0;
- }
- inline void TestRequiredOptimizedForSize::set_has_x() {
- _has_bits_[0] |= 0x00000001u;
- }
- inline void TestRequiredOptimizedForSize::clear_has_x() {
- _has_bits_[0] &= ~0x00000001u;
- }
- inline void TestRequiredOptimizedForSize::clear_x() {
- x_ = 0;
- clear_has_x();
- }
- inline ::google::protobuf::int32 TestRequiredOptimizedForSize::x() const {
- // @@protoc_insertion_point(field_get:protobuf_unittest.TestRequiredOptimizedForSize.x)
- return x_;
- }
- inline void TestRequiredOptimizedForSize::set_x(::google::protobuf::int32 value) {
- set_has_x();
- x_ = value;
- // @@protoc_insertion_point(field_set:protobuf_unittest.TestRequiredOptimizedForSize.x)
- }
- // -------------------------------------------------------------------
- // TestOptionalOptimizedForSize
- // optional .protobuf_unittest.TestRequiredOptimizedForSize o = 1;
- inline bool TestOptionalOptimizedForSize::has_o() const {
- return (_has_bits_[0] & 0x00000001u) != 0;
- }
- inline void TestOptionalOptimizedForSize::set_has_o() {
- _has_bits_[0] |= 0x00000001u;
- }
- inline void TestOptionalOptimizedForSize::clear_has_o() {
- _has_bits_[0] &= ~0x00000001u;
- }
- inline void TestOptionalOptimizedForSize::clear_o() {
- if (o_ != NULL) o_->Clear();
- clear_has_o();
- }
- inline const ::protobuf_unittest::TestRequiredOptimizedForSize& TestOptionalOptimizedForSize::_internal_o() const {
- return *o_;
- }
- inline const ::protobuf_unittest::TestRequiredOptimizedForSize& TestOptionalOptimizedForSize::o() const {
- const ::protobuf_unittest::TestRequiredOptimizedForSize* p = o_;
- // @@protoc_insertion_point(field_get:protobuf_unittest.TestOptionalOptimizedForSize.o)
- return p != NULL ? *p : *reinterpret_cast<const ::protobuf_unittest::TestRequiredOptimizedForSize*>(
- &::protobuf_unittest::_TestRequiredOptimizedForSize_default_instance_);
- }
- inline ::protobuf_unittest::TestRequiredOptimizedForSize* TestOptionalOptimizedForSize::release_o() {
- // @@protoc_insertion_point(field_release:protobuf_unittest.TestOptionalOptimizedForSize.o)
- clear_has_o();
- ::protobuf_unittest::TestRequiredOptimizedForSize* temp = o_;
- o_ = NULL;
- return temp;
- }
- inline ::protobuf_unittest::TestRequiredOptimizedForSize* TestOptionalOptimizedForSize::mutable_o() {
- set_has_o();
- if (o_ == NULL) {
- auto* p = CreateMaybeMessage<::protobuf_unittest::TestRequiredOptimizedForSize>(GetArenaNoVirtual());
- o_ = p;
- }
- // @@protoc_insertion_point(field_mutable:protobuf_unittest.TestOptionalOptimizedForSize.o)
- return o_;
- }
- inline void TestOptionalOptimizedForSize::set_allocated_o(::protobuf_unittest::TestRequiredOptimizedForSize* o) {
- ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
- if (message_arena == NULL) {
- delete o_;
- }
- if (o) {
- ::google::protobuf::Arena* submessage_arena = NULL;
- if (message_arena != submessage_arena) {
- o = ::google::protobuf::internal::GetOwnedMessage(
- message_arena, o, submessage_arena);
- }
- set_has_o();
- } else {
- clear_has_o();
- }
- o_ = o;
- // @@protoc_insertion_point(field_set_allocated:protobuf_unittest.TestOptionalOptimizedForSize.o)
- }
- #ifdef __GNUC__
- #pragma GCC diagnostic pop
- #endif // __GNUC__
- // -------------------------------------------------------------------
- // -------------------------------------------------------------------
- // @@protoc_insertion_point(namespace_scope)
- } // namespace protobuf_unittest
- // @@protoc_insertion_point(global_scope)
- #endif // PROTOBUF_INCLUDED_google_2fprotobuf_2funittest_5foptimize_5ffor_2eproto
|