2019-07-28 10:31:56 +08:00
|
|
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
2013-08-18 17:42:25 +08:00
|
|
|
// source: test.proto
|
2014-12-14 23:27:32 +08:00
|
|
|
#include "stdafx.h"
|
2013-08-18 17:42:25 +08:00
|
|
|
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
|
|
|
|
#include "test.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>
|
2014-11-25 19:44:37 +08:00
|
|
|
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
|
2013-08-18 17:42:25 +08:00
|
|
|
// @@protoc_insertion_point(includes)
|
|
|
|
|
|
|
|
namespace tutorial {
|
|
|
|
|
|
|
|
void protobuf_ShutdownFile_test_2eproto() {
|
|
|
|
delete Person::default_instance_;
|
|
|
|
delete Person_PhoneNumber::default_instance_;
|
|
|
|
delete AddressBook::default_instance_;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
|
|
|
|
void protobuf_AddDesc_test_2eproto_impl() {
|
|
|
|
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
|
|
|
|
|
|
|
#else
|
|
|
|
void protobuf_AddDesc_test_2eproto() {
|
|
|
|
static bool already_here = false;
|
|
|
|
if (already_here) return;
|
|
|
|
already_here = true;
|
|
|
|
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
Person::default_instance_ = new Person();
|
|
|
|
Person_PhoneNumber::default_instance_ = new Person_PhoneNumber();
|
|
|
|
AddressBook::default_instance_ = new AddressBook();
|
|
|
|
Person::default_instance_->InitAsDefaultInstance();
|
|
|
|
Person_PhoneNumber::default_instance_->InitAsDefaultInstance();
|
|
|
|
AddressBook::default_instance_->InitAsDefaultInstance();
|
|
|
|
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_test_2eproto);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
|
|
|
|
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AddDesc_test_2eproto_once_);
|
|
|
|
void protobuf_AddDesc_test_2eproto() {
|
2014-11-25 19:44:37 +08:00
|
|
|
::google::protobuf::GoogleOnceInit(&protobuf_AddDesc_test_2eproto_once_,
|
2013-08-18 17:42:25 +08:00
|
|
|
&protobuf_AddDesc_test_2eproto_impl);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
// Force AddDescriptors() to be called at static initialization time.
|
|
|
|
struct StaticDescriptorInitializer_test_2eproto {
|
|
|
|
StaticDescriptorInitializer_test_2eproto() {
|
|
|
|
protobuf_AddDesc_test_2eproto();
|
|
|
|
}
|
|
|
|
} static_descriptor_initializer_test_2eproto_;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ===================================================================
|
|
|
|
|
|
|
|
bool Person_PhoneType_IsValid(int value) {
|
|
|
|
switch(value) {
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef _MSC_VER
|
|
|
|
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 // _MSC_VER
|
|
|
|
#ifndef _MSC_VER
|
|
|
|
const int Person_PhoneNumber::kNumberFieldNumber;
|
|
|
|
const int Person_PhoneNumber::kTypeFieldNumber;
|
|
|
|
#endif // !_MSC_VER
|
|
|
|
|
|
|
|
Person_PhoneNumber::Person_PhoneNumber()
|
|
|
|
: ::google::protobuf::MessageLite() {
|
|
|
|
SharedCtor();
|
2014-11-25 19:44:37 +08:00
|
|
|
// @@protoc_insertion_point(constructor:tutorial.Person.PhoneNumber)
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Person_PhoneNumber::InitAsDefaultInstance() {
|
|
|
|
}
|
|
|
|
|
|
|
|
Person_PhoneNumber::Person_PhoneNumber(const Person_PhoneNumber& from)
|
|
|
|
: ::google::protobuf::MessageLite() {
|
|
|
|
SharedCtor();
|
|
|
|
MergeFrom(from);
|
2014-11-25 19:44:37 +08:00
|
|
|
// @@protoc_insertion_point(copy_constructor:tutorial.Person.PhoneNumber)
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Person_PhoneNumber::SharedCtor() {
|
2014-11-25 19:44:37 +08:00
|
|
|
::google::protobuf::internal::GetEmptyString();
|
2013-08-18 17:42:25 +08:00
|
|
|
_cached_size_ = 0;
|
2014-11-25 19:44:37 +08:00
|
|
|
number_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
2013-08-18 17:42:25 +08:00
|
|
|
type_ = 1;
|
|
|
|
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
|
|
|
}
|
|
|
|
|
|
|
|
Person_PhoneNumber::~Person_PhoneNumber() {
|
2014-11-25 19:44:37 +08:00
|
|
|
// @@protoc_insertion_point(destructor:tutorial.Person.PhoneNumber)
|
2013-08-18 17:42:25 +08:00
|
|
|
SharedDtor();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person_PhoneNumber::SharedDtor() {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (number_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
|
2013-08-18 17:42:25 +08:00
|
|
|
delete number_;
|
|
|
|
}
|
|
|
|
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
|
|
|
|
if (this != &default_instance()) {
|
|
|
|
#else
|
|
|
|
if (this != default_instance_) {
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person_PhoneNumber::SetCachedSize(int size) const {
|
|
|
|
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
|
|
|
|
_cached_size_ = size;
|
|
|
|
GOOGLE_SAFE_CONCURRENT_WRITES_END();
|
|
|
|
}
|
|
|
|
const Person_PhoneNumber& Person_PhoneNumber::default_instance() {
|
|
|
|
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
|
|
|
|
protobuf_AddDesc_test_2eproto();
|
|
|
|
#else
|
|
|
|
if (default_instance_ == NULL) protobuf_AddDesc_test_2eproto();
|
|
|
|
#endif
|
|
|
|
return *default_instance_;
|
|
|
|
}
|
|
|
|
|
|
|
|
Person_PhoneNumber* Person_PhoneNumber::default_instance_ = NULL;
|
|
|
|
|
|
|
|
Person_PhoneNumber* Person_PhoneNumber::New() const {
|
|
|
|
return new Person_PhoneNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person_PhoneNumber::Clear() {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (_has_bits_[0 / 32] & 3) {
|
2013-08-18 17:42:25 +08:00
|
|
|
if (has_number()) {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (number_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
|
2013-08-18 17:42:25 +08:00
|
|
|
number_->clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
type_ = 1;
|
|
|
|
}
|
|
|
|
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
2014-11-25 19:44:37 +08:00
|
|
|
mutable_unknown_fields()->clear();
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Person_PhoneNumber::MergePartialFromCodedStream(
|
|
|
|
::google::protobuf::io::CodedInputStream* input) {
|
2014-11-25 19:44:37 +08:00
|
|
|
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
|
2013-08-18 17:42:25 +08:00
|
|
|
::google::protobuf::uint32 tag;
|
2014-11-25 19:44:37 +08:00
|
|
|
::google::protobuf::io::StringOutputStream unknown_fields_string(
|
|
|
|
mutable_unknown_fields());
|
|
|
|
::google::protobuf::io::CodedOutputStream unknown_fields_stream(
|
|
|
|
&unknown_fields_string);
|
|
|
|
// @@protoc_insertion_point(parse_start:tutorial.Person.PhoneNumber)
|
|
|
|
for (;;) {
|
|
|
|
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
|
|
|
|
tag = p.first;
|
|
|
|
if (!p.second) goto handle_unusual;
|
2013-08-18 17:42:25 +08:00
|
|
|
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
|
|
|
|
// required string number = 1;
|
|
|
|
case 1: {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (tag == 10) {
|
2013-08-18 17:42:25 +08:00
|
|
|
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
|
|
|
|
input, this->mutable_number()));
|
|
|
|
} else {
|
2014-11-25 19:44:37 +08:00
|
|
|
goto handle_unusual;
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
if (input->ExpectTag(16)) goto parse_type;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// optional .tutorial.Person.PhoneType type = 2 [default = HOME];
|
|
|
|
case 2: {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (tag == 16) {
|
2013-08-18 17:42:25 +08:00
|
|
|
parse_type:
|
|
|
|
int value;
|
|
|
|
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
|
|
|
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
|
|
|
|
input, &value)));
|
|
|
|
if (::tutorial::Person_PhoneType_IsValid(value)) {
|
|
|
|
set_type(static_cast< ::tutorial::Person_PhoneType >(value));
|
2014-11-25 19:44:37 +08:00
|
|
|
} else {
|
|
|
|
unknown_fields_stream.WriteVarint32(tag);
|
|
|
|
unknown_fields_stream.WriteVarint32(value);
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
} else {
|
2014-11-25 19:44:37 +08:00
|
|
|
goto handle_unusual;
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
2014-11-25 19:44:37 +08:00
|
|
|
if (input->ExpectAtEnd()) goto success;
|
2013-08-18 17:42:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default: {
|
2014-11-25 19:44:37 +08:00
|
|
|
handle_unusual:
|
|
|
|
if (tag == 0 ||
|
|
|
|
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
2013-08-18 17:42:25 +08:00
|
|
|
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
|
2014-11-25 19:44:37 +08:00
|
|
|
goto success;
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
2014-11-25 19:44:37 +08:00
|
|
|
DO_(::google::protobuf::internal::WireFormatLite::SkipField(
|
|
|
|
input, tag, &unknown_fields_stream));
|
2013-08-18 17:42:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-11-25 19:44:37 +08:00
|
|
|
success:
|
|
|
|
// @@protoc_insertion_point(parse_success:tutorial.Person.PhoneNumber)
|
2013-08-18 17:42:25 +08:00
|
|
|
return true;
|
2014-11-25 19:44:37 +08:00
|
|
|
failure:
|
|
|
|
// @@protoc_insertion_point(parse_failure:tutorial.Person.PhoneNumber)
|
|
|
|
return false;
|
2013-08-18 17:42:25 +08:00
|
|
|
#undef DO_
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person_PhoneNumber::SerializeWithCachedSizes(
|
|
|
|
::google::protobuf::io::CodedOutputStream* output) const {
|
2014-11-25 19:44:37 +08:00
|
|
|
// @@protoc_insertion_point(serialize_start:tutorial.Person.PhoneNumber)
|
2013-08-18 17:42:25 +08:00
|
|
|
// required string number = 1;
|
|
|
|
if (has_number()) {
|
2014-11-25 19:44:37 +08:00
|
|
|
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
|
2013-08-18 17:42:25 +08:00
|
|
|
1, this->number(), output);
|
|
|
|
}
|
|
|
|
|
|
|
|
// optional .tutorial.Person.PhoneType type = 2 [default = HOME];
|
|
|
|
if (has_type()) {
|
|
|
|
::google::protobuf::internal::WireFormatLite::WriteEnum(
|
|
|
|
2, this->type(), output);
|
|
|
|
}
|
|
|
|
|
2014-11-25 19:44:37 +08:00
|
|
|
output->WriteRaw(unknown_fields().data(),
|
|
|
|
unknown_fields().size());
|
|
|
|
// @@protoc_insertion_point(serialize_end:tutorial.Person.PhoneNumber)
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int Person_PhoneNumber::ByteSize() const {
|
|
|
|
int total_size = 0;
|
|
|
|
|
|
|
|
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
|
|
|
// required string number = 1;
|
|
|
|
if (has_number()) {
|
|
|
|
total_size += 1 +
|
|
|
|
::google::protobuf::internal::WireFormatLite::StringSize(
|
|
|
|
this->number());
|
|
|
|
}
|
|
|
|
|
|
|
|
// optional .tutorial.Person.PhoneType type = 2 [default = HOME];
|
|
|
|
if (has_type()) {
|
|
|
|
total_size += 1 +
|
|
|
|
::google::protobuf::internal::WireFormatLite::EnumSize(this->type());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2014-11-25 19:44:37 +08:00
|
|
|
total_size += unknown_fields().size();
|
|
|
|
|
2013-08-18 17:42:25 +08:00
|
|
|
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
|
|
|
|
_cached_size_ = total_size;
|
|
|
|
GOOGLE_SAFE_CONCURRENT_WRITES_END();
|
|
|
|
return total_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person_PhoneNumber::CheckTypeAndMergeFrom(
|
|
|
|
const ::google::protobuf::MessageLite& from) {
|
|
|
|
MergeFrom(*::google::protobuf::down_cast<const Person_PhoneNumber*>(&from));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person_PhoneNumber::MergeFrom(const Person_PhoneNumber& from) {
|
|
|
|
GOOGLE_CHECK_NE(&from, this);
|
|
|
|
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
|
|
|
if (from.has_number()) {
|
|
|
|
set_number(from.number());
|
|
|
|
}
|
|
|
|
if (from.has_type()) {
|
|
|
|
set_type(from.type());
|
|
|
|
}
|
|
|
|
}
|
2014-11-25 19:44:37 +08:00
|
|
|
mutable_unknown_fields()->append(from.unknown_fields());
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Person_PhoneNumber::CopyFrom(const Person_PhoneNumber& from) {
|
|
|
|
if (&from == this) return;
|
|
|
|
Clear();
|
|
|
|
MergeFrom(from);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Person_PhoneNumber::IsInitialized() const {
|
|
|
|
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person_PhoneNumber::Swap(Person_PhoneNumber* other) {
|
|
|
|
if (other != this) {
|
|
|
|
std::swap(number_, other->number_);
|
|
|
|
std::swap(type_, other->type_);
|
|
|
|
std::swap(_has_bits_[0], other->_has_bits_[0]);
|
2014-11-25 19:44:37 +08:00
|
|
|
_unknown_fields_.swap(other->_unknown_fields_);
|
2013-08-18 17:42:25 +08:00
|
|
|
std::swap(_cached_size_, other->_cached_size_);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
::std::string Person_PhoneNumber::GetTypeName() const {
|
|
|
|
return "tutorial.Person.PhoneNumber";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifndef _MSC_VER
|
|
|
|
const int Person::kNameFieldNumber;
|
|
|
|
const int Person::kIdFieldNumber;
|
|
|
|
const int Person::kEmailFieldNumber;
|
|
|
|
const int Person::kPhoneFieldNumber;
|
|
|
|
#endif // !_MSC_VER
|
|
|
|
|
|
|
|
Person::Person()
|
|
|
|
: ::google::protobuf::MessageLite() {
|
|
|
|
SharedCtor();
|
2014-11-25 19:44:37 +08:00
|
|
|
// @@protoc_insertion_point(constructor:tutorial.Person)
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Person::InitAsDefaultInstance() {
|
|
|
|
}
|
|
|
|
|
|
|
|
Person::Person(const Person& from)
|
|
|
|
: ::google::protobuf::MessageLite() {
|
|
|
|
SharedCtor();
|
|
|
|
MergeFrom(from);
|
2014-11-25 19:44:37 +08:00
|
|
|
// @@protoc_insertion_point(copy_constructor:tutorial.Person)
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Person::SharedCtor() {
|
2014-11-25 19:44:37 +08:00
|
|
|
::google::protobuf::internal::GetEmptyString();
|
2013-08-18 17:42:25 +08:00
|
|
|
_cached_size_ = 0;
|
2014-11-25 19:44:37 +08:00
|
|
|
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
2013-08-18 17:42:25 +08:00
|
|
|
id_ = 0;
|
2014-11-25 19:44:37 +08:00
|
|
|
email_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
|
2013-08-18 17:42:25 +08:00
|
|
|
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
|
|
|
}
|
|
|
|
|
|
|
|
Person::~Person() {
|
2014-11-25 19:44:37 +08:00
|
|
|
// @@protoc_insertion_point(destructor:tutorial.Person)
|
2013-08-18 17:42:25 +08:00
|
|
|
SharedDtor();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person::SharedDtor() {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
|
2013-08-18 17:42:25 +08:00
|
|
|
delete name_;
|
|
|
|
}
|
2014-11-25 19:44:37 +08:00
|
|
|
if (email_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
|
2013-08-18 17:42:25 +08:00
|
|
|
delete email_;
|
|
|
|
}
|
|
|
|
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
|
|
|
|
if (this != &default_instance()) {
|
|
|
|
#else
|
|
|
|
if (this != default_instance_) {
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person::SetCachedSize(int size) const {
|
|
|
|
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
|
|
|
|
_cached_size_ = size;
|
|
|
|
GOOGLE_SAFE_CONCURRENT_WRITES_END();
|
|
|
|
}
|
|
|
|
const Person& Person::default_instance() {
|
|
|
|
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
|
|
|
|
protobuf_AddDesc_test_2eproto();
|
|
|
|
#else
|
|
|
|
if (default_instance_ == NULL) protobuf_AddDesc_test_2eproto();
|
|
|
|
#endif
|
|
|
|
return *default_instance_;
|
|
|
|
}
|
|
|
|
|
|
|
|
Person* Person::default_instance_ = NULL;
|
|
|
|
|
|
|
|
Person* Person::New() const {
|
|
|
|
return new Person;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person::Clear() {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (_has_bits_[0 / 32] & 7) {
|
2013-08-18 17:42:25 +08:00
|
|
|
if (has_name()) {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
|
2013-08-18 17:42:25 +08:00
|
|
|
name_->clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
id_ = 0;
|
|
|
|
if (has_email()) {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (email_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
|
2013-08-18 17:42:25 +08:00
|
|
|
email_->clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
phone_.Clear();
|
|
|
|
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
2014-11-25 19:44:37 +08:00
|
|
|
mutable_unknown_fields()->clear();
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Person::MergePartialFromCodedStream(
|
|
|
|
::google::protobuf::io::CodedInputStream* input) {
|
2014-11-25 19:44:37 +08:00
|
|
|
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
|
2013-08-18 17:42:25 +08:00
|
|
|
::google::protobuf::uint32 tag;
|
2014-11-25 19:44:37 +08:00
|
|
|
::google::protobuf::io::StringOutputStream unknown_fields_string(
|
|
|
|
mutable_unknown_fields());
|
|
|
|
::google::protobuf::io::CodedOutputStream unknown_fields_stream(
|
|
|
|
&unknown_fields_string);
|
|
|
|
// @@protoc_insertion_point(parse_start:tutorial.Person)
|
|
|
|
for (;;) {
|
|
|
|
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
|
|
|
|
tag = p.first;
|
|
|
|
if (!p.second) goto handle_unusual;
|
2013-08-18 17:42:25 +08:00
|
|
|
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
|
|
|
|
// required string name = 1;
|
|
|
|
case 1: {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (tag == 10) {
|
2013-08-18 17:42:25 +08:00
|
|
|
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
|
|
|
|
input, this->mutable_name()));
|
|
|
|
} else {
|
2014-11-25 19:44:37 +08:00
|
|
|
goto handle_unusual;
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
if (input->ExpectTag(16)) goto parse_id;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// required int32 id = 2;
|
|
|
|
case 2: {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (tag == 16) {
|
2013-08-18 17:42:25 +08:00
|
|
|
parse_id:
|
|
|
|
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
|
|
|
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
|
|
|
|
input, &id_)));
|
|
|
|
set_has_id();
|
|
|
|
} else {
|
2014-11-25 19:44:37 +08:00
|
|
|
goto handle_unusual;
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
if (input->ExpectTag(26)) goto parse_email;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// optional string email = 3;
|
|
|
|
case 3: {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (tag == 26) {
|
2013-08-18 17:42:25 +08:00
|
|
|
parse_email:
|
|
|
|
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
|
|
|
|
input, this->mutable_email()));
|
|
|
|
} else {
|
2014-11-25 19:44:37 +08:00
|
|
|
goto handle_unusual;
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
if (input->ExpectTag(34)) goto parse_phone;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// repeated .tutorial.Person.PhoneNumber phone = 4;
|
|
|
|
case 4: {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (tag == 34) {
|
2013-08-18 17:42:25 +08:00
|
|
|
parse_phone:
|
|
|
|
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
|
|
|
|
input, add_phone()));
|
|
|
|
} else {
|
2014-11-25 19:44:37 +08:00
|
|
|
goto handle_unusual;
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
if (input->ExpectTag(34)) goto parse_phone;
|
2014-11-25 19:44:37 +08:00
|
|
|
if (input->ExpectAtEnd()) goto success;
|
2013-08-18 17:42:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default: {
|
2014-11-25 19:44:37 +08:00
|
|
|
handle_unusual:
|
|
|
|
if (tag == 0 ||
|
|
|
|
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
2013-08-18 17:42:25 +08:00
|
|
|
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
|
2014-11-25 19:44:37 +08:00
|
|
|
goto success;
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
2014-11-25 19:44:37 +08:00
|
|
|
DO_(::google::protobuf::internal::WireFormatLite::SkipField(
|
|
|
|
input, tag, &unknown_fields_stream));
|
2013-08-18 17:42:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-11-25 19:44:37 +08:00
|
|
|
success:
|
|
|
|
// @@protoc_insertion_point(parse_success:tutorial.Person)
|
2013-08-18 17:42:25 +08:00
|
|
|
return true;
|
2014-11-25 19:44:37 +08:00
|
|
|
failure:
|
|
|
|
// @@protoc_insertion_point(parse_failure:tutorial.Person)
|
|
|
|
return false;
|
2013-08-18 17:42:25 +08:00
|
|
|
#undef DO_
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person::SerializeWithCachedSizes(
|
|
|
|
::google::protobuf::io::CodedOutputStream* output) const {
|
2014-11-25 19:44:37 +08:00
|
|
|
// @@protoc_insertion_point(serialize_start:tutorial.Person)
|
2013-08-18 17:42:25 +08:00
|
|
|
// required string name = 1;
|
|
|
|
if (has_name()) {
|
2014-11-25 19:44:37 +08:00
|
|
|
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
|
2013-08-18 17:42:25 +08:00
|
|
|
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()) {
|
2014-11-25 19:44:37 +08:00
|
|
|
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
|
2013-08-18 17:42:25 +08:00
|
|
|
3, this->email(), output);
|
|
|
|
}
|
|
|
|
|
|
|
|
// repeated .tutorial.Person.PhoneNumber phone = 4;
|
|
|
|
for (int i = 0; i < this->phone_size(); i++) {
|
|
|
|
::google::protobuf::internal::WireFormatLite::WriteMessage(
|
|
|
|
4, this->phone(i), output);
|
|
|
|
}
|
|
|
|
|
2014-11-25 19:44:37 +08:00
|
|
|
output->WriteRaw(unknown_fields().data(),
|
|
|
|
unknown_fields().size());
|
|
|
|
// @@protoc_insertion_point(serialize_end:tutorial.Person)
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int Person::ByteSize() const {
|
|
|
|
int total_size = 0;
|
|
|
|
|
|
|
|
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
|
|
|
// required string name = 1;
|
|
|
|
if (has_name()) {
|
|
|
|
total_size += 1 +
|
|
|
|
::google::protobuf::internal::WireFormatLite::StringSize(
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
// repeated .tutorial.Person.PhoneNumber phone = 4;
|
|
|
|
total_size += 1 * this->phone_size();
|
|
|
|
for (int i = 0; i < this->phone_size(); i++) {
|
|
|
|
total_size +=
|
|
|
|
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
|
|
|
|
this->phone(i));
|
|
|
|
}
|
|
|
|
|
2014-11-25 19:44:37 +08:00
|
|
|
total_size += unknown_fields().size();
|
|
|
|
|
2013-08-18 17:42:25 +08:00
|
|
|
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
|
|
|
|
_cached_size_ = total_size;
|
|
|
|
GOOGLE_SAFE_CONCURRENT_WRITES_END();
|
|
|
|
return total_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person::CheckTypeAndMergeFrom(
|
|
|
|
const ::google::protobuf::MessageLite& from) {
|
|
|
|
MergeFrom(*::google::protobuf::down_cast<const Person*>(&from));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person::MergeFrom(const Person& from) {
|
|
|
|
GOOGLE_CHECK_NE(&from, this);
|
|
|
|
phone_.MergeFrom(from.phone_);
|
|
|
|
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
|
|
|
if (from.has_name()) {
|
|
|
|
set_name(from.name());
|
|
|
|
}
|
|
|
|
if (from.has_id()) {
|
|
|
|
set_id(from.id());
|
|
|
|
}
|
|
|
|
if (from.has_email()) {
|
|
|
|
set_email(from.email());
|
|
|
|
}
|
|
|
|
}
|
2014-11-25 19:44:37 +08:00
|
|
|
mutable_unknown_fields()->append(from.unknown_fields());
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2014-11-25 19:44:37 +08:00
|
|
|
if (!::google::protobuf::internal::AllAreInitialized(this->phone())) return false;
|
2013-08-18 17:42:25 +08:00
|
|
|
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_);
|
|
|
|
phone_.Swap(&other->phone_);
|
|
|
|
std::swap(_has_bits_[0], other->_has_bits_[0]);
|
2014-11-25 19:44:37 +08:00
|
|
|
_unknown_fields_.swap(other->_unknown_fields_);
|
2013-08-18 17:42:25 +08:00
|
|
|
std::swap(_cached_size_, other->_cached_size_);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
::std::string Person::GetTypeName() const {
|
|
|
|
return "tutorial.Person";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ===================================================================
|
|
|
|
|
|
|
|
#ifndef _MSC_VER
|
|
|
|
const int AddressBook::kPersonFieldNumber;
|
|
|
|
#endif // !_MSC_VER
|
|
|
|
|
|
|
|
AddressBook::AddressBook()
|
|
|
|
: ::google::protobuf::MessageLite() {
|
|
|
|
SharedCtor();
|
2014-11-25 19:44:37 +08:00
|
|
|
// @@protoc_insertion_point(constructor:tutorial.AddressBook)
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void AddressBook::InitAsDefaultInstance() {
|
|
|
|
}
|
|
|
|
|
|
|
|
AddressBook::AddressBook(const AddressBook& from)
|
|
|
|
: ::google::protobuf::MessageLite() {
|
|
|
|
SharedCtor();
|
|
|
|
MergeFrom(from);
|
2014-11-25 19:44:37 +08:00
|
|
|
// @@protoc_insertion_point(copy_constructor:tutorial.AddressBook)
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void AddressBook::SharedCtor() {
|
|
|
|
_cached_size_ = 0;
|
|
|
|
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
|
|
|
}
|
|
|
|
|
|
|
|
AddressBook::~AddressBook() {
|
2014-11-25 19:44:37 +08:00
|
|
|
// @@protoc_insertion_point(destructor:tutorial.AddressBook)
|
2013-08-18 17:42:25 +08:00
|
|
|
SharedDtor();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddressBook::SharedDtor() {
|
|
|
|
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
|
|
|
|
if (this != &default_instance()) {
|
|
|
|
#else
|
|
|
|
if (this != default_instance_) {
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddressBook::SetCachedSize(int size) const {
|
|
|
|
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
|
|
|
|
_cached_size_ = size;
|
|
|
|
GOOGLE_SAFE_CONCURRENT_WRITES_END();
|
|
|
|
}
|
|
|
|
const AddressBook& AddressBook::default_instance() {
|
|
|
|
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
|
|
|
|
protobuf_AddDesc_test_2eproto();
|
|
|
|
#else
|
|
|
|
if (default_instance_ == NULL) protobuf_AddDesc_test_2eproto();
|
|
|
|
#endif
|
|
|
|
return *default_instance_;
|
|
|
|
}
|
|
|
|
|
|
|
|
AddressBook* AddressBook::default_instance_ = NULL;
|
|
|
|
|
|
|
|
AddressBook* AddressBook::New() const {
|
|
|
|
return new AddressBook;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddressBook::Clear() {
|
|
|
|
person_.Clear();
|
|
|
|
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
2014-11-25 19:44:37 +08:00
|
|
|
mutable_unknown_fields()->clear();
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool AddressBook::MergePartialFromCodedStream(
|
|
|
|
::google::protobuf::io::CodedInputStream* input) {
|
2014-11-25 19:44:37 +08:00
|
|
|
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
|
2013-08-18 17:42:25 +08:00
|
|
|
::google::protobuf::uint32 tag;
|
2014-11-25 19:44:37 +08:00
|
|
|
::google::protobuf::io::StringOutputStream unknown_fields_string(
|
|
|
|
mutable_unknown_fields());
|
|
|
|
::google::protobuf::io::CodedOutputStream unknown_fields_stream(
|
|
|
|
&unknown_fields_string);
|
|
|
|
// @@protoc_insertion_point(parse_start:tutorial.AddressBook)
|
|
|
|
for (;;) {
|
|
|
|
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
|
|
|
|
tag = p.first;
|
|
|
|
if (!p.second) goto handle_unusual;
|
2013-08-18 17:42:25 +08:00
|
|
|
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
|
|
|
|
// repeated .tutorial.Person person = 1;
|
|
|
|
case 1: {
|
2014-11-25 19:44:37 +08:00
|
|
|
if (tag == 10) {
|
2013-08-18 17:42:25 +08:00
|
|
|
parse_person:
|
|
|
|
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
|
|
|
|
input, add_person()));
|
|
|
|
} else {
|
2014-11-25 19:44:37 +08:00
|
|
|
goto handle_unusual;
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
if (input->ExpectTag(10)) goto parse_person;
|
2014-11-25 19:44:37 +08:00
|
|
|
if (input->ExpectAtEnd()) goto success;
|
2013-08-18 17:42:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default: {
|
2014-11-25 19:44:37 +08:00
|
|
|
handle_unusual:
|
|
|
|
if (tag == 0 ||
|
|
|
|
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
|
2013-08-18 17:42:25 +08:00
|
|
|
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
|
2014-11-25 19:44:37 +08:00
|
|
|
goto success;
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
2014-11-25 19:44:37 +08:00
|
|
|
DO_(::google::protobuf::internal::WireFormatLite::SkipField(
|
|
|
|
input, tag, &unknown_fields_stream));
|
2013-08-18 17:42:25 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-11-25 19:44:37 +08:00
|
|
|
success:
|
|
|
|
// @@protoc_insertion_point(parse_success:tutorial.AddressBook)
|
2013-08-18 17:42:25 +08:00
|
|
|
return true;
|
2014-11-25 19:44:37 +08:00
|
|
|
failure:
|
|
|
|
// @@protoc_insertion_point(parse_failure:tutorial.AddressBook)
|
|
|
|
return false;
|
2013-08-18 17:42:25 +08:00
|
|
|
#undef DO_
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddressBook::SerializeWithCachedSizes(
|
|
|
|
::google::protobuf::io::CodedOutputStream* output) const {
|
2014-11-25 19:44:37 +08:00
|
|
|
// @@protoc_insertion_point(serialize_start:tutorial.AddressBook)
|
2013-08-18 17:42:25 +08:00
|
|
|
// repeated .tutorial.Person person = 1;
|
|
|
|
for (int i = 0; i < this->person_size(); i++) {
|
|
|
|
::google::protobuf::internal::WireFormatLite::WriteMessage(
|
|
|
|
1, this->person(i), output);
|
|
|
|
}
|
|
|
|
|
2014-11-25 19:44:37 +08:00
|
|
|
output->WriteRaw(unknown_fields().data(),
|
|
|
|
unknown_fields().size());
|
|
|
|
// @@protoc_insertion_point(serialize_end:tutorial.AddressBook)
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int AddressBook::ByteSize() const {
|
|
|
|
int total_size = 0;
|
|
|
|
|
|
|
|
// repeated .tutorial.Person person = 1;
|
|
|
|
total_size += 1 * this->person_size();
|
|
|
|
for (int i = 0; i < this->person_size(); i++) {
|
|
|
|
total_size +=
|
|
|
|
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
|
|
|
|
this->person(i));
|
|
|
|
}
|
|
|
|
|
2014-11-25 19:44:37 +08:00
|
|
|
total_size += unknown_fields().size();
|
|
|
|
|
2013-08-18 17:42:25 +08:00
|
|
|
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
|
|
|
|
_cached_size_ = total_size;
|
|
|
|
GOOGLE_SAFE_CONCURRENT_WRITES_END();
|
|
|
|
return total_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddressBook::CheckTypeAndMergeFrom(
|
|
|
|
const ::google::protobuf::MessageLite& from) {
|
|
|
|
MergeFrom(*::google::protobuf::down_cast<const AddressBook*>(&from));
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddressBook::MergeFrom(const AddressBook& from) {
|
|
|
|
GOOGLE_CHECK_NE(&from, this);
|
|
|
|
person_.MergeFrom(from.person_);
|
2014-11-25 19:44:37 +08:00
|
|
|
mutable_unknown_fields()->append(from.unknown_fields());
|
2013-08-18 17:42:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void AddressBook::CopyFrom(const AddressBook& from) {
|
|
|
|
if (&from == this) return;
|
|
|
|
Clear();
|
|
|
|
MergeFrom(from);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AddressBook::IsInitialized() const {
|
|
|
|
|
2014-11-25 19:44:37 +08:00
|
|
|
if (!::google::protobuf::internal::AllAreInitialized(this->person())) return false;
|
2013-08-18 17:42:25 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddressBook::Swap(AddressBook* other) {
|
|
|
|
if (other != this) {
|
|
|
|
person_.Swap(&other->person_);
|
|
|
|
std::swap(_has_bits_[0], other->_has_bits_[0]);
|
2014-11-25 19:44:37 +08:00
|
|
|
_unknown_fields_.swap(other->_unknown_fields_);
|
2013-08-18 17:42:25 +08:00
|
|
|
std::swap(_cached_size_, other->_cached_size_);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
::std::string AddressBook::GetTypeName() const {
|
|
|
|
return "tutorial.AddressBook";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// @@protoc_insertion_point(namespace_scope)
|
|
|
|
|
|
|
|
} // namespace tutorial
|
|
|
|
|
|
|
|
// @@protoc_insertion_point(global_scope)
|