Created
June 6, 2018 09:38
-
-
Save crawshaw/5310775eab5bab825cacc288eba112de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated by the protocol buffer compiler. DO NOT EDIT! | |
// source: addressbook.proto | |
#include "addressbook.pb.h" | |
#include <algorithm> | |
#include <google/protobuf/stubs/common.h> | |
#include <google/protobuf/stubs/port.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> | |
// This is a temporary google only hack | |
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS | |
#include "third_party/protobuf/version.h" | |
#endif | |
// @@protoc_insertion_point(includes) | |
namespace tutorial { | |
class Person_PhoneNumberDefaultTypeInternal { | |
public: | |
::google::protobuf::internal::ExplicitlyConstructed<Person_PhoneNumber> | |
_instance; | |
} _Person_PhoneNumber_default_instance_; | |
class PersonDefaultTypeInternal { | |
public: | |
::google::protobuf::internal::ExplicitlyConstructed<Person> | |
_instance; | |
} _Person_default_instance_; | |
class AddressBookDefaultTypeInternal { | |
public: | |
::google::protobuf::internal::ExplicitlyConstructed<AddressBook> | |
_instance; | |
} _AddressBook_default_instance_; | |
} // namespace tutorial | |
namespace protobuf_addressbook_2eproto { | |
void InitDefaultsPerson_PhoneNumberImpl() { | |
GOOGLE_PROTOBUF_VERIFY_VERSION; | |
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS | |
::google::protobuf::internal::InitProtobufDefaultsForceUnique(); | |
#else | |
::google::protobuf::internal::InitProtobufDefaults(); | |
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS | |
{ | |
void* ptr = &::tutorial::_Person_PhoneNumber_default_instance_; | |
new (ptr) ::tutorial::Person_PhoneNumber(); | |
::google::protobuf::internal::OnShutdownDestroyMessage(ptr); | |
} | |
::tutorial::Person_PhoneNumber::InitAsDefaultInstance(); | |
} | |
void InitDefaultsPerson_PhoneNumber() { | |
static GOOGLE_PROTOBUF_DECLARE_ONCE(once); | |
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsPerson_PhoneNumberImpl); | |
} | |
void InitDefaultsPersonImpl() { | |
GOOGLE_PROTOBUF_VERIFY_VERSION; | |
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS | |
::google::protobuf::internal::InitProtobufDefaultsForceUnique(); | |
#else | |
::google::protobuf::internal::InitProtobufDefaults(); | |
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS | |
protobuf_addressbook_2eproto::InitDefaultsPerson_PhoneNumber(); | |
protobuf_google_2fprotobuf_2ftimestamp_2eproto::InitDefaultsTimestamp(); | |
{ | |
void* ptr = &::tutorial::_Person_default_instance_; | |
new (ptr) ::tutorial::Person(); | |
::google::protobuf::internal::OnShutdownDestroyMessage(ptr); | |
} | |
::tutorial::Person::InitAsDefaultInstance(); | |
} | |
void InitDefaultsPerson() { | |
static GOOGLE_PROTOBUF_DECLARE_ONCE(once); | |
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsPersonImpl); | |
} | |
void InitDefaultsAddressBookImpl() { | |
GOOGLE_PROTOBUF_VERIFY_VERSION; | |
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS | |
::google::protobuf::internal::InitProtobufDefaultsForceUnique(); | |
#else | |
::google::protobuf::internal::InitProtobufDefaults(); | |
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS | |
protobuf_addressbook_2eproto::InitDefaultsPerson(); | |
{ | |
void* ptr = &::tutorial::_AddressBook_default_instance_; | |
new (ptr) ::tutorial::AddressBook(); | |
::google::protobuf::internal::OnShutdownDestroyMessage(ptr); | |
} | |
::tutorial::AddressBook::InitAsDefaultInstance(); | |
} | |
void InitDefaultsAddressBook() { | |
static GOOGLE_PROTOBUF_DECLARE_ONCE(once); | |
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsAddressBookImpl); | |
} | |
::google::protobuf::Metadata file_level_metadata[3]; | |
const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1]; | |
const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { | |
~0u, // no _has_bits_ | |
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tutorial::Person_PhoneNumber, _internal_metadata_), | |
~0u, // no _extensions_ | |
~0u, // no _oneof_case_ | |
~0u, // no _weak_field_map_ | |
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tutorial::Person_PhoneNumber, number_), | |
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tutorial::Person_PhoneNumber, type_), | |
~0u, // no _has_bits_ | |
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tutorial::Person, _internal_metadata_), | |
~0u, // no _extensions_ | |
~0u, // no _oneof_case_ | |
~0u, // no _weak_field_map_ | |
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tutorial::Person, name_), | |
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tutorial::Person, id_), | |
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tutorial::Person, email_), | |
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tutorial::Person, phones_), | |
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tutorial::Person, last_updated_), | |
~0u, // no _has_bits_ | |
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tutorial::AddressBook, _internal_metadata_), | |
~0u, // no _extensions_ | |
~0u, // no _oneof_case_ | |
~0u, // no _weak_field_map_ | |
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::tutorial::AddressBook, people_), | |
}; | |
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { | |
{ 0, -1, sizeof(::tutorial::Person_PhoneNumber)}, | |
{ 7, -1, sizeof(::tutorial::Person)}, | |
{ 17, -1, sizeof(::tutorial::AddressBook)}, | |
}; | |
static ::google::protobuf::Message const * const file_default_instances[] = { | |
reinterpret_cast<const ::google::protobuf::Message*>(&::tutorial::_Person_PhoneNumber_default_instance_), | |
reinterpret_cast<const ::google::protobuf::Message*>(&::tutorial::_Person_default_instance_), | |
reinterpret_cast<const ::google::protobuf::Message*>(&::tutorial::_AddressBook_default_instance_), | |
}; | |
void protobuf_AssignDescriptors() { | |
AddDescriptors(); | |
::google::protobuf::MessageFactory* factory = NULL; | |
AssignDescriptors( | |
"addressbook.proto", schemas, file_default_instances, TableStruct::offsets, factory, | |
file_level_metadata, file_level_enum_descriptors, NULL); | |
} | |
void protobuf_AssignDescriptorsOnce() { | |
static GOOGLE_PROTOBUF_DECLARE_ONCE(once); | |
::google::protobuf::GoogleOnceInit(&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, 3); | |
} | |
void AddDescriptorsImpl() { | |
InitDefaults(); | |
static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { | |
"\n\021addressbook.proto\022\010tutorial\032\037google/pr" | |
"otobuf/timestamp.proto\"\207\002\n\006Person\022\014\n\004nam" | |
"e\030\001 \001(\t\022\n\n\002id\030\002 \001(\005\022\r\n\005email\030\003 \001(\t\022,\n\006ph" | |
"ones\030\004 \003(\0132\034.tutorial.Person.PhoneNumber" | |
"\0220\n\014last_updated\030\005 \001(\0132\032.google.protobuf" | |
".Timestamp\032G\n\013PhoneNumber\022\016\n\006number\030\001 \001(" | |
"\t\022(\n\004type\030\002 \001(\0162\032.tutorial.Person.PhoneT" | |
"ype\"+\n\tPhoneType\022\n\n\006MOBILE\020\000\022\010\n\004HOME\020\001\022\010" | |
"\n\004WORK\020\002\"/\n\013AddressBook\022 \n\006people\030\001 \003(\0132" | |
"\020.tutorial.PersonBP\n\024com.example.tutoria" | |
"lB\021AddressBookProtos\252\002$Google.Protobuf.E" | |
"xamples.AddressBookb\006proto3" | |
}; | |
::google::protobuf::DescriptorPool::InternalAddGeneratedFile( | |
descriptor, 467); | |
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( | |
"addressbook.proto", &protobuf_RegisterTypes); | |
::protobuf_google_2fprotobuf_2ftimestamp_2eproto::AddDescriptors(); | |
} | |
void AddDescriptors() { | |
static GOOGLE_PROTOBUF_DECLARE_ONCE(once); | |
::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl); | |
} | |
// Force AddDescriptors() to be called at dynamic initialization time. | |
struct StaticDescriptorInitializer { | |
StaticDescriptorInitializer() { | |
AddDescriptors(); | |
} | |
} static_descriptor_initializer; | |
} // namespace protobuf_addressbook_2eproto | |
namespace tutorial { | |
const ::google::protobuf::EnumDescriptor* Person_PhoneType_descriptor() { | |
protobuf_addressbook_2eproto::protobuf_AssignDescriptorsOnce(); | |
return protobuf_addressbook_2eproto::file_level_enum_descriptors[0]; | |
} | |
bool Person_PhoneType_IsValid(int value) { | |
switch (value) { | |
case 0: | |
case 1: | |
case 2: | |
return true; | |
default: | |
return false; | |
} | |
} | |
#if !defined(_MSC_VER) || _MSC_VER >= 1900 | |
const Person_PhoneType Person::MOBILE; | |
const Person_PhoneType Person::HOME; | |
const Person_PhoneType Person::WORK; | |
const Person_PhoneType Person::PhoneType_MIN; | |
const Person_PhoneType Person::PhoneType_MAX; | |
const int Person::PhoneType_ARRAYSIZE; | |
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 | |
// =================================================================== | |
void Person_PhoneNumber::InitAsDefaultInstance() { | |
} | |
#if !defined(_MSC_VER) || _MSC_VER >= 1900 | |
const int Person_PhoneNumber::kNumberFieldNumber; | |
const int Person_PhoneNumber::kTypeFieldNumber; | |
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 | |
Person_PhoneNumber::Person_PhoneNumber() | |
: ::google::protobuf::Message(), _internal_metadata_(NULL) { | |
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { | |
::protobuf_addressbook_2eproto::InitDefaultsPerson_PhoneNumber(); | |
} | |
SharedCtor(); | |
// @@protoc_insertion_point(constructor:tutorial.Person.PhoneNumber) | |
} | |
Person_PhoneNumber::Person_PhoneNumber(const Person_PhoneNumber& from) | |
: ::google::protobuf::Message(), | |
_internal_metadata_(NULL), | |
_cached_size_(0) { | |
_internal_metadata_.MergeFrom(from._internal_metadata_); | |
number_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); | |
if (from.number().size() > 0) { | |
number_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.number_); | |
} | |
type_ = from.type_; | |
// @@protoc_insertion_point(copy_constructor:tutorial.Person.PhoneNumber) | |
} | |
void Person_PhoneNumber::SharedCtor() { | |
number_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); | |
type_ = 0; | |
_cached_size_ = 0; | |
} | |
Person_PhoneNumber::~Person_PhoneNumber() { | |
// @@protoc_insertion_point(destructor:tutorial.Person.PhoneNumber) | |
SharedDtor(); | |
} | |
void Person_PhoneNumber::SharedDtor() { | |
number_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); | |
} | |
void Person_PhoneNumber::SetCachedSize(int size) const { | |
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); | |
_cached_size_ = size; | |
GOOGLE_SAFE_CONCURRENT_WRITES_END(); | |
} | |
const ::google::protobuf::Descriptor* Person_PhoneNumber::descriptor() { | |
::protobuf_addressbook_2eproto::protobuf_AssignDescriptorsOnce(); | |
return ::protobuf_addressbook_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; | |
} | |
const Person_PhoneNumber& Person_PhoneNumber::default_instance() { | |
::protobuf_addressbook_2eproto::InitDefaultsPerson_PhoneNumber(); | |
return *internal_default_instance(); | |
} | |
Person_PhoneNumber* Person_PhoneNumber::New(::google::protobuf::Arena* arena) const { | |
Person_PhoneNumber* n = new Person_PhoneNumber; | |
if (arena != NULL) { | |
arena->Own(n); | |
} | |
return n; | |
} | |
void Person_PhoneNumber::Clear() { | |
// @@protoc_insertion_point(message_clear_start:tutorial.Person.PhoneNumber) | |
::google::protobuf::uint32 cached_has_bits = 0; | |
// Prevent compiler warnings about cached_has_bits being unused | |
(void) cached_has_bits; | |
number_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); | |
type_ = 0; | |
_internal_metadata_.Clear(); | |
} | |
bool Person_PhoneNumber::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:tutorial.Person.PhoneNumber) | |
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)) { | |
// string number = 1; | |
case 1: { | |
if (static_cast< ::google::protobuf::uint8>(tag) == | |
static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { | |
DO_(::google::protobuf::internal::WireFormatLite::ReadString( | |
input, this->mutable_number())); | |
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( | |
this->number().data(), static_cast<int>(this->number().length()), | |
::google::protobuf::internal::WireFormatLite::PARSE, | |
"tutorial.Person.PhoneNumber.number")); | |
} else { | |
goto handle_unusual; | |
} | |
break; | |
} | |
// .tutorial.Person.PhoneType type = 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))); | |
set_type(static_cast< ::tutorial::Person_PhoneType >(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:tutorial.Person.PhoneNumber) | |
return true; | |
failure: | |
// @@protoc_insertion_point(parse_failure:tutorial.Person.PhoneNumber) | |
return false; | |
#undef DO_ | |
} | |
void Person_PhoneNumber::SerializeWithCachedSizes( | |
::google::protobuf::io::CodedOutputStream* output) const { | |
// @@protoc_insertion_point(serialize_start:tutorial.Person.PhoneNumber) | |
::google::protobuf::uint32 cached_has_bits = 0; | |
(void) cached_has_bits; | |
// string number = 1; | |
if (this->number().size() > 0) { | |
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( | |
this->number().data(), static_cast<int>(this->number().length()), | |
::google::protobuf::internal::WireFormatLite::SERIALIZE, | |
"tutorial.Person.PhoneNumber.number"); | |
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( | |
1, this->number(), output); | |
} | |
// .tutorial.Person.PhoneType type = 2; | |
if (this->type() != 0) { | |
::google::protobuf::internal::WireFormatLite::WriteEnum( | |
2, this->type(), output); | |
} | |
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { | |
::google::protobuf::internal::WireFormat::SerializeUnknownFields( | |
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); | |
} | |
// @@protoc_insertion_point(serialize_end:tutorial.Person.PhoneNumber) | |
} | |
::google::protobuf::uint8* Person_PhoneNumber::InternalSerializeWithCachedSizesToArray( | |
bool deterministic, ::google::protobuf::uint8* target) const { | |
(void)deterministic; // Unused | |
// @@protoc_insertion_point(serialize_to_array_start:tutorial.Person.PhoneNumber) | |
::google::protobuf::uint32 cached_has_bits = 0; | |
(void) cached_has_bits; | |
// string number = 1; | |
if (this->number().size() > 0) { | |
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( | |
this->number().data(), static_cast<int>(this->number().length()), | |
::google::protobuf::internal::WireFormatLite::SERIALIZE, | |
"tutorial.Person.PhoneNumber.number"); | |
target = | |
::google::protobuf::internal::WireFormatLite::WriteStringToArray( | |
1, this->number(), target); | |
} | |
// .tutorial.Person.PhoneType type = 2; | |
if (this->type() != 0) { | |
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( | |
2, this->type(), target); | |
} | |
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { | |
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( | |
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); | |
} | |
// @@protoc_insertion_point(serialize_to_array_end:tutorial.Person.PhoneNumber) | |
return target; | |
} | |
size_t Person_PhoneNumber::ByteSizeLong() const { | |
// @@protoc_insertion_point(message_byte_size_start:tutorial.Person.PhoneNumber) | |
size_t total_size = 0; | |
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { | |
total_size += | |
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( | |
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); | |
} | |
// string number = 1; | |
if (this->number().size() > 0) { | |
total_size += 1 + | |
::google::protobuf::internal::WireFormatLite::StringSize( | |
this->number()); | |
} | |
// .tutorial.Person.PhoneType type = 2; | |
if (this->type() != 0) { | |
total_size += 1 + | |
::google::protobuf::internal::WireFormatLite::EnumSize(this->type()); | |
} | |
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); | |
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); | |
_cached_size_ = cached_size; | |
GOOGLE_SAFE_CONCURRENT_WRITES_END(); | |
return total_size; | |
} | |
void Person_PhoneNumber::MergeFrom(const ::google::protobuf::Message& from) { | |
// @@protoc_insertion_point(generalized_merge_from_start:tutorial.Person.PhoneNumber) | |
GOOGLE_DCHECK_NE(&from, this); | |
const Person_PhoneNumber* source = | |
::google::protobuf::internal::DynamicCastToGenerated<const Person_PhoneNumber>( | |
&from); | |
if (source == NULL) { | |
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tutorial.Person.PhoneNumber) | |
::google::protobuf::internal::ReflectionOps::Merge(from, this); | |
} else { | |
// @@protoc_insertion_point(generalized_merge_from_cast_success:tutorial.Person.PhoneNumber) | |
MergeFrom(*source); | |
} | |
} | |
void Person_PhoneNumber::MergeFrom(const Person_PhoneNumber& from) { | |
// @@protoc_insertion_point(class_specific_merge_from_start:tutorial.Person.PhoneNumber) | |
GOOGLE_DCHECK_NE(&from, this); | |
_internal_metadata_.MergeFrom(from._internal_metadata_); | |
::google::protobuf::uint32 cached_has_bits = 0; | |
(void) cached_has_bits; | |
if (from.number().size() > 0) { | |
number_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.number_); | |
} | |
if (from.type() != 0) { | |
set_type(from.type()); | |
} | |
} | |
void Person_PhoneNumber::CopyFrom(const ::google::protobuf::Message& from) { | |
// @@protoc_insertion_point(generalized_copy_from_start:tutorial.Person.PhoneNumber) | |
if (&from == this) return; | |
Clear(); | |
MergeFrom(from); | |
} | |
void Person_PhoneNumber::CopyFrom(const Person_PhoneNumber& from) { | |
// @@protoc_insertion_point(class_specific_copy_from_start:tutorial.Person.PhoneNumber) | |
if (&from == this) return; | |
Clear(); | |
MergeFrom(from); | |
} | |
bool Person_PhoneNumber::IsInitialized() const { | |
return true; | |
} | |
void Person_PhoneNumber::Swap(Person_PhoneNumber* other) { | |
if (other == this) return; | |
InternalSwap(other); | |
} | |
void Person_PhoneNumber::InternalSwap(Person_PhoneNumber* other) { | |
using std::swap; | |
number_.Swap(&other->number_); | |
swap(type_, other->type_); | |
_internal_metadata_.Swap(&other->_internal_metadata_); | |
swap(_cached_size_, other->_cached_size_); | |
} | |
::google::protobuf::Metadata Person_PhoneNumber::GetMetadata() const { | |
protobuf_addressbook_2eproto::protobuf_AssignDescriptorsOnce(); | |
return ::protobuf_addressbook_2eproto::file_level_metadata[kIndexInFileMessages]; | |
} | |
// =================================================================== | |
void Person::InitAsDefaultInstance() { | |
::tutorial::_Person_default_instance_._instance.get_mutable()->last_updated_ = const_cast< ::google::protobuf::Timestamp*>( | |
::google::protobuf::Timestamp::internal_default_instance()); | |
} | |
void Person::clear_last_updated() { | |
if (GetArenaNoVirtual() == NULL && last_updated_ != NULL) { | |
delete last_updated_; | |
} | |
last_updated_ = NULL; | |
} | |
#if !defined(_MSC_VER) || _MSC_VER >= 1900 | |
const int Person::kNameFieldNumber; | |
const int Person::kIdFieldNumber; | |
const int Person::kEmailFieldNumber; | |
const int Person::kPhonesFieldNumber; | |
const int Person::kLastUpdatedFieldNumber; | |
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 | |
Person::Person() | |
: ::google::protobuf::Message(), _internal_metadata_(NULL) { | |
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { | |
::protobuf_addressbook_2eproto::InitDefaultsPerson(); | |
} | |
SharedCtor(); | |
// @@protoc_insertion_point(constructor:tutorial.Person) | |
} | |
Person::Person(const Person& from) | |
: ::google::protobuf::Message(), | |
_internal_metadata_(NULL), | |
phones_(from.phones_), | |
_cached_size_(0) { | |
_internal_metadata_.MergeFrom(from._internal_metadata_); | |
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); | |
if (from.name().size() > 0) { | |
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); | |
} | |
email_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); | |
if (from.email().size() > 0) { | |
email_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.email_); | |
} | |
if (from.has_last_updated()) { | |
last_updated_ = new ::google::protobuf::Timestamp(*from.last_updated_); | |
} else { | |
last_updated_ = NULL; | |
} | |
id_ = from.id_; | |
// @@protoc_insertion_point(copy_constructor:tutorial.Person) | |
} | |
void Person::SharedCtor() { | |
name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); | |
email_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); | |
::memset(&last_updated_, 0, static_cast<size_t>( | |
reinterpret_cast<char*>(&id_) - | |
reinterpret_cast<char*>(&last_updated_)) + sizeof(id_)); | |
_cached_size_ = 0; | |
} | |
Person::~Person() { | |
// @@protoc_insertion_point(destructor:tutorial.Person) | |
SharedDtor(); | |
} | |
void Person::SharedDtor() { | |
name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); | |
email_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); | |
if (this != internal_default_instance()) delete last_updated_; | |
} | |
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_addressbook_2eproto::protobuf_AssignDescriptorsOnce(); | |
return ::protobuf_addressbook_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; | |
} | |
const Person& Person::default_instance() { | |
::protobuf_addressbook_2eproto::InitDefaultsPerson(); | |
return *internal_default_instance(); | |
} | |
Person* Person::New(::google::protobuf::Arena* arena) const { | |
Person* n = new Person; | |
if (arena != NULL) { | |
arena->Own(n); | |
} | |
return n; | |
} | |
void Person::Clear() { | |
// @@protoc_insertion_point(message_clear_start:tutorial.Person) | |
::google::protobuf::uint32 cached_has_bits = 0; | |
// Prevent compiler warnings about cached_has_bits being unused | |
(void) cached_has_bits; | |
phones_.Clear(); | |
name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); | |
email_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); | |
if (GetArenaNoVirtual() == NULL && last_updated_ != NULL) { | |
delete last_updated_; | |
} | |
last_updated_ = NULL; | |
id_ = 0; | |
_internal_metadata_.Clear(); | |
} | |
bool Person::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:tutorial.Person) | |
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)) { | |
// string name = 1; | |
case 1: { | |
if (static_cast< ::google::protobuf::uint8>(tag) == | |
static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { | |
DO_(::google::protobuf::internal::WireFormatLite::ReadString( | |
input, this->mutable_name())); | |
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( | |
this->name().data(), static_cast<int>(this->name().length()), | |
::google::protobuf::internal::WireFormatLite::PARSE, | |
"tutorial.Person.name")); | |
} else { | |
goto handle_unusual; | |
} | |
break; | |
} | |
// int32 id = 2; | |
case 2: { | |
if (static_cast< ::google::protobuf::uint8>(tag) == | |
static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) { | |
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< | |
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( | |
input, &id_))); | |
} else { | |
goto handle_unusual; | |
} | |
break; | |
} | |
// string email = 3; | |
case 3: { | |
if (static_cast< ::google::protobuf::uint8>(tag) == | |
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) { | |
DO_(::google::protobuf::internal::WireFormatLite::ReadString( | |
input, this->mutable_email())); | |
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String( | |
this->email().data(), static_cast<int>(this->email().length()), | |
::google::protobuf::internal::WireFormatLite::PARSE, | |
"tutorial.Person.email")); | |
} else { | |
goto handle_unusual; | |
} | |
break; | |
} | |
// repeated .tutorial.Person.PhoneNumber phones = 4; | |
case 4: { | |
if (static_cast< ::google::protobuf::uint8>(tag) == | |
static_cast< ::google::protobuf::uint8>(34u /* 34 & 0xFF */)) { | |
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_phones())); | |
} else { | |
goto handle_unusual; | |
} | |
break; | |
} | |
// .google.protobuf.Timestamp last_updated = 5; | |
case 5: { | |
if (static_cast< ::google::protobuf::uint8>(tag) == | |
static_cast< ::google::protobuf::uint8>(42u /* 42 & 0xFF */)) { | |
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage( | |
input, mutable_last_updated())); | |
} 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:tutorial.Person) | |
return true; | |
failure: | |
// @@protoc_insertion_point(parse_failure:tutorial.Person) | |
return false; | |
#undef DO_ | |
} | |
void Person::SerializeWithCachedSizes( | |
::google::protobuf::io::CodedOutputStream* output) const { | |
// @@protoc_insertion_point(serialize_start:tutorial.Person) | |
::google::protobuf::uint32 cached_has_bits = 0; | |
(void) cached_has_bits; | |
// string name = 1; | |
if (this->name().size() > 0) { | |
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( | |
this->name().data(), static_cast<int>(this->name().length()), | |
::google::protobuf::internal::WireFormatLite::SERIALIZE, | |
"tutorial.Person.name"); | |
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( | |
1, this->name(), output); | |
} | |
// int32 id = 2; | |
if (this->id() != 0) { | |
::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->id(), output); | |
} | |
// string email = 3; | |
if (this->email().size() > 0) { | |
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( | |
this->email().data(), static_cast<int>(this->email().length()), | |
::google::protobuf::internal::WireFormatLite::SERIALIZE, | |
"tutorial.Person.email"); | |
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( | |
3, this->email(), output); | |
} | |
// repeated .tutorial.Person.PhoneNumber phones = 4; | |
for (unsigned int i = 0, | |
n = static_cast<unsigned int>(this->phones_size()); i < n; i++) { | |
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( | |
4, this->phones(static_cast<int>(i)), output); | |
} | |
// .google.protobuf.Timestamp last_updated = 5; | |
if (this->has_last_updated()) { | |
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( | |
5, *this->last_updated_, output); | |
} | |
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { | |
::google::protobuf::internal::WireFormat::SerializeUnknownFields( | |
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); | |
} | |
// @@protoc_insertion_point(serialize_end:tutorial.Person) | |
} | |
::google::protobuf::uint8* Person::InternalSerializeWithCachedSizesToArray( | |
bool deterministic, ::google::protobuf::uint8* target) const { | |
(void)deterministic; // Unused | |
// @@protoc_insertion_point(serialize_to_array_start:tutorial.Person) | |
::google::protobuf::uint32 cached_has_bits = 0; | |
(void) cached_has_bits; | |
// string name = 1; | |
if (this->name().size() > 0) { | |
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( | |
this->name().data(), static_cast<int>(this->name().length()), | |
::google::protobuf::internal::WireFormatLite::SERIALIZE, | |
"tutorial.Person.name"); | |
target = | |
::google::protobuf::internal::WireFormatLite::WriteStringToArray( | |
1, this->name(), target); | |
} | |
// int32 id = 2; | |
if (this->id() != 0) { | |
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->id(), target); | |
} | |
// string email = 3; | |
if (this->email().size() > 0) { | |
::google::protobuf::internal::WireFormatLite::VerifyUtf8String( | |
this->email().data(), static_cast<int>(this->email().length()), | |
::google::protobuf::internal::WireFormatLite::SERIALIZE, | |
"tutorial.Person.email"); | |
target = | |
::google::protobuf::internal::WireFormatLite::WriteStringToArray( | |
3, this->email(), target); | |
} | |
// repeated .tutorial.Person.PhoneNumber phones = 4; | |
for (unsigned int i = 0, | |
n = static_cast<unsigned int>(this->phones_size()); i < n; i++) { | |
target = ::google::protobuf::internal::WireFormatLite:: | |
InternalWriteMessageToArray( | |
4, this->phones(static_cast<int>(i)), deterministic, target); | |
} | |
// .google.protobuf.Timestamp last_updated = 5; | |
if (this->has_last_updated()) { | |
target = ::google::protobuf::internal::WireFormatLite:: | |
InternalWriteMessageToArray( | |
5, *this->last_updated_, deterministic, target); | |
} | |
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { | |
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( | |
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); | |
} | |
// @@protoc_insertion_point(serialize_to_array_end:tutorial.Person) | |
return target; | |
} | |
size_t Person::ByteSizeLong() const { | |
// @@protoc_insertion_point(message_byte_size_start:tutorial.Person) | |
size_t total_size = 0; | |
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { | |
total_size += | |
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( | |
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); | |
} | |
// repeated .tutorial.Person.PhoneNumber phones = 4; | |
{ | |
unsigned int count = static_cast<unsigned int>(this->phones_size()); | |
total_size += 1UL * count; | |
for (unsigned int i = 0; i < count; i++) { | |
total_size += | |
::google::protobuf::internal::WireFormatLite::MessageSize( | |
this->phones(static_cast<int>(i))); | |
} | |
} | |
// string name = 1; | |
if (this->name().size() > 0) { | |
total_size += 1 + | |
::google::protobuf::internal::WireFormatLite::StringSize( | |
this->name()); | |
} | |
// string email = 3; | |
if (this->email().size() > 0) { | |
total_size += 1 + | |
::google::protobuf::internal::WireFormatLite::StringSize( | |
this->email()); | |
} | |
// .google.protobuf.Timestamp last_updated = 5; | |
if (this->has_last_updated()) { | |
total_size += 1 + | |
::google::protobuf::internal::WireFormatLite::MessageSize( | |
*this->last_updated_); | |
} | |
// int32 id = 2; | |
if (this->id() != 0) { | |
total_size += 1 + | |
::google::protobuf::internal::WireFormatLite::Int32Size( | |
this->id()); | |
} | |
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); | |
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); | |
_cached_size_ = cached_size; | |
GOOGLE_SAFE_CONCURRENT_WRITES_END(); | |
return total_size; | |
} | |
void Person::MergeFrom(const ::google::protobuf::Message& from) { | |
// @@protoc_insertion_point(generalized_merge_from_start:tutorial.Person) | |
GOOGLE_DCHECK_NE(&from, this); | |
const Person* source = | |
::google::protobuf::internal::DynamicCastToGenerated<const Person>( | |
&from); | |
if (source == NULL) { | |
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tutorial.Person) | |
::google::protobuf::internal::ReflectionOps::Merge(from, this); | |
} else { | |
// @@protoc_insertion_point(generalized_merge_from_cast_success:tutorial.Person) | |
MergeFrom(*source); | |
} | |
} | |
void Person::MergeFrom(const Person& from) { | |
// @@protoc_insertion_point(class_specific_merge_from_start:tutorial.Person) | |
GOOGLE_DCHECK_NE(&from, this); | |
_internal_metadata_.MergeFrom(from._internal_metadata_); | |
::google::protobuf::uint32 cached_has_bits = 0; | |
(void) cached_has_bits; | |
phones_.MergeFrom(from.phones_); | |
if (from.name().size() > 0) { | |
name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); | |
} | |
if (from.email().size() > 0) { | |
email_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.email_); | |
} | |
if (from.has_last_updated()) { | |
mutable_last_updated()->::google::protobuf::Timestamp::MergeFrom(from.last_updated()); | |
} | |
if (from.id() != 0) { | |
set_id(from.id()); | |
} | |
} | |
void Person::CopyFrom(const ::google::protobuf::Message& from) { | |
// @@protoc_insertion_point(generalized_copy_from_start:tutorial.Person) | |
if (&from == this) return; | |
Clear(); | |
MergeFrom(from); | |
} | |
void Person::CopyFrom(const Person& from) { | |
// @@protoc_insertion_point(class_specific_copy_from_start:tutorial.Person) | |
if (&from == this) return; | |
Clear(); | |
MergeFrom(from); | |
} | |
bool Person::IsInitialized() const { | |
return true; | |
} | |
void Person::Swap(Person* other) { | |
if (other == this) return; | |
InternalSwap(other); | |
} | |
void Person::InternalSwap(Person* other) { | |
using std::swap; | |
phones_.InternalSwap(&other->phones_); | |
name_.Swap(&other->name_); | |
email_.Swap(&other->email_); | |
swap(last_updated_, other->last_updated_); | |
swap(id_, other->id_); | |
_internal_metadata_.Swap(&other->_internal_metadata_); | |
swap(_cached_size_, other->_cached_size_); | |
} | |
::google::protobuf::Metadata Person::GetMetadata() const { | |
protobuf_addressbook_2eproto::protobuf_AssignDescriptorsOnce(); | |
return ::protobuf_addressbook_2eproto::file_level_metadata[kIndexInFileMessages]; | |
} | |
// =================================================================== | |
void AddressBook::InitAsDefaultInstance() { | |
} | |
#if !defined(_MSC_VER) || _MSC_VER >= 1900 | |
const int AddressBook::kPeopleFieldNumber; | |
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 | |
AddressBook::AddressBook() | |
: ::google::protobuf::Message(), _internal_metadata_(NULL) { | |
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { | |
::protobuf_addressbook_2eproto::InitDefaultsAddressBook(); | |
} | |
SharedCtor(); | |
// @@protoc_insertion_point(constructor:tutorial.AddressBook) | |
} | |
AddressBook::AddressBook(const AddressBook& from) | |
: ::google::protobuf::Message(), | |
_internal_metadata_(NULL), | |
people_(from.people_), | |
_cached_size_(0) { | |
_internal_metadata_.MergeFrom(from._internal_metadata_); | |
// @@protoc_insertion_point(copy_constructor:tutorial.AddressBook) | |
} | |
void AddressBook::SharedCtor() { | |
_cached_size_ = 0; | |
} | |
AddressBook::~AddressBook() { | |
// @@protoc_insertion_point(destructor:tutorial.AddressBook) | |
SharedDtor(); | |
} | |
void AddressBook::SharedDtor() { | |
} | |
void AddressBook::SetCachedSize(int size) const { | |
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); | |
_cached_size_ = size; | |
GOOGLE_SAFE_CONCURRENT_WRITES_END(); | |
} | |
const ::google::protobuf::Descriptor* AddressBook::descriptor() { | |
::protobuf_addressbook_2eproto::protobuf_AssignDescriptorsOnce(); | |
return ::protobuf_addressbook_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; | |
} | |
const AddressBook& AddressBook::default_instance() { | |
::protobuf_addressbook_2eproto::InitDefaultsAddressBook(); | |
return *internal_default_instance(); | |
} | |
AddressBook* AddressBook::New(::google::protobuf::Arena* arena) const { | |
AddressBook* n = new AddressBook; | |
if (arena != NULL) { | |
arena->Own(n); | |
} | |
return n; | |
} | |
void AddressBook::Clear() { | |
// @@protoc_insertion_point(message_clear_start:tutorial.AddressBook) | |
::google::protobuf::uint32 cached_has_bits = 0; | |
// Prevent compiler warnings about cached_has_bits being unused | |
(void) cached_has_bits; | |
people_.Clear(); | |
_internal_metadata_.Clear(); | |
} | |
bool AddressBook::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:tutorial.AddressBook) | |
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)) { | |
// repeated .tutorial.Person people = 1; | |
case 1: { | |
if (static_cast< ::google::protobuf::uint8>(tag) == | |
static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { | |
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_people())); | |
} 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:tutorial.AddressBook) | |
return true; | |
failure: | |
// @@protoc_insertion_point(parse_failure:tutorial.AddressBook) | |
return false; | |
#undef DO_ | |
} | |
void AddressBook::SerializeWithCachedSizes( | |
::google::protobuf::io::CodedOutputStream* output) const { | |
// @@protoc_insertion_point(serialize_start:tutorial.AddressBook) | |
::google::protobuf::uint32 cached_has_bits = 0; | |
(void) cached_has_bits; | |
// repeated .tutorial.Person people = 1; | |
for (unsigned int i = 0, | |
n = static_cast<unsigned int>(this->people_size()); i < n; i++) { | |
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( | |
1, this->people(static_cast<int>(i)), output); | |
} | |
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { | |
::google::protobuf::internal::WireFormat::SerializeUnknownFields( | |
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output); | |
} | |
// @@protoc_insertion_point(serialize_end:tutorial.AddressBook) | |
} | |
::google::protobuf::uint8* AddressBook::InternalSerializeWithCachedSizesToArray( | |
bool deterministic, ::google::protobuf::uint8* target) const { | |
(void)deterministic; // Unused | |
// @@protoc_insertion_point(serialize_to_array_start:tutorial.AddressBook) | |
::google::protobuf::uint32 cached_has_bits = 0; | |
(void) cached_has_bits; | |
// repeated .tutorial.Person people = 1; | |
for (unsigned int i = 0, | |
n = static_cast<unsigned int>(this->people_size()); i < n; i++) { | |
target = ::google::protobuf::internal::WireFormatLite:: | |
InternalWriteMessageToArray( | |
1, this->people(static_cast<int>(i)), deterministic, target); | |
} | |
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { | |
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( | |
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target); | |
} | |
// @@protoc_insertion_point(serialize_to_array_end:tutorial.AddressBook) | |
return target; | |
} | |
size_t AddressBook::ByteSizeLong() const { | |
// @@protoc_insertion_point(message_byte_size_start:tutorial.AddressBook) | |
size_t total_size = 0; | |
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) { | |
total_size += | |
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( | |
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance())); | |
} | |
// repeated .tutorial.Person people = 1; | |
{ | |
unsigned int count = static_cast<unsigned int>(this->people_size()); | |
total_size += 1UL * count; | |
for (unsigned int i = 0; i < count; i++) { | |
total_size += | |
::google::protobuf::internal::WireFormatLite::MessageSize( | |
this->people(static_cast<int>(i))); | |
} | |
} | |
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); | |
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); | |
_cached_size_ = cached_size; | |
GOOGLE_SAFE_CONCURRENT_WRITES_END(); | |
return total_size; | |
} | |
void AddressBook::MergeFrom(const ::google::protobuf::Message& from) { | |
// @@protoc_insertion_point(generalized_merge_from_start:tutorial.AddressBook) | |
GOOGLE_DCHECK_NE(&from, this); | |
const AddressBook* source = | |
::google::protobuf::internal::DynamicCastToGenerated<const AddressBook>( | |
&from); | |
if (source == NULL) { | |
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tutorial.AddressBook) | |
::google::protobuf::internal::ReflectionOps::Merge(from, this); | |
} else { | |
// @@protoc_insertion_point(generalized_merge_from_cast_success:tutorial.AddressBook) | |
MergeFrom(*source); | |
} | |
} | |
void AddressBook::MergeFrom(const AddressBook& from) { | |
// @@protoc_insertion_point(class_specific_merge_from_start:tutorial.AddressBook) | |
GOOGLE_DCHECK_NE(&from, this); | |
_internal_metadata_.MergeFrom(from._internal_metadata_); | |
::google::protobuf::uint32 cached_has_bits = 0; | |
(void) cached_has_bits; | |
people_.MergeFrom(from.people_); | |
} | |
void AddressBook::CopyFrom(const ::google::protobuf::Message& from) { | |
// @@protoc_insertion_point(generalized_copy_from_start:tutorial.AddressBook) | |
if (&from == this) return; | |
Clear(); | |
MergeFrom(from); | |
} | |
void AddressBook::CopyFrom(const AddressBook& from) { | |
// @@protoc_insertion_point(class_specific_copy_from_start:tutorial.AddressBook) | |
if (&from == this) return; | |
Clear(); | |
MergeFrom(from); | |
} | |
bool AddressBook::IsInitialized() const { | |
return true; | |
} | |
void AddressBook::Swap(AddressBook* other) { | |
if (other == this) return; | |
InternalSwap(other); | |
} | |
void AddressBook::InternalSwap(AddressBook* other) { | |
using std::swap; | |
people_.InternalSwap(&other->people_); | |
_internal_metadata_.Swap(&other->_internal_metadata_); | |
swap(_cached_size_, other->_cached_size_); | |
} | |
::google::protobuf::Metadata AddressBook::GetMetadata() const { | |
protobuf_addressbook_2eproto::protobuf_AssignDescriptorsOnce(); | |
return ::protobuf_addressbook_2eproto::file_level_metadata[kIndexInFileMessages]; | |
} | |
// @@protoc_insertion_point(namespace_scope) | |
} // namespace tutorial | |
// @@protoc_insertion_point(global_scope) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment