// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: tests/person.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "person.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace {
const ::google::protobuf::Descriptor* Name_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
Name_reflection_ = NULL;
const ::google::protobuf::Descriptor* Person_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
Person_reflection_ = NULL;
} // namespace
void protobuf_AssignDesc_tests_2fperson_2eproto() {
protobuf_AddDesc_tests_2fperson_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"tests/person.proto");
GOOGLE_CHECK(file != NULL);
Name_descriptor_ = file->message_type(0);
static const int Name_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Name, firstname_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Name, lastname_),
};
Name_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
Name_descriptor_,
Name::default_instance_,
Name_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Name, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Name, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(Name));
Person_descriptor_ = file->message_type(1);
static const int Person_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Person, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Person, id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Person, email_),
};
Person_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
Person_descriptor_,
Person::default_instance_,
Person_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Person, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Person, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(Person));
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_tests_2fperson_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
Name_descriptor_, &Name::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
Person_descriptor_, &Person::default_instance());
}
} // namespace
void protobuf_ShutdownFile_tests_2fperson_2eproto() {
delete Name::default_instance_;
delete Name_reflection_;
delete Person::default_instance_;
delete Person_reflection_;
}
void protobuf_AddDesc_tests_2fperson_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\022tests/person.proto\"+\n\004Name\022\021\n\tfirstnam"
"e\030\001 \001(\t\022\020\n\010lastname\030\002 \001(\t\"8\n\006Person\022\023\n\004n"
"ame\030\001 \002(\0132\005.Name\022\n\n\002id\030\002 \002(\005\022\r\n\005email\030\003 "
"\001(\t", 123);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"tests/person.proto", &protobuf_RegisterTypes);
Name::default_instance_ = new Name();
Person::default_instance_ = new Person();
Name::default_instance_->InitAsDefaultInstance();
Person::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_tests_2fperson_2eproto);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_tests_2fperson_2eproto {
StaticDescriptorInitializer_tests_2fperson_2eproto() {
protobuf_AddDesc_tests_2fperson_2eproto();
}
} static_descriptor_initializer_tests_2fperson_2eproto_;
// ===================================================================
#ifndef _MSC_VER
const int Name::kFirstnameFieldNumber;
const int Name::kLastnameFieldNumber;
#endif // !_MSC_VER
Name::Name()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Name)
}
void Name::InitAsDefaultInstance() {
}
Name::Name(const Name& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Name)
}
void Name::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
firstname_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
lastname_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
Name::~Name() {
// @@protoc_insertion_point(destructor:Name)
SharedDtor();
}
void Name::SharedDtor() {
if (firstname_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete firstname_;
}
if (lastname_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete lastname_;
}
if (this != default_instance_) {
}
}
void Name::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Name::descriptor() {
protobuf_AssignDescriptorsOnce();
return Name_descriptor_;
}
const Name& Name::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_tests_2fperson_2eproto();
return *default_instance_;
}
Name* Name::default_instance_ = NULL;
Name* Name::New() const {
return new Name;
}
void Name::Clear() {
if (_has_bits_[0 / 32] & 3) {
if (has_firstname()) {
if (firstname_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
firstname_->clear();
}
}
if (has_lastname()) {
if (lastname_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
lastname_->clear();
}
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool Name::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Name)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string firstname = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_firstname()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->firstname().data(), this->firstname().length(),
::google::protobuf::internal::WireFormat::PARSE,
"firstname");
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_lastname;
break;
}
// optional string lastname = 2;
case 2: {
if (tag == 18) {
parse_lastname:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_lastname()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->lastname().data(), this->lastname().length(),
::google::protobuf::internal::WireFormat::PARSE,
"lastname");
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Name)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Name)
return false;
#undef DO_
}
void Name::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Name)
// optional string firstname = 1;
if (has_firstname()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->firstname().data(), this->firstname().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"firstname");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->firstname(), output);
}
// optional string lastname = 2;
if (has_lastname()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->lastname().data(), this->lastname().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"lastname");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->lastname(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Name)
}
::google::protobuf::uint8* Name::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Name)
// optional string firstname = 1;
if (has_firstname()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->firstname().data(), this->firstname().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"firstname");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->firstname(), target);
}
// optional string lastname = 2;
if (has_lastname()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->lastname().data(), this->lastname().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"lastname");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->lastname(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Name)
return target;
}
int Name::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional string firstname = 1;
if (has_firstname()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->firstname());
}
// optional string lastname = 2;
if (has_lastname()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->lastname());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void Name::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const Name* source =
::google::protobuf::internal::dynamic_cast_if_available<const Name*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void Name::MergeFrom(const Name& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_firstname()) {
set_firstname(from.firstname());
}
if (from.has_lastname()) {
set_lastname(from.lastname());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void Name::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void Name::CopyFrom(const Name& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool Name::IsInitialized() const {
return true;
}
void Name::Swap(Name* other) {
if (other != this) {
std::swap(firstname_, other->firstname_);
std::swap(lastname_, other->lastname_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata Name::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = Name_descriptor_;
metadata.reflection = Name_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int Person::kNameFieldNumber;
const int Person::kIdFieldNumber;
const int Person::kEmailFieldNumber;
#endif // !_MSC_VER
Person::Person()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Person)
}
void Person::InitAsDefaultInstance() {
name_ = const_cast< ::Name*>(&::Name::default_instance());
}
Person::Person(const Person& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Person)
}
void Person::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
name_ = NULL;
id_ = 0;
email_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
Person::~Person() {
// @@protoc_insertion_point(destructor:Person)
SharedDtor();
}
void Person::SharedDtor() {
if (email_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete email_;
}
if (this != default_instance_) {
delete name_;
}
}
void Person::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* Person::descriptor() {
protobuf_AssignDescriptorsOnce();
return Person_descriptor_;
}
const Person& Person::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_tests_2fperson_2eproto();
return *default_instance_;
}
Person* Person::default_instance_ = NULL;
Person* Person::New() const {
return new Person;
}
void Person::Clear() {
if (_has_bits_[0 / 32] & 7) {
if (has_name()) {
if (name_ != NULL) name_->::Name::Clear();
}
id_ = 0;
if (has_email()) {
if (email_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
email_->clear();
}
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool Person::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Person)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .Name name = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_name()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_id;
break;
}
// required int32 id = 2;
case 2: {
if (tag == 16) {
parse_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &id_)));
set_has_id();
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_email;
break;
}
// optional string email = 3;
case 3: {
if (tag == 26) {
parse_email:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_email()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->email().data(), this->email().length(),
::google::protobuf::internal::WireFormat::PARSE,
"email");
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Person)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Person)
return false;
#undef DO_
}
void Person::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Person)
// required .Name name = 1;
if (has_name()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->name(), output);
}
// required int32 id = 2;
if (has_id()) {
::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->id(), output);
}
// optional string email = 3;
if (has_email()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->email().data(), this->email().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"email");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->email(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Person)
}
::google::protobuf::uint8* Person::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Person)
// required .Name name = 1;
if (has_name()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->name(), target);
}
// required int32 id = 2;
if (has_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->id(), target);
}
// optional string email = 3;
if (has_email()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->email().data(), this->email().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"email");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->email(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Person)
return target;
}
int Person::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .Name name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->name());
}
// required int32 id = 2;
if (has_id()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->id());
}
// optional string email = 3;
if (has_email()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->email());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void Person::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const Person* source =
::google::protobuf::internal::dynamic_cast_if_available<const Person*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void Person::MergeFrom(const Person& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_name()) {
mutable_name()->::Name::MergeFrom(from.name());
}
if (from.has_id()) {
set_id(from.id());
}
if (from.has_email()) {
set_email(from.email());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void Person::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void Person::CopyFrom(const Person& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool Person::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
return true;
}
void Person::Swap(Person* other) {
if (other != this) {
std::swap(name_, other->name_);
std::swap(id_, other->id_);
std::swap(email_, other->email_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata Person::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = Person_descriptor_;
metadata.reflection = Person_reflection_;
return metadata;
}
// @@protoc_insertion_point(namespace_scope)
// @@protoc_insertion_point(global_scope)