You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2013/07/12 22:26:40 UTC
[2/3] git commit: Added a JSON::Protobuf for constructing
JSON::Objects from protobufs.
Added a JSON::Protobuf for constructing JSON::Objects from protobufs.
Review: https://reviews.apache.org/r/12473
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d33efc97
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d33efc97
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d33efc97
Branch: refs/heads/master
Commit: d33efc9734ae3edf67597feaca8ed9ef13b6ef5f
Parents: fec1a18
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Thu Jul 11 14:17:32 2013 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Fri Jul 12 13:23:20 2013 -0700
----------------------------------------------------------------------
3rdparty/libprocess/3rdparty/stout/Makefile.am | 4 +
.../3rdparty/stout/include/stout/json.hpp | 2 +-
.../3rdparty/stout/include/stout/protobuf.hpp | 149 +-
.../3rdparty/stout/tests/protobuf_tests.cpp | 95 +
.../3rdparty/stout/tests/protobuf_tests.pb.cc | 1692 ++++++++++++++++++
.../3rdparty/stout/tests/protobuf_tests.pb.h | 1340 ++++++++++++++
.../3rdparty/stout/tests/protobuf_tests.proto | 63 +
7 files changed, 3343 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/d33efc97/3rdparty/libprocess/3rdparty/stout/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/Makefile.am b/3rdparty/libprocess/3rdparty/stout/Makefile.am
index 864b30e..2748584 100644
--- a/3rdparty/libprocess/3rdparty/stout/Makefile.am
+++ b/3rdparty/libprocess/3rdparty/stout/Makefile.am
@@ -66,6 +66,10 @@ EXTRA_DIST = \
tests/none_tests.cpp \
tests/os_tests.cpp \
tests/proc_tests.cpp \
+ tests/protobuf_tests.cpp \
+ tests/protobuf_tests.pb.cc \
+ tests/protobuf_tests.pb.h \
+ tests/protobuf_tests.proto \
tests/strings_tests.cpp \
tests/thread_tests.cpp \
tests/uuid_tests.cpp
http://git-wip-us.apache.org/repos/asf/mesos/blob/d33efc97/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
index e2cd4f2..e2ef0d3 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
@@ -58,7 +58,7 @@ struct String
struct Number
{
- Number() {}
+ Number() : value(0) {}
Number(double _value) : value(_value) {}
double value;
};
http://git-wip-us.apache.org/repos/asf/mesos/blob/d33efc97/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
index eb79e7b..bd5bc73 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/protobuf.hpp
@@ -1,6 +1,7 @@
#ifndef __STOUT_PROTOBUF_HPP__
#define __STOUT_PROTOBUF_HPP__
+#include <assert.h>
#include <errno.h>
#include <stdint.h>
#include <unistd.h>
@@ -9,6 +10,7 @@
#include <glog/logging.h>
+#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
@@ -18,6 +20,7 @@
#include <boost/lexical_cast.hpp>
#include "error.hpp"
+#include "json.hpp"
#include "none.hpp"
#include "os.hpp"
#include "result.hpp"
@@ -153,7 +156,151 @@ inline Result<T> read(const std::string& path)
return result;
}
-
} // namespace protobuf {
+namespace JSON {
+
+struct Protobuf
+{
+ Protobuf(const google::protobuf::Message& message)
+ {
+ const google::protobuf::Reflection* reflection = message.GetReflection();
+ std::vector<const google::protobuf::FieldDescriptor*> fields;
+ reflection->ListFields(message, &fields);
+
+ foreach (const google::protobuf::FieldDescriptor* field, fields) {
+ if (field->is_repeated()) {
+ JSON::Array array;
+ for (int i = 0; i < reflection->FieldSize(message, field); ++i) {
+ switch (field->type()) {
+ case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
+ array.values.push_back(JSON::Number(
+ reflection->GetRepeatedDouble(message, field, i)));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_FLOAT:
+ array.values.push_back(JSON::Number(
+ reflection->GetRepeatedFloat(message, field, i)));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_INT64:
+ case google::protobuf::FieldDescriptor::TYPE_SINT64:
+ case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
+ array.values.push_back(JSON::Number(
+ reflection->GetRepeatedInt64(message, field, i)));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_UINT64:
+ case google::protobuf::FieldDescriptor::TYPE_FIXED64:
+ array.values.push_back(JSON::Number(
+ reflection->GetRepeatedUInt64(message, field, i)));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_INT32:
+ case google::protobuf::FieldDescriptor::TYPE_SINT32:
+ case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
+ array.values.push_back(JSON::Number(
+ reflection->GetRepeatedInt32(message, field, i)));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_UINT32:
+ case google::protobuf::FieldDescriptor::TYPE_FIXED32:
+ array.values.push_back(JSON::Number(
+ reflection->GetRepeatedUInt32(message, field, i)));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_BOOL:
+ if (reflection->GetRepeatedBool(message, field, i)) {
+ array.values.push_back(JSON::True());
+ } else {
+ array.values.push_back(JSON::False());
+ }
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_STRING:
+ case google::protobuf::FieldDescriptor::TYPE_BYTES:
+ array.values.push_back(JSON::String(
+ reflection->GetRepeatedString(message, field, i)));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
+ array.values.push_back(Protobuf(
+ reflection->GetRepeatedMessage(message, field, i)));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_ENUM:
+ array.values.push_back(JSON::String(
+ reflection->GetRepeatedEnum(message, field, i)->name()));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_GROUP:
+ // Deprecated!
+ default:
+ std::cerr << "Unhandled protobuf field type: " << field->type()
+ << std::endl;
+ abort();
+ }
+ }
+ object.values[field->name()] = array;
+ } else {
+ switch (field->type()) {
+ case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
+ object.values[field->name()] =
+ JSON::Number(reflection->GetDouble(message, field));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_FLOAT:
+ object.values[field->name()] =
+ JSON::Number(reflection->GetFloat(message, field));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_INT64:
+ case google::protobuf::FieldDescriptor::TYPE_SINT64:
+ case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
+ object.values[field->name()] =
+ JSON::Number(reflection->GetInt64(message, field));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_UINT64:
+ case google::protobuf::FieldDescriptor::TYPE_FIXED64:
+ object.values[field->name()] =
+ JSON::Number(reflection->GetUInt64(message, field));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_INT32:
+ case google::protobuf::FieldDescriptor::TYPE_SINT32:
+ case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
+ object.values[field->name()] =
+ JSON::Number(reflection->GetInt32(message, field));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_UINT32:
+ case google::protobuf::FieldDescriptor::TYPE_FIXED32:
+ object.values[field->name()] =
+ JSON::Number(reflection->GetUInt32(message, field));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_BOOL:
+ if (reflection->GetBool(message, field)) {
+ object.values[field->name()] = JSON::True();
+ } else {
+ object.values[field->name()] = JSON::False();
+ }
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_STRING:
+ case google::protobuf::FieldDescriptor::TYPE_BYTES:
+ object.values[field->name()] =
+ JSON::String(reflection->GetString(message, field));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
+ object.values[field->name()] =
+ Protobuf(reflection->GetMessage(message, field));
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_ENUM:
+ object.values[field->name()] =
+ JSON::String(reflection->GetEnum(message, field)->name());
+ break;
+ case google::protobuf::FieldDescriptor::TYPE_GROUP:
+ // Deprecated!
+ default:
+ std::cerr << "Unhandled protobuf field type: " << field->type()
+ << std::endl;
+ abort();
+ }
+ }
+ }
+ }
+
+ operator Object () const { return object; }
+
+private:
+ JSON::Object object;
+};
+
+} // namespace JSON {
+
#endif // __STOUT_PROTOBUF_HPP__
http://git-wip-us.apache.org/repos/asf/mesos/blob/d33efc97/3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.cpp
new file mode 100644
index 0000000..02bbf74
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.cpp
@@ -0,0 +1,95 @@
+#include <gtest/gtest.h>
+
+#include <gmock/gmock.h>
+
+#include <string>
+
+#include <stout/json.hpp>
+#include <stout/protobuf.hpp>
+#include <stout/stringify.hpp>
+#include <stout/strings.hpp>
+
+#include "protobuf_tests.pb.h"
+
+using std::string;
+
+TEST(ProtobufTest, JSON)
+{
+ tests::Message message;
+ message.set_str("string");
+ message.set_bytes("bytes");
+ message.set_int32(-1);
+ message.set_int64(-1);
+ message.set_uint32(1);
+ message.set_uint64(1);
+ message.set_sint32(-1);
+ message.set_sint64(-1);
+ message.set_f(1.0);
+ message.set_d(1.0);
+ message.set_e(tests::ONE);
+ message.mutable_nested()->set_str("nested");
+ message.add_repeated_string("repeated_string");
+ message.add_repeated_bytes("repeated_bytes");
+ message.add_repeated_int32(-2);
+ message.add_repeated_int64(-2);
+ message.add_repeated_uint32(2);
+ message.add_repeated_uint64(2);
+ message.add_repeated_sint32(-2);
+ message.add_repeated_sint64(-2);
+ message.add_repeated_float(1.0);
+ message.add_repeated_double(1.0);
+ message.add_repeated_double(2.0);
+ message.add_repeated_enum(tests::TWO);
+ message.add_repeated_nested()->set_str("repeated_nested");
+
+ // TODO(bmahler): To dynamically generate a protobuf message,
+ // see the commented-out code below.
+// DescriptorProto proto;
+//
+// proto.set_name("Message");
+//
+// FieldDescriptorProto* field = proto.add_field();
+// field->set_name("str");
+// field->set_type(FieldDescriptorProto::TYPE_STRING);
+//
+// const Descriptor* descriptor = proto.descriptor();
+//
+// DynamicMessageFactory factory;
+// Message* message = factory.GetPrototype(descriptor);
+//
+// Reflection* message.getReflection();
+
+ // The keys are in alphabetical order.
+ string expected = strings::remove(
+ "{"
+ " \"bytes\": \"bytes\","
+ " \"d\": 1,"
+ " \"e\": \"ONE\","
+ " \"f\": 1,"
+ " \"int32\": -1,"
+ " \"int64\": -1,"
+ " \"nested\": { \"str\": \"nested\"},"
+ " \"repeated_bytes\": [\"repeated_bytes\"],"
+ " \"repeated_double\": [1, 2],"
+ " \"repeated_enum\": [\"TWO\"],"
+ " \"repeated_float\": [1],"
+ " \"repeated_int32\": [-2],"
+ " \"repeated_int64\": [-2],"
+ " \"repeated_nested\": [ { \"str\": \"repeated_nested\" } ],"
+ " \"repeated_sint32\": [-2],"
+ " \"repeated_sint64\": [-2],"
+ " \"repeated_string\": [\"repeated_string\"],"
+ " \"repeated_uint32\": [2],"
+ " \"repeated_uint64\": [2],"
+ " \"sint32\": -1,"
+ " \"sint64\": -1,"
+ " \"str\": \"string\","
+ " \"uint32\": 1,"
+ " \"uint64\": 1"
+ "}",
+ " ");
+
+ JSON::Object object = JSON::Protobuf(message);
+
+ EXPECT_EQ(expected, stringify(object));
+}
http://git-wip-us.apache.org/repos/asf/mesos/blob/d33efc97/3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.pb.cc
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.pb.cc b/3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.pb.cc
new file mode 100644
index 0000000..ecf34e1
--- /dev/null
+++ b/3rdparty/libprocess/3rdparty/stout/tests/protobuf_tests.pb.cc
@@ -0,0 +1,1692 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+
+#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
+#include "protobuf_tests.pb.h"
+
+#include <algorithm>
+
+#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/reflection_ops.h>
+#include <google/protobuf/wire_format.h>
+// @@protoc_insertion_point(includes)
+
+namespace tests {
+
+namespace {
+
+const ::google::protobuf::Descriptor* Nested_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+ Nested_reflection_ = NULL;
+const ::google::protobuf::Descriptor* Message_descriptor_ = NULL;
+const ::google::protobuf::internal::GeneratedMessageReflection*
+ Message_reflection_ = NULL;
+const ::google::protobuf::EnumDescriptor* Enum_descriptor_ = NULL;
+
+} // namespace
+
+
+void protobuf_AssignDesc_protobuf_5ftests_2eproto() {
+ protobuf_AddDesc_protobuf_5ftests_2eproto();
+ const ::google::protobuf::FileDescriptor* file =
+ ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
+ "protobuf_tests.proto");
+ GOOGLE_CHECK(file != NULL);
+ Nested_descriptor_ = file->message_type(0);
+ static const int Nested_offsets_[1] = {
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Nested, str_),
+ };
+ Nested_reflection_ =
+ new ::google::protobuf::internal::GeneratedMessageReflection(
+ Nested_descriptor_,
+ Nested::default_instance_,
+ Nested_offsets_,
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Nested, _has_bits_[0]),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Nested, _unknown_fields_),
+ -1,
+ ::google::protobuf::DescriptorPool::generated_pool(),
+ ::google::protobuf::MessageFactory::generated_factory(),
+ sizeof(Nested));
+ Message_descriptor_ = file->message_type(1);
+ static const int Message_offsets_[25] = {
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, str_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, bytes_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, int32_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, int64_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, uint32_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, uint64_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, sint32_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, sint64_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, f_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, d_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, e_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, nested_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, repeated_string_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, repeated_bytes_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, repeated_int32_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, repeated_int64_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, repeated_uint32_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, repeated_uint64_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, repeated_sint32_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, repeated_sint64_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, repeated_float_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, repeated_double_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, repeated_enum_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, repeated_nested_),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, empty_),
+ };
+ Message_reflection_ =
+ new ::google::protobuf::internal::GeneratedMessageReflection(
+ Message_descriptor_,
+ Message::default_instance_,
+ Message_offsets_,
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, _has_bits_[0]),
+ GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Message, _unknown_fields_),
+ -1,
+ ::google::protobuf::DescriptorPool::generated_pool(),
+ ::google::protobuf::MessageFactory::generated_factory(),
+ sizeof(Message));
+ Enum_descriptor_ = file->enum_type(0);
+}
+
+namespace {
+
+GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
+inline void protobuf_AssignDescriptorsOnce() {
+ ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
+ &protobuf_AssignDesc_protobuf_5ftests_2eproto);
+}
+
+void protobuf_RegisterTypes(const ::std::string&) {
+ protobuf_AssignDescriptorsOnce();
+ ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+ Nested_descriptor_, &Nested::default_instance());
+ ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
+ Message_descriptor_, &Message::default_instance());
+}
+
+} // namespace
+
+void protobuf_ShutdownFile_protobuf_5ftests_2eproto() {
+ delete Nested::default_instance_;
+ delete Nested_reflection_;
+ delete Message::default_instance_;
+ delete Message_reflection_;
+}
+
+void protobuf_AddDesc_protobuf_5ftests_2eproto() {
+ static bool already_here = false;
+ if (already_here) return;
+ already_here = true;
+ GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+ ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
+ "\n\024protobuf_tests.proto\022\005tests\"\025\n\006Nested\022"
+ "\013\n\003str\030\001 \001(\t\"\241\004\n\007Message\022\013\n\003str\030\001 \002(\t\022\r\n"
+ "\005bytes\030\002 \002(\014\022\r\n\005int32\030\003 \001(\005\022\r\n\005int64\030\004 \001"
+ "(\003\022\016\n\006uint32\030\005 \001(\r\022\016\n\006uint64\030\006 \001(\004\022\016\n\006si"
+ "nt32\030\007 \001(\021\022\016\n\006sint64\030\010 \001(\022\022\t\n\001f\030\t \002(\002\022\t\n"
+ "\001d\030\n \002(\001\022\026\n\001e\030\013 \002(\0162\013.tests.Enum\022\035\n\006nest"
+ "ed\030\014 \002(\0132\r.tests.Nested\022\027\n\017repeated_stri"
+ "ng\030\r \003(\t\022\026\n\016repeated_bytes\030\016 \003(\014\022\026\n\016repe"
+ "ated_int32\030\017 \003(\005\022\026\n\016repeated_int64\030\020 \003(\003"
+ "\022\027\n\017repeated_uint32\030\021 \003(\r\022\027\n\017repeated_ui"
+ "nt64\030\022 \003(\004\022\027\n\017repeated_sint32\030\023 \003(\021\022\027\n\017r"
+ "epeated_sint64\030\024 \003(\022\022\026\n\016repeated_float\030\025"
+ " \003(\002\022\027\n\017repeated_double\030\026 \003(\001\022\"\n\rrepeate"
+ "d_enum\030\027 \003(\0162\013.tests.Enum\022&\n\017repeated_ne"
+ "sted\030\030 \003(\0132\r.tests.Nested\022\r\n\005empty\030\031 \003(\t"
+ "*\030\n\004Enum\022\007\n\003ONE\020\001\022\007\n\003TWO\020\002", 626);
+ ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
+ "protobuf_tests.proto", &protobuf_RegisterTypes);
+ Nested::default_instance_ = new Nested();
+ Message::default_instance_ = new Message();
+ Nested::default_instance_->InitAsDefaultInstance();
+ Message::default_instance_->InitAsDefaultInstance();
+ ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_protobuf_5ftests_2eproto);
+}
+
+// Force AddDescriptors() to be called at static initialization time.
+struct StaticDescriptorInitializer_protobuf_5ftests_2eproto {
+ StaticDescriptorInitializer_protobuf_5ftests_2eproto() {
+ protobuf_AddDesc_protobuf_5ftests_2eproto();
+ }
+} static_descriptor_initializer_protobuf_5ftests_2eproto_;
+
+const ::google::protobuf::EnumDescriptor* Enum_descriptor() {
+ protobuf_AssignDescriptorsOnce();
+ return Enum_descriptor_;
+}
+bool Enum_IsValid(int value) {
+ switch(value) {
+ case 1:
+ case 2:
+ return true;
+ default:
+ return false;
+ }
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int Nested::kStrFieldNumber;
+#endif // !_MSC_VER
+
+Nested::Nested()
+ : ::google::protobuf::Message() {
+ SharedCtor();
+}
+
+void Nested::InitAsDefaultInstance() {
+}
+
+Nested::Nested(const Nested& from)
+ : ::google::protobuf::Message() {
+ SharedCtor();
+ MergeFrom(from);
+}
+
+void Nested::SharedCtor() {
+ _cached_size_ = 0;
+ str_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+Nested::~Nested() {
+ SharedDtor();
+}
+
+void Nested::SharedDtor() {
+ if (str_ != &::google::protobuf::internal::kEmptyString) {
+ delete str_;
+ }
+ if (this != default_instance_) {
+ }
+}
+
+void Nested::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* Nested::descriptor() {
+ protobuf_AssignDescriptorsOnce();
+ return Nested_descriptor_;
+}
+
+const Nested& Nested::default_instance() {
+ if (default_instance_ == NULL) protobuf_AddDesc_protobuf_5ftests_2eproto(); return *default_instance_;
+}
+
+Nested* Nested::default_instance_ = NULL;
+
+Nested* Nested::New() const {
+ return new Nested;
+}
+
+void Nested::Clear() {
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (has_str()) {
+ if (str_ != &::google::protobuf::internal::kEmptyString) {
+ str_->clear();
+ }
+ }
+ }
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->Clear();
+}
+
+bool Nested::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+ ::google::protobuf::uint32 tag;
+ while ((tag = input->ReadTag()) != 0) {
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // optional string str = 1;
+ case 1: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+ DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+ input, this->mutable_str()));
+ ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+ this->str().data(), this->str().length(),
+ ::google::protobuf::internal::WireFormat::PARSE);
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectAtEnd()) return true;
+ break;
+ }
+
+ default: {
+ handle_uninterpreted:
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ return true;
+ }
+ DO_(::google::protobuf::internal::WireFormat::SkipField(
+ input, tag, mutable_unknown_fields()));
+ break;
+ }
+ }
+ }
+ return true;
+#undef DO_
+}
+
+void Nested::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // optional string str = 1;
+ if (has_str()) {
+ ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+ this->str().data(), this->str().length(),
+ ::google::protobuf::internal::WireFormat::SERIALIZE);
+ ::google::protobuf::internal::WireFormatLite::WriteString(
+ 1, this->str(), output);
+ }
+
+ if (!unknown_fields().empty()) {
+ ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ unknown_fields(), output);
+ }
+}
+
+::google::protobuf::uint8* Nested::SerializeWithCachedSizesToArray(
+ ::google::protobuf::uint8* target) const {
+ // optional string str = 1;
+ if (has_str()) {
+ ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+ this->str().data(), this->str().length(),
+ ::google::protobuf::internal::WireFormat::SERIALIZE);
+ target =
+ ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+ 1, this->str(), target);
+ }
+
+ if (!unknown_fields().empty()) {
+ target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ unknown_fields(), target);
+ }
+ return target;
+}
+
+int Nested::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // optional string str = 1;
+ if (has_str()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::StringSize(
+ this->str());
+ }
+
+ }
+ 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 Nested::MergeFrom(const ::google::protobuf::Message& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ const Nested* source =
+ ::google::protobuf::internal::dynamic_cast_if_available<const Nested*>(
+ &from);
+ if (source == NULL) {
+ ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+ } else {
+ MergeFrom(*source);
+ }
+}
+
+void Nested::MergeFrom(const Nested& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_str()) {
+ set_str(from.str());
+ }
+ }
+ mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void Nested::CopyFrom(const ::google::protobuf::Message& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+void Nested::CopyFrom(const Nested& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool Nested::IsInitialized() const {
+
+ return true;
+}
+
+void Nested::Swap(Nested* other) {
+ if (other != this) {
+ std::swap(str_, other->str_);
+ 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 Nested::GetMetadata() const {
+ protobuf_AssignDescriptorsOnce();
+ ::google::protobuf::Metadata metadata;
+ metadata.descriptor = Nested_descriptor_;
+ metadata.reflection = Nested_reflection_;
+ return metadata;
+}
+
+
+// ===================================================================
+
+#ifndef _MSC_VER
+const int Message::kStrFieldNumber;
+const int Message::kBytesFieldNumber;
+const int Message::kInt32FieldNumber;
+const int Message::kInt64FieldNumber;
+const int Message::kUint32FieldNumber;
+const int Message::kUint64FieldNumber;
+const int Message::kSint32FieldNumber;
+const int Message::kSint64FieldNumber;
+const int Message::kFFieldNumber;
+const int Message::kDFieldNumber;
+const int Message::kEFieldNumber;
+const int Message::kNestedFieldNumber;
+const int Message::kRepeatedStringFieldNumber;
+const int Message::kRepeatedBytesFieldNumber;
+const int Message::kRepeatedInt32FieldNumber;
+const int Message::kRepeatedInt64FieldNumber;
+const int Message::kRepeatedUint32FieldNumber;
+const int Message::kRepeatedUint64FieldNumber;
+const int Message::kRepeatedSint32FieldNumber;
+const int Message::kRepeatedSint64FieldNumber;
+const int Message::kRepeatedFloatFieldNumber;
+const int Message::kRepeatedDoubleFieldNumber;
+const int Message::kRepeatedEnumFieldNumber;
+const int Message::kRepeatedNestedFieldNumber;
+const int Message::kEmptyFieldNumber;
+#endif // !_MSC_VER
+
+Message::Message()
+ : ::google::protobuf::Message() {
+ SharedCtor();
+}
+
+void Message::InitAsDefaultInstance() {
+ nested_ = const_cast< ::tests::Nested*>(&::tests::Nested::default_instance());
+}
+
+Message::Message(const Message& from)
+ : ::google::protobuf::Message() {
+ SharedCtor();
+ MergeFrom(from);
+}
+
+void Message::SharedCtor() {
+ _cached_size_ = 0;
+ str_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ bytes_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ int32_ = 0;
+ int64_ = GOOGLE_LONGLONG(0);
+ uint32_ = 0u;
+ uint64_ = GOOGLE_ULONGLONG(0);
+ sint32_ = 0;
+ sint64_ = GOOGLE_LONGLONG(0);
+ f_ = 0;
+ d_ = 0;
+ e_ = 1;
+ nested_ = NULL;
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+}
+
+Message::~Message() {
+ SharedDtor();
+}
+
+void Message::SharedDtor() {
+ if (str_ != &::google::protobuf::internal::kEmptyString) {
+ delete str_;
+ }
+ if (bytes_ != &::google::protobuf::internal::kEmptyString) {
+ delete bytes_;
+ }
+ if (this != default_instance_) {
+ delete nested_;
+ }
+}
+
+void Message::SetCachedSize(int size) const {
+ GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
+ _cached_size_ = size;
+ GOOGLE_SAFE_CONCURRENT_WRITES_END();
+}
+const ::google::protobuf::Descriptor* Message::descriptor() {
+ protobuf_AssignDescriptorsOnce();
+ return Message_descriptor_;
+}
+
+const Message& Message::default_instance() {
+ if (default_instance_ == NULL) protobuf_AddDesc_protobuf_5ftests_2eproto(); return *default_instance_;
+}
+
+Message* Message::default_instance_ = NULL;
+
+Message* Message::New() const {
+ return new Message;
+}
+
+void Message::Clear() {
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (has_str()) {
+ if (str_ != &::google::protobuf::internal::kEmptyString) {
+ str_->clear();
+ }
+ }
+ if (has_bytes()) {
+ if (bytes_ != &::google::protobuf::internal::kEmptyString) {
+ bytes_->clear();
+ }
+ }
+ int32_ = 0;
+ int64_ = GOOGLE_LONGLONG(0);
+ uint32_ = 0u;
+ uint64_ = GOOGLE_ULONGLONG(0);
+ sint32_ = 0;
+ sint64_ = GOOGLE_LONGLONG(0);
+ }
+ if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
+ f_ = 0;
+ d_ = 0;
+ e_ = 1;
+ if (has_nested()) {
+ if (nested_ != NULL) nested_->::tests::Nested::Clear();
+ }
+ }
+ repeated_string_.Clear();
+ repeated_bytes_.Clear();
+ repeated_int32_.Clear();
+ repeated_int64_.Clear();
+ repeated_uint32_.Clear();
+ repeated_uint64_.Clear();
+ repeated_sint32_.Clear();
+ repeated_sint64_.Clear();
+ repeated_float_.Clear();
+ repeated_double_.Clear();
+ repeated_enum_.Clear();
+ repeated_nested_.Clear();
+ empty_.Clear();
+ ::memset(_has_bits_, 0, sizeof(_has_bits_));
+ mutable_unknown_fields()->Clear();
+}
+
+bool Message::MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
+ ::google::protobuf::uint32 tag;
+ while ((tag = input->ReadTag()) != 0) {
+ switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+ // required string str = 1;
+ case 1: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+ DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+ input, this->mutable_str()));
+ ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+ this->str().data(), this->str().length(),
+ ::google::protobuf::internal::WireFormat::PARSE);
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(18)) goto parse_bytes;
+ break;
+ }
+
+ // required bytes bytes = 2;
+ case 2: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+ parse_bytes:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
+ input, this->mutable_bytes()));
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(24)) goto parse_int32;
+ break;
+ }
+
+ // optional int32 int32 = 3;
+ case 3: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_int32:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+ input, &int32_)));
+ set_has_int32();
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(32)) goto parse_int64;
+ break;
+ }
+
+ // optional int64 int64 = 4;
+ case 4: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_int64:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
+ input, &int64_)));
+ set_has_int64();
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(40)) goto parse_uint32;
+ break;
+ }
+
+ // optional uint32 uint32 = 5;
+ case 5: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_uint32:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, &uint32_)));
+ set_has_uint32();
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(48)) goto parse_uint64;
+ break;
+ }
+
+ // optional uint64 uint64 = 6;
+ case 6: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_uint64:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
+ input, &uint64_)));
+ set_has_uint64();
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(56)) goto parse_sint32;
+ break;
+ }
+
+ // optional sint32 sint32 = 7;
+ case 7: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_sint32:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_SINT32>(
+ input, &sint32_)));
+ set_has_sint32();
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(64)) goto parse_sint64;
+ break;
+ }
+
+ // optional sint64 sint64 = 8;
+ case 8: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_sint64:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_SINT64>(
+ input, &sint64_)));
+ set_has_sint64();
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(77)) goto parse_f;
+ break;
+ }
+
+ // required float f = 9;
+ case 9: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED32) {
+ parse_f:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
+ input, &f_)));
+ set_has_f();
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(81)) goto parse_d;
+ break;
+ }
+
+ // required double d = 10;
+ case 10: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) {
+ parse_d:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
+ input, &d_)));
+ set_has_d();
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(88)) goto parse_e;
+ break;
+ }
+
+ // required .tests.Enum e = 11;
+ case 11: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_e:
+ int value;
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+ input, &value)));
+ if (tests::Enum_IsValid(value)) {
+ set_e(static_cast< tests::Enum >(value));
+ } else {
+ mutable_unknown_fields()->AddVarint(11, value);
+ }
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(98)) goto parse_nested;
+ break;
+ }
+
+ // required .tests.Nested nested = 12;
+ case 12: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+ parse_nested:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+ input, mutable_nested()));
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(106)) goto parse_repeated_string;
+ break;
+ }
+
+ // repeated string repeated_string = 13;
+ case 13: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+ parse_repeated_string:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+ input, this->add_repeated_string()));
+ ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+ this->repeated_string(0).data(), this->repeated_string(0).length(),
+ ::google::protobuf::internal::WireFormat::PARSE);
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(106)) goto parse_repeated_string;
+ if (input->ExpectTag(114)) goto parse_repeated_bytes;
+ break;
+ }
+
+ // repeated bytes repeated_bytes = 14;
+ case 14: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+ parse_repeated_bytes:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
+ input, this->add_repeated_bytes()));
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(114)) goto parse_repeated_bytes;
+ if (input->ExpectTag(120)) goto parse_repeated_int32;
+ break;
+ }
+
+ // repeated int32 repeated_int32 = 15;
+ case 15: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_repeated_int32:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
+ ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+ 1, 120, input, this->mutable_repeated_int32())));
+ } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
+ == ::google::protobuf::internal::WireFormatLite::
+ WIRETYPE_LENGTH_DELIMITED) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
+ ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
+ input, this->mutable_repeated_int32())));
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(120)) goto parse_repeated_int32;
+ if (input->ExpectTag(128)) goto parse_repeated_int64;
+ break;
+ }
+
+ // repeated int64 repeated_int64 = 16;
+ case 16: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_repeated_int64:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
+ ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
+ 2, 128, input, this->mutable_repeated_int64())));
+ } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
+ == ::google::protobuf::internal::WireFormatLite::
+ WIRETYPE_LENGTH_DELIMITED) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
+ ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
+ input, this->mutable_repeated_int64())));
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(128)) goto parse_repeated_int64;
+ if (input->ExpectTag(136)) goto parse_repeated_uint32;
+ break;
+ }
+
+ // repeated uint32 repeated_uint32 = 17;
+ case 17: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_repeated_uint32:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ 2, 136, input, this->mutable_repeated_uint32())));
+ } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
+ == ::google::protobuf::internal::WireFormatLite::
+ WIRETYPE_LENGTH_DELIMITED) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
+ ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
+ input, this->mutable_repeated_uint32())));
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(136)) goto parse_repeated_uint32;
+ if (input->ExpectTag(144)) goto parse_repeated_uint64;
+ break;
+ }
+
+ // repeated uint64 repeated_uint64 = 18;
+ case 18: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_repeated_uint64:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
+ ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
+ 2, 144, input, this->mutable_repeated_uint64())));
+ } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
+ == ::google::protobuf::internal::WireFormatLite::
+ WIRETYPE_LENGTH_DELIMITED) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
+ ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
+ input, this->mutable_repeated_uint64())));
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(144)) goto parse_repeated_uint64;
+ if (input->ExpectTag(152)) goto parse_repeated_sint32;
+ break;
+ }
+
+ // repeated sint32 repeated_sint32 = 19;
+ case 19: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_repeated_sint32:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
+ ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_SINT32>(
+ 2, 152, input, this->mutable_repeated_sint32())));
+ } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
+ == ::google::protobuf::internal::WireFormatLite::
+ WIRETYPE_LENGTH_DELIMITED) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
+ ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_SINT32>(
+ input, this->mutable_repeated_sint32())));
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(152)) goto parse_repeated_sint32;
+ if (input->ExpectTag(160)) goto parse_repeated_sint64;
+ break;
+ }
+
+ // repeated sint64 repeated_sint64 = 20;
+ case 20: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_repeated_sint64:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
+ ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_SINT64>(
+ 2, 160, input, this->mutable_repeated_sint64())));
+ } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
+ == ::google::protobuf::internal::WireFormatLite::
+ WIRETYPE_LENGTH_DELIMITED) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
+ ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_SINT64>(
+ input, this->mutable_repeated_sint64())));
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(160)) goto parse_repeated_sint64;
+ if (input->ExpectTag(173)) goto parse_repeated_float;
+ break;
+ }
+
+ // repeated float repeated_float = 21;
+ case 21: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED32) {
+ parse_repeated_float:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
+ float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
+ 2, 173, input, this->mutable_repeated_float())));
+ } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
+ == ::google::protobuf::internal::WireFormatLite::
+ WIRETYPE_LENGTH_DELIMITED) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
+ float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
+ input, this->mutable_repeated_float())));
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(173)) goto parse_repeated_float;
+ if (input->ExpectTag(177)) goto parse_repeated_double;
+ break;
+ }
+
+ // repeated double repeated_double = 22;
+ case 22: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) {
+ parse_repeated_double:
+ DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<
+ double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
+ 2, 177, input, this->mutable_repeated_double())));
+ } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
+ == ::google::protobuf::internal::WireFormatLite::
+ WIRETYPE_LENGTH_DELIMITED) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline<
+ double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
+ input, this->mutable_repeated_double())));
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(177)) goto parse_repeated_double;
+ if (input->ExpectTag(184)) goto parse_repeated_enum;
+ break;
+ }
+
+ // repeated .tests.Enum repeated_enum = 23;
+ case 23: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+ parse_repeated_enum:
+ int value;
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+ int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+ input, &value)));
+ if (tests::Enum_IsValid(value)) {
+ add_repeated_enum(static_cast< tests::Enum >(value));
+ } else {
+ mutable_unknown_fields()->AddVarint(23, value);
+ }
+ } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag)
+ == ::google::protobuf::internal::WireFormatLite::
+ WIRETYPE_LENGTH_DELIMITED) {
+ DO_((::google::protobuf::internal::WireFormatLite::ReadPackedEnumNoInline(
+ input,
+ &tests::Enum_IsValid,
+ this->mutable_repeated_enum())));
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(184)) goto parse_repeated_enum;
+ if (input->ExpectTag(194)) goto parse_repeated_nested;
+ break;
+ }
+
+ // repeated .tests.Nested repeated_nested = 24;
+ case 24: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+ parse_repeated_nested:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
+ input, add_repeated_nested()));
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(194)) goto parse_repeated_nested;
+ if (input->ExpectTag(202)) goto parse_empty;
+ break;
+ }
+
+ // repeated string empty = 25;
+ case 25: {
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+ parse_empty:
+ DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+ input, this->add_empty()));
+ ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+ this->empty(0).data(), this->empty(0).length(),
+ ::google::protobuf::internal::WireFormat::PARSE);
+ } else {
+ goto handle_uninterpreted;
+ }
+ if (input->ExpectTag(202)) goto parse_empty;
+ if (input->ExpectAtEnd()) return true;
+ break;
+ }
+
+ default: {
+ handle_uninterpreted:
+ if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+ ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
+ return true;
+ }
+ DO_(::google::protobuf::internal::WireFormat::SkipField(
+ input, tag, mutable_unknown_fields()));
+ break;
+ }
+ }
+ }
+ return true;
+#undef DO_
+}
+
+void Message::SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const {
+ // required string str = 1;
+ if (has_str()) {
+ ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+ this->str().data(), this->str().length(),
+ ::google::protobuf::internal::WireFormat::SERIALIZE);
+ ::google::protobuf::internal::WireFormatLite::WriteString(
+ 1, this->str(), output);
+ }
+
+ // required bytes bytes = 2;
+ if (has_bytes()) {
+ ::google::protobuf::internal::WireFormatLite::WriteBytes(
+ 2, this->bytes(), output);
+ }
+
+ // optional int32 int32 = 3;
+ if (has_int32()) {
+ ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->int32(), output);
+ }
+
+ // optional int64 int64 = 4;
+ if (has_int64()) {
+ ::google::protobuf::internal::WireFormatLite::WriteInt64(4, this->int64(), output);
+ }
+
+ // optional uint32 uint32 = 5;
+ if (has_uint32()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->uint32(), output);
+ }
+
+ // optional uint64 uint64 = 6;
+ if (has_uint64()) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt64(6, this->uint64(), output);
+ }
+
+ // optional sint32 sint32 = 7;
+ if (has_sint32()) {
+ ::google::protobuf::internal::WireFormatLite::WriteSInt32(7, this->sint32(), output);
+ }
+
+ // optional sint64 sint64 = 8;
+ if (has_sint64()) {
+ ::google::protobuf::internal::WireFormatLite::WriteSInt64(8, this->sint64(), output);
+ }
+
+ // required float f = 9;
+ if (has_f()) {
+ ::google::protobuf::internal::WireFormatLite::WriteFloat(9, this->f(), output);
+ }
+
+ // required double d = 10;
+ if (has_d()) {
+ ::google::protobuf::internal::WireFormatLite::WriteDouble(10, this->d(), output);
+ }
+
+ // required .tests.Enum e = 11;
+ if (has_e()) {
+ ::google::protobuf::internal::WireFormatLite::WriteEnum(
+ 11, this->e(), output);
+ }
+
+ // required .tests.Nested nested = 12;
+ if (has_nested()) {
+ ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+ 12, this->nested(), output);
+ }
+
+ // repeated string repeated_string = 13;
+ for (int i = 0; i < this->repeated_string_size(); i++) {
+ ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+ this->repeated_string(i).data(), this->repeated_string(i).length(),
+ ::google::protobuf::internal::WireFormat::SERIALIZE);
+ ::google::protobuf::internal::WireFormatLite::WriteString(
+ 13, this->repeated_string(i), output);
+ }
+
+ // repeated bytes repeated_bytes = 14;
+ for (int i = 0; i < this->repeated_bytes_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteBytes(
+ 14, this->repeated_bytes(i), output);
+ }
+
+ // repeated int32 repeated_int32 = 15;
+ for (int i = 0; i < this->repeated_int32_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteInt32(
+ 15, this->repeated_int32(i), output);
+ }
+
+ // repeated int64 repeated_int64 = 16;
+ for (int i = 0; i < this->repeated_int64_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteInt64(
+ 16, this->repeated_int64(i), output);
+ }
+
+ // repeated uint32 repeated_uint32 = 17;
+ for (int i = 0; i < this->repeated_uint32_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt32(
+ 17, this->repeated_uint32(i), output);
+ }
+
+ // repeated uint64 repeated_uint64 = 18;
+ for (int i = 0; i < this->repeated_uint64_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteUInt64(
+ 18, this->repeated_uint64(i), output);
+ }
+
+ // repeated sint32 repeated_sint32 = 19;
+ for (int i = 0; i < this->repeated_sint32_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteSInt32(
+ 19, this->repeated_sint32(i), output);
+ }
+
+ // repeated sint64 repeated_sint64 = 20;
+ for (int i = 0; i < this->repeated_sint64_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteSInt64(
+ 20, this->repeated_sint64(i), output);
+ }
+
+ // repeated float repeated_float = 21;
+ for (int i = 0; i < this->repeated_float_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteFloat(
+ 21, this->repeated_float(i), output);
+ }
+
+ // repeated double repeated_double = 22;
+ for (int i = 0; i < this->repeated_double_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteDouble(
+ 22, this->repeated_double(i), output);
+ }
+
+ // repeated .tests.Enum repeated_enum = 23;
+ for (int i = 0; i < this->repeated_enum_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteEnum(
+ 23, this->repeated_enum(i), output);
+ }
+
+ // repeated .tests.Nested repeated_nested = 24;
+ for (int i = 0; i < this->repeated_nested_size(); i++) {
+ ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
+ 24, this->repeated_nested(i), output);
+ }
+
+ // repeated string empty = 25;
+ for (int i = 0; i < this->empty_size(); i++) {
+ ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+ this->empty(i).data(), this->empty(i).length(),
+ ::google::protobuf::internal::WireFormat::SERIALIZE);
+ ::google::protobuf::internal::WireFormatLite::WriteString(
+ 25, this->empty(i), output);
+ }
+
+ if (!unknown_fields().empty()) {
+ ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+ unknown_fields(), output);
+ }
+}
+
+::google::protobuf::uint8* Message::SerializeWithCachedSizesToArray(
+ ::google::protobuf::uint8* target) const {
+ // required string str = 1;
+ if (has_str()) {
+ ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+ this->str().data(), this->str().length(),
+ ::google::protobuf::internal::WireFormat::SERIALIZE);
+ target =
+ ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+ 1, this->str(), target);
+ }
+
+ // required bytes bytes = 2;
+ if (has_bytes()) {
+ target =
+ ::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
+ 2, this->bytes(), target);
+ }
+
+ // optional int32 int32 = 3;
+ if (has_int32()) {
+ target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->int32(), target);
+ }
+
+ // optional int64 int64 = 4;
+ if (has_int64()) {
+ target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(4, this->int64(), target);
+ }
+
+ // optional uint32 uint32 = 5;
+ if (has_uint32()) {
+ target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->uint32(), target);
+ }
+
+ // optional uint64 uint64 = 6;
+ if (has_uint64()) {
+ target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(6, this->uint64(), target);
+ }
+
+ // optional sint32 sint32 = 7;
+ if (has_sint32()) {
+ target = ::google::protobuf::internal::WireFormatLite::WriteSInt32ToArray(7, this->sint32(), target);
+ }
+
+ // optional sint64 sint64 = 8;
+ if (has_sint64()) {
+ target = ::google::protobuf::internal::WireFormatLite::WriteSInt64ToArray(8, this->sint64(), target);
+ }
+
+ // required float f = 9;
+ if (has_f()) {
+ target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(9, this->f(), target);
+ }
+
+ // required double d = 10;
+ if (has_d()) {
+ target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(10, this->d(), target);
+ }
+
+ // required .tests.Enum e = 11;
+ if (has_e()) {
+ target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+ 11, this->e(), target);
+ }
+
+ // required .tests.Nested nested = 12;
+ if (has_nested()) {
+ target = ::google::protobuf::internal::WireFormatLite::
+ WriteMessageNoVirtualToArray(
+ 12, this->nested(), target);
+ }
+
+ // repeated string repeated_string = 13;
+ for (int i = 0; i < this->repeated_string_size(); i++) {
+ ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+ this->repeated_string(i).data(), this->repeated_string(i).length(),
+ ::google::protobuf::internal::WireFormat::SERIALIZE);
+ target = ::google::protobuf::internal::WireFormatLite::
+ WriteStringToArray(13, this->repeated_string(i), target);
+ }
+
+ // repeated bytes repeated_bytes = 14;
+ for (int i = 0; i < this->repeated_bytes_size(); i++) {
+ target = ::google::protobuf::internal::WireFormatLite::
+ WriteBytesToArray(14, this->repeated_bytes(i), target);
+ }
+
+ // repeated int32 repeated_int32 = 15;
+ for (int i = 0; i < this->repeated_int32_size(); i++) {
+ target = ::google::protobuf::internal::WireFormatLite::
+ WriteInt32ToArray(15, this->repeated_int32(i), target);
+ }
+
+ // repeated int64 repeated_int64 = 16;
+ for (int i = 0; i < this->repeated_int64_size(); i++) {
+ target = ::google::protobuf::internal::WireFormatLite::
+ WriteInt64ToArray(16, this->repeated_int64(i), target);
+ }
+
+ // repeated uint32 repeated_uint32 = 17;
+ for (int i = 0; i < this->repeated_uint32_size(); i++) {
+ target = ::google::protobuf::internal::WireFormatLite::
+ WriteUInt32ToArray(17, this->repeated_uint32(i), target);
+ }
+
+ // repeated uint64 repeated_uint64 = 18;
+ for (int i = 0; i < this->repeated_uint64_size(); i++) {
+ target = ::google::protobuf::internal::WireFormatLite::
+ WriteUInt64ToArray(18, this->repeated_uint64(i), target);
+ }
+
+ // repeated sint32 repeated_sint32 = 19;
+ for (int i = 0; i < this->repeated_sint32_size(); i++) {
+ target = ::google::protobuf::internal::WireFormatLite::
+ WriteSInt32ToArray(19, this->repeated_sint32(i), target);
+ }
+
+ // repeated sint64 repeated_sint64 = 20;
+ for (int i = 0; i < this->repeated_sint64_size(); i++) {
+ target = ::google::protobuf::internal::WireFormatLite::
+ WriteSInt64ToArray(20, this->repeated_sint64(i), target);
+ }
+
+ // repeated float repeated_float = 21;
+ for (int i = 0; i < this->repeated_float_size(); i++) {
+ target = ::google::protobuf::internal::WireFormatLite::
+ WriteFloatToArray(21, this->repeated_float(i), target);
+ }
+
+ // repeated double repeated_double = 22;
+ for (int i = 0; i < this->repeated_double_size(); i++) {
+ target = ::google::protobuf::internal::WireFormatLite::
+ WriteDoubleToArray(22, this->repeated_double(i), target);
+ }
+
+ // repeated .tests.Enum repeated_enum = 23;
+ for (int i = 0; i < this->repeated_enum_size(); i++) {
+ target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+ 23, this->repeated_enum(i), target);
+ }
+
+ // repeated .tests.Nested repeated_nested = 24;
+ for (int i = 0; i < this->repeated_nested_size(); i++) {
+ target = ::google::protobuf::internal::WireFormatLite::
+ WriteMessageNoVirtualToArray(
+ 24, this->repeated_nested(i), target);
+ }
+
+ // repeated string empty = 25;
+ for (int i = 0; i < this->empty_size(); i++) {
+ ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+ this->empty(i).data(), this->empty(i).length(),
+ ::google::protobuf::internal::WireFormat::SERIALIZE);
+ target = ::google::protobuf::internal::WireFormatLite::
+ WriteStringToArray(25, this->empty(i), target);
+ }
+
+ if (!unknown_fields().empty()) {
+ target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+ unknown_fields(), target);
+ }
+ return target;
+}
+
+int Message::ByteSize() const {
+ int total_size = 0;
+
+ if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ // required string str = 1;
+ if (has_str()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::StringSize(
+ this->str());
+ }
+
+ // required bytes bytes = 2;
+ if (has_bytes()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::BytesSize(
+ this->bytes());
+ }
+
+ // optional int32 int32 = 3;
+ if (has_int32()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::Int32Size(
+ this->int32());
+ }
+
+ // optional int64 int64 = 4;
+ if (has_int64()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::Int64Size(
+ this->int64());
+ }
+
+ // optional uint32 uint32 = 5;
+ if (has_uint32()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt32Size(
+ this->uint32());
+ }
+
+ // optional uint64 uint64 = 6;
+ if (has_uint64()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::UInt64Size(
+ this->uint64());
+ }
+
+ // optional sint32 sint32 = 7;
+ if (has_sint32()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::SInt32Size(
+ this->sint32());
+ }
+
+ // optional sint64 sint64 = 8;
+ if (has_sint64()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::SInt64Size(
+ this->sint64());
+ }
+
+ }
+ if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
+ // required float f = 9;
+ if (has_f()) {
+ total_size += 1 + 4;
+ }
+
+ // required double d = 10;
+ if (has_d()) {
+ total_size += 1 + 8;
+ }
+
+ // required .tests.Enum e = 11;
+ if (has_e()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::EnumSize(this->e());
+ }
+
+ // required .tests.Nested nested = 12;
+ if (has_nested()) {
+ total_size += 1 +
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ this->nested());
+ }
+
+ }
+ // repeated string repeated_string = 13;
+ total_size += 1 * this->repeated_string_size();
+ for (int i = 0; i < this->repeated_string_size(); i++) {
+ total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
+ this->repeated_string(i));
+ }
+
+ // repeated bytes repeated_bytes = 14;
+ total_size += 1 * this->repeated_bytes_size();
+ for (int i = 0; i < this->repeated_bytes_size(); i++) {
+ total_size += ::google::protobuf::internal::WireFormatLite::BytesSize(
+ this->repeated_bytes(i));
+ }
+
+ // repeated int32 repeated_int32 = 15;
+ {
+ int data_size = 0;
+ for (int i = 0; i < this->repeated_int32_size(); i++) {
+ data_size += ::google::protobuf::internal::WireFormatLite::
+ Int32Size(this->repeated_int32(i));
+ }
+ total_size += 1 * this->repeated_int32_size() + data_size;
+ }
+
+ // repeated int64 repeated_int64 = 16;
+ {
+ int data_size = 0;
+ for (int i = 0; i < this->repeated_int64_size(); i++) {
+ data_size += ::google::protobuf::internal::WireFormatLite::
+ Int64Size(this->repeated_int64(i));
+ }
+ total_size += 2 * this->repeated_int64_size() + data_size;
+ }
+
+ // repeated uint32 repeated_uint32 = 17;
+ {
+ int data_size = 0;
+ for (int i = 0; i < this->repeated_uint32_size(); i++) {
+ data_size += ::google::protobuf::internal::WireFormatLite::
+ UInt32Size(this->repeated_uint32(i));
+ }
+ total_size += 2 * this->repeated_uint32_size() + data_size;
+ }
+
+ // repeated uint64 repeated_uint64 = 18;
+ {
+ int data_size = 0;
+ for (int i = 0; i < this->repeated_uint64_size(); i++) {
+ data_size += ::google::protobuf::internal::WireFormatLite::
+ UInt64Size(this->repeated_uint64(i));
+ }
+ total_size += 2 * this->repeated_uint64_size() + data_size;
+ }
+
+ // repeated sint32 repeated_sint32 = 19;
+ {
+ int data_size = 0;
+ for (int i = 0; i < this->repeated_sint32_size(); i++) {
+ data_size += ::google::protobuf::internal::WireFormatLite::
+ SInt32Size(this->repeated_sint32(i));
+ }
+ total_size += 2 * this->repeated_sint32_size() + data_size;
+ }
+
+ // repeated sint64 repeated_sint64 = 20;
+ {
+ int data_size = 0;
+ for (int i = 0; i < this->repeated_sint64_size(); i++) {
+ data_size += ::google::protobuf::internal::WireFormatLite::
+ SInt64Size(this->repeated_sint64(i));
+ }
+ total_size += 2 * this->repeated_sint64_size() + data_size;
+ }
+
+ // repeated float repeated_float = 21;
+ {
+ int data_size = 0;
+ data_size = 4 * this->repeated_float_size();
+ total_size += 2 * this->repeated_float_size() + data_size;
+ }
+
+ // repeated double repeated_double = 22;
+ {
+ int data_size = 0;
+ data_size = 8 * this->repeated_double_size();
+ total_size += 2 * this->repeated_double_size() + data_size;
+ }
+
+ // repeated .tests.Enum repeated_enum = 23;
+ {
+ int data_size = 0;
+ for (int i = 0; i < this->repeated_enum_size(); i++) {
+ data_size += ::google::protobuf::internal::WireFormatLite::EnumSize(
+ this->repeated_enum(i));
+ }
+ total_size += 2 * this->repeated_enum_size() + data_size;
+ }
+
+ // repeated .tests.Nested repeated_nested = 24;
+ total_size += 2 * this->repeated_nested_size();
+ for (int i = 0; i < this->repeated_nested_size(); i++) {
+ total_size +=
+ ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
+ this->repeated_nested(i));
+ }
+
+ // repeated string empty = 25;
+ total_size += 2 * this->empty_size();
+ for (int i = 0; i < this->empty_size(); i++) {
+ total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
+ this->empty(i));
+ }
+
+ 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 Message::MergeFrom(const ::google::protobuf::Message& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ const Message* source =
+ ::google::protobuf::internal::dynamic_cast_if_available<const Message*>(
+ &from);
+ if (source == NULL) {
+ ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+ } else {
+ MergeFrom(*source);
+ }
+}
+
+void Message::MergeFrom(const Message& from) {
+ GOOGLE_CHECK_NE(&from, this);
+ repeated_string_.MergeFrom(from.repeated_string_);
+ repeated_bytes_.MergeFrom(from.repeated_bytes_);
+ repeated_int32_.MergeFrom(from.repeated_int32_);
+ repeated_int64_.MergeFrom(from.repeated_int64_);
+ repeated_uint32_.MergeFrom(from.repeated_uint32_);
+ repeated_uint64_.MergeFrom(from.repeated_uint64_);
+ repeated_sint32_.MergeFrom(from.repeated_sint32_);
+ repeated_sint64_.MergeFrom(from.repeated_sint64_);
+ repeated_float_.MergeFrom(from.repeated_float_);
+ repeated_double_.MergeFrom(from.repeated_double_);
+ repeated_enum_.MergeFrom(from.repeated_enum_);
+ repeated_nested_.MergeFrom(from.repeated_nested_);
+ empty_.MergeFrom(from.empty_);
+ if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
+ if (from.has_str()) {
+ set_str(from.str());
+ }
+ if (from.has_bytes()) {
+ set_bytes(from.bytes());
+ }
+ if (from.has_int32()) {
+ set_int32(from.int32());
+ }
+ if (from.has_int64()) {
+ set_int64(from.int64());
+ }
+ if (from.has_uint32()) {
+ set_uint32(from.uint32());
+ }
+ if (from.has_uint64()) {
+ set_uint64(from.uint64());
+ }
+ if (from.has_sint32()) {
+ set_sint32(from.sint32());
+ }
+ if (from.has_sint64()) {
+ set_sint64(from.sint64());
+ }
+ }
+ if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
+ if (from.has_f()) {
+ set_f(from.f());
+ }
+ if (from.has_d()) {
+ set_d(from.d());
+ }
+ if (from.has_e()) {
+ set_e(from.e());
+ }
+ if (from.has_nested()) {
+ mutable_nested()->::tests::Nested::MergeFrom(from.nested());
+ }
+ }
+ mutable_unknown_fields()->MergeFrom(from.unknown_fields());
+}
+
+void Message::CopyFrom(const ::google::protobuf::Message& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+void Message::CopyFrom(const Message& from) {
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool Message::IsInitialized() const {
+ if ((_has_bits_[0] & 0x00000f03) != 0x00000f03) return false;
+
+ return true;
+}
+
+void Message::Swap(Message* other) {
+ if (other != this) {
+ std::swap(str_, other->str_);
+ std::swap(bytes_, other->bytes_);
+ std::swap(int32_, other->int32_);
+ std::swap(int64_, other->int64_);
+ std::swap(uint32_, other->uint32_);
+ std::swap(uint64_, other->uint64_);
+ std::swap(sint32_, other->sint32_);
+ std::swap(sint64_, other->sint64_);
+ std::swap(f_, other->f_);
+ std::swap(d_, other->d_);
+ std::swap(e_, other->e_);
+ std::swap(nested_, other->nested_);
+ repeated_string_.Swap(&other->repeated_string_);
+ repeated_bytes_.Swap(&other->repeated_bytes_);
+ repeated_int32_.Swap(&other->repeated_int32_);
+ repeated_int64_.Swap(&other->repeated_int64_);
+ repeated_uint32_.Swap(&other->repeated_uint32_);
+ repeated_uint64_.Swap(&other->repeated_uint64_);
+ repeated_sint32_.Swap(&other->repeated_sint32_);
+ repeated_sint64_.Swap(&other->repeated_sint64_);
+ repeated_float_.Swap(&other->repeated_float_);
+ repeated_double_.Swap(&other->repeated_double_);
+ repeated_enum_.Swap(&other->repeated_enum_);
+ repeated_nested_.Swap(&other->repeated_nested_);
+ empty_.Swap(&other->empty_);
+ 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 Message::GetMetadata() const {
+ protobuf_AssignDescriptorsOnce();
+ ::google::protobuf::Metadata metadata;
+ metadata.descriptor = Message_descriptor_;
+ metadata.reflection = Message_reflection_;
+ return metadata;
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+} // namespace tests
+
+// @@protoc_insertion_point(global_scope)