diff options
Diffstat (limited to 'src')
84 files changed, 20967 insertions, 61 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 02b8cd72..fd10b789 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -86,13 +86,18 @@ nobase_include_HEADERS = \ google/protobuf/stubs/stl_util.h \ google/protobuf/stubs/template_util.h \ google/protobuf/stubs/type_traits.h \ + google/protobuf/any.pb.h \ + google/protobuf/api.pb.h \ google/protobuf/arena.h \ google/protobuf/arenastring.h \ google/protobuf/descriptor_database.h \ google/protobuf/descriptor.h \ google/protobuf/descriptor.pb.h \ + google/protobuf/duration.pb.h \ google/protobuf/dynamic_message.h \ + google/protobuf/empty.pb.h \ google/protobuf/extension_set.h \ + google/protobuf/field_mask.pb.h \ google/protobuf/generated_enum_reflection.h \ google/protobuf/generated_enum_util.h \ google/protobuf/generated_message_reflection.h \ @@ -100,8 +105,8 @@ nobase_include_HEADERS = \ google/protobuf/map_entry.h \ google/protobuf/map_entry_lite.h \ google/protobuf/map_field.h \ - google/protobuf/map_field_lite.h \ google/protobuf/map_field_inl.h \ + google/protobuf/map_field_lite.h \ google/protobuf/map.h \ google/protobuf/map_type_handler.h \ google/protobuf/message.h \ @@ -112,11 +117,16 @@ nobase_include_HEADERS = \ google/protobuf/repeated_field.h \ google/protobuf/repeated_field_reflection.h \ google/protobuf/service.h \ + google/protobuf/source_context.pb.h \ + google/protobuf/struct.pb.h \ google/protobuf/text_format.h \ + google/protobuf/timestamp.pb.h \ + google/protobuf/type.pb.h \ google/protobuf/unknown_field_set.h \ google/protobuf/wire_format.h \ google/protobuf/wire_format_lite.h \ google/protobuf/wire_format_lite_inl.h \ + google/protobuf/wrappers.pb.h \ google/protobuf/io/coded_stream.h \ $(GZHEADERS) \ google/protobuf/io/printer.h \ @@ -137,7 +147,8 @@ nobase_include_HEADERS = \ google/protobuf/compiler/javanano/javanano_generator.h \ google/protobuf/compiler/objectivec/objectivec_generator.h \ google/protobuf/compiler/python/python_generator.h \ - google/protobuf/compiler/ruby/ruby_generator.h + google/protobuf/compiler/ruby/ruby_generator.h \ + google/protobuf/compiler/csharp/csharp_generator.h nobase_nodist_include_HEADERS = \ $(public_config) @@ -173,25 +184,35 @@ libprotobuf_la_LIBADD = $(PTHREAD_LIBS) libprotobuf_la_LDFLAGS = -version-info 10:0:0 -export-dynamic -no-undefined libprotobuf_la_SOURCES = \ $(libprotobuf_lite_la_SOURCES) \ - google/protobuf/stubs/strutil.cc \ - google/protobuf/stubs/strutil.h \ - google/protobuf/stubs/substitute.cc \ - google/protobuf/stubs/substitute.h \ - google/protobuf/stubs/structurally_valid.cc \ + google/protobuf/any.pb.cc \ + google/protobuf/api.pb.cc \ google/protobuf/descriptor.cc \ google/protobuf/descriptor_database.cc \ google/protobuf/descriptor.pb.cc \ + google/protobuf/duration.pb.cc \ google/protobuf/dynamic_message.cc \ + google/protobuf/empty.pb.cc \ google/protobuf/extension_set_heavy.cc \ + google/protobuf/field_mask.pb.cc \ google/protobuf/generated_message_reflection.cc \ google/protobuf/map_field.cc \ google/protobuf/message.cc \ google/protobuf/reflection_internal.h \ google/protobuf/reflection_ops.cc \ google/protobuf/service.cc \ + google/protobuf/source_context.pb.cc \ + google/protobuf/struct.pb.cc \ + google/protobuf/stubs/structurally_valid.cc \ + google/protobuf/stubs/strutil.cc \ + google/protobuf/stubs/strutil.h \ + google/protobuf/stubs/substitute.cc \ + google/protobuf/stubs/substitute.h \ google/protobuf/text_format.cc \ + google/protobuf/timestamp.pb.cc \ + google/protobuf/type.pb.cc \ google/protobuf/unknown_field_set.cc \ google/protobuf/wire_format.cc \ + google/protobuf/wrappers.pb.cc \ google/protobuf/io/gzip_stream.cc \ google/protobuf/io/printer.cc \ google/protobuf/io/strtod.cc \ @@ -322,7 +343,36 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/objectivec/objectivec_primitive_field.cc \ google/protobuf/compiler/objectivec/objectivec_primitive_field.h \ google/protobuf/compiler/python/python_generator.cc \ - google/protobuf/compiler/ruby/ruby_generator.cc + google/protobuf/compiler/ruby/ruby_generator.cc \ + google/protobuf/compiler/csharp/csharp_enum.cc \ + google/protobuf/compiler/csharp/csharp_enum.h \ + google/protobuf/compiler/csharp/csharp_enum_field.cc \ + google/protobuf/compiler/csharp/csharp_enum_field.h \ + google/protobuf/compiler/csharp/csharp_extension.cc \ + google/protobuf/compiler/csharp/csharp_extension.h \ + google/protobuf/compiler/csharp/csharp_field_base.cc \ + google/protobuf/compiler/csharp/csharp_field_base.h \ + google/protobuf/compiler/csharp/csharp_generator.cc \ + google/protobuf/compiler/csharp/csharp_helpers.cc \ + google/protobuf/compiler/csharp/csharp_helpers.h \ + google/protobuf/compiler/csharp/csharp_message.cc \ + google/protobuf/compiler/csharp/csharp_message.h \ + google/protobuf/compiler/csharp/csharp_message_field.cc \ + google/protobuf/compiler/csharp/csharp_message_field.h \ + google/protobuf/compiler/csharp/csharp_primitive_field.cc \ + google/protobuf/compiler/csharp/csharp_primitive_field.h \ + google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc \ + google/protobuf/compiler/csharp/csharp_repeated_enum_field.h \ + google/protobuf/compiler/csharp/csharp_repeated_message_field.cc \ + google/protobuf/compiler/csharp/csharp_repeated_message_field.h \ + google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc \ + google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h \ + google/protobuf/compiler/csharp/csharp_source_generator_base.cc \ + google/protobuf/compiler/csharp/csharp_source_generator_base.h \ + google/protobuf/compiler/csharp/csharp_umbrella_class.cc \ + google/protobuf/compiler/csharp/csharp_umbrella_class.h \ + google/protobuf/compiler/csharp/csharp_writer.cc \ + google/protobuf/compiler/csharp/csharp_writer.h bin_PROGRAMS = protoc protoc_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la @@ -355,6 +405,7 @@ protoc_inputs = \ google/protobuf/unittest_preserve_unknown_enum.proto \ google/protobuf/unittest_preserve_unknown_enum2.proto \ google/protobuf/unittest_proto3_arena.proto \ + google/protobuf/unittest_well_known_types.proto \ google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto \ google/protobuf/compiler/cpp/cpp_test_large_enum_value.proto @@ -432,6 +483,8 @@ protoc_outputs = \ google/protobuf/unittest_preserve_unknown_enum2.pb.h \ google/protobuf/unittest_proto3_arena.pb.cc \ google/protobuf/unittest_proto3_arena.pb.h \ + google/protobuf/unittest_well_known_types.pb.cc \ + google/protobuf/unittest_well_known_types.pb.h \ google/protobuf/compiler/cpp/cpp_test_large_enum_value.pb.cc \ google/protobuf/compiler/cpp/cpp_test_large_enum_value.pb.h \ google/protobuf/compiler/cpp/cpp_test_bad_identifiers.pb.cc \ @@ -509,6 +562,7 @@ protobuf_test_SOURCES = \ google/protobuf/repeated_field_unittest.cc \ google/protobuf/text_format_unittest.cc \ google/protobuf/unknown_field_set_unittest.cc \ + google/protobuf/well_known_types_unittest.cc \ google/protobuf/wire_format_unittest.cc \ google/protobuf/io/coded_stream_unittest.cc \ google/protobuf/io/printer_unittest.cc \ @@ -528,6 +582,7 @@ protobuf_test_SOURCES = \ google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc \ google/protobuf/compiler/python/python_plugin_unittest.cc \ google/protobuf/compiler/ruby/ruby_generator_unittest.cc \ + google/protobuf/compiler/csharp/csharp_generator_unittest.cc \ $(COMMON_TEST_SOURCES) nodist_protobuf_test_SOURCES = $(protoc_outputs) diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc new file mode 100644 index 00000000..64500b5c --- /dev/null +++ b/src/google/protobuf/any.pb.cc @@ -0,0 +1,472 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/any.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "google/protobuf/any.pb.h" + +#include <algorithm> + +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/once.h> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/wire_format_lite_inl.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/generated_message_reflection.h> +#include <google/protobuf/reflection_ops.h> +#include <google/protobuf/wire_format.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +namespace { + +const ::google::protobuf::Descriptor* Any_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Any_reflection_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_google_2fprotobuf_2fany_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fany_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "google/protobuf/any.proto"); + GOOGLE_CHECK(file != NULL); + Any_descriptor_ = file->message_type(0); + static const int Any_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, type_url_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, value_), + }; + Any_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Any_descriptor_, + Any::default_instance_, + Any_offsets_, + -1, + -1, + -1, + sizeof(Any), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Any, _is_default_instance_)); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_google_2fprotobuf_2fany_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Any_descriptor_, &Any::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_google_2fprotobuf_2fany_2eproto() { + delete Any::default_instance_; + delete Any_reflection_; +} + +void protobuf_AddDesc_google_2fprotobuf_2fany_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n\031google/protobuf/any.proto\022\017google.prot" + "obuf\"&\n\003Any\022\020\n\010type_url\030\001 \001(\t\022\r\n\005value\030\002" + " \001(\014B*\n\023com.google.protobufB\010AnyProtoP\001\240" + "\001\001\242\002\003GPBb\006proto3", 136); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "google/protobuf/any.proto", &protobuf_RegisterTypes); + Any::default_instance_ = new Any(); + Any::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fany_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_google_2fprotobuf_2fany_2eproto { + StaticDescriptorInitializer_google_2fprotobuf_2fany_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fany_2eproto(); + } +} static_descriptor_initializer_google_2fprotobuf_2fany_2eproto_; + +namespace { + +static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD; +static void MergeFromFail(int line) { + GOOGLE_CHECK(false) << __FILE__ << ":" << line; +} + +} // namespace + + +// =================================================================== + +#ifndef _MSC_VER +const int Any::kTypeUrlFieldNumber; +const int Any::kValueFieldNumber; +#endif // !_MSC_VER + +Any::Any() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Any) +} + +void Any::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +Any::Any(const Any& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Any) +} + +void Any::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +Any::~Any() { + // @@protoc_insertion_point(destructor:google.protobuf.Any) + SharedDtor(); +} + +void Any::SharedDtor() { + type_url_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void Any::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Any::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Any_descriptor_; +} + +const Any& Any::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fany_2eproto(); + return *default_instance_; +} + +Any* Any::default_instance_ = NULL; + +Any* Any::New(::google::protobuf::Arena* arena) const { + Any* n = new Any; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Any::Clear() { + type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +bool Any::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Any) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string type_url = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_type_url())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->type_url().data(), this->type_url().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.Any.type_url"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(18)) goto parse_value; + break; + } + + // optional bytes value = 2; + case 2: { + if (tag == 18) { + parse_value: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_value())); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Any) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Any) + return false; +#undef DO_ +} + +void Any::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Any) + // optional string type_url = 1; + if (this->type_url().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->type_url().data(), this->type_url().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Any.type_url"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->type_url(), output); + } + + // optional bytes value = 2; + if (this->value().size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( + 2, this->value(), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.Any) +} + +::google::protobuf::uint8* Any::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Any) + // optional string type_url = 1; + if (this->type_url().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->type_url().data(), this->type_url().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Any.type_url"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->type_url(), target); + } + + // optional bytes value = 2; + if (this->value().size() > 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( + 2, this->value(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Any) + return target; +} + +int Any::ByteSize() const { + int total_size = 0; + + // optional string type_url = 1; + if (this->type_url().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->type_url()); + } + + // optional bytes value = 2; + if (this->value().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->value()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Any::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Any* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Any*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Any::MergeFrom(const Any& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.type_url().size() > 0) { + + type_url_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_url_); + } + if (from.value().size() > 0) { + + value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.value_); + } +} + +void Any::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Any::CopyFrom(const Any& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Any::IsInitialized() const { + + return true; +} + +void Any::Swap(Any* other) { + if (other == this) return; + InternalSwap(other); +} +void Any::InternalSwap(Any* other) { + type_url_.Swap(&other->type_url_); + value_.Swap(&other->value_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Any::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Any_descriptor_; + metadata.reflection = Any_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Any + +// optional string type_url = 1; + void Any::clear_type_url() { + type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& Any::type_url() const { + // @@protoc_insertion_point(field_get:google.protobuf.Any.type_url) + return type_url_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Any::set_type_url(const ::std::string& value) { + + type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Any.type_url) +} + void Any::set_type_url(const char* value) { + + type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Any.type_url) +} + void Any::set_type_url(const char* value, size_t size) { + + type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.type_url) +} + ::std::string* Any::mutable_type_url() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Any.type_url) + return type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* Any::release_type_url() { + + return type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Any::set_allocated_type_url(::std::string* type_url) { + if (type_url != NULL) { + + } else { + + } + type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_url); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url) +} + +// optional bytes value = 2; + void Any::clear_value() { + value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& Any::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Any.value) + return value_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Any::set_value(const ::std::string& value) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Any.value) +} + void Any::set_value(const char* value) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Any.value) +} + void Any::set_value(const void* value, size_t size) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.value) +} + ::std::string* Any::mutable_value() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Any.value) + return value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* Any::release_value() { + + return value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Any::set_allocated_value(::std::string* value) { + if (value != NULL) { + + } else { + + } + value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h new file mode 100644 index 00000000..b2c238c1 --- /dev/null +++ b/src/google/protobuf/any.pb.h @@ -0,0 +1,240 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/any.proto + +#ifndef PROTOBUF_google_2fprotobuf_2fany_2eproto__INCLUDED +#define PROTOBUF_google_2fprotobuf_2fany_2eproto__INCLUDED + +#include <string> + +#include <google/protobuf/stubs/common.h> + +#if GOOGLE_PROTOBUF_VERSION < 3000000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/metadata.h> +#include <google/protobuf/message.h> +#include <google/protobuf/repeated_field.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/unknown_field_set.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +// Internal implementation detail -- do not call these. +void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fany_2eproto(); +void protobuf_AssignDesc_google_2fprotobuf_2fany_2eproto(); +void protobuf_ShutdownFile_google_2fprotobuf_2fany_2eproto(); + +class Any; + +// =================================================================== + +class LIBPROTOBUF_EXPORT Any : public ::google::protobuf::Message { + public: + Any(); + virtual ~Any(); + + Any(const Any& from); + + inline Any& operator=(const Any& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Any& default_instance(); + + void Swap(Any* other); + + // implements Message ---------------------------------------------- + + inline Any* New() const { return New(NULL); } + + Any* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Any& from); + void MergeFrom(const Any& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Any* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string type_url = 1; + void clear_type_url(); + static const int kTypeUrlFieldNumber = 1; + const ::std::string& type_url() const; + void set_type_url(const ::std::string& value); + void set_type_url(const char* value); + void set_type_url(const char* value, size_t size); + ::std::string* mutable_type_url(); + ::std::string* release_type_url(); + void set_allocated_type_url(::std::string* type_url); + + // optional bytes value = 2; + void clear_value(); + static const int kValueFieldNumber = 2; + const ::std::string& value() const; + void set_value(const ::std::string& value); + void set_value(const char* value); + void set_value(const void* value, size_t size); + ::std::string* mutable_value(); + ::std::string* release_value(); + void set_allocated_value(::std::string* value); + + // @@protoc_insertion_point(class_scope:google.protobuf.Any) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr type_url_; + ::google::protobuf::internal::ArenaStringPtr value_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fany_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fany_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fany_2eproto(); + + void InitAsDefaultInstance(); + static Any* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +#if !PROTOBUF_INLINE_NOT_IN_HEADERS +// Any + +// optional string type_url = 1; +inline void Any::clear_type_url() { + type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& Any::type_url() const { + // @@protoc_insertion_point(field_get:google.protobuf.Any.type_url) + return type_url_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Any::set_type_url(const ::std::string& value) { + + type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Any.type_url) +} +inline void Any::set_type_url(const char* value) { + + type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Any.type_url) +} +inline void Any::set_type_url(const char* value, size_t size) { + + type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.type_url) +} +inline ::std::string* Any::mutable_type_url() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Any.type_url) + return type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* Any::release_type_url() { + + return type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Any::set_allocated_type_url(::std::string* type_url) { + if (type_url != NULL) { + + } else { + + } + type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_url); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url) +} + +// optional bytes value = 2; +inline void Any::clear_value() { + value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& Any::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Any.value) + return value_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Any::set_value(const ::std::string& value) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Any.value) +} +inline void Any::set_value(const char* value) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Any.value) +} +inline void Any::set_value(const void* value, size_t size) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.value) +} +inline ::std::string* Any::mutable_value() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Any.value) + return value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* Any::release_value() { + + return value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Any::set_allocated_value(::std::string* value) { + if (value != NULL) { + + } else { + + } + value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value) +} + +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_google_2fprotobuf_2fany_2eproto__INCLUDED diff --git a/src/google/protobuf/any.proto b/src/google/protobuf/any.proto index 0bb375ce..e1780fe5 100644 --- a/src/google/protobuf/any.proto +++ b/src/google/protobuf/any.proto @@ -35,6 +35,7 @@ option java_generate_equals_and_hash = true; option java_multiple_files = true; option java_outer_classname = "AnyProto"; option java_package = "com.google.protobuf"; +option csharp_namespace = "Google.ProtocolBuffers"; option objc_class_prefix = "GPB"; diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc new file mode 100644 index 00000000..b34ce803 --- /dev/null +++ b/src/google/protobuf/api.pb.cc @@ -0,0 +1,1392 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/api.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "google/protobuf/api.pb.h" + +#include <algorithm> + +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/once.h> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/wire_format_lite_inl.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/generated_message_reflection.h> +#include <google/protobuf/reflection_ops.h> +#include <google/protobuf/wire_format.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +namespace { + +const ::google::protobuf::Descriptor* Api_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Api_reflection_ = NULL; +const ::google::protobuf::Descriptor* Method_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Method_reflection_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_google_2fprotobuf_2fapi_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fapi_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "google/protobuf/api.proto"); + GOOGLE_CHECK(file != NULL); + Api_descriptor_ = file->message_type(0); + static const int Api_offsets_[5] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, methods_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, version_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, source_context_), + }; + Api_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Api_descriptor_, + Api::default_instance_, + Api_offsets_, + -1, + -1, + -1, + sizeof(Api), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Api, _is_default_instance_)); + Method_descriptor_ = file->message_type(1); + static const int Method_offsets_[6] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, request_type_url_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, request_streaming_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, response_type_url_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, response_streaming_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, options_), + }; + Method_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Method_descriptor_, + Method::default_instance_, + Method_offsets_, + -1, + -1, + -1, + sizeof(Method), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Method, _is_default_instance_)); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_google_2fprotobuf_2fapi_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Api_descriptor_, &Api::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Method_descriptor_, &Method::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_google_2fprotobuf_2fapi_2eproto() { + delete Api::default_instance_; + delete Api_reflection_; + delete Method::default_instance_; + delete Method_reflection_; +} + +void protobuf_AddDesc_google_2fprotobuf_2fapi_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fsource_5fcontext_2eproto(); + ::google::protobuf::protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n\031google/protobuf/api.proto\022\017google.prot" + "obuf\032$google/protobuf/source_context.pro" + "to\032\032google/protobuf/type.proto\"\260\001\n\003Api\022\014" + "\n\004name\030\001 \001(\t\022(\n\007methods\030\002 \003(\0132\027.google.p" + "rotobuf.Method\022(\n\007options\030\003 \003(\0132\027.google" + ".protobuf.Option\022\017\n\007version\030\004 \001(\t\0226\n\016sou" + "rce_context\030\005 \001(\0132\036.google.protobuf.Sour" + "ceContext\"\254\001\n\006Method\022\014\n\004name\030\001 \001(\t\022\030\n\020re" + "quest_type_url\030\002 \001(\t\022\031\n\021request_streamin" + "g\030\003 \001(\010\022\031\n\021response_type_url\030\004 \001(\t\022\032\n\022re" + "sponse_streaming\030\005 \001(\010\022(\n\007options\030\006 \003(\0132" + "\027.google.protobuf.OptionB\'\n\023com.google.p" + "rotobufB\010ApiProtoP\001\242\002\003GPBb\006proto3", 513); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "google/protobuf/api.proto", &protobuf_RegisterTypes); + Api::default_instance_ = new Api(); + Method::default_instance_ = new Method(); + Api::default_instance_->InitAsDefaultInstance(); + Method::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fapi_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_google_2fprotobuf_2fapi_2eproto { + StaticDescriptorInitializer_google_2fprotobuf_2fapi_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fapi_2eproto(); + } +} static_descriptor_initializer_google_2fprotobuf_2fapi_2eproto_; + +namespace { + +static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD; +static void MergeFromFail(int line) { + GOOGLE_CHECK(false) << __FILE__ << ":" << line; +} + +} // namespace + + +// =================================================================== + +#ifndef _MSC_VER +const int Api::kNameFieldNumber; +const int Api::kMethodsFieldNumber; +const int Api::kOptionsFieldNumber; +const int Api::kVersionFieldNumber; +const int Api::kSourceContextFieldNumber; +#endif // !_MSC_VER + +Api::Api() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Api) +} + +void Api::InitAsDefaultInstance() { + _is_default_instance_ = true; + source_context_ = const_cast< ::google::protobuf::SourceContext*>(&::google::protobuf::SourceContext::default_instance()); +} + +Api::Api(const Api& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Api) +} + +void Api::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + source_context_ = NULL; +} + +Api::~Api() { + // @@protoc_insertion_point(destructor:google.protobuf.Api) + SharedDtor(); +} + +void Api::SharedDtor() { + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + version_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + delete source_context_; + } +} + +void Api::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Api::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Api_descriptor_; +} + +const Api& Api::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fapi_2eproto(); + return *default_instance_; +} + +Api* Api::default_instance_ = NULL; + +Api* Api::New(::google::protobuf::Arena* arena) const { + Api* n = new Api; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Api::Clear() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + version_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (source_context_ != NULL) delete source_context_; + source_context_ = NULL; + methods_.Clear(); + options_.Clear(); +} + +bool Api::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Api) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.Api.name"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(18)) goto parse_methods; + break; + } + + // repeated .google.protobuf.Method methods = 2; + case 2: { + if (tag == 18) { + parse_methods: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_methods())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(18)) goto parse_methods; + if (input->ExpectTag(26)) goto parse_options; + break; + } + + // repeated .google.protobuf.Option options = 3; + case 3: { + if (tag == 26) { + parse_options: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_options())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(26)) goto parse_options; + if (input->ExpectTag(34)) goto parse_version; + break; + } + + // optional string version = 4; + case 4: { + if (tag == 34) { + parse_version: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_version())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->version().data(), this->version().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.Api.version"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(42)) goto parse_source_context; + break; + } + + // optional .google.protobuf.SourceContext source_context = 5; + case 5: { + if (tag == 42) { + parse_source_context: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_source_context())); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Api) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Api) + return false; +#undef DO_ +} + +void Api::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Api) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Api.name"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->name(), output); + } + + // repeated .google.protobuf.Method methods = 2; + for (unsigned int i = 0, n = this->methods_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 2, this->methods(i), output); + } + + // repeated .google.protobuf.Option options = 3; + for (unsigned int i = 0, n = this->options_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 3, this->options(i), output); + } + + // optional string version = 4; + if (this->version().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->version().data(), this->version().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Api.version"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 4, this->version(), output); + } + + // optional .google.protobuf.SourceContext source_context = 5; + if (this->has_source_context()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 5, *this->source_context_, output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.Api) +} + +::google::protobuf::uint8* Api::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Api) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Api.name"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // repeated .google.protobuf.Method methods = 2; + for (unsigned int i = 0, n = this->methods_size(); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 2, this->methods(i), target); + } + + // repeated .google.protobuf.Option options = 3; + for (unsigned int i = 0, n = this->options_size(); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 3, this->options(i), target); + } + + // optional string version = 4; + if (this->version().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->version().data(), this->version().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Api.version"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 4, this->version(), target); + } + + // optional .google.protobuf.SourceContext source_context = 5; + if (this->has_source_context()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 5, *this->source_context_, target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Api) + return target; +} + +int Api::ByteSize() const { + int total_size = 0; + + // optional string name = 1; + if (this->name().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional string version = 4; + if (this->version().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->version()); + } + + // optional .google.protobuf.SourceContext source_context = 5; + if (this->has_source_context()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *this->source_context_); + } + + // repeated .google.protobuf.Method methods = 2; + total_size += 1 * this->methods_size(); + for (int i = 0; i < this->methods_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->methods(i)); + } + + // repeated .google.protobuf.Option options = 3; + total_size += 1 * this->options_size(); + for (int i = 0; i < this->options_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->options(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Api::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Api* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Api*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Api::MergeFrom(const Api& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + methods_.MergeFrom(from.methods_); + options_.MergeFrom(from.options_); + if (from.name().size() > 0) { + + name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + } + if (from.version().size() > 0) { + + version_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.version_); + } + if (from.has_source_context()) { + mutable_source_context()->::google::protobuf::SourceContext::MergeFrom(from.source_context()); + } +} + +void Api::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Api::CopyFrom(const Api& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Api::IsInitialized() const { + + return true; +} + +void Api::Swap(Api* other) { + if (other == this) return; + InternalSwap(other); +} +void Api::InternalSwap(Api* other) { + name_.Swap(&other->name_); + methods_.UnsafeArenaSwap(&other->methods_); + options_.UnsafeArenaSwap(&other->options_); + version_.Swap(&other->version_); + std::swap(source_context_, other->source_context_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Api::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Api_descriptor_; + metadata.reflection = Api_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Api + +// optional string name = 1; + void Api::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& Api::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.Api.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Api::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Api.name) +} + void Api::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Api.name) +} + void Api::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.name) +} + ::std::string* Api::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Api.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* Api::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Api::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name) +} + +// repeated .google.protobuf.Method methods = 2; + int Api::methods_size() const { + return methods_.size(); +} + void Api::clear_methods() { + methods_.Clear(); +} + const ::google::protobuf::Method& Api::methods(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Api.methods) + return methods_.Get(index); +} + ::google::protobuf::Method* Api::mutable_methods(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Api.methods) + return methods_.Mutable(index); +} + ::google::protobuf::Method* Api::add_methods() { + // @@protoc_insertion_point(field_add:google.protobuf.Api.methods) + return methods_.Add(); +} + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >& +Api::methods() const { + // @@protoc_insertion_point(field_list:google.protobuf.Api.methods) + return methods_; +} + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >* +Api::mutable_methods() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods) + return &methods_; +} + +// repeated .google.protobuf.Option options = 3; + int Api::options_size() const { + return options_.size(); +} + void Api::clear_options() { + options_.Clear(); +} + const ::google::protobuf::Option& Api::options(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Api.options) + return options_.Get(index); +} + ::google::protobuf::Option* Api::mutable_options(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Api.options) + return options_.Mutable(index); +} + ::google::protobuf::Option* Api::add_options() { + // @@protoc_insertion_point(field_add:google.protobuf.Api.options) + return options_.Add(); +} + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& +Api::options() const { + // @@protoc_insertion_point(field_list:google.protobuf.Api.options) + return options_; +} + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* +Api::mutable_options() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options) + return &options_; +} + +// optional string version = 4; + void Api::clear_version() { + version_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& Api::version() const { + // @@protoc_insertion_point(field_get:google.protobuf.Api.version) + return version_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Api::set_version(const ::std::string& value) { + + version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Api.version) +} + void Api::set_version(const char* value) { + + version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Api.version) +} + void Api::set_version(const char* value, size_t size) { + + version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.version) +} + ::std::string* Api::mutable_version() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Api.version) + return version_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* Api::release_version() { + + return version_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Api::set_allocated_version(::std::string* version) { + if (version != NULL) { + + } else { + + } + version_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), version); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version) +} + +// optional .google.protobuf.SourceContext source_context = 5; + bool Api::has_source_context() const { + return !_is_default_instance_ && source_context_ != NULL; +} + void Api::clear_source_context() { + if (source_context_ != NULL) delete source_context_; + source_context_ = NULL; +} + const ::google::protobuf::SourceContext& Api::source_context() const { + // @@protoc_insertion_point(field_get:google.protobuf.Api.source_context) + return source_context_ != NULL ? *source_context_ : *default_instance_->source_context_; +} + ::google::protobuf::SourceContext* Api::mutable_source_context() { + + if (source_context_ == NULL) { + source_context_ = new ::google::protobuf::SourceContext; + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context) + return source_context_; +} + ::google::protobuf::SourceContext* Api::release_source_context() { + + ::google::protobuf::SourceContext* temp = source_context_; + source_context_ = NULL; + return temp; +} + void Api::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { + delete source_context_; + source_context_ = source_context; + if (source_context) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.source_context) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int Method::kNameFieldNumber; +const int Method::kRequestTypeUrlFieldNumber; +const int Method::kRequestStreamingFieldNumber; +const int Method::kResponseTypeUrlFieldNumber; +const int Method::kResponseStreamingFieldNumber; +const int Method::kOptionsFieldNumber; +#endif // !_MSC_VER + +Method::Method() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Method) +} + +void Method::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +Method::Method(const Method& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Method) +} + +void Method::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + request_type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + request_streaming_ = false; + response_type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + response_streaming_ = false; +} + +Method::~Method() { + // @@protoc_insertion_point(destructor:google.protobuf.Method) + SharedDtor(); +} + +void Method::SharedDtor() { + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + request_type_url_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + response_type_url_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void Method::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Method::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Method_descriptor_; +} + +const Method& Method::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fapi_2eproto(); + return *default_instance_; +} + +Method* Method::default_instance_ = NULL; + +Method* Method::New(::google::protobuf::Arena* arena) const { + Method* n = new Method; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Method::Clear() { +#define ZR_HELPER_(f) reinterpret_cast<char*>(\ + &reinterpret_cast<Method*>(16)->f) + +#define ZR_(first, last) do {\ + ::memset(&first, 0,\ + ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\ +} while (0) + + ZR_(request_streaming_, response_streaming_); + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + request_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + response_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + +#undef ZR_HELPER_ +#undef ZR_ + + options_.Clear(); +} + +bool Method::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Method) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.Method.name"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(18)) goto parse_request_type_url; + break; + } + + // optional string request_type_url = 2; + case 2: { + if (tag == 18) { + parse_request_type_url: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_request_type_url())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->request_type_url().data(), this->request_type_url().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.Method.request_type_url"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(24)) goto parse_request_streaming; + break; + } + + // optional bool request_streaming = 3; + case 3: { + if (tag == 24) { + parse_request_streaming: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &request_streaming_))); + + } else { + goto handle_unusual; + } + if (input->ExpectTag(34)) goto parse_response_type_url; + break; + } + + // optional string response_type_url = 4; + case 4: { + if (tag == 34) { + parse_response_type_url: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_response_type_url())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->response_type_url().data(), this->response_type_url().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.Method.response_type_url"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(40)) goto parse_response_streaming; + break; + } + + // optional bool response_streaming = 5; + case 5: { + if (tag == 40) { + parse_response_streaming: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &response_streaming_))); + + } else { + goto handle_unusual; + } + if (input->ExpectTag(50)) goto parse_options; + break; + } + + // repeated .google.protobuf.Option options = 6; + case 6: { + if (tag == 50) { + parse_options: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_options())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(50)) goto parse_options; + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Method) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Method) + return false; +#undef DO_ +} + +void Method::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Method) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Method.name"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->name(), output); + } + + // optional string request_type_url = 2; + if (this->request_type_url().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->request_type_url().data(), this->request_type_url().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Method.request_type_url"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 2, this->request_type_url(), output); + } + + // optional bool request_streaming = 3; + if (this->request_streaming() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteBool(3, this->request_streaming(), output); + } + + // optional string response_type_url = 4; + if (this->response_type_url().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->response_type_url().data(), this->response_type_url().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Method.response_type_url"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 4, this->response_type_url(), output); + } + + // optional bool response_streaming = 5; + if (this->response_streaming() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteBool(5, this->response_streaming(), output); + } + + // repeated .google.protobuf.Option options = 6; + for (unsigned int i = 0, n = this->options_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 6, this->options(i), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.Method) +} + +::google::protobuf::uint8* Method::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Method) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Method.name"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // optional string request_type_url = 2; + if (this->request_type_url().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->request_type_url().data(), this->request_type_url().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Method.request_type_url"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 2, this->request_type_url(), target); + } + + // optional bool request_streaming = 3; + if (this->request_streaming() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(3, this->request_streaming(), target); + } + + // optional string response_type_url = 4; + if (this->response_type_url().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->response_type_url().data(), this->response_type_url().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Method.response_type_url"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 4, this->response_type_url(), target); + } + + // optional bool response_streaming = 5; + if (this->response_streaming() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(5, this->response_streaming(), target); + } + + // repeated .google.protobuf.Option options = 6; + for (unsigned int i = 0, n = this->options_size(); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 6, this->options(i), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Method) + return target; +} + +int Method::ByteSize() const { + int total_size = 0; + + // optional string name = 1; + if (this->name().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional string request_type_url = 2; + if (this->request_type_url().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->request_type_url()); + } + + // optional bool request_streaming = 3; + if (this->request_streaming() != 0) { + total_size += 1 + 1; + } + + // optional string response_type_url = 4; + if (this->response_type_url().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->response_type_url()); + } + + // optional bool response_streaming = 5; + if (this->response_streaming() != 0) { + total_size += 1 + 1; + } + + // repeated .google.protobuf.Option options = 6; + total_size += 1 * this->options_size(); + for (int i = 0; i < this->options_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->options(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Method::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Method* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Method*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Method::MergeFrom(const Method& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + options_.MergeFrom(from.options_); + if (from.name().size() > 0) { + + name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + } + if (from.request_type_url().size() > 0) { + + request_type_url_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.request_type_url_); + } + if (from.request_streaming() != 0) { + set_request_streaming(from.request_streaming()); + } + if (from.response_type_url().size() > 0) { + + response_type_url_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.response_type_url_); + } + if (from.response_streaming() != 0) { + set_response_streaming(from.response_streaming()); + } +} + +void Method::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Method::CopyFrom(const Method& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Method::IsInitialized() const { + + return true; +} + +void Method::Swap(Method* other) { + if (other == this) return; + InternalSwap(other); +} +void Method::InternalSwap(Method* other) { + name_.Swap(&other->name_); + request_type_url_.Swap(&other->request_type_url_); + std::swap(request_streaming_, other->request_streaming_); + response_type_url_.Swap(&other->response_type_url_); + std::swap(response_streaming_, other->response_streaming_); + options_.UnsafeArenaSwap(&other->options_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Method::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Method_descriptor_; + metadata.reflection = Method_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Method + +// optional string name = 1; + void Method::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& Method::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.Method.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Method::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Method.name) +} + void Method::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Method.name) +} + void Method::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.name) +} + ::std::string* Method::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Method.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* Method::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Method::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name) +} + +// optional string request_type_url = 2; + void Method::clear_request_type_url() { + request_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& Method::request_type_url() const { + // @@protoc_insertion_point(field_get:google.protobuf.Method.request_type_url) + return request_type_url_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Method::set_request_type_url(const ::std::string& value) { + + request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url) +} + void Method::set_request_type_url(const char* value) { + + request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Method.request_type_url) +} + void Method::set_request_type_url(const char* value, size_t size) { + + request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.request_type_url) +} + ::std::string* Method::mutable_request_type_url() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Method.request_type_url) + return request_type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* Method::release_request_type_url() { + + return request_type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Method::set_allocated_request_type_url(::std::string* request_type_url) { + if (request_type_url != NULL) { + + } else { + + } + request_type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), request_type_url); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url) +} + +// optional bool request_streaming = 3; + void Method::clear_request_streaming() { + request_streaming_ = false; +} + bool Method::request_streaming() const { + // @@protoc_insertion_point(field_get:google.protobuf.Method.request_streaming) + return request_streaming_; +} + void Method::set_request_streaming(bool value) { + + request_streaming_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Method.request_streaming) +} + +// optional string response_type_url = 4; + void Method::clear_response_type_url() { + response_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& Method::response_type_url() const { + // @@protoc_insertion_point(field_get:google.protobuf.Method.response_type_url) + return response_type_url_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Method::set_response_type_url(const ::std::string& value) { + + response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url) +} + void Method::set_response_type_url(const char* value) { + + response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Method.response_type_url) +} + void Method::set_response_type_url(const char* value, size_t size) { + + response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.response_type_url) +} + ::std::string* Method::mutable_response_type_url() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Method.response_type_url) + return response_type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* Method::release_response_type_url() { + + return response_type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Method::set_allocated_response_type_url(::std::string* response_type_url) { + if (response_type_url != NULL) { + + } else { + + } + response_type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), response_type_url); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url) +} + +// optional bool response_streaming = 5; + void Method::clear_response_streaming() { + response_streaming_ = false; +} + bool Method::response_streaming() const { + // @@protoc_insertion_point(field_get:google.protobuf.Method.response_streaming) + return response_streaming_; +} + void Method::set_response_streaming(bool value) { + + response_streaming_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Method.response_streaming) +} + +// repeated .google.protobuf.Option options = 6; + int Method::options_size() const { + return options_.size(); +} + void Method::clear_options() { + options_.Clear(); +} + const ::google::protobuf::Option& Method::options(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Method.options) + return options_.Get(index); +} + ::google::protobuf::Option* Method::mutable_options(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Method.options) + return options_.Mutable(index); +} + ::google::protobuf::Option* Method::add_options() { + // @@protoc_insertion_point(field_add:google.protobuf.Method.options) + return options_.Add(); +} + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& +Method::options() const { + // @@protoc_insertion_point(field_list:google.protobuf.Method.options) + return options_; +} + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* +Method::mutable_options() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options) + return &options_; +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h new file mode 100644 index 00000000..f459af0f --- /dev/null +++ b/src/google/protobuf/api.pb.h @@ -0,0 +1,701 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/api.proto + +#ifndef PROTOBUF_google_2fprotobuf_2fapi_2eproto__INCLUDED +#define PROTOBUF_google_2fprotobuf_2fapi_2eproto__INCLUDED + +#include <string> + +#include <google/protobuf/stubs/common.h> + +#if GOOGLE_PROTOBUF_VERSION < 3000000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/metadata.h> +#include <google/protobuf/message.h> +#include <google/protobuf/repeated_field.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/unknown_field_set.h> +#include "google/protobuf/source_context.pb.h" +#include "google/protobuf/type.pb.h" +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +// Internal implementation detail -- do not call these. +void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fapi_2eproto(); +void protobuf_AssignDesc_google_2fprotobuf_2fapi_2eproto(); +void protobuf_ShutdownFile_google_2fprotobuf_2fapi_2eproto(); + +class Api; +class Method; + +// =================================================================== + +class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message { + public: + Api(); + virtual ~Api(); + + Api(const Api& from); + + inline Api& operator=(const Api& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Api& default_instance(); + + void Swap(Api* other); + + // implements Message ---------------------------------------------- + + inline Api* New() const { return New(NULL); } + + Api* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Api& from); + void MergeFrom(const Api& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Api* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + void clear_name(); + static const int kNameFieldNumber = 1; + const ::std::string& name() const; + void set_name(const ::std::string& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + ::std::string* mutable_name(); + ::std::string* release_name(); + void set_allocated_name(::std::string* name); + + // repeated .google.protobuf.Method methods = 2; + int methods_size() const; + void clear_methods(); + static const int kMethodsFieldNumber = 2; + const ::google::protobuf::Method& methods(int index) const; + ::google::protobuf::Method* mutable_methods(int index); + ::google::protobuf::Method* add_methods(); + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >& + methods() const; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >* + mutable_methods(); + + // repeated .google.protobuf.Option options = 3; + int options_size() const; + void clear_options(); + static const int kOptionsFieldNumber = 3; + const ::google::protobuf::Option& options(int index) const; + ::google::protobuf::Option* mutable_options(int index); + ::google::protobuf::Option* add_options(); + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& + options() const; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* + mutable_options(); + + // optional string version = 4; + void clear_version(); + static const int kVersionFieldNumber = 4; + const ::std::string& version() const; + void set_version(const ::std::string& value); + void set_version(const char* value); + void set_version(const char* value, size_t size); + ::std::string* mutable_version(); + ::std::string* release_version(); + void set_allocated_version(::std::string* version); + + // optional .google.protobuf.SourceContext source_context = 5; + bool has_source_context() const; + void clear_source_context(); + static const int kSourceContextFieldNumber = 5; + const ::google::protobuf::SourceContext& source_context() const; + ::google::protobuf::SourceContext* mutable_source_context(); + ::google::protobuf::SourceContext* release_source_context(); + void set_allocated_source_context(::google::protobuf::SourceContext* source_context); + + // @@protoc_insertion_point(class_scope:google.protobuf.Api) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method > methods_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; + ::google::protobuf::internal::ArenaStringPtr version_; + ::google::protobuf::SourceContext* source_context_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fapi_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fapi_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fapi_2eproto(); + + void InitAsDefaultInstance(); + static Api* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT Method : public ::google::protobuf::Message { + public: + Method(); + virtual ~Method(); + + Method(const Method& from); + + inline Method& operator=(const Method& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Method& default_instance(); + + void Swap(Method* other); + + // implements Message ---------------------------------------------- + + inline Method* New() const { return New(NULL); } + + Method* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Method& from); + void MergeFrom(const Method& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Method* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + void clear_name(); + static const int kNameFieldNumber = 1; + const ::std::string& name() const; + void set_name(const ::std::string& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + ::std::string* mutable_name(); + ::std::string* release_name(); + void set_allocated_name(::std::string* name); + + // optional string request_type_url = 2; + void clear_request_type_url(); + static const int kRequestTypeUrlFieldNumber = 2; + const ::std::string& request_type_url() const; + void set_request_type_url(const ::std::string& value); + void set_request_type_url(const char* value); + void set_request_type_url(const char* value, size_t size); + ::std::string* mutable_request_type_url(); + ::std::string* release_request_type_url(); + void set_allocated_request_type_url(::std::string* request_type_url); + + // optional bool request_streaming = 3; + void clear_request_streaming(); + static const int kRequestStreamingFieldNumber = 3; + bool request_streaming() const; + void set_request_streaming(bool value); + + // optional string response_type_url = 4; + void clear_response_type_url(); + static const int kResponseTypeUrlFieldNumber = 4; + const ::std::string& response_type_url() const; + void set_response_type_url(const ::std::string& value); + void set_response_type_url(const char* value); + void set_response_type_url(const char* value, size_t size); + ::std::string* mutable_response_type_url(); + ::std::string* release_response_type_url(); + void set_allocated_response_type_url(::std::string* response_type_url); + + // optional bool response_streaming = 5; + void clear_response_streaming(); + static const int kResponseStreamingFieldNumber = 5; + bool response_streaming() const; + void set_response_streaming(bool value); + + // repeated .google.protobuf.Option options = 6; + int options_size() const; + void clear_options(); + static const int kOptionsFieldNumber = 6; + const ::google::protobuf::Option& options(int index) const; + ::google::protobuf::Option* mutable_options(int index); + ::google::protobuf::Option* add_options(); + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& + options() const; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* + mutable_options(); + + // @@protoc_insertion_point(class_scope:google.protobuf.Method) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::google::protobuf::internal::ArenaStringPtr request_type_url_; + ::google::protobuf::internal::ArenaStringPtr response_type_url_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; + bool request_streaming_; + bool response_streaming_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fapi_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fapi_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fapi_2eproto(); + + void InitAsDefaultInstance(); + static Method* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +#if !PROTOBUF_INLINE_NOT_IN_HEADERS +// Api + +// optional string name = 1; +inline void Api::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& Api::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.Api.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Api::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Api.name) +} +inline void Api::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Api.name) +} +inline void Api::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.name) +} +inline ::std::string* Api::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Api.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* Api::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Api::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name) +} + +// repeated .google.protobuf.Method methods = 2; +inline int Api::methods_size() const { + return methods_.size(); +} +inline void Api::clear_methods() { + methods_.Clear(); +} +inline const ::google::protobuf::Method& Api::methods(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Api.methods) + return methods_.Get(index); +} +inline ::google::protobuf::Method* Api::mutable_methods(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Api.methods) + return methods_.Mutable(index); +} +inline ::google::protobuf::Method* Api::add_methods() { + // @@protoc_insertion_point(field_add:google.protobuf.Api.methods) + return methods_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >& +Api::methods() const { + // @@protoc_insertion_point(field_list:google.protobuf.Api.methods) + return methods_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >* +Api::mutable_methods() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods) + return &methods_; +} + +// repeated .google.protobuf.Option options = 3; +inline int Api::options_size() const { + return options_.size(); +} +inline void Api::clear_options() { + options_.Clear(); +} +inline const ::google::protobuf::Option& Api::options(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Api.options) + return options_.Get(index); +} +inline ::google::protobuf::Option* Api::mutable_options(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Api.options) + return options_.Mutable(index); +} +inline ::google::protobuf::Option* Api::add_options() { + // @@protoc_insertion_point(field_add:google.protobuf.Api.options) + return options_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& +Api::options() const { + // @@protoc_insertion_point(field_list:google.protobuf.Api.options) + return options_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* +Api::mutable_options() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options) + return &options_; +} + +// optional string version = 4; +inline void Api::clear_version() { + version_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& Api::version() const { + // @@protoc_insertion_point(field_get:google.protobuf.Api.version) + return version_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Api::set_version(const ::std::string& value) { + + version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Api.version) +} +inline void Api::set_version(const char* value) { + + version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Api.version) +} +inline void Api::set_version(const char* value, size_t size) { + + version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.version) +} +inline ::std::string* Api::mutable_version() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Api.version) + return version_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* Api::release_version() { + + return version_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Api::set_allocated_version(::std::string* version) { + if (version != NULL) { + + } else { + + } + version_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), version); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version) +} + +// optional .google.protobuf.SourceContext source_context = 5; +inline bool Api::has_source_context() const { + return !_is_default_instance_ && source_context_ != NULL; +} +inline void Api::clear_source_context() { + if (source_context_ != NULL) delete source_context_; + source_context_ = NULL; +} +inline const ::google::protobuf::SourceContext& Api::source_context() const { + // @@protoc_insertion_point(field_get:google.protobuf.Api.source_context) + return source_context_ != NULL ? *source_context_ : *default_instance_->source_context_; +} +inline ::google::protobuf::SourceContext* Api::mutable_source_context() { + + if (source_context_ == NULL) { + source_context_ = new ::google::protobuf::SourceContext; + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context) + return source_context_; +} +inline ::google::protobuf::SourceContext* Api::release_source_context() { + + ::google::protobuf::SourceContext* temp = source_context_; + source_context_ = NULL; + return temp; +} +inline void Api::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { + delete source_context_; + source_context_ = source_context; + if (source_context) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.source_context) +} + +// ------------------------------------------------------------------- + +// Method + +// optional string name = 1; +inline void Method::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& Method::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.Method.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Method::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Method.name) +} +inline void Method::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Method.name) +} +inline void Method::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.name) +} +inline ::std::string* Method::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Method.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* Method::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Method::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name) +} + +// optional string request_type_url = 2; +inline void Method::clear_request_type_url() { + request_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& Method::request_type_url() const { + // @@protoc_insertion_point(field_get:google.protobuf.Method.request_type_url) + return request_type_url_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Method::set_request_type_url(const ::std::string& value) { + + request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url) +} +inline void Method::set_request_type_url(const char* value) { + + request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Method.request_type_url) +} +inline void Method::set_request_type_url(const char* value, size_t size) { + + request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.request_type_url) +} +inline ::std::string* Method::mutable_request_type_url() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Method.request_type_url) + return request_type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* Method::release_request_type_url() { + + return request_type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Method::set_allocated_request_type_url(::std::string* request_type_url) { + if (request_type_url != NULL) { + + } else { + + } + request_type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), request_type_url); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url) +} + +// optional bool request_streaming = 3; +inline void Method::clear_request_streaming() { + request_streaming_ = false; +} +inline bool Method::request_streaming() const { + // @@protoc_insertion_point(field_get:google.protobuf.Method.request_streaming) + return request_streaming_; +} +inline void Method::set_request_streaming(bool value) { + + request_streaming_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Method.request_streaming) +} + +// optional string response_type_url = 4; +inline void Method::clear_response_type_url() { + response_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& Method::response_type_url() const { + // @@protoc_insertion_point(field_get:google.protobuf.Method.response_type_url) + return response_type_url_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Method::set_response_type_url(const ::std::string& value) { + + response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url) +} +inline void Method::set_response_type_url(const char* value) { + + response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Method.response_type_url) +} +inline void Method::set_response_type_url(const char* value, size_t size) { + + response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.response_type_url) +} +inline ::std::string* Method::mutable_response_type_url() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Method.response_type_url) + return response_type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* Method::release_response_type_url() { + + return response_type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Method::set_allocated_response_type_url(::std::string* response_type_url) { + if (response_type_url != NULL) { + + } else { + + } + response_type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), response_type_url); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url) +} + +// optional bool response_streaming = 5; +inline void Method::clear_response_streaming() { + response_streaming_ = false; +} +inline bool Method::response_streaming() const { + // @@protoc_insertion_point(field_get:google.protobuf.Method.response_streaming) + return response_streaming_; +} +inline void Method::set_response_streaming(bool value) { + + response_streaming_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Method.response_streaming) +} + +// repeated .google.protobuf.Option options = 6; +inline int Method::options_size() const { + return options_.size(); +} +inline void Method::clear_options() { + options_.Clear(); +} +inline const ::google::protobuf::Option& Method::options(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Method.options) + return options_.Get(index); +} +inline ::google::protobuf::Option* Method::mutable_options(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Method.options) + return options_.Mutable(index); +} +inline ::google::protobuf::Option* Method::add_options() { + // @@protoc_insertion_point(field_add:google.protobuf.Method.options) + return options_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& +Method::options() const { + // @@protoc_insertion_point(field_list:google.protobuf.Method.options) + return options_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* +Method::mutable_options() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options) + return &options_; +} + +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_google_2fprotobuf_2fapi_2eproto__INCLUDED diff --git a/src/google/protobuf/compiler/csharp/csharp_enum.cc b/src/google/protobuf/compiler/csharp/csharp_enum.cc new file mode 100644 index 00000000..27643e61 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_enum.cc @@ -0,0 +1,79 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <sstream> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> +#include <google/protobuf/stubs/strutil.h> + +#include <google/protobuf/compiler/csharp/csharp_enum.h> +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/compiler/csharp/csharp_writer.h> + +using google::protobuf::internal::scoped_ptr; + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor) : + SourceGeneratorBase(descriptor->file()), + descriptor_(descriptor) { +} + +EnumGenerator::~EnumGenerator() { +} + +void EnumGenerator::Generate(Writer* writer) { + WriteGeneratedCodeAttributes(writer); + writer->WriteLine("$0$ enum $1$ {", + class_access_level(), + descriptor_->name()); + writer->Indent(); + for (int i = 0; i < descriptor_->value_count(); i++) { + writer->WriteLine("$0$ = $1$,", + descriptor_->value(i)->name(), + SimpleItoa(descriptor_->value(i)->number())); + } + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_enum.h b/src/google/protobuf/compiler/csharp/csharp_enum.h new file mode 100644 index 00000000..eaa7a9c5 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_enum.h @@ -0,0 +1,65 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_H__ + +#include <string> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/csharp/csharp_source_generator_base.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class EnumGenerator : public SourceGeneratorBase { + public: + EnumGenerator(const EnumDescriptor* descriptor); + ~EnumGenerator(); + + void Generate(Writer* writer); + + private: + const EnumDescriptor* descriptor_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_enum_field.cc b/src/google/protobuf/compiler/csharp/csharp_enum_field.cc new file mode 100644 index 00000000..34d1c5c6 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_enum_field.cc @@ -0,0 +1,199 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <sstream> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> + +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/compiler/csharp/csharp_enum_field.h> +#include <google/protobuf/compiler/csharp/csharp_writer.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +EnumFieldGenerator::EnumFieldGenerator(const FieldDescriptor* descriptor, + int fieldOrdinal) + : FieldGeneratorBase(descriptor, fieldOrdinal) { +} + +EnumFieldGenerator::~EnumFieldGenerator() { + +} + +void EnumFieldGenerator::GenerateMembers(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("private bool has$0$;", property_name()); + } + writer->WriteLine("private $0$ $1$_ = $2$;", type_name(), name(), + default_value()); + AddDeprecatedFlag(writer); + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("public bool Has$0$ {", property_name()); + writer->WriteLine(" get { return has$0$; }", property_name()); + writer->WriteLine("}"); + } + AddPublicMemberAttributes(writer); + writer->WriteLine("public $0$ $1$ {", type_name(), property_name()); + writer->WriteLine(" get { return $0$_; }", name()); + writer->WriteLine("}"); +} + +void EnumFieldGenerator::GenerateBuilderMembers(Writer* writer) { + AddDeprecatedFlag(writer); + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("public bool Has$0$ {", property_name()); + writer->WriteLine(" get { return result.has$0$; }", property_name()); + writer->WriteLine("}"); + } + AddPublicMemberAttributes(writer); + writer->WriteLine("public $0$ $1$ {", type_name(), property_name()); + writer->WriteLine(" get { return result.$0$; }", property_name()); + writer->WriteLine(" set { Set$0$(value); }", property_name()); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public Builder Set$0$($1$ value) {", property_name(), + type_name()); + writer->WriteLine(" PrepareBuilder();"); + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine(" result.has$0$ = true;", property_name()); + } + writer->WriteLine(" result.$0$_ = value;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Clear$0$() {", property_name()); + writer->WriteLine(" PrepareBuilder();"); + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine(" result.has$0$ = false;", property_name()); + } + writer->WriteLine(" result.$0$_ = $1$;", name(), default_value()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); +} + +void EnumFieldGenerator::GenerateMergingCode(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("if (other.Has$0$) {", property_name()); + } else { + writer->WriteLine("if (other.$0$ != $1$) {", property_name(), default_value()); + } + writer->WriteLine(" $0$ = other.$0$;", property_name()); + writer->WriteLine("}"); +} + +void EnumFieldGenerator::GenerateBuildingCode(Writer* writer) { + // Nothing to do here for enum types +} + +void EnumFieldGenerator::GenerateParsingCode(Writer* writer) { + writer->WriteLine("object unknown;"); + writer->WriteLine("if(input.ReadEnum(ref result.$0$_, out unknown)) {", + name()); + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine(" result.has$0$ = true;", property_name()); + } + writer->WriteLine("} else if(unknown is int) {"); + if (!use_lite_runtime()) { + writer->WriteLine(" if (unknownFields == null) {"); // First unknown field - create builder now + writer->WriteLine( + " unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);"); + writer->WriteLine(" }"); + writer->WriteLine( + " unknownFields.MergeVarintField($0$, (ulong)(int)unknown);", + number()); + } + writer->WriteLine("}"); +} + +void EnumFieldGenerator::GenerateSerializationCode(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("if (has$0$) {", property_name()); + } else { + writer->WriteLine("if ($0$ != $1$) {", property_name(), default_value()); + } + writer->WriteLine( + " output.WriteEnum($0$, field_names[$2$], (int) $1$, $1$);", number(), + property_name(), field_ordinal()); + writer->WriteLine("}"); +} + +void EnumFieldGenerator::GenerateSerializedSizeCode(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("if (has$0$) {", property_name()); + } else { + writer->WriteLine("if ($0$ != $1$) {", property_name(), default_value()); + } + writer->WriteLine( + " size += pb::CodedOutputStream.ComputeEnumSize($0$, (int) $1$);", + number(), property_name()); + writer->WriteLine("}"); +} + +void EnumFieldGenerator::WriteHash(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("if (has$0$) {", property_name()); + } else { + writer->WriteLine("if ($0$ != $1$) {", property_name(), default_value()); + } + writer->WriteLine(" hash ^= $0$_.GetHashCode();", name()); + writer->WriteLine("}"); +} +void EnumFieldGenerator::WriteEquals(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine( + "if (has$0$ != other.has$0$ || (has$0$ && !$1$_.Equals(other.$1$_))) return false;", + property_name(), name()); + } else { + writer->WriteLine( + "if (!$0$_.Equals(other.$0$_)) return false;", name()); + } +} +void EnumFieldGenerator::WriteToString(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("PrintField(\"$0$\", has$1$, $2$_, writer);", + descriptor_->name(), property_name(), name()); + } else { + writer->WriteLine("PrintField(\"$0$\", $1$_, writer);", + descriptor_->name(), name()); + } +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_enum_field.h b/src/google/protobuf/compiler/csharp/csharp_enum_field.h new file mode 100644 index 00000000..b21fa9dc --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_enum_field.h @@ -0,0 +1,73 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_FIELD_H__ + +#include <string> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/csharp/csharp_field_base.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class EnumFieldGenerator : public FieldGeneratorBase { + public: + EnumFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + ~EnumFieldGenerator(); + + virtual void GenerateMembers(Writer* writer); + virtual void GenerateBuilderMembers(Writer* writer); + virtual void GenerateMergingCode(Writer* writer); + virtual void GenerateBuildingCode(Writer* writer); + virtual void GenerateParsingCode(Writer* writer); + virtual void GenerateSerializationCode(Writer* writer); + virtual void GenerateSerializedSizeCode(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_FIELD_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_extension.cc b/src/google/protobuf/compiler/csharp/csharp_extension.cc new file mode 100644 index 00000000..2bac320d --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_extension.cc @@ -0,0 +1,166 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <sstream> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> + +#include <google/protobuf/compiler/csharp/csharp_extension.h> +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/compiler/csharp/csharp_writer.h> +#include <google/protobuf/compiler/csharp/csharp_field_base.h> + +using google::protobuf::internal::scoped_ptr; + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor) + : FieldGeneratorBase(descriptor, 0) { + if (descriptor_->extension_scope()) { + scope_ = GetClassName(descriptor_->extension_scope()); + } else { + scope_ = GetFullUmbrellaClassName(descriptor_->file()); + } + extends_ = GetClassName(descriptor_->containing_type()); +} + +ExtensionGenerator::~ExtensionGenerator() { +} + +void ExtensionGenerator::Generate(Writer* writer) { + writer->WriteLine("public const int $0$ = $1$;", + GetFieldConstantName(descriptor_), + SimpleItoa(descriptor_->number())); + + if (use_lite_runtime()) { + // TODO(jtattermusch): include the following check + //if (Descriptor.MappedType == MappedType.Message && Descriptor.MessageType.Options.MessageSetWireFormat) + //{ + // throw new ArgumentException( + // "option message_set_wire_format = true; is not supported in Lite runtime extensions."); + //} + + writer->Write("$0$ ", class_access_level()); + writer->WriteLine( + "static pb::$3$<$0$, $1$> $2$;", + extends_, + type_name(), + property_name(), + descriptor_->is_repeated() ? + "GeneratedRepeatExtensionLite" : "GeneratedExtensionLite"); + } else if (descriptor_->is_repeated()) { + writer->WriteLine( + "$0$ static pb::GeneratedExtensionBase<scg::IList<$1$>> $2$;", + class_access_level(), type_name(), property_name()); + } else { + writer->WriteLine("$0$ static pb::GeneratedExtensionBase<$1$> $2$;", + class_access_level(), type_name(), property_name()); + } +} + +void ExtensionGenerator::GenerateStaticVariableInitializers(Writer* writer) { + if (use_lite_runtime()) { + writer->WriteLine("$0$.$1$ = ", scope_, property_name()); + writer->Indent(); + writer->WriteLine( + "new pb::$0$<$1$, $2$>(", + descriptor_->is_repeated() ? + "GeneratedRepeatExtensionLite" : "GeneratedExtensionLite", + extends_, type_name()); + writer->Indent(); + writer->WriteLine("\"$0$\",", descriptor_->full_name()); + writer->WriteLine("$0$.DefaultInstance,", extends_); + if (!descriptor_->is_repeated()) { + std::string default_val; + if (descriptor_->has_default_value()) { + default_val = default_value(); + } else { + default_val = is_nullable_type() ? "null" : ("default(" + type_name() + ")"); + } + writer->WriteLine("$0$,", default_val); + } + writer->WriteLine( + "$0$,", + (GetCSharpType(descriptor_->type()) == CSHARPTYPE_MESSAGE) ? + type_name() + ".DefaultInstance" : "null"); + writer->WriteLine( + "$0$,", + (GetCSharpType(descriptor_->type()) == CSHARPTYPE_ENUM) ? + "new EnumLiteMap<" + type_name() + ">()" : "null"); + writer->WriteLine("$0$.$1$FieldNumber,", scope_, + GetPropertyName(descriptor_)); + writer->Write("pbd::FieldType.$0$", capitalized_type_name()); + if (descriptor_->is_repeated()) { + writer->WriteLine(","); + writer->Write(descriptor_->is_packed() ? "true" : "false"); + } + writer->Outdent(); + writer->WriteLine(");"); + writer->Outdent(); + } + else if (descriptor_->is_repeated()) + { + writer->WriteLine( + "$0$.$1$ = pb::GeneratedRepeatExtension<$2$>.CreateInstance($0$.Descriptor.Extensions[$3$]);", + scope_, property_name(), type_name(), SimpleItoa(descriptor_->index())); + } + else + { + writer->WriteLine( + "$0$.$1$ = pb::GeneratedSingleExtension<$2$>.CreateInstance($0$.Descriptor.Extensions[$3$]);", + scope_, property_name(), type_name(), SimpleItoa(descriptor_->index())); + } +} + +void ExtensionGenerator::GenerateExtensionRegistrationCode(Writer* writer) { + writer->WriteLine("registry.Add($0$.$1$);", scope_, property_name()); +} + +void ExtensionGenerator::WriteHash(Writer* writer) { +} + +void ExtensionGenerator::WriteEquals(Writer* writer) { +} + +void ExtensionGenerator::WriteToString(Writer* writer) { +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_extension.h b/src/google/protobuf/compiler/csharp/csharp_extension.h new file mode 100644 index 00000000..203f6e5e --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_extension.h @@ -0,0 +1,80 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_EXTENSION_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_EXTENSION_H__ + +#include <string> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/csharp/csharp_field_base.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class ExtensionGenerator : public FieldGeneratorBase { + public: + ExtensionGenerator(const FieldDescriptor* descriptor); + ~ExtensionGenerator(); + + void GenerateStaticVariableInitializers(Writer* writer); + void GenerateExtensionRegistrationCode(Writer* writer); + void Generate(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + virtual void GenerateMembers(Writer* writer) {}; + virtual void GenerateBuilderMembers(Writer* writer) {}; + virtual void GenerateMergingCode(Writer* writer) {}; + virtual void GenerateBuildingCode(Writer* writer) {}; + virtual void GenerateParsingCode(Writer* writer) {}; + virtual void GenerateSerializationCode(Writer* writer) {}; + virtual void GenerateSerializedSizeCode(Writer* writer) {}; + + private: + std::string scope_; + std::string extends_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_EXTENSION_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.cc b/src/google/protobuf/compiler/csharp/csharp_field_base.cc new file mode 100644 index 00000000..145b6743 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_field_base.cc @@ -0,0 +1,380 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <limits> +#include <sstream> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> +#include <google/protobuf/stubs/strutil.h> + +#include <google/protobuf/compiler/csharp/csharp_field_base.h> +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/compiler/csharp/csharp_writer.h> + +using google::protobuf::internal::scoped_ptr; + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +FieldGeneratorBase::FieldGeneratorBase(const FieldDescriptor* descriptor, + int fieldOrdinal) + : SourceGeneratorBase(descriptor->file()), + descriptor_(descriptor), + fieldOrdinal_(fieldOrdinal) { +} + +FieldGeneratorBase::~FieldGeneratorBase() { +} + +void FieldGeneratorBase::AddDeprecatedFlag(Writer* writer) { + if (descriptor_->options().deprecated()) + { + writer->WriteLine("[global::System.ObsoleteAttribute()]"); + } +} + +void FieldGeneratorBase::AddNullCheck(Writer* writer) { + AddNullCheck(writer, "value"); +} + +void FieldGeneratorBase::AddNullCheck(Writer* writer, const std::string& name) { + if (is_nullable_type()) { + writer->WriteLine(" pb::ThrowHelper.ThrowIfNull($0$, \"$0$\");", name); + } +} + +void FieldGeneratorBase::AddPublicMemberAttributes(Writer* writer) { + AddDeprecatedFlag(writer); +} + +std::string FieldGeneratorBase::property_name() { + return GetPropertyName(descriptor_); +} + +std::string FieldGeneratorBase::name() { + return UnderscoresToCamelCase(GetFieldName(descriptor_), false); +} + +std::string FieldGeneratorBase::type_name() { + switch (descriptor_->type()) { + case FieldDescriptor::TYPE_ENUM: + return GetClassName(descriptor_->enum_type()); + case FieldDescriptor::TYPE_MESSAGE: + case FieldDescriptor::TYPE_GROUP: + return GetClassName(descriptor_->message_type()); + case FieldDescriptor::TYPE_DOUBLE: + return "double"; + case FieldDescriptor::TYPE_FLOAT: + return "float"; + case FieldDescriptor::TYPE_INT64: + return "long"; + case FieldDescriptor::TYPE_UINT64: + return "ulong"; + case FieldDescriptor::TYPE_INT32: + return "int"; + case FieldDescriptor::TYPE_FIXED64: + return "ulong"; + case FieldDescriptor::TYPE_FIXED32: + return "uint"; + case FieldDescriptor::TYPE_BOOL: + return "bool"; + case FieldDescriptor::TYPE_STRING: + return "string"; + case FieldDescriptor::TYPE_BYTES: + return "pb::ByteString"; + case FieldDescriptor::TYPE_UINT32: + return "uint"; + case FieldDescriptor::TYPE_SFIXED32: + return "int"; + case FieldDescriptor::TYPE_SFIXED64: + return "long"; + case FieldDescriptor::TYPE_SINT32: + return "int"; + case FieldDescriptor::TYPE_SINT64: + return "long"; + default: + GOOGLE_LOG(FATAL)<< "Unknown field type."; + return ""; + } +} + +bool FieldGeneratorBase::has_default_value() { + switch (descriptor_->type()) { + case FieldDescriptor::TYPE_ENUM: + case FieldDescriptor::TYPE_MESSAGE: + case FieldDescriptor::TYPE_GROUP: + return true; + case FieldDescriptor::TYPE_DOUBLE: + return descriptor_->default_value_double() != 0.0; + case FieldDescriptor::TYPE_FLOAT: + return descriptor_->default_value_float() != 0.0; + case FieldDescriptor::TYPE_INT64: + return descriptor_->default_value_int64() != 0L; + case FieldDescriptor::TYPE_UINT64: + return descriptor_->default_value_uint64() != 0L; + case FieldDescriptor::TYPE_INT32: + return descriptor_->default_value_int32() != 0; + case FieldDescriptor::TYPE_FIXED64: + return descriptor_->default_value_uint64() != 0L; + case FieldDescriptor::TYPE_FIXED32: + return descriptor_->default_value_uint32() != 0; + case FieldDescriptor::TYPE_BOOL: + return descriptor_->default_value_bool(); + case FieldDescriptor::TYPE_STRING: + return true; + case FieldDescriptor::TYPE_BYTES: + return true; + case FieldDescriptor::TYPE_UINT32: + return descriptor_->default_value_uint32() != 0; + case FieldDescriptor::TYPE_SFIXED32: + return descriptor_->default_value_int32() != 0; + case FieldDescriptor::TYPE_SFIXED64: + return descriptor_->default_value_int64() != 0L; + case FieldDescriptor::TYPE_SINT32: + return descriptor_->default_value_int32() != 0; + case FieldDescriptor::TYPE_SINT64: + return descriptor_->default_value_int64() != 0L; + default: + GOOGLE_LOG(FATAL)<< "Unknown field type."; + return true; + } +} + +bool FieldGeneratorBase::is_nullable_type() { + switch (descriptor_->type()) { + case FieldDescriptor::TYPE_ENUM: + case FieldDescriptor::TYPE_DOUBLE: + case FieldDescriptor::TYPE_FLOAT: + case FieldDescriptor::TYPE_INT64: + case FieldDescriptor::TYPE_UINT64: + case FieldDescriptor::TYPE_INT32: + case FieldDescriptor::TYPE_FIXED64: + case FieldDescriptor::TYPE_FIXED32: + case FieldDescriptor::TYPE_BOOL: + case FieldDescriptor::TYPE_UINT32: + case FieldDescriptor::TYPE_SFIXED32: + case FieldDescriptor::TYPE_SFIXED64: + case FieldDescriptor::TYPE_SINT32: + case FieldDescriptor::TYPE_SINT64: + return false; + + case FieldDescriptor::TYPE_MESSAGE: + case FieldDescriptor::TYPE_GROUP: + case FieldDescriptor::TYPE_STRING: + case FieldDescriptor::TYPE_BYTES: + return true; + + default: + GOOGLE_LOG(FATAL)<< "Unknown field type."; + return true; + } +} + +inline bool IsNaN(double value) { + // NaN is never equal to anything, even itself. + return value != value; +} + +bool AllPrintableAscii(const std::string& text) { + for(int i = 0; i < text.size(); i++) { + if (text[i] < 0x20 || text[i] > 0x7e) { + return false; + } + } + return true; +} + +std::string FieldGeneratorBase::GetStringDefaultValueInternal() { + if (!descriptor_->has_default_value()) { + return "\"\""; + } + if (AllPrintableAscii(descriptor_->default_value_string())) { + // All chars are ASCII and printable. In this case we only + // need to escape quotes and backslashes. + std::string temp = descriptor_->default_value_string(); + temp = StringReplace(temp, "\\", "\\\\", true); + temp = StringReplace(temp, "'", "\\'", true); + temp = StringReplace(temp, "\"", "\\\"", true); + return "\"" + temp + "\""; + } + if (use_lite_runtime()) { + return "pb::ByteString.FromBase64(\"" + + StringToBase64(descriptor_->default_value_string()) + + "\").ToStringUtf8()"; + } + return "(string) " + GetClassName(descriptor_->containing_type()) + + ".Descriptor.Fields[" + SimpleItoa(descriptor_->index()) + + "].DefaultValue"; +} + +std::string FieldGeneratorBase::GetBytesDefaultValueInternal() { + if (!descriptor_->has_default_value()) { + return "pb::ByteString.Empty"; + } + if (use_lite_runtime()) { + return "pb::ByteString.FromBase64(\"" + StringToBase64(descriptor_->default_value_string()) + "\")"; + } + return "(pb::ByteString) "+ GetClassName(descriptor_->containing_type()) + + ".Descriptor.Fields[" + SimpleItoa(descriptor_->index()) + "].DefaultValue"; +} + +std::string FieldGeneratorBase::default_value() { + switch (descriptor_->type()) { + case FieldDescriptor::TYPE_ENUM: + return type_name() + "." + descriptor_->default_value_enum()->name(); + case FieldDescriptor::TYPE_MESSAGE: + case FieldDescriptor::TYPE_GROUP: + return type_name() + ".DefaultInstance"; + case FieldDescriptor::TYPE_DOUBLE: { + double value = descriptor_->default_value_double(); + if (value == numeric_limits<double>::infinity()) { + return "double.PositiveInfinity"; + } else if (value == -numeric_limits<double>::infinity()) { + return "double.NegativeInfinity"; + } else if (IsNaN(value)) { + return "double.NaN"; + } + return SimpleDtoa(value) + "D"; + } + case FieldDescriptor::TYPE_FLOAT: { + float value = descriptor_->default_value_float(); + if (value == numeric_limits<float>::infinity()) { + return "float.PositiveInfinity"; + } else if (value == -numeric_limits<float>::infinity()) { + return "float.NegativeInfinity"; + } else if (IsNaN(value)) { + return "float.NaN"; + } + return SimpleFtoa(value) + "F"; + } + case FieldDescriptor::TYPE_INT64: + return SimpleItoa(descriptor_->default_value_int64()) + "L"; + case FieldDescriptor::TYPE_UINT64: + return SimpleItoa(descriptor_->default_value_uint64()) + "UL"; + case FieldDescriptor::TYPE_INT32: + return SimpleItoa(descriptor_->default_value_int32()); + case FieldDescriptor::TYPE_FIXED64: + return SimpleItoa(descriptor_->default_value_uint64()) + "UL"; + case FieldDescriptor::TYPE_FIXED32: + return SimpleItoa(descriptor_->default_value_uint32()); + case FieldDescriptor::TYPE_BOOL: + if (descriptor_->default_value_bool()) { + return "true"; + } else { + return "false"; + } + case FieldDescriptor::TYPE_STRING: + return GetStringDefaultValueInternal(); + case FieldDescriptor::TYPE_BYTES: + return GetBytesDefaultValueInternal(); + case FieldDescriptor::TYPE_UINT32: + return SimpleItoa(descriptor_->default_value_uint32()); + case FieldDescriptor::TYPE_SFIXED32: + return SimpleItoa(descriptor_->default_value_int32()); + case FieldDescriptor::TYPE_SFIXED64: + return SimpleItoa(descriptor_->default_value_int64()) + "L"; + case FieldDescriptor::TYPE_SINT32: + return SimpleItoa(descriptor_->default_value_int32()); + case FieldDescriptor::TYPE_SINT64: + return SimpleItoa(descriptor_->default_value_int64()) + "L"; + default: + GOOGLE_LOG(FATAL)<< "Unknown field type."; + return ""; + } +} + +std::string FieldGeneratorBase::number() { + return SimpleItoa(descriptor_->number()); +} + +std::string FieldGeneratorBase::message_or_group() { + return + (descriptor_->type() == FieldDescriptor::TYPE_GROUP) ? "Group" : "Message"; +} + +std::string FieldGeneratorBase::capitalized_type_name() { + switch (descriptor_->type()) { + case FieldDescriptor::TYPE_ENUM: + return "Enum"; + case FieldDescriptor::TYPE_MESSAGE: + return "Message"; + case FieldDescriptor::TYPE_GROUP: + return "Group"; + case FieldDescriptor::TYPE_DOUBLE: + return "Double"; + case FieldDescriptor::TYPE_FLOAT: + return "Float"; + case FieldDescriptor::TYPE_INT64: + return "Int64"; + case FieldDescriptor::TYPE_UINT64: + return "UInt64"; + case FieldDescriptor::TYPE_INT32: + return "Int32"; + case FieldDescriptor::TYPE_FIXED64: + return "Fixed64"; + case FieldDescriptor::TYPE_FIXED32: + return "Fixed32"; + case FieldDescriptor::TYPE_BOOL: + return "Bool"; + case FieldDescriptor::TYPE_STRING: + return "String"; + case FieldDescriptor::TYPE_BYTES: + return "Bytes"; + case FieldDescriptor::TYPE_UINT32: + return "UInt32"; + case FieldDescriptor::TYPE_SFIXED32: + return "SFixed32"; + case FieldDescriptor::TYPE_SFIXED64: + return "SFixed64"; + case FieldDescriptor::TYPE_SINT32: + return "SInt32"; + case FieldDescriptor::TYPE_SINT64: + return "SInt64"; + default: + GOOGLE_LOG(FATAL)<< "Unknown field type."; + return ""; + } +} + +std::string FieldGeneratorBase::field_ordinal() { + return SimpleItoa(fieldOrdinal_); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.h b/src/google/protobuf/compiler/csharp/csharp_field_base.h new file mode 100644 index 00000000..311f7a6e --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_field_base.h @@ -0,0 +1,98 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_FIELD_BASE_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_FIELD_BASE_H__ + +#include <string> +#include <google/protobuf/stubs/strutil.h> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/csharp/csharp_source_generator_base.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class FieldGeneratorBase : public SourceGeneratorBase { + public: + FieldGeneratorBase(const FieldDescriptor* descriptor, int fieldOrdinal); + ~FieldGeneratorBase(); + + virtual void GenerateMembers(Writer* writer) = 0; + virtual void GenerateBuilderMembers(Writer* writer) = 0; + virtual void GenerateMergingCode(Writer* writer) = 0; + virtual void GenerateBuildingCode(Writer* writer) = 0; + virtual void GenerateParsingCode(Writer* writer) = 0; + virtual void GenerateSerializationCode(Writer* writer) = 0; + virtual void GenerateSerializedSizeCode(Writer* writer) = 0; + + virtual void WriteHash(Writer* writer) = 0; + virtual void WriteEquals(Writer* writer) = 0; + virtual void WriteToString(Writer* writer) = 0; + + protected: + const FieldDescriptor* descriptor_; + const int fieldOrdinal_; + + void AddDeprecatedFlag(Writer* writer); + void AddNullCheck(Writer* writer); + void AddNullCheck(Writer* writer, const std::string& name); + + void AddPublicMemberAttributes(Writer* writer); + + std::string property_name(); + std::string name(); + std::string type_name(); + bool has_default_value(); + bool is_nullable_type(); + std::string default_value(); + std::string number(); + std::string message_or_group(); + std::string capitalized_type_name(); + std::string field_ordinal(); + + private: + std::string GetStringDefaultValueInternal(); + std::string GetBytesDefaultValueInternal(); + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorBase); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_FIELD_BASE_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_generator.cc b/src/google/protobuf/compiler/csharp/csharp_generator.cc new file mode 100644 index 00000000..64c4bd7d --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_generator.cc @@ -0,0 +1,96 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <sstream> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> + +#include <google/protobuf/compiler/csharp/csharp_generator.h> +#include <google/protobuf/compiler/csharp/csharp_umbrella_class.h> +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/compiler/csharp/csharp_writer.h> + +using google::protobuf::internal::scoped_ptr; + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +std::string GetOutputFile(const google::protobuf::FileDescriptor* file, const std::string file_extension) +{ + return GetFileUmbrellaClassname(file) + file_extension; +} + +void GenerateFile(const google::protobuf::FileDescriptor* file, + Writer* writer) { + UmbrellaClassGenerator umbrellaGenerator(file); + umbrellaGenerator.Generate(writer); +} + +bool Generator::Generate( + const FileDescriptor* file, + const string& parameter, + GeneratorContext* generator_context, + string* error) const { + + vector<pair<string, string> > options; + ParseGeneratorParameter(parameter, &options); + + std::string file_extension = ".cs"; + for (int i = 0; i < options.size(); i++) { + if (options[i].first == "file_extension") { + file_extension = options[i].second; + } else { + *error = "Unknown generator option: " + options[i].first; + return false; + } + } + + std::string filename = GetOutputFile(file, file_extension); + scoped_ptr<io::ZeroCopyOutputStream> output( + generator_context->Open(filename)); + io::Printer printer(output.get(), '$'); + Writer writer(&printer); + + GenerateFile(file, &writer); + + return true; +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_generator.h b/src/google/protobuf/compiler/csharp/csharp_generator.h new file mode 100644 index 00000000..9b54e914 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_generator.h @@ -0,0 +1,58 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__ + +#include <string> + +#include <google/protobuf/compiler/code_generator.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class LIBPROTOC_EXPORT Generator + : public google::protobuf::compiler::CodeGenerator { + virtual bool Generate( + const FileDescriptor* file, + const string& parameter, + GeneratorContext* generator_context, + string* error) const; +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc b/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc new file mode 100644 index 00000000..7ef7df42 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc @@ -0,0 +1,54 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2014 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <memory> + +#include <google/protobuf/compiler/ruby/ruby_generator.h> +#include <google/protobuf/compiler/command_line_interface.h> +#include <google/protobuf/io/zero_copy_stream.h> +#include <google/protobuf/io/printer.h> + +#include <google/protobuf/testing/googletest.h> +#include <gtest/gtest.h> +#include <google/protobuf/testing/file.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { +namespace { + +// TODO(jtattermusch): add some tests. + +} // namespace +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/src/google/protobuf/compiler/csharp/csharp_helpers.cc new file mode 100644 index 00000000..4580b7be --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_helpers.cc @@ -0,0 +1,409 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#include <algorithm> +#include <google/protobuf/stubs/hash.h> +#include <limits> +#include <vector> + +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/wire_format.h> +#include <google/protobuf/stubs/strutil.h> +#include <google/protobuf/stubs/substitute.h> + +#include <google/protobuf/compiler/csharp/csharp_field_base.h> +#include <google/protobuf/compiler/csharp/csharp_enum_field.h> +#include <google/protobuf/compiler/csharp/csharp_message_field.h> +#include <google/protobuf/compiler/csharp/csharp_primitive_field.h> +#include <google/protobuf/compiler/csharp/csharp_repeated_enum_field.h> +#include <google/protobuf/compiler/csharp/csharp_repeated_message_field.h> +#include <google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +CSharpType GetCSharpType(FieldDescriptor::Type type) { + switch (type) { + case FieldDescriptor::TYPE_INT32: + return CSHARPTYPE_INT32; + case FieldDescriptor::TYPE_INT64: + return CSHARPTYPE_INT64; + case FieldDescriptor::TYPE_UINT32: + return CSHARPTYPE_UINT32; + case FieldDescriptor::TYPE_UINT64: + return CSHARPTYPE_UINT32; + case FieldDescriptor::TYPE_SINT32: + return CSHARPTYPE_INT32; + case FieldDescriptor::TYPE_SINT64: + return CSHARPTYPE_INT64; + case FieldDescriptor::TYPE_FIXED32: + return CSHARPTYPE_UINT32; + case FieldDescriptor::TYPE_FIXED64: + return CSHARPTYPE_UINT64; + case FieldDescriptor::TYPE_SFIXED32: + return CSHARPTYPE_INT32; + case FieldDescriptor::TYPE_SFIXED64: + return CSHARPTYPE_INT64; + case FieldDescriptor::TYPE_FLOAT: + return CSHARPTYPE_FLOAT; + case FieldDescriptor::TYPE_DOUBLE: + return CSHARPTYPE_DOUBLE; + case FieldDescriptor::TYPE_BOOL: + return CSHARPTYPE_BOOL; + case FieldDescriptor::TYPE_ENUM: + return CSHARPTYPE_ENUM; + case FieldDescriptor::TYPE_STRING: + return CSHARPTYPE_STRING; + case FieldDescriptor::TYPE_BYTES: + return CSHARPTYPE_BYTESTRING; + case FieldDescriptor::TYPE_GROUP: + return CSHARPTYPE_MESSAGE; + case FieldDescriptor::TYPE_MESSAGE: + return CSHARPTYPE_MESSAGE; + + // No default because we want the compiler to complain if any new + // types are added. + } + GOOGLE_LOG(FATAL)<< "Can't get here."; + return (CSharpType) -1; +} + +std::string StripDotProto(const std::string& proto_file) { + int lastindex = proto_file.find_last_of("."); + return proto_file.substr(0, lastindex); +} + +std::string GetFileNamespace(const FileDescriptor* descriptor) { + if (descriptor->options().has_csharp_namespace()) { + return descriptor->options().csharp_namespace(); + } + return descriptor->package(); +} + +std::string GetUmbrellaClassNameInternal(const std::string& proto_file) { + int lastslash = proto_file.find_last_of("/"); + std::string base = proto_file.substr(lastslash + 1); + return UnderscoresToPascalCase(StripDotProto(base)); +} + +std::string GetFileUmbrellaClassname(const FileDescriptor* descriptor) { + // umbrella_classname can no longer be set using message option. + return GetUmbrellaClassNameInternal(descriptor->name()); +} + +std::string GetFileUmbrellaNamespace(const FileDescriptor* descriptor) { + // TODO(jtattermusch): reintroduce csharp_umbrella_namespace option + bool collision = false; + std::string umbrella_classname = GetFileUmbrellaClassname(descriptor); + for(int i = 0; i < descriptor->message_type_count(); i++) { + if (descriptor->message_type(i)->name() == umbrella_classname) { + collision = true; + break; + } + } + for (int i = 0; i < descriptor->service_count(); i++) { + if (descriptor->service(i)->name() == umbrella_classname) { + collision = true; + break; + } + } + for (int i = 0; i < descriptor->enum_type_count(); i++) { + if (descriptor->enum_type(i)->name() == umbrella_classname) { + collision = true; + break; + } + } + return collision ? "Proto" : ""; +} + +// TODO(jtattermusch): can we reuse a utility function? +std::string UnderscoresToCamelCase(const std::string& input, + bool cap_next_letter) { + string result; + // Note: I distrust ctype.h due to locales. + for (int i = 0; i < input.size(); i++) { + if ('a' <= input[i] && input[i] <= 'z') { + if (cap_next_letter) { + result += input[i] + ('A' - 'a'); + } else { + result += input[i]; + } + cap_next_letter = false; + } else if ('A' <= input[i] && input[i] <= 'Z') { + if (i == 0 && !cap_next_letter) { + // Force first letter to lower-case unless explicitly told to + // capitalize it. + result += input[i] + ('a' - 'A'); + } else { + // Capital letters after the first are left as-is. + result += input[i]; + } + cap_next_letter = false; + } else if ('0' <= input[i] && input[i] <= '9') { + result += input[i]; + cap_next_letter = true; + } else { + cap_next_letter = true; + } + } + // Add a trailing "_" if the name should be altered. + if (input[input.size() - 1] == '#') { + result += '_'; + } + return result; +} + +std::string UnderscoresToPascalCase(const std::string& input) { + return UnderscoresToCamelCase(input, true); +} + +std::string ToCSharpName(const std::string& name, const FileDescriptor* file) { + std::string result = GetFileNamespace(file); + if (result != "") { + result += '.'; + } + string classname; + if (file->package().empty()) { + classname = name; + } else { + // Strip the proto package from full_name since we've replaced it with + // the C# namespace. + classname = name.substr(file->package().size() + 1); + } + result += StringReplace(classname, ".", ".Types.", false); + return "global::" + result; +} + + + +std::string GetFullUmbrellaClassName(const FileDescriptor* descriptor) { + std::string result = GetFileNamespace(descriptor); + if (!result.empty()) { + result += '.'; + } + result += GetQualifiedUmbrellaClassName(descriptor); + return "global::" + result; +} + +std::string GetQualifiedUmbrellaClassName(const FileDescriptor* descriptor) { + std::string umbrellaNamespace = GetFileUmbrellaNamespace(descriptor); + std::string umbrellaClassname = GetFileUmbrellaClassname(descriptor); + + std::string fullName = umbrellaClassname; + if (!umbrellaNamespace.empty()) { + fullName = umbrellaNamespace + "." + umbrellaClassname; + } + return fullName; +} + +std::string GetClassName(const Descriptor* descriptor) { + return ToCSharpName(descriptor->full_name(), descriptor->file()); +} + +std::string GetClassName(const EnumDescriptor* descriptor) { + return ToCSharpName(descriptor->full_name(), descriptor->file()); +} + +// Groups are hacky: The name of the field is just the lower-cased name +// of the group type. In C#, though, we would like to retain the original +// capitalization of the type name. +std::string GetFieldName(const FieldDescriptor* descriptor) { + if (descriptor->type() == FieldDescriptor::TYPE_GROUP) { + return descriptor->message_type()->name(); + } else { + return descriptor->name(); + } +} + +std::string GetFieldConstantName(const FieldDescriptor* field) { + return GetPropertyName(field) + "FieldNumber"; +} + +std::string GetPropertyName(const FieldDescriptor* descriptor) { + // TODO(jtattermusch): consider introducing csharp_property_name field option + std::string property_name = UnderscoresToPascalCase(GetFieldName(descriptor)); + if (property_name == descriptor->containing_type()->name()) { + property_name += "_"; + } + return property_name; +} + +// TODO: c&p from Java protoc plugin +// For encodings with fixed sizes, returns that size in bytes. Otherwise +// returns -1. +int GetFixedSize(FieldDescriptor::Type type) { + switch (type) { + case FieldDescriptor::TYPE_INT32 : return -1; + case FieldDescriptor::TYPE_INT64 : return -1; + case FieldDescriptor::TYPE_UINT32 : return -1; + case FieldDescriptor::TYPE_UINT64 : return -1; + case FieldDescriptor::TYPE_SINT32 : return -1; + case FieldDescriptor::TYPE_SINT64 : return -1; + case FieldDescriptor::TYPE_FIXED32 : return internal::WireFormatLite::kFixed32Size; + case FieldDescriptor::TYPE_FIXED64 : return internal::WireFormatLite::kFixed64Size; + case FieldDescriptor::TYPE_SFIXED32: return internal::WireFormatLite::kSFixed32Size; + case FieldDescriptor::TYPE_SFIXED64: return internal::WireFormatLite::kSFixed64Size; + case FieldDescriptor::TYPE_FLOAT : return internal::WireFormatLite::kFloatSize; + case FieldDescriptor::TYPE_DOUBLE : return internal::WireFormatLite::kDoubleSize; + + case FieldDescriptor::TYPE_BOOL : return internal::WireFormatLite::kBoolSize; + case FieldDescriptor::TYPE_ENUM : return -1; + + case FieldDescriptor::TYPE_STRING : return -1; + case FieldDescriptor::TYPE_BYTES : return -1; + case FieldDescriptor::TYPE_GROUP : return -1; + case FieldDescriptor::TYPE_MESSAGE : return -1; + + // No default because we want the compiler to complain if any new + // types are added. + } + GOOGLE_LOG(FATAL) << "Can't get here."; + return -1; +} + +static const char base64_chars[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +std::string StringToBase64(const std::string& input) { + std::string result; + size_t remaining = input.size(); + const unsigned char *src = (const unsigned char*) input.c_str(); + while (remaining > 2) { + result += base64_chars[src[0] >> 2]; + result += base64_chars[((src[0] & 0x3) << 4) | (src[1] >> 4)]; + result += base64_chars[((src[1] & 0xf) << 2) | (src[2] >> 6)]; + result += base64_chars[src[2] & 0x3f]; + remaining -= 3; + src += 3; + } + switch (remaining) { + case 2: + result += base64_chars[src[0] >> 2]; + result += base64_chars[((src[0] & 0x3) << 4) | (src[1] >> 4)]; + result += base64_chars[(src[1] & 0xf) << 2]; + result += '='; + src += 2; + break; + case 1: + result += base64_chars[src[0] >> 2]; + result += base64_chars[((src[0] & 0x3) << 4)]; + result += '='; + result += '='; + src += 1; + break; + } + return result; +} + +std::string FileDescriptorToBase64(const FileDescriptor* descriptor) { + std::string fdp_bytes; + FileDescriptorProto fdp; + descriptor->CopyTo(&fdp); + fdp.SerializeToString(&fdp_bytes); + return StringToBase64(fdp_bytes); +} + +FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor, + int fieldOrdinal) { + switch (descriptor->type()) { + case FieldDescriptor::TYPE_GROUP: + case FieldDescriptor::TYPE_MESSAGE: + if (descriptor->is_repeated()) { + return new RepeatedMessageFieldGenerator(descriptor, fieldOrdinal); + } else { + return new MessageFieldGenerator(descriptor, fieldOrdinal); + } + case FieldDescriptor::TYPE_ENUM: + if (descriptor->is_repeated()) { + return new RepeatedEnumFieldGenerator(descriptor, fieldOrdinal); + } else { + return new EnumFieldGenerator(descriptor, fieldOrdinal); + } + default: + if (descriptor->is_repeated()) { + return new RepeatedPrimitiveFieldGenerator(descriptor, fieldOrdinal); + } else { + return new PrimitiveFieldGenerator(descriptor, fieldOrdinal); + } + } +} + +bool HasRequiredFields(const Descriptor* descriptor, std::set<const Descriptor*>* already_seen) { + if (already_seen->find(descriptor) != already_seen->end()) { + // The type is already in cache. This means that either: + // a. The type has no required fields. + // b. We are in the midst of checking if the type has required fields, + // somewhere up the stack. In this case, we know that if the type + // has any required fields, they'll be found when we return to it, + // and the whole call to HasRequiredFields() will return true. + // Therefore, we don't have to check if this type has required fields + // here. + return false; + } + already_seen->insert(descriptor); + + // If the type has extensions, an extension with message type could contain + // required fields, so we have to be conservative and assume such an + // extension exists. + if (descriptor->extension_count() > 0) { + return true; + } + + for (int i = 0; i < descriptor->field_count(); i++) { + const FieldDescriptor* field = descriptor->field(i); + if (field->is_required()) { + return true; + } + if (GetCSharpType(field->type()) == CSHARPTYPE_MESSAGE) { + if (HasRequiredFields(field->message_type(), already_seen)) { + return true; + } + } + } + return false; +} + +bool HasRequiredFields(const Descriptor* descriptor) { + std::set<const Descriptor*> already_seen; + return HasRequiredFields(descriptor, &already_seen); +} + +} // namespace java +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.h b/src/google/protobuf/compiler/csharp/csharp_helpers.h new file mode 100644 index 00000000..bc77f43a --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_helpers.h @@ -0,0 +1,112 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_HELPERS_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_HELPERS_H__ + +#include <string> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/io/printer.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class FieldGeneratorBase; + +// TODO: start using this enum. +enum CSharpType { + CSHARPTYPE_INT32 = 1, + CSHARPTYPE_INT64 = 2, + CSHARPTYPE_UINT32 = 3, + CSHARPTYPE_UINT64 = 4, + CSHARPTYPE_FLOAT = 5, + CSHARPTYPE_DOUBLE = 6, + CSHARPTYPE_BOOL = 7, + CSHARPTYPE_STRING = 8, + CSHARPTYPE_BYTESTRING = 9, + CSHARPTYPE_MESSAGE = 10, + CSHARPTYPE_ENUM = 11, + MAX_CSHARPTYPE = 11 +}; + +// Converts field type to corresponding C# type. +CSharpType GetCSharpType(FieldDescriptor::Type type); + +std::string StripDotProto(const std::string& proto_file); + +std::string GetFileNamespace(const FileDescriptor* descriptor); +std::string GetFileUmbrellaClassname(const FileDescriptor* descriptor); +std::string GetFileUmbrellaNamespace(const FileDescriptor* descriptor); + +std::string GetFullUmbrellaClassName(const FileDescriptor* descriptor); + +std::string GetQualifiedUmbrellaClassName(const FileDescriptor* descriptor); + +std::string GetClassName(const Descriptor* descriptor); +std::string GetClassName(const EnumDescriptor* descriptor); + +std::string GetFieldName(const FieldDescriptor* descriptor); + +std::string GetFieldConstantName(const FieldDescriptor* field); + +std::string GetPropertyName(const FieldDescriptor* descriptor); + +int GetFixedSize(FieldDescriptor::Type type); + +std::string UnderscoresToCamelCase(const std::string& input, bool cap_next_letter); + +std::string UnderscoresToPascalCase(const std::string& input); + +// TODO(jtattermusch): perhaps we could move this to strutil +std::string StringToBase64(const std::string& input); + +std::string FileDescriptorToBase64(const FileDescriptor* descriptor); + +FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + +bool HasRequiredFields(const Descriptor* descriptor); + +inline bool SupportFieldPresence(const FileDescriptor* file) { + return file->syntax() != FileDescriptor::SYNTAX_PROTO3; +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_HELPERS_H__ diff --git a/src/google/protobuf/compiler/csharp/csharp_message.cc b/src/google/protobuf/compiler/csharp/csharp_message.cc new file mode 100644 index 00000000..96f7c17c --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_message.cc @@ -0,0 +1,894 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <sstream> +#include <algorithm> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> +#include <google/protobuf/stubs/strutil.h> +#include <google/protobuf/wire_format.h> +#include <google/protobuf/wire_format_lite.h> + +#include <google/protobuf/compiler/csharp/csharp_enum.h> +#include <google/protobuf/compiler/csharp/csharp_extension.h> +#include <google/protobuf/compiler/csharp/csharp_message.h> +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/compiler/csharp/csharp_field_base.h> +#include <google/protobuf/compiler/csharp/csharp_writer.h> + +using google::protobuf::internal::scoped_ptr; + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +bool CompareFieldNumbers(const FieldDescriptor* d1, const FieldDescriptor* d2) { + return d1->number() < d2->number(); +} + +MessageGenerator::MessageGenerator(const Descriptor* descriptor) + : SourceGeneratorBase(descriptor->file()), + descriptor_(descriptor) { + + // sorted field names + for (int i = 0; i < descriptor_->field_count(); i++) { + field_names_.push_back(descriptor_->field(i)->name()); + } + std::sort(field_names_.begin(), field_names_.end()); + + // fields by number + for (int i = 0; i < descriptor_->field_count(); i++) { + fields_by_number_.push_back(descriptor_->field(i)); + } + std::sort(fields_by_number_.begin(), fields_by_number_.end(), + CompareFieldNumbers); +} + +MessageGenerator::~MessageGenerator() { +} + +std::string MessageGenerator::class_name() { + return descriptor_->name(); +} + +std::string MessageGenerator::full_class_name() { + return GetClassName(descriptor_); +} + +const std::vector<std::string>& MessageGenerator::field_names() { + return field_names_; +} + +const std::vector<const FieldDescriptor*>& MessageGenerator::fields_by_number() { + return fields_by_number_; +} + +/// Get an identifier that uniquely identifies this type within the file. +/// This is used to declare static variables related to this type at the +/// outermost file scope. +std::string GetUniqueFileScopeIdentifier(const Descriptor* descriptor) { + std::string result = descriptor->full_name(); + std::replace(result.begin(), result.end(), '.', '_'); + return "static_" + result; +} + +void MessageGenerator::GenerateStaticVariables(Writer* writer) { + // Because descriptor.proto (Google.ProtocolBuffers.DescriptorProtos) is + // used in the construction of descriptors, we have a tricky bootstrapping + // problem. To help control static initialization order, we make sure all + // descriptors and other static data that depends on them are members of + // the proto-descriptor class. This way, they will be initialized in + // a deterministic order. + + std::string identifier = GetUniqueFileScopeIdentifier(descriptor_); + + if (!use_lite_runtime()) { + // The descriptor for this type. + std::string access = "internal"; + writer->WriteLine( + "$0$ static pbd::MessageDescriptor internal__$1$__Descriptor;", access, + identifier); + writer->WriteLine( + "$0$ static pb::FieldAccess.FieldAccessorTable<$1$, $1$.Builder> internal__$2$__FieldAccessorTable;", + access, full_class_name(), identifier); + } + + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + MessageGenerator messageGenerator(descriptor_->nested_type(i)); + messageGenerator.GenerateStaticVariables(writer); + } +} + +void MessageGenerator::GenerateStaticVariableInitializers(Writer* writer) { + std::string identifier = GetUniqueFileScopeIdentifier(descriptor_); + + if (!use_lite_runtime()) { + writer->Write("internal__$0$__Descriptor = ", identifier); + + if (!descriptor_->containing_type()) { + writer->WriteLine("Descriptor.MessageTypes[$0$];", + SimpleItoa(descriptor_->index())); + } else { + writer->WriteLine( + "internal__$0$__Descriptor.NestedTypes[$1$];", + GetUniqueFileScopeIdentifier(descriptor_->containing_type()), + SimpleItoa(descriptor_->index())); + } + + writer->WriteLine("internal__$0$__FieldAccessorTable = ", identifier); + writer->WriteLine( + " new pb::FieldAccess.FieldAccessorTable<$1$, $1$.Builder>(internal__$0$__Descriptor,", + identifier, full_class_name()); + writer->Write(" new string[] { "); + for (int i = 0; i < descriptor_->field_count(); i++) { + writer->Write("\"$0$\", ", GetPropertyName(descriptor_->field(i))); + } + writer->WriteLine("});"); + } + + // Generate static member initializers for all nested types. + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + MessageGenerator messageGenerator(descriptor_->nested_type(i)); + messageGenerator.GenerateStaticVariableInitializers(writer); + } + + for (int i = 0; i < descriptor_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(descriptor_->extension(i)); + extensionGenerator.GenerateStaticVariableInitializers(writer); + } +} + +void MessageGenerator::Generate(Writer* writer) { + writer->WriteLine( + "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer->WriteLine( + "$0$ sealed partial class $1$ : pb::$2$Message$3$<$1$, $1$.Builder> {", + class_access_level(), class_name(), + descriptor_->extension_range_count() > 0 ? "Extendable" : "Generated", + runtime_suffix()); + writer->Indent(); + writer->WriteLine("private $0$() { }", class_name()); // Private ctor. + // Must call MakeReadOnly() to make sure all lists are made read-only + writer->WriteLine( + "private static readonly $0$ defaultInstance = new $0$().MakeReadOnly();", + class_name()); + + if (optimize_speed()) { + writer->WriteLine( + "private static readonly string[] _$0$FieldNames = new string[] { $2$$1$$2$ };", + UnderscoresToCamelCase(class_name(), false), + JoinStrings(field_names(), "\", \""), + field_names().size() > 0 ? "\"" : ""); + std::vector<std::string> tags; + for (int i = 0; i < field_names().size(); i++) { + uint32 tag = internal::WireFormat::MakeTag( + descriptor_->FindFieldByName(field_names()[i])); + tags.push_back(SimpleItoa(tag)); + } + writer->WriteLine( + "private static readonly uint[] _$0$FieldTags = new uint[] { $1$ };", + UnderscoresToCamelCase(class_name(), false), JoinStrings(tags, ", ")); + } + writer->WriteLine("public static $0$ DefaultInstance {", class_name()); + writer->WriteLine(" get { return defaultInstance; }"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("public override $0$ DefaultInstanceForType {", + class_name()); + writer->WriteLine(" get { return DefaultInstance; }"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("protected override $0$ ThisMessage {", class_name()); + writer->WriteLine(" get { return this; }"); + writer->WriteLine("}"); + writer->WriteLine(); + if (!use_lite_runtime()) { + writer->WriteLine("public static pbd::MessageDescriptor Descriptor {"); + writer->WriteLine(" get { return $0$.internal__$1$__Descriptor; }", + GetFullUmbrellaClassName(descriptor_->file()), + GetUniqueFileScopeIdentifier(descriptor_)); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine( + "protected override pb::FieldAccess.FieldAccessorTable<$0$, $0$.Builder> InternalFieldAccessors {", + class_name()); + writer->WriteLine(" get { return $0$.internal__$1$__FieldAccessorTable; }", + GetFullUmbrellaClassName(descriptor_->file()), + GetUniqueFileScopeIdentifier(descriptor_)); + writer->WriteLine("}"); + writer->WriteLine(); + } + + // Extensions don't need to go in an extra nested type + for (int i = 0; i < descriptor_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(descriptor_->extension(i)); + extensionGenerator.Generate(writer); + } + + if (descriptor_->enum_type_count() + descriptor_->nested_type_count() > 0) { + writer->WriteLine("#region Nested types"); + writer->WriteLine( + "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer->WriteLine("public static partial class Types {"); + writer->Indent(); + for (int i = 0; i < descriptor_->enum_type_count(); i++) { + EnumGenerator enumGenerator(descriptor_->enum_type(i)); + enumGenerator.Generate(writer); + } + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + MessageGenerator messageGenerator(descriptor_->nested_type(i)); + messageGenerator.Generate(writer); + } + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine("#endregion"); + writer->WriteLine(); + } + + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* fieldDescriptor = descriptor_->field(i); + + // Rats: we lose the debug comment here :( + writer->WriteLine("public const int $0$ = $1$;", + GetFieldConstantName(fieldDescriptor), + SimpleItoa(fieldDescriptor->number())); + scoped_ptr<FieldGeneratorBase> generator( + CreateFieldGeneratorInternal(fieldDescriptor)); + generator->GenerateMembers(writer); + writer->WriteLine(); + } + + if (optimize_speed()) { + if (SupportFieldPresence(descriptor_->file())) { + GenerateIsInitialized(writer); + } + GenerateMessageSerializationMethods(writer); + } + if (use_lite_runtime()) { + GenerateLiteRuntimeMethods(writer); + } + + GenerateParseFromMethods(writer); + GenerateBuilder(writer); + + // Force the static initialization code for the file to run, since it may + // initialize static variables declared in this class. + writer->WriteLine("static $0$() {", class_name()); + // We call object.ReferenceEquals() just to make it a valid statement on its own. + // Another option would be GetType(), but that causes problems in DescriptorProtoFile, + // where the bootstrapping is somewhat recursive - type initializers call + // each other, effectively. We temporarily see Descriptor as null. + writer->WriteLine(" object.ReferenceEquals($0$.Descriptor, null);", + GetFullUmbrellaClassName(descriptor_->file())); + writer->WriteLine("}"); + + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + +} + +void MessageGenerator::GenerateLiteRuntimeMethods(Writer* writer) { + bool callbase = descriptor_->extension_range_count() > 0; + writer->WriteLine("#region Lite runtime methods"); + writer->WriteLine("public override int GetHashCode() {"); + writer->Indent(); + writer->WriteLine("int hash = GetType().GetHashCode();"); + for (int i = 0; i < descriptor_->field_count(); i++) { + scoped_ptr<FieldGeneratorBase> generator( + CreateFieldGeneratorInternal(descriptor_->field(i))); + generator->WriteHash(writer); + } + if (callbase) { + writer->WriteLine("hash ^= base.GetHashCode();"); + } + writer->WriteLine("return hash;"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + + writer->WriteLine("public override bool Equals(object obj) {"); + writer->Indent(); + writer->WriteLine("$0$ other = obj as $0$;", class_name()); + writer->WriteLine("if (other == null) return false;"); + for (int i = 0; i < descriptor_->field_count(); i++) { + scoped_ptr<FieldGeneratorBase> generator( + CreateFieldGeneratorInternal(descriptor_->field(i))); + generator->WriteEquals(writer); + } + if (callbase) { + writer->WriteLine("if (!base.Equals(other)) return false;"); + } + writer->WriteLine("return true;"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + + writer->WriteLine( + "public override void PrintTo(global::System.IO.TextWriter writer) {"); + writer->Indent(); + + for (int i = 0; i < fields_by_number().size(); i++) { + scoped_ptr<FieldGeneratorBase> generator( + CreateFieldGeneratorInternal(fields_by_number()[i])); + generator->WriteToString(writer); + } + + if (callbase) { + writer->WriteLine("base.PrintTo(writer);"); + } + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine("#endregion"); + writer->WriteLine(); +} + +bool CompareExtensionRangesStart(const Descriptor::ExtensionRange* r1, + const Descriptor::ExtensionRange* r2) { + return r1->start < r2->start; +} + +void MessageGenerator::GenerateMessageSerializationMethods(Writer* writer) { + std::vector<const Descriptor::ExtensionRange*> extension_ranges_sorted; + for (int i = 0; i < descriptor_->extension_range_count(); i++) { + extension_ranges_sorted.push_back(descriptor_->extension_range(i)); + } + std::sort(extension_ranges_sorted.begin(), extension_ranges_sorted.end(), + CompareExtensionRangesStart); + + writer->WriteLine( + "public override void WriteTo(pb::ICodedOutputStream output) {"); + writer->Indent(); + // Make sure we've computed the serialized length, so that packed fields are generated correctly. + writer->WriteLine("CalcSerializedSize();"); + writer->WriteLine("string[] field_names = _$0$FieldNames;", + UnderscoresToCamelCase(class_name(), false)); + if (descriptor_->extension_range_count()) { + writer->WriteLine( + "pb::ExtendableMessage$1$<$0$, $0$.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);", + class_name(), runtime_suffix()); + } + + // Merge the fields and the extension ranges, both sorted by field number. + for (int i = 0, j = 0; + i < fields_by_number().size() || j < extension_ranges_sorted.size();) { + if (i == fields_by_number().size()) { + GenerateSerializeOneExtensionRange(writer, extension_ranges_sorted[j++]); + } else if (j == extension_ranges_sorted.size()) { + GenerateSerializeOneField(writer, fields_by_number()[i++]); + } else if (fields_by_number()[i]->number() + < extension_ranges_sorted[j]->start) { + GenerateSerializeOneField(writer, fields_by_number()[i++]); + } else { + GenerateSerializeOneExtensionRange(writer, extension_ranges_sorted[j++]); + } + } + + if (!use_lite_runtime()) { + if (descriptor_->options().message_set_wire_format()) + { + writer->WriteLine("UnknownFields.WriteAsMessageSetTo(output);"); + } else { + writer->WriteLine("UnknownFields.WriteTo(output);"); + } + } + + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("private int memoizedSerializedSize = -1;"); + writer->WriteLine("public override int SerializedSize {"); + writer->Indent(); + writer->WriteLine("get {"); + writer->Indent(); + writer->WriteLine("int size = memoizedSerializedSize;"); + writer->WriteLine("if (size != -1) return size;"); + writer->WriteLine("return CalcSerializedSize();"); + writer->Outdent(); + writer->WriteLine("}"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + + writer->WriteLine("private int CalcSerializedSize() {"); + writer->Indent(); + writer->WriteLine("int size = memoizedSerializedSize;"); + writer->WriteLine("if (size != -1) return size;"); + writer->WriteLine(); + writer->WriteLine("size = 0;"); + for (int i = 0; i < descriptor_->field_count(); i++) { + scoped_ptr<FieldGeneratorBase> generator( + CreateFieldGeneratorInternal(descriptor_->field(i))); + generator->GenerateSerializedSizeCode(writer); + } + if (descriptor_->extension_range_count() > 0) { + writer->WriteLine("size += ExtensionsSerializedSize;"); + } + + if (!use_lite_runtime()) { + if (descriptor_->options().message_set_wire_format()) { + writer->WriteLine("size += UnknownFields.SerializedSizeAsMessageSet;"); + } else { + writer->WriteLine("size += UnknownFields.SerializedSize;"); + } + } + writer->WriteLine("memoizedSerializedSize = size;"); + writer->WriteLine("return size;"); + writer->Outdent(); + writer->WriteLine("}"); +} + +void MessageGenerator::GenerateSerializeOneField( + Writer* writer, const FieldDescriptor* fieldDescriptor) { + scoped_ptr<FieldGeneratorBase> generator( + CreateFieldGeneratorInternal(fieldDescriptor)); + generator->GenerateSerializationCode(writer); +} + +void MessageGenerator::GenerateSerializeOneExtensionRange( + Writer* writer, const Descriptor::ExtensionRange* extensionRange) { + writer->WriteLine("extensionWriter.WriteUntil($0$, output);", + SimpleItoa(extensionRange->end)); +} + +void MessageGenerator::GenerateParseFromMethods(Writer* writer) { + // Note: These are separate from GenerateMessageSerializationMethods() + // because they need to be generated even for messages that are optimized + // for code size. + + writer->WriteLine("public static $0$ ParseFrom(pb::ByteString data) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine("public static $0$ ParseFrom(byte[] data) {", class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseFrom(global::System.IO.Stream input) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseDelimitedFrom(global::System.IO.Stream input) {", + class_name()); + writer->WriteLine( + " return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {", + class_name()); + writer->WriteLine( + " return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseFrom(pb::ICodedInputStream input) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();"); + writer->WriteLine("}"); +} + +void MessageGenerator::GenerateBuilder(Writer* writer) { + writer->WriteLine("private $0$ MakeReadOnly() {", class_name()); + writer->Indent(); + for (int i = 0; i < descriptor_->field_count(); i++) { + scoped_ptr<FieldGeneratorBase> generator( + CreateFieldGeneratorInternal(descriptor_->field(i))); + generator->GenerateBuildingCode(writer); + } + writer->WriteLine("return this;"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + + writer->WriteLine( + "public static Builder CreateBuilder() { return new Builder(); }"); + writer->WriteLine( + "public override Builder ToBuilder() { return CreateBuilder(this); }"); + writer->WriteLine( + "public override Builder CreateBuilderForType() { return new Builder(); }"); + writer->WriteLine("public static Builder CreateBuilder($0$ prototype) {", + class_name()); + writer->WriteLine(" return new Builder(prototype);"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine( + "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer->WriteLine( + "$0$ sealed partial class Builder : pb::$2$Builder$3$<$1$, Builder> {", + class_access_level(), class_name(), + descriptor_->extension_range_count() > 0 ? "Extendable" : "Generated", + runtime_suffix()); + writer->Indent(); + writer->WriteLine("protected override Builder ThisBuilder {"); + writer->WriteLine(" get { return this; }"); + writer->WriteLine("}"); + GenerateCommonBuilderMethods(writer); + if (optimize_speed()) { + GenerateBuilderParsingMethods(writer); + } + for (int i = 0; i < descriptor_->field_count(); i++) { + scoped_ptr<FieldGeneratorBase> generator( + CreateFieldGeneratorInternal(descriptor_->field(i))); + writer->WriteLine(); + // No field comment :( + generator->GenerateBuilderMembers(writer); + } + writer->Outdent(); + writer->WriteLine("}"); +} + +void MessageGenerator::GenerateCommonBuilderMethods(Writer* writer) { + //default constructor + writer->WriteLine("public Builder() {"); + //Durring static initialization of message, DefaultInstance is expected to return null. + writer->WriteLine(" result = DefaultInstance;"); + writer->WriteLine(" resultIsReadOnly = true;"); + writer->WriteLine("}"); + //clone constructor + writer->WriteLine("internal Builder($0$ cloneFrom) {", class_name()); + writer->WriteLine(" result = cloneFrom;"); + writer->WriteLine(" resultIsReadOnly = true;"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("private bool resultIsReadOnly;"); + writer->WriteLine("private $0$ result;", class_name()); + writer->WriteLine(); + writer->WriteLine("private $0$ PrepareBuilder() {", class_name()); + writer->WriteLine(" if (resultIsReadOnly) {"); + writer->WriteLine(" $0$ original = result;", class_name()); + writer->WriteLine(" result = new $0$();", class_name()); + writer->WriteLine(" resultIsReadOnly = false;"); + writer->WriteLine(" MergeFrom(original);"); + writer->WriteLine(" }"); + writer->WriteLine(" return result;"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("public override bool IsInitialized {"); + writer->WriteLine(" get { return result.IsInitialized; }"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("protected override $0$ MessageBeingBuilt {", class_name()); + writer->WriteLine(" get { return PrepareBuilder(); }"); + writer->WriteLine("}"); + writer->WriteLine(); + //Not actually expecting that DefaultInstance would ever be null here; however, we will ensure it does not break + writer->WriteLine("public override Builder Clear() {"); + writer->WriteLine(" result = DefaultInstance;"); + writer->WriteLine(" resultIsReadOnly = true;"); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("public override Builder Clone() {"); + writer->WriteLine(" if (resultIsReadOnly) {"); + writer->WriteLine(" return new Builder(result);"); + writer->WriteLine(" } else {"); + writer->WriteLine(" return new Builder().MergeFrom(result);"); + writer->WriteLine(" }"); + writer->WriteLine("}"); + writer->WriteLine(); + if (!use_lite_runtime()) { + writer->WriteLine( + "public override pbd::MessageDescriptor DescriptorForType {"); + writer->WriteLine(" get { return $0$.Descriptor; }", full_class_name()); + writer->WriteLine("}"); + writer->WriteLine(); + } + writer->WriteLine("public override $0$ DefaultInstanceForType {", + class_name()); + writer->WriteLine(" get { return $0$.DefaultInstance; }", full_class_name()); + writer->WriteLine("}"); + writer->WriteLine(); + + writer->WriteLine("public override $0$ BuildPartial() {", class_name()); + writer->Indent(); + writer->WriteLine("if (resultIsReadOnly) {"); + writer->WriteLine(" return result;"); + writer->WriteLine("}"); + writer->WriteLine("resultIsReadOnly = true;"); + writer->WriteLine("return result.MakeReadOnly();"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + + if (optimize_speed()) { + writer->WriteLine( + "public override Builder MergeFrom(pb::IMessage$0$ other) {", + runtime_suffix()); + writer->WriteLine(" if (other is $0$) {", class_name()); + writer->WriteLine(" return MergeFrom(($0$) other);", class_name()); + writer->WriteLine(" } else {"); + writer->WriteLine(" base.MergeFrom(other);"); + writer->WriteLine(" return this;"); + writer->WriteLine(" }"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("public override Builder MergeFrom($0$ other) {", + class_name()); + // Optimization: If other is the default instance, we know none of its + // fields are set so we can skip the merge. + writer->Indent(); + writer->WriteLine("if (other == $0$.DefaultInstance) return this;", + full_class_name()); + writer->WriteLine("PrepareBuilder();"); + for (int i = 0; i < descriptor_->field_count(); i++) { + scoped_ptr<FieldGeneratorBase> generator( + CreateFieldGeneratorInternal(descriptor_->field(i))); + generator->GenerateMergingCode(writer); + } + // if message type has extensions + if (descriptor_->extension_range_count() > 0) { + writer->WriteLine(" this.MergeExtensionFields(other);"); + } + if (!use_lite_runtime()) { + writer->WriteLine("this.MergeUnknownFields(other.UnknownFields);"); + } + writer->WriteLine("return this;"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + } + +} + +void MessageGenerator::GenerateBuilderParsingMethods(Writer* writer) { + writer->WriteLine( + "public override Builder MergeFrom(pb::ICodedInputStream input) {"); + writer->WriteLine(" return MergeFrom(input, pb::ExtensionRegistry.Empty);"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine( + "public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {"); + writer->Indent(); + writer->WriteLine("PrepareBuilder();"); + if (!use_lite_runtime()) { + writer->WriteLine("pb::UnknownFieldSet.Builder unknownFields = null;"); + } + writer->WriteLine("uint tag;"); + writer->WriteLine("string field_name;"); + writer->WriteLine("while (input.ReadTag(out tag, out field_name)) {"); + writer->Indent(); + writer->WriteLine("if(tag == 0 && field_name != null) {"); + writer->Indent(); + //if you change from StringComparer.Ordinal, the array sort in FieldNames { get; } must also change + writer->WriteLine( + "int field_ordinal = global::System.Array.BinarySearch(_$0$FieldNames, field_name, global::System.StringComparer.Ordinal);", + UnderscoresToCamelCase(class_name(), false)); + writer->WriteLine("if(field_ordinal >= 0)"); + writer->WriteLine(" tag = _$0$FieldTags[field_ordinal];", + UnderscoresToCamelCase(class_name(), false)); + writer->WriteLine("else {"); + if (!use_lite_runtime()) { + writer->WriteLine(" if (unknownFields == null) {"); // First unknown field - create builder now + writer->WriteLine( + " unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);"); + writer->WriteLine(" }"); + } + writer->WriteLine( + " ParseUnknownField(input, $0$extensionRegistry, tag, field_name);", + use_lite_runtime() ? "" : "unknownFields, "); + writer->WriteLine(" continue;"); + writer->WriteLine("}"); + writer->Outdent(); + writer->WriteLine("}"); + + writer->WriteLine("switch (tag) {"); + writer->Indent(); + writer->WriteLine("case 0: {"); // 0 signals EOF / limit reached + writer->WriteLine(" throw pb::InvalidProtocolBufferException.InvalidTag();"); + writer->WriteLine("}"); + writer->WriteLine("default: {"); + writer->WriteLine(" if (pb::WireFormat.IsEndGroupTag(tag)) {"); + if (!use_lite_runtime()) { + writer->WriteLine(" if (unknownFields != null) {"); + writer->WriteLine(" this.UnknownFields = unknownFields.Build();"); + writer->WriteLine(" }"); + } + writer->WriteLine(" return this;"); // it's an endgroup tag + writer->WriteLine(" }"); + if (!use_lite_runtime()) { + writer->WriteLine(" if (unknownFields == null) {"); // First unknown field - create builder now + writer->WriteLine( + " unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);"); + writer->WriteLine(" }"); + } + writer->WriteLine( + " ParseUnknownField(input, $0$extensionRegistry, tag, field_name);", + use_lite_runtime() ? "" : "unknownFields, "); + writer->WriteLine(" break;"); + writer->WriteLine("}"); + + for (int i = 0; i < fields_by_number().size(); i++) { + const FieldDescriptor* field = fields_by_number()[i]; + internal::WireFormatLite::WireType wt = + internal::WireFormat::WireTypeForFieldType(field->type()); + uint32 tag = internal::WireFormatLite::MakeTag(field->number(), wt); + if (field->is_repeated() + && (wt == internal::WireFormatLite::WIRETYPE_VARINT + || wt == internal::WireFormatLite::WIRETYPE_FIXED32 + || wt == internal::WireFormatLite::WIRETYPE_FIXED64)) { + writer->WriteLine( + "case $0$:", + SimpleItoa( + internal::WireFormatLite::MakeTag( + field->number(), + internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED))); + } + + writer->WriteLine("case $0$: {", SimpleItoa(tag)); + writer->Indent(); + scoped_ptr<FieldGeneratorBase> generator( + CreateFieldGeneratorInternal(field)); + generator->GenerateParsingCode(writer); + writer->WriteLine("break;"); + writer->Outdent(); + writer->WriteLine("}"); + } + + writer->Outdent(); + writer->WriteLine("}"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + if (!use_lite_runtime()) { + writer->WriteLine("if (unknownFields != null) {"); + writer->WriteLine(" this.UnknownFields = unknownFields.Build();"); + writer->WriteLine("}"); + } + writer->WriteLine("return this;"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); +} + +void MessageGenerator::GenerateIsInitialized(Writer* writer) { + writer->WriteLine("public override bool IsInitialized {"); + writer->Indent(); + writer->WriteLine("get {"); + writer->Indent(); + + // Check that all required fields in this message are set. + // TODO(kenton): We can optimize this when we switch to putting all the + // "has" fields into a single bitfield. + for (int i = 0; i < descriptor_->field_count(); i++) { + if (descriptor_->field(i)->is_required()) { + writer->WriteLine("if (!has$0$) return false;", + GetPropertyName(descriptor_->field(i))); + } + } + + // Now check that all embedded messages are initialized. + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + + if (field->type() != FieldDescriptor::TYPE_MESSAGE || + !HasRequiredFields(field->message_type())) + { + continue; + } + // TODO(jtattermusch): shouldn't we use GetPropertyName here? + string propertyName = UnderscoresToPascalCase(GetFieldName(field)); + if (field->is_repeated()) + { + writer->WriteLine("foreach ($0$ element in $1$List) {", + GetClassName(field->message_type()), + propertyName); + writer->WriteLine(" if (!element.IsInitialized) return false;"); + writer->WriteLine("}"); + } + else if (field->is_optional()) + { + writer->WriteLine("if (Has$0$) {", propertyName); + writer->WriteLine(" if (!$0$.IsInitialized) return false;", propertyName); + writer->WriteLine("}"); + } + else + { + writer->WriteLine("if (!$0$.IsInitialized) return false;", propertyName); + } + } + + if (descriptor_->extension_range_count() > 0) { + writer->WriteLine("if (!ExtensionsAreInitialized) return false;"); + } + writer->WriteLine("return true;"); + writer->Outdent(); + writer->WriteLine("}"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); +} + +void MessageGenerator::GenerateExtensionRegistrationCode(Writer* writer) { + for (int i = 0; i < descriptor_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(descriptor_->extension(i)); + extensionGenerator.GenerateExtensionRegistrationCode(writer); + } + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + MessageGenerator messageGenerator(descriptor_->nested_type(i)); + messageGenerator.GenerateExtensionRegistrationCode(writer); + } +} + +int MessageGenerator::GetFieldOrdinal(const FieldDescriptor* descriptor) { + for (int i = 0; i < field_names().size(); i++) { + if (field_names()[i] == descriptor->name()) { + return i; + } + } + GOOGLE_LOG(DFATAL)<< "Could not find ordinal for field " << descriptor->name(); + return -1; +} + +FieldGeneratorBase* MessageGenerator::CreateFieldGeneratorInternal( + const FieldDescriptor* descriptor) { + return CreateFieldGenerator(descriptor, GetFieldOrdinal(descriptor)); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_message.h b/src/google/protobuf/compiler/csharp/csharp_message.h new file mode 100644 index 00000000..b8d15df0 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_message.h @@ -0,0 +1,98 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__ + +#include <string> +#include <vector> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/csharp/csharp_source_generator_base.h> +#include <google/protobuf/compiler/csharp/csharp_helpers.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; +class FieldGeneratorBase; + +class MessageGenerator : public SourceGeneratorBase { + public: + MessageGenerator(const Descriptor* descriptor); + ~MessageGenerator(); + + void GenerateStaticVariables(Writer* printer); + void GenerateStaticVariableInitializers(Writer* printer); + void GenerateExtensionRegistrationCode(Writer* printer); + void Generate(Writer* printer); + + private: + const Descriptor* descriptor_; + std::vector<std::string> field_names_; + std::vector<const FieldDescriptor*> fields_by_number_; + + void GenerateLiteRuntimeMethods(Writer* writer); + void GenerateMessageSerializationMethods(Writer* writer); + void GenerateSerializeOneField(Writer* writer, + const FieldDescriptor* fieldDescriptor); + void GenerateSerializeOneExtensionRange( + Writer* writer, const Descriptor::ExtensionRange* extendsionRange); + void GenerateParseFromMethods(Writer* writer); + void GenerateBuilder(Writer* writer); + void GenerateCommonBuilderMethods(Writer* writer); + void GenerateBuilderParsingMethods(Writer* writer); + void GenerateIsInitialized(Writer* writer); + + int GetFieldOrdinal(const FieldDescriptor* descriptor); + FieldGeneratorBase* CreateFieldGeneratorInternal( + const FieldDescriptor* descriptor); + + std::string class_name(); + std::string full_class_name(); + + // field names sorted alphabetically + const std::vector<std::string>& field_names(); + + // field descriptors sorted by number + const std::vector<const FieldDescriptor*>& fields_by_number(); + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_message_field.cc b/src/google/protobuf/compiler/csharp/csharp_message_field.cc new file mode 100644 index 00000000..10464c4b --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_message_field.cc @@ -0,0 +1,183 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <sstream> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> +#include <google/protobuf/stubs/strutil.h> + +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/compiler/csharp/csharp_message_field.h> +#include <google/protobuf/compiler/csharp/csharp_writer.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor, + int fieldOrdinal) + : FieldGeneratorBase(descriptor, fieldOrdinal) { +} + +MessageFieldGenerator::~MessageFieldGenerator() { + +} + +void MessageFieldGenerator::GenerateMembers(Writer* writer) { + writer->WriteLine("private bool has$0$;", property_name()); + writer->WriteLine("private $0$ $1$_;", type_name(), name()); + AddDeprecatedFlag(writer); + writer->WriteLine("public bool Has$0$ {", property_name()); + writer->WriteLine(" get { return has$0$; }", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public $0$ $1$ {", type_name(), property_name()); + writer->WriteLine(" get { return $0$_ ?? $1$; }", name(), default_value()); + writer->WriteLine("}"); +} + +void MessageFieldGenerator::GenerateBuilderMembers(Writer* writer) { + AddDeprecatedFlag(writer); + writer->WriteLine("public bool Has$0$ {", property_name()); + writer->WriteLine(" get { return result.has$0$; }", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public $0$ $1$ {", type_name(), property_name()); + writer->WriteLine(" get { return result.$0$; }", property_name()); + writer->WriteLine(" set { Set$0$(value); }", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Set$0$($1$ value) {", property_name(), + type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.has$0$ = true;", property_name()); + writer->WriteLine(" result.$0$_ = value;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Set$0$($1$.Builder builderForValue) {", + property_name(), type_name()); + AddNullCheck(writer, "builderForValue"); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.has$0$ = true;", property_name()); + writer->WriteLine(" result.$0$_ = builderForValue.Build();", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Merge$0$($1$ value) {", property_name(), + type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" if (result.has$0$ &&", property_name()); + writer->WriteLine(" result.$0$_ != $1$) {", name(), default_value()); + writer->WriteLine( + " result.$0$_ = $1$.CreateBuilder(result.$0$_).MergeFrom(value).BuildPartial();", + name(), type_name()); + writer->WriteLine(" } else {"); + writer->WriteLine(" result.$0$_ = value;", name()); + writer->WriteLine(" }"); + writer->WriteLine(" result.has$0$ = true;", property_name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Clear$0$() {", property_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.has$0$ = false;", property_name()); + writer->WriteLine(" result.$0$_ = null;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); +} + +void MessageFieldGenerator::GenerateMergingCode(Writer* writer) { + writer->WriteLine("if (other.Has$0$) {", property_name()); + writer->WriteLine(" Merge$0$(other.$0$);", property_name()); + writer->WriteLine("}"); +} + +void MessageFieldGenerator::GenerateBuildingCode(Writer* writer) { + // Nothing to do for singular fields +} + +void MessageFieldGenerator::GenerateParsingCode(Writer* writer) { + writer->WriteLine("$0$.Builder subBuilder = $0$.CreateBuilder();", + type_name()); + writer->WriteLine("if (result.has$0$) {", property_name()); + writer->WriteLine(" subBuilder.MergeFrom($0$);", property_name()); + writer->WriteLine("}"); + + if (descriptor_->type() == FieldDescriptor::TYPE_GROUP) { + writer->WriteLine("input.ReadGroup($0$, subBuilder, extensionRegistry);", + number()); + } else { + writer->WriteLine("input.ReadMessage(subBuilder, extensionRegistry);"); + } + writer->WriteLine("$0$ = subBuilder.BuildPartial();", property_name()); +} + +void MessageFieldGenerator::GenerateSerializationCode(Writer* writer) { + writer->WriteLine("if (has$0$) {", property_name()); + writer->WriteLine(" output.Write$0$($1$, field_names[$3$], $2$);", + message_or_group(), number(), property_name(), + field_ordinal()); + writer->WriteLine("}"); +} + +void MessageFieldGenerator::GenerateSerializedSizeCode(Writer* writer) { + writer->WriteLine("if (has$0$) {", property_name()); + writer->WriteLine(" size += pb::CodedOutputStream.Compute$0$Size($1$, $2$);", + message_or_group(), number(), property_name()); + writer->WriteLine("}"); +} + +void MessageFieldGenerator::WriteHash(Writer* writer) { + writer->WriteLine("if (has$0$) hash ^= $1$_.GetHashCode();", property_name(), + name()); +} +void MessageFieldGenerator::WriteEquals(Writer* writer) { + writer->WriteLine( + "if (has$0$ != other.has$0$ || (has$0$ && !$1$_.Equals(other.$1$_))) return false;", + property_name(), name()); +} +void MessageFieldGenerator::WriteToString(Writer* writer) { + writer->WriteLine("PrintField(\"$2$\", has$0$, $1$_, writer);", + property_name(), name(), GetFieldName(descriptor_)); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_message_field.h b/src/google/protobuf/compiler/csharp/csharp_message_field.h new file mode 100644 index 00000000..48bf8be5 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_message_field.h @@ -0,0 +1,73 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_FIELD_H__ + +#include <string> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/csharp/csharp_field_base.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class MessageFieldGenerator : public FieldGeneratorBase { + public: + MessageFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + ~MessageFieldGenerator(); + + virtual void GenerateMembers(Writer* writer); + virtual void GenerateBuilderMembers(Writer* writer); + virtual void GenerateMergingCode(Writer* writer); + virtual void GenerateBuildingCode(Writer* writer); + virtual void GenerateParsingCode(Writer* writer); + virtual void GenerateSerializationCode(Writer* writer); + virtual void GenerateSerializedSizeCode(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_FIELD_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc new file mode 100644 index 00000000..a193afda --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc @@ -0,0 +1,190 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <sstream> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> +#include <google/protobuf/stubs/strutil.h> + +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/compiler/csharp/csharp_primitive_field.h> +#include <google/protobuf/compiler/csharp/csharp_writer.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +PrimitiveFieldGenerator::PrimitiveFieldGenerator( + const FieldDescriptor* descriptor, int fieldOrdinal) + : FieldGeneratorBase(descriptor, fieldOrdinal) { +} + +PrimitiveFieldGenerator::~PrimitiveFieldGenerator() { + +} + +void PrimitiveFieldGenerator::GenerateMembers(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("private bool has$0$;", property_name()); + } + writer->WriteLine("private $0$ $1$_$2$;", type_name(), name(), + has_default_value() ? " = " + default_value() : ""); + AddDeprecatedFlag(writer); + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("public bool Has$0$ {", property_name()); + writer->WriteLine(" get { return has$0$; }", property_name()); + writer->WriteLine("}"); + } + AddPublicMemberAttributes(writer); + writer->WriteLine("public $0$ $1$ {", type_name(), property_name()); + writer->WriteLine(" get { return $0$_; }", name()); + writer->WriteLine("}"); +} + +void PrimitiveFieldGenerator::GenerateBuilderMembers(Writer* writer) { + AddDeprecatedFlag(writer); + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("public bool Has$0$ {", property_name()); + writer->WriteLine(" get { return result.has$0$; }", property_name()); + writer->WriteLine("}"); + } + AddPublicMemberAttributes(writer); + writer->WriteLine("public $0$ $1$ {", type_name(), property_name()); + writer->WriteLine(" get { return result.$0$; }", property_name()); + writer->WriteLine(" set { Set$0$(value); }", property_name()); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public Builder Set$0$($1$ value) {", property_name(), + type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine(" result.has$0$ = true;", property_name()); + } + writer->WriteLine(" result.$0$_ = value;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Clear$0$() {", property_name()); + writer->WriteLine(" PrepareBuilder();"); + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine(" result.has$0$ = false;", property_name()); + } + writer->WriteLine(" result.$0$_ = $1$;", name(), default_value()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); +} + +void PrimitiveFieldGenerator::GenerateMergingCode(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("if (other.Has$0$) {", property_name()); + } else { + writer->WriteLine("if (other.$0$ != $1$) {", property_name(), default_value()); + } + writer->WriteLine(" $0$ = other.$0$;", property_name()); + writer->WriteLine("}"); +} + +void PrimitiveFieldGenerator::GenerateBuildingCode(Writer* writer) { + // Nothing to do here for primitive types +} + +void PrimitiveFieldGenerator::GenerateParsingCode(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("result.has$0$ = input.Read$1$(ref result.$2$_);", + property_name(), capitalized_type_name(), name()); + } else { + writer->WriteLine("input.Read$0$(ref result.$1$_);", + capitalized_type_name(), name()); + } +} + +void PrimitiveFieldGenerator::GenerateSerializationCode(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("if (has$0$) {", property_name()); + } else { + writer->WriteLine("if ($0$ != $1$) {", property_name(), default_value()); + } + writer->WriteLine(" output.Write$0$($1$, field_names[$3$], $2$);", + capitalized_type_name(), number(), property_name(), + field_ordinal()); + writer->WriteLine("}"); +} + +void PrimitiveFieldGenerator::GenerateSerializedSizeCode(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("if (has$0$) {", property_name()); + } else { + writer->WriteLine("if ($0$ != $1$) {", property_name(), default_value()); + } + writer->WriteLine(" size += pb::CodedOutputStream.Compute$0$Size($1$, $2$);", + capitalized_type_name(), number(), property_name()); + writer->WriteLine("}"); +} + +void PrimitiveFieldGenerator::WriteHash(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("if (has$0$) {", property_name()); + } else { + writer->WriteLine("if ($0$ != $1$) {", property_name(), default_value()); + } + writer->WriteLine(" hash ^= $0$_.GetHashCode();", name()); + writer->WriteLine("}"); +} +void PrimitiveFieldGenerator::WriteEquals(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine( + "if (has$0$ != other.has$0$ || (has$0$ && !$1$_.Equals(other.$1$_))) return false;", + property_name(), name()); + } else { + writer->WriteLine( + "if (!$0$_.Equals(other.$0$_)) return false;", name()); + } +} +void PrimitiveFieldGenerator::WriteToString(Writer* writer) { + if (SupportFieldPresence(descriptor_->file())) { + writer->WriteLine("PrintField(\"$0$\", has$1$, $2$_, writer);", + descriptor_->name(), property_name(), name()); + } else { + writer->WriteLine("PrintField(\"$0$\", $1$_, writer);", + descriptor_->name(), name()); + } +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_primitive_field.h b/src/google/protobuf/compiler/csharp/csharp_primitive_field.h new file mode 100644 index 00000000..fb27ab43 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_primitive_field.h @@ -0,0 +1,73 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_PRIMITIVE_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_PRIMITIVE_FIELD_H__ + +#include <string> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/csharp/csharp_field_base.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class PrimitiveFieldGenerator : public FieldGeneratorBase { + public: + PrimitiveFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + ~PrimitiveFieldGenerator(); + + virtual void GenerateMembers(Writer* writer); + virtual void GenerateBuilderMembers(Writer* writer); + virtual void GenerateMergingCode(Writer* writer); + virtual void GenerateBuildingCode(Writer* writer); + virtual void GenerateParsingCode(Writer* writer); + virtual void GenerateSerializationCode(Writer* writer); + virtual void GenerateSerializedSizeCode(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_PRIMITIVE_FIELD_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc new file mode 100644 index 00000000..cc8745ae --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc @@ -0,0 +1,226 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <sstream> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> +#include <google/protobuf/wire_format.h> + +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/compiler/csharp/csharp_repeated_enum_field.h> +#include <google/protobuf/compiler/csharp/csharp_writer.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +RepeatedEnumFieldGenerator::RepeatedEnumFieldGenerator( + const FieldDescriptor* descriptor, int fieldOrdinal) + : FieldGeneratorBase(descriptor, fieldOrdinal) { +} + +RepeatedEnumFieldGenerator::~RepeatedEnumFieldGenerator() { + +} + +void RepeatedEnumFieldGenerator::GenerateMembers(Writer* writer) { + if (descriptor_->is_packed() && optimize_speed()) { + writer->WriteLine("private int $0$MemoizedSerializedSize;", name()); + } + writer->WriteLine( + "private pbc::PopsicleList<$0$> $1$_ = new pbc::PopsicleList<$0$>();", + type_name(), name()); + AddDeprecatedFlag(writer); + writer->WriteLine("public scg::IList<$0$> $1$List {", type_name(), + property_name()); + writer->WriteLine(" get { return pbc::Lists.AsReadOnly($0$_); }", name()); + writer->WriteLine("}"); + + // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + AddDeprecatedFlag(writer); + writer->WriteLine("public int $0$Count {", property_name()); + writer->WriteLine(" get { return $0$_.Count; }", name()); + writer->WriteLine("}"); + + AddDeprecatedFlag(writer); + writer->WriteLine("public $0$ Get$1$(int index) {", type_name(), + property_name()); + writer->WriteLine(" return $0$_[index];", name()); + writer->WriteLine("}"); +} + +void RepeatedEnumFieldGenerator::GenerateBuilderMembers(Writer* writer) { + // Note: We can return the original list here, because we make it unmodifiable when we build + // We return it via IPopsicleList so that collection initializers work more pleasantly. + AddDeprecatedFlag(writer); + writer->WriteLine("public pbc::IPopsicleList<$0$> $1$List {", type_name(), + property_name()); + writer->WriteLine(" get { return PrepareBuilder().$0$_; }", name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public int $0$Count {", property_name()); + writer->WriteLine(" get { return result.$0$Count; }", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public $0$ Get$1$(int index) {", type_name(), + property_name()); + writer->WriteLine(" return result.Get$0$(index);", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Set$0$(int index, $1$ value) {", + property_name(), type_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_[index] = value;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Add$0$($1$ value) {", property_name(), + type_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(value);", name(), type_name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine( + "public Builder AddRange$0$(scg::IEnumerable<$1$> values) {", + property_name(), type_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(values);", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Clear$0$() {", property_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Clear();", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); +} + +void RepeatedEnumFieldGenerator::GenerateMergingCode(Writer* writer) { + writer->WriteLine("if (other.$0$_.Count != 0) {", name()); + writer->WriteLine(" result.$0$_.Add(other.$0$_);", name()); + writer->WriteLine("}"); +} + +void RepeatedEnumFieldGenerator::GenerateBuildingCode(Writer* writer) { + writer->WriteLine("$0$_.MakeReadOnly();", name()); +} + +void RepeatedEnumFieldGenerator::GenerateParsingCode(Writer* writer) { + writer->WriteLine("scg::ICollection<object> unknownItems;"); + writer->WriteLine( + "input.ReadEnumArray<$0$>(tag, field_name, result.$1$_, out unknownItems);", + type_name(), name()); + if (!use_lite_runtime()) { + writer->WriteLine("if (unknownItems != null) {"); + writer->WriteLine(" if (unknownFields == null) {"); + writer->WriteLine( + " unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);"); + writer->WriteLine(" }"); + writer->WriteLine(" foreach (object rawValue in unknownItems)"); + writer->WriteLine(" if (rawValue is int)"); + writer->WriteLine( + " unknownFields.MergeVarintField($0$, (ulong)(int)rawValue);", + number()); + writer->WriteLine("}"); + } +} + +void RepeatedEnumFieldGenerator::GenerateSerializationCode(Writer* writer) { + writer->WriteLine("if ($0$_.Count > 0) {", name()); + writer->Indent(); + if (descriptor_->is_packed()) { + writer->WriteLine( + "output.WritePackedEnumArray($0$, field_names[$2$], $1$MemoizedSerializedSize, $1$_);", + number(), name(), field_ordinal()); + } else { + writer->WriteLine("output.WriteEnumArray($0$, field_names[$2$], $1$_);", + number(), name(), field_ordinal()); + } + writer->Outdent(); + writer->WriteLine("}"); +} + +void RepeatedEnumFieldGenerator::GenerateSerializedSizeCode(Writer* writer) { + writer->WriteLine("{"); + writer->Indent(); + writer->WriteLine("int dataSize = 0;"); + writer->WriteLine("if ($0$_.Count > 0) {", name()); + writer->Indent(); + writer->WriteLine("foreach ($0$ element in $1$_) {", type_name(), name()); + writer->WriteLine( + " dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element);"); + writer->WriteLine("}"); + writer->WriteLine("size += dataSize;"); + int tagSize = internal::WireFormat::TagSize(descriptor_->number(), descriptor_->type()); + if (descriptor_->is_packed()) { + writer->WriteLine("size += $0$;", SimpleItoa(tagSize)); + writer->WriteLine( + "size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize);"); + } else { + writer->WriteLine("size += $0$ * $1$_.Count;", SimpleItoa(tagSize), name()); + } + writer->Outdent(); + writer->WriteLine("}"); + // cache the data size for packed fields. + if (descriptor_->is_packed()) { + writer->WriteLine("$0$MemoizedSerializedSize = dataSize;", name()); + } + writer->Outdent(); + writer->WriteLine("}"); +} + +void RepeatedEnumFieldGenerator::WriteHash(Writer* writer) { + writer->WriteLine("foreach($0$ i in $1$_)", type_name(), name()); + writer->WriteLine(" hash ^= i.GetHashCode();"); +} + +void RepeatedEnumFieldGenerator::WriteEquals(Writer* writer) { + writer->WriteLine("if($0$_.Count != other.$0$_.Count) return false;", name()); + writer->WriteLine("for(int ix=0; ix < $0$_.Count; ix++)", name()); + writer->WriteLine(" if(!$0$_[ix].Equals(other.$0$_[ix])) return false;", + name()); +} + +void RepeatedEnumFieldGenerator::WriteToString(Writer* writer) { + writer->WriteLine("PrintField(\"$0$\", $1$_, writer);", descriptor_->name(), + name()); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h new file mode 100644 index 00000000..c872131c --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h @@ -0,0 +1,73 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_ENUM_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_ENUM_FIELD_H__ + +#include <string> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/csharp/csharp_field_base.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class RepeatedEnumFieldGenerator : public FieldGeneratorBase { + public: + RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + ~RepeatedEnumFieldGenerator(); + + virtual void GenerateMembers(Writer* writer); + virtual void GenerateBuilderMembers(Writer* writer); + virtual void GenerateMergingCode(Writer* writer); + virtual void GenerateBuildingCode(Writer* writer); + virtual void GenerateParsingCode(Writer* writer); + virtual void GenerateSerializationCode(Writer* writer); + virtual void GenerateSerializedSizeCode(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_ENUM_FIELD_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc new file mode 100644 index 00000000..2dfcd402 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc @@ -0,0 +1,201 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <sstream> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> + +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/compiler/csharp/csharp_repeated_message_field.h> +#include <google/protobuf/compiler/csharp/csharp_writer.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( + const FieldDescriptor* descriptor, int fieldOrdinal) + : FieldGeneratorBase(descriptor, fieldOrdinal) { +} + +RepeatedMessageFieldGenerator::~RepeatedMessageFieldGenerator() { + +} + +void RepeatedMessageFieldGenerator::GenerateMembers(Writer* writer) { + writer->WriteLine( + "private pbc::PopsicleList<$0$> $1$_ = new pbc::PopsicleList<$0$>();", + type_name(), name()); + AddDeprecatedFlag(writer); + writer->WriteLine("public scg::IList<$0$> $1$List {", type_name(), + property_name()); + writer->WriteLine(" get { return $0$_; }", name()); + writer->WriteLine("}"); + + // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + AddDeprecatedFlag(writer); + writer->WriteLine("public int $0$Count {", property_name()); + writer->WriteLine(" get { return $0$_.Count; }", name()); + writer->WriteLine("}"); + + AddDeprecatedFlag(writer); + writer->WriteLine("public $0$ Get$1$(int index) {", type_name(), + property_name()); + writer->WriteLine(" return $0$_[index];", name()); + writer->WriteLine("}"); +} + +void RepeatedMessageFieldGenerator::GenerateBuilderMembers(Writer* writer) { + // Note: We can return the original list here, because we make it unmodifiable when we build + // We return it via IPopsicleList so that collection initializers work more pleasantly. + AddDeprecatedFlag(writer); + writer->WriteLine("public pbc::IPopsicleList<$0$> $1$List {", type_name(), + property_name()); + writer->WriteLine(" get { return PrepareBuilder().$0$_; }", name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public int $0$Count {", property_name()); + writer->WriteLine(" get { return result.$0$Count; }", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public $0$ Get$1$(int index) {", type_name(), + property_name()); + writer->WriteLine(" return result.Get$0$(index);", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Set$0$(int index, $1$ value) {", + property_name(), type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_[index] = value;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + // Extra overload for builder (just on messages) + AddDeprecatedFlag(writer); + writer->WriteLine( + "public Builder Set$0$(int index, $1$.Builder builderForValue) {", + property_name(), type_name()); + AddNullCheck(writer, "builderForValue"); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_[index] = builderForValue.Build();", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Add$0$($1$ value) {", property_name(), + type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(value);", name(), type_name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + // Extra overload for builder (just on messages) + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Add$0$($1$.Builder builderForValue) {", + property_name(), type_name()); + AddNullCheck(writer, "builderForValue"); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(builderForValue.Build());", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine( + "public Builder AddRange$0$(scg::IEnumerable<$1$> values) {", + property_name(), type_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(values);", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Clear$0$() {", property_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Clear();", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); +} + +void RepeatedMessageFieldGenerator::GenerateMergingCode(Writer* writer) { + writer->WriteLine("if (other.$0$_.Count != 0) {", name()); + writer->WriteLine(" result.$0$_.Add(other.$0$_);", name()); + writer->WriteLine("}"); +} + +void RepeatedMessageFieldGenerator::GenerateBuildingCode(Writer* writer) { + writer->WriteLine("$0$_.MakeReadOnly();", name()); +} + +void RepeatedMessageFieldGenerator::GenerateParsingCode(Writer* writer) { + writer->WriteLine( + "input.Read$0$Array(tag, field_name, result.$1$_, $2$.DefaultInstance, extensionRegistry);", + message_or_group(), name(), type_name()); +} + +void RepeatedMessageFieldGenerator::GenerateSerializationCode(Writer* writer) { + writer->WriteLine("if ($0$_.Count > 0) {", name()); + writer->Indent(); + writer->WriteLine("output.Write$0$Array($1$, field_names[$3$], $2$_);", + message_or_group(), number(), name(), field_ordinal()); + writer->Outdent(); + writer->WriteLine("}"); +} + +void RepeatedMessageFieldGenerator::GenerateSerializedSizeCode(Writer* writer) { + writer->WriteLine("foreach ($0$ element in $1$List) {", type_name(), + property_name()); + writer->WriteLine( + " size += pb::CodedOutputStream.Compute$0$Size($1$, element);", + message_or_group(), number()); + writer->WriteLine("}"); +} + +void RepeatedMessageFieldGenerator::WriteHash(Writer* writer) { + writer->WriteLine("foreach($0$ i in $1$_)", type_name(), name()); + writer->WriteLine(" hash ^= i.GetHashCode();"); +} +void RepeatedMessageFieldGenerator::WriteEquals(Writer* writer) { + writer->WriteLine("if($0$_.Count != other.$0$_.Count) return false;", name()); + writer->WriteLine("for(int ix=0; ix < $0$_.Count; ix++)", name()); + writer->WriteLine(" if(!$0$_[ix].Equals(other.$0$_[ix])) return false;", + name()); +} +void RepeatedMessageFieldGenerator::WriteToString(Writer* writer) { + writer->WriteLine("PrintField(\"$0$\", $1$_, writer);", + GetFieldName(descriptor_), name()); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h new file mode 100644 index 00000000..104274cb --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h @@ -0,0 +1,73 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__ + +#include <string> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/csharp/csharp_field_base.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class RepeatedMessageFieldGenerator : public FieldGeneratorBase { + public: + RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + ~RepeatedMessageFieldGenerator(); + + virtual void GenerateMembers(Writer* writer); + virtual void GenerateBuilderMembers(Writer* writer); + virtual void GenerateMergingCode(Writer* writer); + virtual void GenerateBuildingCode(Writer* writer); + virtual void GenerateParsingCode(Writer* writer); + virtual void GenerateSerializationCode(Writer* writer); + virtual void GenerateSerializedSizeCode(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc new file mode 100644 index 00000000..8b285468 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc @@ -0,0 +1,219 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <sstream> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> +#include <google/protobuf/wire_format.h> + +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h> +#include <google/protobuf/compiler/csharp/csharp_writer.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +RepeatedPrimitiveFieldGenerator::RepeatedPrimitiveFieldGenerator( + const FieldDescriptor* descriptor, int fieldOrdinal) + : FieldGeneratorBase(descriptor, fieldOrdinal) { +} + +RepeatedPrimitiveFieldGenerator::~RepeatedPrimitiveFieldGenerator() { + +} + +void RepeatedPrimitiveFieldGenerator::GenerateMembers(Writer* writer) { + if (descriptor_->is_packed() && optimize_speed()) { + writer->WriteLine("private int $0$MemoizedSerializedSize;", name()); + } + writer->WriteLine( + "private pbc::PopsicleList<$0$> $1$_ = new pbc::PopsicleList<$0$>();", + type_name(), name()); + AddPublicMemberAttributes(writer); + writer->WriteLine("public scg::IList<$0$> $1$List {", type_name(), + property_name()); + writer->WriteLine(" get { return pbc::Lists.AsReadOnly($0$_); }", name()); + writer->WriteLine("}"); + + // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + AddDeprecatedFlag(writer); + writer->WriteLine("public int $0$Count {", property_name()); + writer->WriteLine(" get { return $0$_.Count; }", name()); + writer->WriteLine("}"); + + AddPublicMemberAttributes(writer); + writer->WriteLine("public $0$ Get$1$(int index) {", type_name(), + property_name()); + writer->WriteLine(" return $0$_[index];", name()); + writer->WriteLine("}"); +} + +void RepeatedPrimitiveFieldGenerator::GenerateBuilderMembers(Writer* writer) { + // Note: We can return the original list here, because we make it unmodifiable when we build + // We return it via IPopsicleList so that collection initializers work more pleasantly. + AddPublicMemberAttributes(writer); + writer->WriteLine("public pbc::IPopsicleList<$0$> $1$List {", type_name(), + property_name()); + writer->WriteLine(" get { return PrepareBuilder().$0$_; }", name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public int $0$Count {", property_name()); + writer->WriteLine(" get { return result.$0$Count; }", property_name()); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public $0$ Get$1$(int index) {", type_name(), + property_name()); + writer->WriteLine(" return result.Get$0$(index);", property_name()); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public Builder Set$0$(int index, $1$ value) {", + property_name(), type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_[index] = value;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public Builder Add$0$($1$ value) {", property_name(), + type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(value);", name(), type_name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine( + "public Builder AddRange$0$(scg::IEnumerable<$1$> values) {", + property_name(), type_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(values);", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Clear$0$() {", property_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Clear();", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); +} + +void RepeatedPrimitiveFieldGenerator::GenerateMergingCode(Writer* writer) { + writer->WriteLine("if (other.$0$_.Count != 0) {", name()); + writer->WriteLine(" result.$0$_.Add(other.$0$_);", name()); + writer->WriteLine("}"); +} + +void RepeatedPrimitiveFieldGenerator::GenerateBuildingCode(Writer* writer) { + writer->WriteLine("$0$_.MakeReadOnly();", name()); +} + +void RepeatedPrimitiveFieldGenerator::GenerateParsingCode(Writer* writer) { + writer->WriteLine("input.Read$0$Array(tag, field_name, result.$1$_);", + capitalized_type_name(), name()); +} + +void RepeatedPrimitiveFieldGenerator::GenerateSerializationCode( + Writer* writer) { + writer->WriteLine("if ($0$_.Count > 0) {", name()); + writer->Indent(); + if (descriptor_->is_packed()) { + writer->WriteLine( + "output.WritePacked$0$Array($1$, field_names[$3$], $2$MemoizedSerializedSize, $2$_);", + capitalized_type_name(), number(), name(), field_ordinal()); + } else { + writer->WriteLine("output.Write$0$Array($1$, field_names[$3$], $2$_);", + capitalized_type_name(), number(), name(), + field_ordinal()); + } + writer->Outdent(); + writer->WriteLine("}"); +} + +void RepeatedPrimitiveFieldGenerator::GenerateSerializedSizeCode( + Writer* writer) { + writer->WriteLine("{"); + writer->Indent(); + writer->WriteLine("int dataSize = 0;"); + int fixedSize = GetFixedSize(descriptor_->type()); + if (fixedSize == -1) { + writer->WriteLine("foreach ($0$ element in $1$List) {", type_name(), + property_name()); + writer->WriteLine( + " dataSize += pb::CodedOutputStream.Compute$0$SizeNoTag(element);", + capitalized_type_name(), number()); + writer->WriteLine("}"); + } else { + writer->WriteLine("dataSize = $0$ * $1$_.Count;", SimpleItoa(fixedSize), name()); + } + writer->WriteLine("size += dataSize;"); + int tagSize = internal::WireFormat::TagSize(descriptor_->number(), descriptor_->type()); + if (descriptor_->is_packed()) { + writer->WriteLine("if ($0$_.Count != 0) {", name()); + writer->WriteLine( + " size += $0$ + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize);", + SimpleItoa(tagSize)); + writer->WriteLine("}"); + } else { + writer->WriteLine("size += $0$ * $1$_.Count;", SimpleItoa(tagSize), name()); + } + // cache the data size for packed fields. + if (descriptor_->is_packed()) { + writer->WriteLine("$0$MemoizedSerializedSize = dataSize;", name()); + } + writer->Outdent(); + writer->WriteLine("}"); +} + +void RepeatedPrimitiveFieldGenerator::WriteHash(Writer* writer) { + writer->WriteLine("foreach($0$ i in $1$_)", type_name(), name()); + writer->WriteLine(" hash ^= i.GetHashCode();"); +} +void RepeatedPrimitiveFieldGenerator::WriteEquals(Writer* writer) { + writer->WriteLine("if($0$_.Count != other.$0$_.Count) return false;", name()); + writer->WriteLine("for(int ix=0; ix < $0$_.Count; ix++)", name()); + writer->WriteLine(" if(!$0$_[ix].Equals(other.$0$_[ix])) return false;", + name()); +} +void RepeatedPrimitiveFieldGenerator::WriteToString(Writer* writer) { + writer->WriteLine("PrintField(\"$0$\", $1$_, writer);", descriptor_->name(), + name()); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h new file mode 100644 index 00000000..07b12015 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h @@ -0,0 +1,73 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_PRIMITIVE_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_PRIMITIVE_FIELD_H__ + +#include <string> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/csharp/csharp_field_base.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class RepeatedPrimitiveFieldGenerator : public FieldGeneratorBase { + public: + RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + ~RepeatedPrimitiveFieldGenerator(); + + virtual void GenerateMembers(Writer* writer); + virtual void GenerateBuilderMembers(Writer* writer); + virtual void GenerateMergingCode(Writer* writer); + virtual void GenerateBuildingCode(Writer* writer); + virtual void GenerateParsingCode(Writer* writer); + virtual void GenerateSerializationCode(Writer* writer); + virtual void GenerateSerializedSizeCode(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_PRIMITIVE_FIELD_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc b/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc new file mode 100644 index 00000000..8dfb41d4 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc @@ -0,0 +1,75 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <sstream> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> + +#include <google/protobuf/compiler/csharp/csharp_source_generator_base.h> +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/compiler/csharp/csharp_writer.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +SourceGeneratorBase::SourceGeneratorBase(const FileDescriptor* descriptor) + : descriptor_(descriptor) { + optimizeSize_ = (descriptor->options().optimize_for() + == FileOptions::CODE_SIZE); + optimizeSpeed_ = (descriptor->options().optimize_for() == FileOptions::SPEED); + useLiteRuntime_ = (descriptor->options().optimize_for() + == FileOptions::LITE_RUNTIME); + + optimizeSpeed_ |= useLiteRuntime_; + runtimeSuffix_ = useLiteRuntime_ ? "Lite" : ""; +} + +SourceGeneratorBase::~SourceGeneratorBase() { +} + +void SourceGeneratorBase::WriteGeneratedCodeAttributes(Writer* writer) { + // This hook can be used to reintroduce generated code attributes in the future. +} + +std::string SourceGeneratorBase::class_access_level() { + return "public"; // public_classes is always on. +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h b/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h new file mode 100644 index 00000000..1955394e --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h @@ -0,0 +1,83 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_SOURCE_GENERATOR_BASE_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_SOURCE_GENERATOR_BASE_H__ + +#include <string> + +#include <google/protobuf/compiler/code_generator.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class SourceGeneratorBase { + protected: + SourceGeneratorBase(const FileDescriptor* descriptor); + virtual ~SourceGeneratorBase(); + + std::string class_access_level(); + + bool optimize_size() { + return optimizeSize_; + } + bool optimize_speed() { + return optimizeSpeed_; + } + bool use_lite_runtime() { + return useLiteRuntime_; + } + std::string runtime_suffix() { + return runtimeSuffix_; + } + + void WriteGeneratedCodeAttributes(Writer* writer); + + private: + const FileDescriptor* descriptor_; + bool optimizeSize_; + bool optimizeSpeed_; + bool useLiteRuntime_; + std::string runtimeSuffix_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SourceGeneratorBase); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_SOURCE_GENERATOR_BASE_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc new file mode 100644 index 00000000..358cfa4f --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc @@ -0,0 +1,286 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <sstream> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> + +#include <google/protobuf/compiler/csharp/csharp_umbrella_class.h> +#include <google/protobuf/compiler/csharp/csharp_enum.h> +#include <google/protobuf/compiler/csharp/csharp_extension.h> +#include <google/protobuf/compiler/csharp/csharp_helpers.h> +#include <google/protobuf/compiler/csharp/csharp_message.h> +#include <google/protobuf/compiler/csharp/csharp_writer.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +UmbrellaClassGenerator::UmbrellaClassGenerator(const FileDescriptor* file) + : SourceGeneratorBase(file), + file_(file) { + namespace_ = GetFileNamespace(file); + umbrellaClassname_ = GetFileUmbrellaClassname(file); + umbrellaNamespace_ = GetFileUmbrellaNamespace(file); +} + +UmbrellaClassGenerator::~UmbrellaClassGenerator() { +} + +void UmbrellaClassGenerator::Generate(Writer* writer) { + WriteIntroduction(writer); + WriteExtensionRegistration(writer); + + // write children: Extensions + if (file_->extension_count() > 0) { + writer->WriteLine("#region Extensions"); + for (int i = 0; i < file_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(file_->extension(i)); + extensionGenerator.Generate(writer); + } + writer->WriteLine("#endregion"); + writer->WriteLine(); + } + + writer->WriteLine("#region Static variables"); + for (int i = 0; i < file_->message_type_count(); i++) { + MessageGenerator messageGenerator(file_->message_type(i)); + messageGenerator.GenerateStaticVariables(writer); + } + writer->WriteLine("#endregion"); + if (!use_lite_runtime()) { + WriteDescriptor(writer); + } else { + WriteLiteExtensions(writer); + } + // Close the class declaration. + writer->Outdent(); + writer->WriteLine("}"); + + // Close the namespace around the umbrella class if defined + if (!umbrellaNamespace_.empty()) { + writer->Outdent(); + writer->WriteLine("}"); + } + + // write children: Enums + if (file_->enum_type_count() > 0) { + writer->WriteLine("#region Enums"); + for (int i = 0; i < file_->enum_type_count(); i++) { + EnumGenerator enumGenerator(file_->enum_type(i)); + enumGenerator.Generate(writer); + } + writer->WriteLine("#endregion"); + writer->WriteLine(); + } + + // write children: Messages + if (file_->message_type_count() > 0) { + writer->WriteLine("#region Messages"); + for (int i = 0; i < file_->message_type_count(); i++) { + MessageGenerator messageGenerator(file_->message_type(i)); + messageGenerator.Generate(writer); + } + writer->WriteLine("#endregion"); + writer->WriteLine(); + } + + // TODO(jtattermusch): add insertion point for services. + + if (!namespace_.empty()) { + writer->Outdent(); + writer->WriteLine("}"); + } + writer->WriteLine(); + writer->WriteLine("#endregion Designer generated code"); +} + +void UmbrellaClassGenerator::WriteIntroduction(Writer* writer) { + writer->WriteLine( + "// Generated by the protocol buffer compiler. DO NOT EDIT!"); + writer->WriteLine("// source: $0$", file_->name()); + writer->WriteLine("#pragma warning disable 1591, 0612, 3021"); + writer->WriteLine("#region Designer generated code"); + + writer->WriteLine(); + writer->WriteLine("using pb = global::Google.ProtocolBuffers;"); + writer->WriteLine("using pbc = global::Google.ProtocolBuffers.Collections;"); + writer->WriteLine("using pbd = global::Google.ProtocolBuffers.Descriptors;"); + writer->WriteLine("using scg = global::System.Collections.Generic;"); + + if (!namespace_.empty()) { + writer->WriteLine("namespace $0$ {", namespace_); + writer->Indent(); + writer->WriteLine(); + } + + // Add the namespace around the umbrella class if defined + if (!umbrellaNamespace_.empty()) { + writer->WriteLine("namespace $0$ {", umbrellaNamespace_); + writer->Indent(); + writer->WriteLine(); + } + + writer->WriteLine( + "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer->WriteLine("$0$ static partial class $1$ {", class_access_level(), + umbrellaClassname_); + writer->WriteLine(); + writer->Indent(); +} + +void UmbrellaClassGenerator::WriteExtensionRegistration(Writer* writer) { + writer->WriteLine("#region Extension registration"); + writer->WriteLine( + "public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {"); + writer->Indent(); + for (int i = 0; i < file_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(file_->extension(i)); + extensionGenerator.GenerateExtensionRegistrationCode(writer); + } + for (int i = 0; i < file_->message_type_count(); i++) { + MessageGenerator messageGenerator(file_->message_type(i)); + messageGenerator.GenerateExtensionRegistrationCode(writer); + } + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine("#endregion"); +} + +void UmbrellaClassGenerator::WriteDescriptor(Writer* writer) { + writer->WriteLine("#region Descriptor"); + + writer->WriteLine("public static pbd::FileDescriptor Descriptor {"); + writer->WriteLine(" get { return descriptor; }"); + writer->WriteLine("}"); + writer->WriteLine("private static pbd::FileDescriptor descriptor;"); + writer->WriteLine(); + writer->WriteLine("static $0$() {", umbrellaClassname_); + writer->Indent(); + writer->WriteLine( + "byte[] descriptorData = global::System.Convert.FromBase64String("); + writer->Indent(); + writer->Indent(); + writer->WriteLine("string.Concat("); + writer->Indent(); + + // TODO(jonskeet): Consider a C#-escaping format here instead of just Base64. + std::string base64 = FileDescriptorToBase64(file_); + while (base64.size() > 60) { + writer->WriteLine("\"$0$\", ", base64.substr(0, 60)); + base64 = base64.substr(60); + } + writer->Outdent(); + writer->WriteLine("\"$0$\"));", base64); + writer->Outdent(); + writer->Outdent(); + writer->WriteLine( + "pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {"); + writer->Indent(); + writer->WriteLine("descriptor = root;"); + for (int i = 0; i < file_->message_type_count(); i++) { + MessageGenerator messageGenerator(file_->message_type(i)); + messageGenerator.GenerateStaticVariableInitializers(writer); + } + for (int i = 0; i < file_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(file_->extension(i)); + extensionGenerator.GenerateStaticVariableInitializers(writer); + } + + if (uses_extensions()) { + // Must construct an ExtensionRegistry containing all possible extensions + // and return it. + writer->WriteLine( + "pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance();"); + writer->WriteLine("RegisterAllExtensions(registry);"); + for (int i = 0; i < file_->dependency_count(); i++) { + writer->WriteLine("$0$.RegisterAllExtensions(registry);", + GetFullUmbrellaClassName(file_->dependency(i))); + } + writer->WriteLine("return registry;"); + } else { + writer->WriteLine("return null;"); + } + writer->Outdent(); + writer->WriteLine("};"); + + // ----------------------------------------------------------------- + // Invoke internalBuildGeneratedFileFrom() to build the file. + writer->WriteLine( + "pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,"); + writer->WriteLine(" new pbd::FileDescriptor[] {"); + for (int i = 0; i < file_->dependency_count(); i++) { + writer->WriteLine(" $0$.Descriptor, ", + GetFullUmbrellaClassName(file_->dependency(i))); + } + writer->WriteLine(" }, assigner);"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine("#endregion"); + writer->WriteLine(); +} + +void UmbrellaClassGenerator::WriteLiteExtensions(Writer* writer) { + writer->WriteLine("#region Extensions"); + writer->WriteLine("internal static readonly object Descriptor;"); + writer->WriteLine("static $0$() {", umbrellaClassname_); + writer->Indent(); + writer->WriteLine("Descriptor = null;"); + for (int i = 0; i < file_->message_type_count(); i++) { + MessageGenerator messageGenerator(file_->message_type(i)); + messageGenerator.GenerateStaticVariableInitializers(writer); + } + for (int i = 0; i < file_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(file_->extension(i)); + extensionGenerator.GenerateStaticVariableInitializers(writer); + } + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine("#endregion"); + writer->WriteLine(); +} + +bool UmbrellaClassGenerator::uses_extensions() { + // TODO(jtattermusch): implement recursive descent that looks for extensions. + // For now, we conservatively assume that extensions are used. + return true; +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_umbrella_class.h b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.h new file mode 100644 index 00000000..757f8f91 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.h @@ -0,0 +1,76 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_UMBRELLA_CLASS_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_UMBRELLA_CLASS_H__ + +#include <string> + +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/csharp/csharp_source_generator_base.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class UmbrellaClassGenerator : public SourceGeneratorBase { + public: + UmbrellaClassGenerator(const FileDescriptor* file); + ~UmbrellaClassGenerator(); + + void Generate(Writer* write); + + private: + const FileDescriptor* file_; + + std::string namespace_; + std::string umbrellaClassname_; + std::string umbrellaNamespace_; + + void WriteIntroduction(Writer* writer); + void WriteExtensionRegistration(Writer* writer); + void WriteDescriptor(Writer* writer); + void WriteLiteExtensions(Writer* write); + + bool uses_extensions(); + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(UmbrellaClassGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_UMBRELLA_CLASS_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_writer.cc b/src/google/protobuf/compiler/csharp/csharp_writer.cc new file mode 100644 index 00000000..2bcafde5 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_writer.cc @@ -0,0 +1,136 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#include <algorithm> +#include <google/protobuf/stubs/hash.h> +#include <limits> +#include <vector> + +#include <google/protobuf/compiler/csharp/csharp_writer.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/wire_format.h> +#include <google/protobuf/stubs/strutil.h> +#include <google/protobuf/stubs/substitute.h> + +#include <google/protobuf/compiler/csharp/csharp_field_base.h> +#include <google/protobuf/compiler/csharp/csharp_enum_field.h> +#include <google/protobuf/compiler/csharp/csharp_message_field.h> +#include <google/protobuf/compiler/csharp/csharp_primitive_field.h> +#include <google/protobuf/compiler/csharp/csharp_repeated_enum_field.h> +#include <google/protobuf/compiler/csharp/csharp_repeated_message_field.h> +#include <google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +Writer::Writer(google::protobuf::io::Printer* printer) + : printer_(printer), + newline_("\n") { + // TODO(jtattermusch): make newline customizable. +} + +Writer::~Writer() { +} + +void Writer::Indent() { + printer_->Indent(); +} + +void Writer::Outdent() { + printer_->Outdent(); +} + +void Writer::Write(const char* text) { + printer_->Print(text); +} + +void Writer::Write(const char* text, const string& value0) { + printer_->Print(text, "0", value0); +} + +void Writer::Write(const char* text, const string& value0, + const string& value1) { + printer_->Print(text, "0", value0, "1", value1); +} + +void Writer::Write(const char* text, const string& value0, const string& value1, + const string& value2) { + printer_->Print(text, "0", value0, "1", value1, "2", value2); +} + +void Writer::Write(const char* text, const string& value0, const string& value1, + const string& value2, const string& value3) { + printer_->Print(text, "0", value0, "1", value1, "2", value2, "3", value3); +} + +void Writer::WriteLine() { + printer_->Print(newline_); +} + +void Writer::WriteLine(const char* text) { + Write(text); + WriteLine(); +} + +void Writer::WriteLine(const char* text, const string& value0) { + Write(text, value0); + WriteLine(); +} + +void Writer::WriteLine(const char* text, const string& value0, + const string& value1) { + Write(text, value0, value1); + WriteLine(); +} + +void Writer::WriteLine(const char* text, const string& value0, + const string& value1, const string& value2) { + Write(text, value0, value1, value2); + WriteLine(); +} + +void Writer::WriteLine(const char* text, const string& value0, + const string& value1, const string& value2, + const string& value3) { + Write(text, value0, value1, value2, value3); + WriteLine(); +} + +} // namespace java +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_writer.h b/src/google/protobuf/compiler/csharp/csharp_writer.h new file mode 100644 index 00000000..26c59b31 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_writer.h @@ -0,0 +1,93 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_WRITER_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_WRITER_H__ + +#include <string> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/io/printer.h> + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +// Simple wrapper around Printer that supports customizable line endings +// and number-based variables (e.g. $0$). +class Writer { + public: + Writer(io::Printer* printer); + ~Writer(); + + void Indent(); + void Outdent(); + + void Write(const char* text); + + void Write(const char* text, const string& value0); + + void Write(const char* text, const string& value0, const string& value1); + + void Write(const char* text, const string& value0, const string& value1, + const string& value2); + + void Write(const char* text, const string& value0, const string& value1, + const string& value2, const string& value3); + + void WriteLine(); + + void WriteLine(const char* text); + + void WriteLine(const char* text, const string& value0); + + void WriteLine(const char* text, const string& value0, const string& value1); + + void WriteLine(const char* text, const string& value0, const string& value1, + const string& value2); + + void WriteLine(const char* text, const string& value0, const string& value1, + const string& value2, const string& value3); + private: + io::Printer* printer_; + const char* newline_; +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_WRITER_H__ diff --git a/src/google/protobuf/compiler/main.cc b/src/google/protobuf/compiler/main.cc index cff80164..4815a726 100644 --- a/src/google/protobuf/compiler/main.cc +++ b/src/google/protobuf/compiler/main.cc @@ -36,6 +36,7 @@ #include <google/protobuf/compiler/java/java_generator.h> #include <google/protobuf/compiler/javanano/javanano_generator.h> #include <google/protobuf/compiler/ruby/ruby_generator.h> +#include <google/protobuf/compiler/csharp/csharp_generator.h> #include <google/protobuf/compiler/objectivec/objectivec_generator.h> int main(int argc, char* argv[]) { @@ -69,6 +70,11 @@ int main(int argc, char* argv[]) { cli.RegisterGenerator("--ruby_out", &rb_generator, "Generate Ruby source file."); + // CSharp + google::protobuf::compiler::csharp::Generator csharp_generator; + cli.RegisterGenerator("--csharp_out", &csharp_generator, + "Generate C# source file."); + // Objective C google::protobuf::compiler::objectivec::ObjectiveCGenerator objc_generator; cli.RegisterGenerator("--objc_out", &objc_generator, diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index c201136e..5ae36510 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -289,7 +289,7 @@ void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto() { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, _internal_metadata_), -1); FileOptions_descriptor_ = file->message_type(9); - static const int FileOptions_offsets_[14] = { + static const int FileOptions_offsets_[15] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_package_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_outer_classname_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_multiple_files_), @@ -303,6 +303,7 @@ void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto() { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, deprecated_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_enable_arenas_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, objc_class_prefix_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, csharp_namespace_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, uninterpreted_option_), }; FileOptions_reflection_ = @@ -663,7 +664,7 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { "t_type\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036.google.p" "rotobuf.MethodOptions\022\037\n\020client_streamin" "g\030\005 \001(\010:\005false\022\037\n\020server_streaming\030\006 \001(\010" - ":\005false\"\347\004\n\013FileOptions\022\024\n\014java_package\030" + ":\005false\"\201\005\n\013FileOptions\022\024\n\014java_package\030" "\001 \001(\t\022\034\n\024java_outer_classname\030\010 \001(\t\022\"\n\023j" "ava_multiple_files\030\n \001(\010:\005false\022,\n\035java_" "generate_equals_and_hash\030\024 \001(\010:\005false\022%\n" @@ -675,50 +676,52 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { "se\022\"\n\023py_generic_services\030\022 \001(\010:\005false\022\031" "\n\ndeprecated\030\027 \001(\010:\005false\022\037\n\020cc_enable_a" "renas\030\037 \001(\010:\005false\022\031\n\021objc_class_prefix\030" - "$ \001(\t\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.g" - "oogle.protobuf.UninterpretedOption\":\n\014Op" - "timizeMode\022\t\n\005SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014" - "LITE_RUNTIME\020\003*\t\010\350\007\020\200\200\200\200\002\"\346\001\n\016MessageOpt" - "ions\022&\n\027message_set_wire_format\030\001 \001(\010:\005f" - "alse\022.\n\037no_standard_descriptor_accessor\030" - "\002 \001(\010:\005false\022\031\n\ndeprecated\030\003 \001(\010:\005false\022" - "\021\n\tmap_entry\030\007 \001(\010\022C\n\024uninterpreted_opti" - "on\030\347\007 \003(\0132$.google.protobuf.Uninterprete" - "dOption*\t\010\350\007\020\200\200\200\200\002\"\240\002\n\014FieldOptions\022:\n\005c" - "type\030\001 \001(\0162#.google.protobuf.FieldOption" - "s.CType:\006STRING\022\016\n\006packed\030\002 \001(\010\022\023\n\004lazy\030" - "\005 \001(\010:\005false\022\031\n\ndeprecated\030\003 \001(\010:\005false\022" - "\023\n\004weak\030\n \001(\010:\005false\022C\n\024uninterpreted_op" - "tion\030\347\007 \003(\0132$.google.protobuf.Uninterpre" - "tedOption\"/\n\005CType\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001" - "\022\020\n\014STRING_PIECE\020\002*\t\010\350\007\020\200\200\200\200\002\"\215\001\n\013EnumOp" - "tions\022\023\n\013allow_alias\030\002 \001(\010\022\031\n\ndeprecated" - "\030\003 \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007" - " \003(\0132$.google.protobuf.UninterpretedOpti" - "on*\t\010\350\007\020\200\200\200\200\002\"}\n\020EnumValueOptions\022\031\n\ndep" - "recated\030\001 \001(\010:\005false\022C\n\024uninterpreted_op" - "tion\030\347\007 \003(\0132$.google.protobuf.Uninterpre" - "tedOption*\t\010\350\007\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031" - "\n\ndeprecated\030! \001(\010:\005false\022C\n\024uninterpret" - "ed_option\030\347\007 \003(\0132$.google.protobuf.Unint" - "erpretedOption*\t\010\350\007\020\200\200\200\200\002\"z\n\rMethodOptio" - "ns\022\031\n\ndeprecated\030! \001(\010:\005false\022C\n\024uninter" - "preted_option\030\347\007 \003(\0132$.google.protobuf.U" - "ninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023Uninte" - "rpretedOption\022;\n\004name\030\002 \003(\0132-.google.pro" - "tobuf.UninterpretedOption.NamePart\022\030\n\020id" - "entifier_value\030\003 \001(\t\022\032\n\022positive_int_val" - "ue\030\004 \001(\004\022\032\n\022negative_int_value\030\005 \001(\003\022\024\n\014" - "double_value\030\006 \001(\001\022\024\n\014string_value\030\007 \001(\014" - "\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010NamePart\022\021\n" - "\tname_part\030\001 \002(\t\022\024\n\014is_extension\030\002 \002(\010\"\325" - "\001\n\016SourceCodeInfo\022:\n\010location\030\001 \003(\0132(.go" - "ogle.protobuf.SourceCodeInfo.Location\032\206\001" - "\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003" - "(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022\031\n\021trai" - "ling_comments\030\004 \001(\t\022!\n\031leading_detached_" - "comments\030\006 \003(\tB/\n\023com.google.protobufB\020D" - "escriptorProtosH\001\242\002\003GPB", 4623); + "$ \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022C\n\024unint" + "erpreted_option\030\347\007 \003(\0132$.google.protobuf" + ".UninterpretedOption\":\n\014OptimizeMode\022\t\n\005" + "SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003" + "*\t\010\350\007\020\200\200\200\200\002\"\346\001\n\016MessageOptions\022&\n\027messag" + "e_set_wire_format\030\001 \001(\010:\005false\022.\n\037no_sta" + "ndard_descriptor_accessor\030\002 \001(\010:\005false\022\031" + "\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_entry\030\007" + " \001(\010\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.go" + "ogle.protobuf.UninterpretedOption*\t\010\350\007\020\200" + "\200\200\200\002\"\240\002\n\014FieldOptions\022:\n\005ctype\030\001 \001(\0162#.g" + "oogle.protobuf.FieldOptions.CType:\006STRIN" + "G\022\016\n\006packed\030\002 \001(\010\022\023\n\004lazy\030\005 \001(\010:\005false\022\031" + "\n\ndeprecated\030\003 \001(\010:\005false\022\023\n\004weak\030\n \001(\010:" + "\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$." + "google.protobuf.UninterpretedOption\"/\n\005C" + "Type\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIE" + "CE\020\002*\t\010\350\007\020\200\200\200\200\002\"\215\001\n\013EnumOptions\022\023\n\013allow" + "_alias\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005false\022" + "C\n\024uninterpreted_option\030\347\007 \003(\0132$.google." + "protobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"" + "}\n\020EnumValueOptions\022\031\n\ndeprecated\030\001 \001(\010:" + "\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$." + "google.protobuf.UninterpretedOption*\t\010\350\007" + "\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprecated\030!" + " \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003" + "(\0132$.google.protobuf.UninterpretedOption" + "*\t\010\350\007\020\200\200\200\200\002\"z\n\rMethodOptions\022\031\n\ndeprecat" + "ed\030! \001(\010:\005false\022C\n\024uninterpreted_option\030" + "\347\007 \003(\0132$.google.protobuf.UninterpretedOp" + "tion*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023UninterpretedOption\022" + ";\n\004name\030\002 \003(\0132-.google.protobuf.Uninterp" + "retedOption.NamePart\022\030\n\020identifier_value" + "\030\003 \001(\t\022\032\n\022positive_int_value\030\004 \001(\004\022\032\n\022ne" + "gative_int_value\030\005 \001(\003\022\024\n\014double_value\030\006" + " \001(\001\022\024\n\014string_value\030\007 \001(\014\022\027\n\017aggregate_" + "value\030\010 \001(\t\0323\n\010NamePart\022\021\n\tname_part\030\001 \002" + "(\t\022\024\n\014is_extension\030\002 \002(\010\"\325\001\n\016SourceCodeI" + "nfo\022:\n\010location\030\001 \003(\0132(.google.protobuf." + "SourceCodeInfo.Location\032\206\001\n\010Location\022\020\n\004" + "path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020lead" + "ing_comments\030\003 \001(\t\022\031\n\021trailing_comments\030" + "\004 \001(\t\022!\n\031leading_detached_comments\030\006 \003(\t" + "BY\n\023com.google.protobufB\020DescriptorProto" + "sH\001\242\002\003GPB\252\002\'Google.ProtocolBuffers.Descr" + "iptorProtos", 4691); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/descriptor.proto", &protobuf_RegisterTypes); FileDescriptorSet::default_instance_ = new FileDescriptorSet(); @@ -7016,6 +7019,7 @@ const int FileOptions::kPyGenericServicesFieldNumber; const int FileOptions::kDeprecatedFieldNumber; const int FileOptions::kCcEnableArenasFieldNumber; const int FileOptions::kObjcClassPrefixFieldNumber; +const int FileOptions::kCsharpNamespaceFieldNumber; const int FileOptions::kUninterpretedOptionFieldNumber; #endif // !_MSC_VER @@ -7052,6 +7056,7 @@ void FileOptions::SharedCtor() { deprecated_ = false; cc_enable_arenas_ = false; objc_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + csharp_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } @@ -7065,6 +7070,7 @@ void FileOptions::SharedDtor() { java_outer_classname_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); go_package_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); objc_class_prefix_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + csharp_namespace_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != default_instance_) { } } @@ -7117,11 +7123,14 @@ void FileOptions::Clear() { go_package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } } - if (_has_bits_[8 / 32] & 7936) { + if (_has_bits_[8 / 32] & 16128) { ZR_(java_generic_services_, cc_enable_arenas_); if (has_objc_class_prefix()) { objc_class_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + if (has_csharp_namespace()) { + csharp_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } } #undef ZR_HELPER_ @@ -7347,6 +7356,23 @@ bool FileOptions::MergePartialFromCodedStream( } else { goto handle_unusual; } + if (input->ExpectTag(298)) goto parse_csharp_namespace; + break; + } + + // optional string csharp_namespace = 37; + case 37: { + if (tag == 298) { + parse_csharp_namespace: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_csharp_namespace())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->csharp_namespace().data(), this->csharp_namespace().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.FileOptions.csharp_namespace"); + } else { + goto handle_unusual; + } if (input->ExpectTag(7994)) goto parse_uninterpreted_option; break; } @@ -7481,6 +7507,16 @@ void FileOptions::SerializeWithCachedSizes( 36, this->objc_class_prefix(), output); } + // optional string csharp_namespace = 37; + if (has_csharp_namespace()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->csharp_namespace().data(), this->csharp_namespace().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.csharp_namespace"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 37, this->csharp_namespace(), output); + } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( @@ -7591,6 +7627,17 @@ void FileOptions::SerializeWithCachedSizes( 36, this->objc_class_prefix(), target); } + // optional string csharp_namespace = 37; + if (has_csharp_namespace()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->csharp_namespace().data(), this->csharp_namespace().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.csharp_namespace"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 37, this->csharp_namespace(), target); + } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: @@ -7662,7 +7709,7 @@ int FileOptions::ByteSize() const { } } - if (_has_bits_[8 / 32] & 7936) { + if (_has_bits_[8 / 32] & 16128) { // optional bool java_generic_services = 17 [default = false]; if (has_java_generic_services()) { total_size += 2 + 1; @@ -7690,6 +7737,13 @@ int FileOptions::ByteSize() const { this->objc_class_prefix()); } + // optional string csharp_namespace = 37; + if (has_csharp_namespace()) { + total_size += 2 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->csharp_namespace()); + } + } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; total_size += 2 * this->uninterpreted_option_size(); @@ -7773,6 +7827,10 @@ void FileOptions::MergeFrom(const FileOptions& from) { set_has_objc_class_prefix(); objc_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.objc_class_prefix_); } + if (from.has_csharp_namespace()) { + set_has_csharp_namespace(); + csharp_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.csharp_namespace_); + } } _extensions_.MergeFrom(from._extensions_); if (from._internal_metadata_.have_unknown_fields()) { @@ -7817,6 +7875,7 @@ void FileOptions::InternalSwap(FileOptions* other) { std::swap(deprecated_, other->deprecated_); std::swap(cc_enable_arenas_, other->cc_enable_arenas_); objc_class_prefix_.Swap(&other->objc_class_prefix_); + csharp_namespace_.Swap(&other->csharp_namespace_); uninterpreted_option_.UnsafeArenaSwap(&other->uninterpreted_option_); std::swap(_has_bits_[0], other->_has_bits_[0]); _internal_metadata_.Swap(&other->_internal_metadata_); @@ -8264,6 +8323,59 @@ void FileOptions::InternalSwap(FileOptions* other) { // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix) } +// optional string csharp_namespace = 37; + bool FileOptions::has_csharp_namespace() const { + return (_has_bits_[0] & 0x00002000u) != 0; +} + void FileOptions::set_has_csharp_namespace() { + _has_bits_[0] |= 0x00002000u; +} + void FileOptions::clear_has_csharp_namespace() { + _has_bits_[0] &= ~0x00002000u; +} + void FileOptions::clear_csharp_namespace() { + csharp_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_csharp_namespace(); +} + const ::std::string& FileOptions::csharp_namespace() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.csharp_namespace) + return csharp_namespace_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void FileOptions::set_csharp_namespace(const ::std::string& value) { + set_has_csharp_namespace(); + csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace) +} + void FileOptions::set_csharp_namespace(const char* value) { + set_has_csharp_namespace(); + csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.csharp_namespace) +} + void FileOptions::set_csharp_namespace(const char* value, size_t size) { + set_has_csharp_namespace(); + csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.csharp_namespace) +} + ::std::string* FileOptions::mutable_csharp_namespace() { + set_has_csharp_namespace(); + // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.csharp_namespace) + return csharp_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* FileOptions::release_csharp_namespace() { + clear_has_csharp_namespace(); + return csharp_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_namespace) { + if (csharp_namespace != NULL) { + set_has_csharp_namespace(); + } else { + clear_has_csharp_namespace(); + } + csharp_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), csharp_namespace); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace) +} + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int FileOptions::uninterpreted_option_size() const { return uninterpreted_option_.size(); diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index d8cba659..5bebf4fd 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -1837,6 +1837,18 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { ::std::string* release_objc_class_prefix(); void set_allocated_objc_class_prefix(::std::string* objc_class_prefix); + // optional string csharp_namespace = 37; + bool has_csharp_namespace() const; + void clear_csharp_namespace(); + static const int kCsharpNamespaceFieldNumber = 37; + const ::std::string& csharp_namespace() const; + void set_csharp_namespace(const ::std::string& value); + void set_csharp_namespace(const char* value); + void set_csharp_namespace(const char* value, size_t size); + ::std::string* mutable_csharp_namespace(); + ::std::string* release_csharp_namespace(); + void set_allocated_csharp_namespace(::std::string* csharp_namespace); + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; void clear_uninterpreted_option(); @@ -1878,6 +1890,8 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { inline void clear_has_cc_enable_arenas(); inline void set_has_objc_class_prefix(); inline void clear_has_objc_class_prefix(); + inline void set_has_csharp_namespace(); + inline void clear_has_csharp_namespace(); ::google::protobuf::internal::ExtensionSet _extensions_; @@ -1893,6 +1907,7 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { int optimize_for_; ::google::protobuf::internal::ArenaStringPtr go_package_; ::google::protobuf::internal::ArenaStringPtr objc_class_prefix_; + ::google::protobuf::internal::ArenaStringPtr csharp_namespace_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; bool java_generic_services_; bool py_generic_services_; @@ -5502,6 +5517,59 @@ inline void FileOptions::set_allocated_objc_class_prefix(::std::string* objc_cla // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix) } +// optional string csharp_namespace = 37; +inline bool FileOptions::has_csharp_namespace() const { + return (_has_bits_[0] & 0x00002000u) != 0; +} +inline void FileOptions::set_has_csharp_namespace() { + _has_bits_[0] |= 0x00002000u; +} +inline void FileOptions::clear_has_csharp_namespace() { + _has_bits_[0] &= ~0x00002000u; +} +inline void FileOptions::clear_csharp_namespace() { + csharp_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_csharp_namespace(); +} +inline const ::std::string& FileOptions::csharp_namespace() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.csharp_namespace) + return csharp_namespace_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void FileOptions::set_csharp_namespace(const ::std::string& value) { + set_has_csharp_namespace(); + csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace) +} +inline void FileOptions::set_csharp_namespace(const char* value) { + set_has_csharp_namespace(); + csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.csharp_namespace) +} +inline void FileOptions::set_csharp_namespace(const char* value, size_t size) { + set_has_csharp_namespace(); + csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.csharp_namespace) +} +inline ::std::string* FileOptions::mutable_csharp_namespace() { + set_has_csharp_namespace(); + // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.csharp_namespace) + return csharp_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* FileOptions::release_csharp_namespace() { + clear_has_csharp_namespace(); + return csharp_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_namespace) { + if (csharp_namespace != NULL) { + set_has_csharp_namespace(); + } else { + clear_has_csharp_namespace(); + } + csharp_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), csharp_namespace); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace) +} + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int FileOptions::uninterpreted_option_size() const { return uninterpreted_option_.size(); diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto index de242690..7099135d 100644 --- a/src/google/protobuf/descriptor.proto +++ b/src/google/protobuf/descriptor.proto @@ -42,6 +42,7 @@ syntax = "proto2"; package google.protobuf; option java_package = "com.google.protobuf"; option java_outer_classname = "DescriptorProtos"; +option csharp_namespace = "Google.ProtocolBuffers.DescriptorProtos"; option objc_class_prefix = "GPB"; // descriptor.proto must be optimized for speed because reflection-based @@ -352,6 +353,9 @@ message FileOptions { // generated classes from this .proto. There is no default. optional string objc_class_prefix = 36; + // Namespace for generated classes; defaults to the package. + optional string csharp_namespace = 37; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -482,8 +486,6 @@ message FieldOptions { // For Google-internal migration only. Do not use. optional bool weak = 10 [default=false]; - - // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc new file mode 100644 index 00000000..2e0ee45e --- /dev/null +++ b/src/google/protobuf/duration.pb.cc @@ -0,0 +1,406 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/duration.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "google/protobuf/duration.pb.h" + +#include <algorithm> + +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/once.h> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/wire_format_lite_inl.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/generated_message_reflection.h> +#include <google/protobuf/reflection_ops.h> +#include <google/protobuf/wire_format.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +namespace { + +const ::google::protobuf::Descriptor* Duration_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Duration_reflection_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_google_2fprotobuf_2fduration_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fduration_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "google/protobuf/duration.proto"); + GOOGLE_CHECK(file != NULL); + Duration_descriptor_ = file->message_type(0); + static const int Duration_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, seconds_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, nanos_), + }; + Duration_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Duration_descriptor_, + Duration::default_instance_, + Duration_offsets_, + -1, + -1, + -1, + sizeof(Duration), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Duration, _is_default_instance_)); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_google_2fprotobuf_2fduration_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Duration_descriptor_, &Duration::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_google_2fprotobuf_2fduration_2eproto() { + delete Duration::default_instance_; + delete Duration_reflection_; +} + +void protobuf_AddDesc_google_2fprotobuf_2fduration_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n\036google/protobuf/duration.proto\022\017google" + ".protobuf\"*\n\010Duration\022\017\n\007seconds\030\001 \001(\003\022\r" + "\n\005nanos\030\002 \001(\005B/\n\023com.google.protobufB\rDu" + "rationProtoP\001\240\001\001\242\002\003GPBb\006proto3", 150); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "google/protobuf/duration.proto", &protobuf_RegisterTypes); + Duration::default_instance_ = new Duration(); + Duration::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fduration_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_google_2fprotobuf_2fduration_2eproto { + StaticDescriptorInitializer_google_2fprotobuf_2fduration_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fduration_2eproto(); + } +} static_descriptor_initializer_google_2fprotobuf_2fduration_2eproto_; + +namespace { + +static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD; +static void MergeFromFail(int line) { + GOOGLE_CHECK(false) << __FILE__ << ":" << line; +} + +} // namespace + + +// =================================================================== + +#ifndef _MSC_VER +const int Duration::kSecondsFieldNumber; +const int Duration::kNanosFieldNumber; +#endif // !_MSC_VER + +Duration::Duration() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Duration) +} + +void Duration::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +Duration::Duration(const Duration& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Duration) +} + +void Duration::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; + seconds_ = GOOGLE_LONGLONG(0); + nanos_ = 0; +} + +Duration::~Duration() { + // @@protoc_insertion_point(destructor:google.protobuf.Duration) + SharedDtor(); +} + +void Duration::SharedDtor() { + if (this != default_instance_) { + } +} + +void Duration::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Duration::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Duration_descriptor_; +} + +const Duration& Duration::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fduration_2eproto(); + return *default_instance_; +} + +Duration* Duration::default_instance_ = NULL; + +Duration* Duration::New(::google::protobuf::Arena* arena) const { + Duration* n = new Duration; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Duration::Clear() { +#define ZR_HELPER_(f) reinterpret_cast<char*>(\ + &reinterpret_cast<Duration*>(16)->f) + +#define ZR_(first, last) do {\ + ::memset(&first, 0,\ + ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\ +} while (0) + + ZR_(seconds_, nanos_); + +#undef ZR_HELPER_ +#undef ZR_ + +} + +bool Duration::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Duration) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional int64 seconds = 1; + case 1: { + if (tag == 8) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &seconds_))); + + } else { + goto handle_unusual; + } + if (input->ExpectTag(16)) goto parse_nanos; + break; + } + + // optional int32 nanos = 2; + case 2: { + if (tag == 16) { + parse_nanos: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &nanos_))); + + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Duration) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Duration) + return false; +#undef DO_ +} + +void Duration::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Duration) + // optional int64 seconds = 1; + if (this->seconds() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(1, this->seconds(), output); + } + + // optional int32 nanos = 2; + if (this->nanos() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->nanos(), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.Duration) +} + +::google::protobuf::uint8* Duration::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Duration) + // optional int64 seconds = 1; + if (this->seconds() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(1, this->seconds(), target); + } + + // optional int32 nanos = 2; + if (this->nanos() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->nanos(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Duration) + return target; +} + +int Duration::ByteSize() const { + int total_size = 0; + + // optional int64 seconds = 1; + if (this->seconds() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->seconds()); + } + + // optional int32 nanos = 2; + if (this->nanos() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->nanos()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Duration::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Duration* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Duration*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Duration::MergeFrom(const Duration& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.seconds() != 0) { + set_seconds(from.seconds()); + } + if (from.nanos() != 0) { + set_nanos(from.nanos()); + } +} + +void Duration::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Duration::CopyFrom(const Duration& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Duration::IsInitialized() const { + + return true; +} + +void Duration::Swap(Duration* other) { + if (other == this) return; + InternalSwap(other); +} +void Duration::InternalSwap(Duration* other) { + std::swap(seconds_, other->seconds_); + std::swap(nanos_, other->nanos_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Duration::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Duration_descriptor_; + metadata.reflection = Duration_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Duration + +// optional int64 seconds = 1; + void Duration::clear_seconds() { + seconds_ = GOOGLE_LONGLONG(0); +} + ::google::protobuf::int64 Duration::seconds() const { + // @@protoc_insertion_point(field_get:google.protobuf.Duration.seconds) + return seconds_; +} + void Duration::set_seconds(::google::protobuf::int64 value) { + + seconds_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Duration.seconds) +} + +// optional int32 nanos = 2; + void Duration::clear_nanos() { + nanos_ = 0; +} + ::google::protobuf::int32 Duration::nanos() const { + // @@protoc_insertion_point(field_get:google.protobuf.Duration.nanos) + return nanos_; +} + void Duration::set_nanos(::google::protobuf::int32 value) { + + nanos_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Duration.nanos) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h new file mode 100644 index 00000000..215a52c4 --- /dev/null +++ b/src/google/protobuf/duration.pb.h @@ -0,0 +1,172 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/duration.proto + +#ifndef PROTOBUF_google_2fprotobuf_2fduration_2eproto__INCLUDED +#define PROTOBUF_google_2fprotobuf_2fduration_2eproto__INCLUDED + +#include <string> + +#include <google/protobuf/stubs/common.h> + +#if GOOGLE_PROTOBUF_VERSION < 3000000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/metadata.h> +#include <google/protobuf/message.h> +#include <google/protobuf/repeated_field.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/unknown_field_set.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +// Internal implementation detail -- do not call these. +void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fduration_2eproto(); +void protobuf_AssignDesc_google_2fprotobuf_2fduration_2eproto(); +void protobuf_ShutdownFile_google_2fprotobuf_2fduration_2eproto(); + +class Duration; + +// =================================================================== + +class LIBPROTOBUF_EXPORT Duration : public ::google::protobuf::Message { + public: + Duration(); + virtual ~Duration(); + + Duration(const Duration& from); + + inline Duration& operator=(const Duration& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Duration& default_instance(); + + void Swap(Duration* other); + + // implements Message ---------------------------------------------- + + inline Duration* New() const { return New(NULL); } + + Duration* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Duration& from); + void MergeFrom(const Duration& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Duration* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int64 seconds = 1; + void clear_seconds(); + static const int kSecondsFieldNumber = 1; + ::google::protobuf::int64 seconds() const; + void set_seconds(::google::protobuf::int64 value); + + // optional int32 nanos = 2; + void clear_nanos(); + static const int kNanosFieldNumber = 2; + ::google::protobuf::int32 nanos() const; + void set_nanos(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:google.protobuf.Duration) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::int64 seconds_; + ::google::protobuf::int32 nanos_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fduration_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fduration_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fduration_2eproto(); + + void InitAsDefaultInstance(); + static Duration* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +#if !PROTOBUF_INLINE_NOT_IN_HEADERS +// Duration + +// optional int64 seconds = 1; +inline void Duration::clear_seconds() { + seconds_ = GOOGLE_LONGLONG(0); +} +inline ::google::protobuf::int64 Duration::seconds() const { + // @@protoc_insertion_point(field_get:google.protobuf.Duration.seconds) + return seconds_; +} +inline void Duration::set_seconds(::google::protobuf::int64 value) { + + seconds_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Duration.seconds) +} + +// optional int32 nanos = 2; +inline void Duration::clear_nanos() { + nanos_ = 0; +} +inline ::google::protobuf::int32 Duration::nanos() const { + // @@protoc_insertion_point(field_get:google.protobuf.Duration.nanos) + return nanos_; +} +inline void Duration::set_nanos(::google::protobuf::int32 value) { + + nanos_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Duration.nanos) +} + +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_google_2fprotobuf_2fduration_2eproto__INCLUDED diff --git a/src/google/protobuf/duration.proto b/src/google/protobuf/duration.proto index 12337f53..0ab970d3 100644 --- a/src/google/protobuf/duration.proto +++ b/src/google/protobuf/duration.proto @@ -35,8 +35,7 @@ option java_generate_equals_and_hash = true; option java_multiple_files = true; option java_outer_classname = "DurationProto"; option java_package = "com.google.protobuf"; -option objc_class_prefix = "GPB"; - +option csharp_namespace = "Google.ProtocolBuffers"; // A Duration represents a signed, fixed-length span of time represented // as a count of seconds and fractions of seconds at nanosecond diff --git a/src/google/protobuf/empty.pb.cc b/src/google/protobuf/empty.pb.cc new file mode 100644 index 00000000..f7ca5013 --- /dev/null +++ b/src/google/protobuf/empty.pb.cc @@ -0,0 +1,282 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/empty.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "google/protobuf/empty.pb.h" + +#include <algorithm> + +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/once.h> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/wire_format_lite_inl.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/generated_message_reflection.h> +#include <google/protobuf/reflection_ops.h> +#include <google/protobuf/wire_format.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +namespace { + +const ::google::protobuf::Descriptor* Empty_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Empty_reflection_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_google_2fprotobuf_2fempty_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fempty_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "google/protobuf/empty.proto"); + GOOGLE_CHECK(file != NULL); + Empty_descriptor_ = file->message_type(0); + static const int Empty_offsets_[1] = { + }; + Empty_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Empty_descriptor_, + Empty::default_instance_, + Empty_offsets_, + -1, + -1, + -1, + sizeof(Empty), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Empty, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Empty, _is_default_instance_)); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_google_2fprotobuf_2fempty_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Empty_descriptor_, &Empty::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_google_2fprotobuf_2fempty_2eproto() { + delete Empty::default_instance_; + delete Empty_reflection_; +} + +void protobuf_AddDesc_google_2fprotobuf_2fempty_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n\033google/protobuf/empty.proto\022\017google.pr" + "otobuf\"\007\n\005EmptyB)\n\023com.google.protobufB\n" + "EmptyProtoP\001\242\002\003GPBb\006proto3", 106); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "google/protobuf/empty.proto", &protobuf_RegisterTypes); + Empty::default_instance_ = new Empty(); + Empty::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fempty_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_google_2fprotobuf_2fempty_2eproto { + StaticDescriptorInitializer_google_2fprotobuf_2fempty_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fempty_2eproto(); + } +} static_descriptor_initializer_google_2fprotobuf_2fempty_2eproto_; + +namespace { + +static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD; +static void MergeFromFail(int line) { + GOOGLE_CHECK(false) << __FILE__ << ":" << line; +} + +} // namespace + + +// =================================================================== + +#ifndef _MSC_VER +#endif // !_MSC_VER + +Empty::Empty() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Empty) +} + +void Empty::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +Empty::Empty(const Empty& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Empty) +} + +void Empty::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; +} + +Empty::~Empty() { + // @@protoc_insertion_point(destructor:google.protobuf.Empty) + SharedDtor(); +} + +void Empty::SharedDtor() { + if (this != default_instance_) { + } +} + +void Empty::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Empty::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Empty_descriptor_; +} + +const Empty& Empty::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fempty_2eproto(); + return *default_instance_; +} + +Empty* Empty::default_instance_ = NULL; + +Empty* Empty::New(::google::protobuf::Arena* arena) const { + Empty* n = new Empty; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Empty::Clear() { +} + +bool Empty::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Empty) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Empty) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Empty) + return false; +#undef DO_ +} + +void Empty::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Empty) + // @@protoc_insertion_point(serialize_end:google.protobuf.Empty) +} + +::google::protobuf::uint8* Empty::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Empty) + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Empty) + return target; +} + +int Empty::ByteSize() const { + int total_size = 0; + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Empty::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Empty* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Empty*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Empty::MergeFrom(const Empty& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); +} + +void Empty::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Empty::CopyFrom(const Empty& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Empty::IsInitialized() const { + + return true; +} + +void Empty::Swap(Empty* other) { + if (other == this) return; + InternalSwap(other); +} +void Empty::InternalSwap(Empty* other) { + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Empty::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Empty_descriptor_; + metadata.reflection = Empty_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Empty + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h new file mode 100644 index 00000000..20876bea --- /dev/null +++ b/src/google/protobuf/empty.pb.h @@ -0,0 +1,130 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/empty.proto + +#ifndef PROTOBUF_google_2fprotobuf_2fempty_2eproto__INCLUDED +#define PROTOBUF_google_2fprotobuf_2fempty_2eproto__INCLUDED + +#include <string> + +#include <google/protobuf/stubs/common.h> + +#if GOOGLE_PROTOBUF_VERSION < 3000000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/metadata.h> +#include <google/protobuf/message.h> +#include <google/protobuf/repeated_field.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/unknown_field_set.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +// Internal implementation detail -- do not call these. +void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fempty_2eproto(); +void protobuf_AssignDesc_google_2fprotobuf_2fempty_2eproto(); +void protobuf_ShutdownFile_google_2fprotobuf_2fempty_2eproto(); + +class Empty; + +// =================================================================== + +class LIBPROTOBUF_EXPORT Empty : public ::google::protobuf::Message { + public: + Empty(); + virtual ~Empty(); + + Empty(const Empty& from); + + inline Empty& operator=(const Empty& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Empty& default_instance(); + + void Swap(Empty* other); + + // implements Message ---------------------------------------------- + + inline Empty* New() const { return New(NULL); } + + Empty* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Empty& from); + void MergeFrom(const Empty& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Empty* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:google.protobuf.Empty) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fempty_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fempty_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fempty_2eproto(); + + void InitAsDefaultInstance(); + static Empty* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +#if !PROTOBUF_INLINE_NOT_IN_HEADERS +// Empty + +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_google_2fprotobuf_2fempty_2eproto__INCLUDED diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc new file mode 100644 index 00000000..ec8a7df7 --- /dev/null +++ b/src/google/protobuf/field_mask.pb.cc @@ -0,0 +1,394 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/field_mask.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "google/protobuf/field_mask.pb.h" + +#include <algorithm> + +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/once.h> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/wire_format_lite_inl.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/generated_message_reflection.h> +#include <google/protobuf/reflection_ops.h> +#include <google/protobuf/wire_format.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +namespace { + +const ::google::protobuf::Descriptor* FieldMask_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + FieldMask_reflection_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_google_2fprotobuf_2ffield_5fmask_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2ffield_5fmask_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "google/protobuf/field_mask.proto"); + GOOGLE_CHECK(file != NULL); + FieldMask_descriptor_ = file->message_type(0); + static const int FieldMask_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldMask, paths_), + }; + FieldMask_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + FieldMask_descriptor_, + FieldMask::default_instance_, + FieldMask_offsets_, + -1, + -1, + -1, + sizeof(FieldMask), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldMask, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FieldMask, _is_default_instance_)); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_google_2fprotobuf_2ffield_5fmask_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + FieldMask_descriptor_, &FieldMask::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_google_2fprotobuf_2ffield_5fmask_2eproto() { + delete FieldMask::default_instance_; + delete FieldMask_reflection_; +} + +void protobuf_AddDesc_google_2fprotobuf_2ffield_5fmask_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n google/protobuf/field_mask.proto\022\017goog" + "le.protobuf\"\032\n\tFieldMask\022\r\n\005paths\030\001 \003(\tB" + "-\n\023com.google.protobufB\016FieldMaskProtoP\001" + "\242\002\003GPBb\006proto3", 134); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "google/protobuf/field_mask.proto", &protobuf_RegisterTypes); + FieldMask::default_instance_ = new FieldMask(); + FieldMask::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2ffield_5fmask_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_google_2fprotobuf_2ffield_5fmask_2eproto { + StaticDescriptorInitializer_google_2fprotobuf_2ffield_5fmask_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2ffield_5fmask_2eproto(); + } +} static_descriptor_initializer_google_2fprotobuf_2ffield_5fmask_2eproto_; + +namespace { + +static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD; +static void MergeFromFail(int line) { + GOOGLE_CHECK(false) << __FILE__ << ":" << line; +} + +} // namespace + + +// =================================================================== + +#ifndef _MSC_VER +const int FieldMask::kPathsFieldNumber; +#endif // !_MSC_VER + +FieldMask::FieldMask() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.FieldMask) +} + +void FieldMask::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +FieldMask::FieldMask(const FieldMask& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldMask) +} + +void FieldMask::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; +} + +FieldMask::~FieldMask() { + // @@protoc_insertion_point(destructor:google.protobuf.FieldMask) + SharedDtor(); +} + +void FieldMask::SharedDtor() { + if (this != default_instance_) { + } +} + +void FieldMask::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* FieldMask::descriptor() { + protobuf_AssignDescriptorsOnce(); + return FieldMask_descriptor_; +} + +const FieldMask& FieldMask::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2ffield_5fmask_2eproto(); + return *default_instance_; +} + +FieldMask* FieldMask::default_instance_ = NULL; + +FieldMask* FieldMask::New(::google::protobuf::Arena* arena) const { + FieldMask* n = new FieldMask; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void FieldMask::Clear() { + paths_.Clear(); +} + +bool FieldMask::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.FieldMask) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated string paths = 1; + case 1: { + if (tag == 10) { + parse_paths: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->add_paths())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->paths(this->paths_size() - 1).data(), + this->paths(this->paths_size() - 1).length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.FieldMask.paths"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(10)) goto parse_paths; + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.FieldMask) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.FieldMask) + return false; +#undef DO_ +} + +void FieldMask::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.FieldMask) + // repeated string paths = 1; + for (int i = 0; i < this->paths_size(); i++) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->paths(i).data(), this->paths(i).length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FieldMask.paths"); + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->paths(i), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.FieldMask) +} + +::google::protobuf::uint8* FieldMask::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldMask) + // repeated string paths = 1; + for (int i = 0; i < this->paths_size(); i++) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->paths(i).data(), this->paths(i).length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FieldMask.paths"); + target = ::google::protobuf::internal::WireFormatLite:: + WriteStringToArray(1, this->paths(i), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FieldMask) + return target; +} + +int FieldMask::ByteSize() const { + int total_size = 0; + + // repeated string paths = 1; + total_size += 1 * this->paths_size(); + for (int i = 0; i < this->paths_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this->paths(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void FieldMask::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const FieldMask* source = + ::google::protobuf::internal::dynamic_cast_if_available<const FieldMask*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void FieldMask::MergeFrom(const FieldMask& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + paths_.MergeFrom(from.paths_); +} + +void FieldMask::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void FieldMask::CopyFrom(const FieldMask& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FieldMask::IsInitialized() const { + + return true; +} + +void FieldMask::Swap(FieldMask* other) { + if (other == this) return; + InternalSwap(other); +} +void FieldMask::InternalSwap(FieldMask* other) { + paths_.UnsafeArenaSwap(&other->paths_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata FieldMask::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = FieldMask_descriptor_; + metadata.reflection = FieldMask_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// FieldMask + +// repeated string paths = 1; + int FieldMask::paths_size() const { + return paths_.size(); +} + void FieldMask::clear_paths() { + paths_.Clear(); +} + const ::std::string& FieldMask::paths(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldMask.paths) + return paths_.Get(index); +} + ::std::string* FieldMask::mutable_paths(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.FieldMask.paths) + return paths_.Mutable(index); +} + void FieldMask::set_paths(int index, const ::std::string& value) { + // @@protoc_insertion_point(field_set:google.protobuf.FieldMask.paths) + paths_.Mutable(index)->assign(value); +} + void FieldMask::set_paths(int index, const char* value) { + paths_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.FieldMask.paths) +} + void FieldMask::set_paths(int index, const char* value, size_t size) { + paths_.Mutable(index)->assign( + reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldMask.paths) +} + ::std::string* FieldMask::add_paths() { + return paths_.Add(); +} + void FieldMask::add_paths(const ::std::string& value) { + paths_.Add()->assign(value); + // @@protoc_insertion_point(field_add:google.protobuf.FieldMask.paths) +} + void FieldMask::add_paths(const char* value) { + paths_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:google.protobuf.FieldMask.paths) +} + void FieldMask::add_paths(const char* value, size_t size) { + paths_.Add()->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_add_pointer:google.protobuf.FieldMask.paths) +} + const ::google::protobuf::RepeatedPtrField< ::std::string>& +FieldMask::paths() const { + // @@protoc_insertion_point(field_list:google.protobuf.FieldMask.paths) + return paths_; +} + ::google::protobuf::RepeatedPtrField< ::std::string>* +FieldMask::mutable_paths() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldMask.paths) + return &paths_; +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h new file mode 100644 index 00000000..7189fd79 --- /dev/null +++ b/src/google/protobuf/field_mask.pb.h @@ -0,0 +1,201 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/field_mask.proto + +#ifndef PROTOBUF_google_2fprotobuf_2ffield_5fmask_2eproto__INCLUDED +#define PROTOBUF_google_2fprotobuf_2ffield_5fmask_2eproto__INCLUDED + +#include <string> + +#include <google/protobuf/stubs/common.h> + +#if GOOGLE_PROTOBUF_VERSION < 3000000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/metadata.h> +#include <google/protobuf/message.h> +#include <google/protobuf/repeated_field.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/unknown_field_set.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +// Internal implementation detail -- do not call these. +void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2ffield_5fmask_2eproto(); +void protobuf_AssignDesc_google_2fprotobuf_2ffield_5fmask_2eproto(); +void protobuf_ShutdownFile_google_2fprotobuf_2ffield_5fmask_2eproto(); + +class FieldMask; + +// =================================================================== + +class LIBPROTOBUF_EXPORT FieldMask : public ::google::protobuf::Message { + public: + FieldMask(); + virtual ~FieldMask(); + + FieldMask(const FieldMask& from); + + inline FieldMask& operator=(const FieldMask& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const FieldMask& default_instance(); + + void Swap(FieldMask* other); + + // implements Message ---------------------------------------------- + + inline FieldMask* New() const { return New(NULL); } + + FieldMask* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const FieldMask& from); + void MergeFrom(const FieldMask& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FieldMask* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated string paths = 1; + int paths_size() const; + void clear_paths(); + static const int kPathsFieldNumber = 1; + const ::std::string& paths(int index) const; + ::std::string* mutable_paths(int index); + void set_paths(int index, const ::std::string& value); + void set_paths(int index, const char* value); + void set_paths(int index, const char* value, size_t size); + ::std::string* add_paths(); + void add_paths(const ::std::string& value); + void add_paths(const char* value); + void add_paths(const char* value, size_t size); + const ::google::protobuf::RepeatedPtrField< ::std::string>& paths() const; + ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_paths(); + + // @@protoc_insertion_point(class_scope:google.protobuf.FieldMask) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::RepeatedPtrField< ::std::string> paths_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2ffield_5fmask_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2ffield_5fmask_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2ffield_5fmask_2eproto(); + + void InitAsDefaultInstance(); + static FieldMask* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +#if !PROTOBUF_INLINE_NOT_IN_HEADERS +// FieldMask + +// repeated string paths = 1; +inline int FieldMask::paths_size() const { + return paths_.size(); +} +inline void FieldMask::clear_paths() { + paths_.Clear(); +} +inline const ::std::string& FieldMask::paths(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.FieldMask.paths) + return paths_.Get(index); +} +inline ::std::string* FieldMask::mutable_paths(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.FieldMask.paths) + return paths_.Mutable(index); +} +inline void FieldMask::set_paths(int index, const ::std::string& value) { + // @@protoc_insertion_point(field_set:google.protobuf.FieldMask.paths) + paths_.Mutable(index)->assign(value); +} +inline void FieldMask::set_paths(int index, const char* value) { + paths_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.FieldMask.paths) +} +inline void FieldMask::set_paths(int index, const char* value, size_t size) { + paths_.Mutable(index)->assign( + reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FieldMask.paths) +} +inline ::std::string* FieldMask::add_paths() { + return paths_.Add(); +} +inline void FieldMask::add_paths(const ::std::string& value) { + paths_.Add()->assign(value); + // @@protoc_insertion_point(field_add:google.protobuf.FieldMask.paths) +} +inline void FieldMask::add_paths(const char* value) { + paths_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:google.protobuf.FieldMask.paths) +} +inline void FieldMask::add_paths(const char* value, size_t size) { + paths_.Add()->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_add_pointer:google.protobuf.FieldMask.paths) +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +FieldMask::paths() const { + // @@protoc_insertion_point(field_list:google.protobuf.FieldMask.paths) + return paths_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +FieldMask::mutable_paths() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.FieldMask.paths) + return &paths_; +} + +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_google_2fprotobuf_2ffield_5fmask_2eproto__INCLUDED diff --git a/src/google/protobuf/field_mask.proto b/src/google/protobuf/field_mask.proto index 081c004a..35b1acc3 100644 --- a/src/google/protobuf/field_mask.proto +++ b/src/google/protobuf/field_mask.proto @@ -34,6 +34,7 @@ package google.protobuf; option java_multiple_files = true; option java_outer_classname = "FieldMaskProto"; option java_package = "com.google.protobuf"; +option csharp_namespace = "Google.ProtocolBuffers"; option objc_class_prefix = "GPB"; diff --git a/src/google/protobuf/map_lite_unittest.proto b/src/google/protobuf/map_lite_unittest.proto index c69e8d94..febfe5f6 100644 --- a/src/google/protobuf/map_lite_unittest.proto +++ b/src/google/protobuf/map_lite_unittest.proto @@ -32,6 +32,7 @@ syntax = "proto2"; option cc_enable_arenas = true; option optimize_for = LITE_RUNTIME; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; import "google/protobuf/unittest_lite.proto"; diff --git a/src/google/protobuf/map_proto2_unittest.proto b/src/google/protobuf/map_proto2_unittest.proto index 3d4af28e..04ca6170 100644 --- a/src/google/protobuf/map_proto2_unittest.proto +++ b/src/google/protobuf/map_proto2_unittest.proto @@ -36,6 +36,8 @@ syntax = "proto2"; // In map_test_util.h we do "using namespace unittest = protobuf_unittest". package protobuf_unittest; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; + enum Proto2MapEnum { PROTO2_MAP_ENUM_FOO = 0; PROTO2_MAP_ENUM_BAR = 1; diff --git a/src/google/protobuf/map_unittest.proto b/src/google/protobuf/map_unittest.proto index 830f672b..b6a988b3 100644 --- a/src/google/protobuf/map_unittest.proto +++ b/src/google/protobuf/map_unittest.proto @@ -31,6 +31,7 @@ syntax = "proto3"; option cc_enable_arenas = true; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; import "google/protobuf/unittest.proto"; diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc new file mode 100644 index 00000000..0926e747 --- /dev/null +++ b/src/google/protobuf/source_context.pb.cc @@ -0,0 +1,386 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/source_context.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "google/protobuf/source_context.pb.h" + +#include <algorithm> + +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/once.h> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/wire_format_lite_inl.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/generated_message_reflection.h> +#include <google/protobuf/reflection_ops.h> +#include <google/protobuf/wire_format.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +namespace { + +const ::google::protobuf::Descriptor* SourceContext_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + SourceContext_reflection_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_google_2fprotobuf_2fsource_5fcontext_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fsource_5fcontext_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "google/protobuf/source_context.proto"); + GOOGLE_CHECK(file != NULL); + SourceContext_descriptor_ = file->message_type(0); + static const int SourceContext_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceContext, file_name_), + }; + SourceContext_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + SourceContext_descriptor_, + SourceContext::default_instance_, + SourceContext_offsets_, + -1, + -1, + -1, + sizeof(SourceContext), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceContext, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceContext, _is_default_instance_)); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_google_2fprotobuf_2fsource_5fcontext_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + SourceContext_descriptor_, &SourceContext::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_google_2fprotobuf_2fsource_5fcontext_2eproto() { + delete SourceContext::default_instance_; + delete SourceContext_reflection_; +} + +void protobuf_AddDesc_google_2fprotobuf_2fsource_5fcontext_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n$google/protobuf/source_context.proto\022\017" + "google.protobuf\"\"\n\rSourceContext\022\021\n\tfile" + "_name\030\001 \001(\tB1\n\023com.google.protobufB\022Sour" + "ceContextProtoP\001\242\002\003GPBb\006proto3", 150); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "google/protobuf/source_context.proto", &protobuf_RegisterTypes); + SourceContext::default_instance_ = new SourceContext(); + SourceContext::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fsource_5fcontext_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_google_2fprotobuf_2fsource_5fcontext_2eproto { + StaticDescriptorInitializer_google_2fprotobuf_2fsource_5fcontext_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fsource_5fcontext_2eproto(); + } +} static_descriptor_initializer_google_2fprotobuf_2fsource_5fcontext_2eproto_; + +namespace { + +static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD; +static void MergeFromFail(int line) { + GOOGLE_CHECK(false) << __FILE__ << ":" << line; +} + +} // namespace + + +// =================================================================== + +#ifndef _MSC_VER +const int SourceContext::kFileNameFieldNumber; +#endif // !_MSC_VER + +SourceContext::SourceContext() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.SourceContext) +} + +void SourceContext::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +SourceContext::SourceContext(const SourceContext& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceContext) +} + +void SourceContext::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + file_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +SourceContext::~SourceContext() { + // @@protoc_insertion_point(destructor:google.protobuf.SourceContext) + SharedDtor(); +} + +void SourceContext::SharedDtor() { + file_name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void SourceContext::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* SourceContext::descriptor() { + protobuf_AssignDescriptorsOnce(); + return SourceContext_descriptor_; +} + +const SourceContext& SourceContext::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fsource_5fcontext_2eproto(); + return *default_instance_; +} + +SourceContext* SourceContext::default_instance_ = NULL; + +SourceContext* SourceContext::New(::google::protobuf::Arena* arena) const { + SourceContext* n = new SourceContext; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void SourceContext::Clear() { + file_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +bool SourceContext::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.SourceContext) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string file_name = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_file_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->file_name().data(), this->file_name().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.SourceContext.file_name"); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.SourceContext) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.SourceContext) + return false; +#undef DO_ +} + +void SourceContext::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.SourceContext) + // optional string file_name = 1; + if (this->file_name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->file_name().data(), this->file_name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.SourceContext.file_name"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->file_name(), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.SourceContext) +} + +::google::protobuf::uint8* SourceContext::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceContext) + // optional string file_name = 1; + if (this->file_name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->file_name().data(), this->file_name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.SourceContext.file_name"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->file_name(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.SourceContext) + return target; +} + +int SourceContext::ByteSize() const { + int total_size = 0; + + // optional string file_name = 1; + if (this->file_name().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->file_name()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void SourceContext::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const SourceContext* source = + ::google::protobuf::internal::dynamic_cast_if_available<const SourceContext*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void SourceContext::MergeFrom(const SourceContext& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.file_name().size() > 0) { + + file_name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.file_name_); + } +} + +void SourceContext::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void SourceContext::CopyFrom(const SourceContext& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SourceContext::IsInitialized() const { + + return true; +} + +void SourceContext::Swap(SourceContext* other) { + if (other == this) return; + InternalSwap(other); +} +void SourceContext::InternalSwap(SourceContext* other) { + file_name_.Swap(&other->file_name_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata SourceContext::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = SourceContext_descriptor_; + metadata.reflection = SourceContext_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// SourceContext + +// optional string file_name = 1; + void SourceContext::clear_file_name() { + file_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& SourceContext::file_name() const { + // @@protoc_insertion_point(field_get:google.protobuf.SourceContext.file_name) + return file_name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void SourceContext::set_file_name(const ::std::string& value) { + + file_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.SourceContext.file_name) +} + void SourceContext::set_file_name(const char* value) { + + file_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.SourceContext.file_name) +} + void SourceContext::set_file_name(const char* value, size_t size) { + + file_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceContext.file_name) +} + ::std::string* SourceContext::mutable_file_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.SourceContext.file_name) + return file_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* SourceContext::release_file_name() { + + return file_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void SourceContext::set_allocated_file_name(::std::string* file_name) { + if (file_name != NULL) { + + } else { + + } + file_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), file_name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceContext.file_name) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h new file mode 100644 index 00000000..02e11460 --- /dev/null +++ b/src/google/protobuf/source_context.pb.h @@ -0,0 +1,185 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/source_context.proto + +#ifndef PROTOBUF_google_2fprotobuf_2fsource_5fcontext_2eproto__INCLUDED +#define PROTOBUF_google_2fprotobuf_2fsource_5fcontext_2eproto__INCLUDED + +#include <string> + +#include <google/protobuf/stubs/common.h> + +#if GOOGLE_PROTOBUF_VERSION < 3000000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/metadata.h> +#include <google/protobuf/message.h> +#include <google/protobuf/repeated_field.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/unknown_field_set.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +// Internal implementation detail -- do not call these. +void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fsource_5fcontext_2eproto(); +void protobuf_AssignDesc_google_2fprotobuf_2fsource_5fcontext_2eproto(); +void protobuf_ShutdownFile_google_2fprotobuf_2fsource_5fcontext_2eproto(); + +class SourceContext; + +// =================================================================== + +class LIBPROTOBUF_EXPORT SourceContext : public ::google::protobuf::Message { + public: + SourceContext(); + virtual ~SourceContext(); + + SourceContext(const SourceContext& from); + + inline SourceContext& operator=(const SourceContext& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const SourceContext& default_instance(); + + void Swap(SourceContext* other); + + // implements Message ---------------------------------------------- + + inline SourceContext* New() const { return New(NULL); } + + SourceContext* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const SourceContext& from); + void MergeFrom(const SourceContext& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SourceContext* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string file_name = 1; + void clear_file_name(); + static const int kFileNameFieldNumber = 1; + const ::std::string& file_name() const; + void set_file_name(const ::std::string& value); + void set_file_name(const char* value); + void set_file_name(const char* value, size_t size); + ::std::string* mutable_file_name(); + ::std::string* release_file_name(); + void set_allocated_file_name(::std::string* file_name); + + // @@protoc_insertion_point(class_scope:google.protobuf.SourceContext) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr file_name_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fsource_5fcontext_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fsource_5fcontext_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fsource_5fcontext_2eproto(); + + void InitAsDefaultInstance(); + static SourceContext* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +#if !PROTOBUF_INLINE_NOT_IN_HEADERS +// SourceContext + +// optional string file_name = 1; +inline void SourceContext::clear_file_name() { + file_name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& SourceContext::file_name() const { + // @@protoc_insertion_point(field_get:google.protobuf.SourceContext.file_name) + return file_name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void SourceContext::set_file_name(const ::std::string& value) { + + file_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.SourceContext.file_name) +} +inline void SourceContext::set_file_name(const char* value) { + + file_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.SourceContext.file_name) +} +inline void SourceContext::set_file_name(const char* value, size_t size) { + + file_name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.SourceContext.file_name) +} +inline ::std::string* SourceContext::mutable_file_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.SourceContext.file_name) + return file_name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* SourceContext::release_file_name() { + + return file_name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void SourceContext::set_allocated_file_name(::std::string* file_name) { + if (file_name != NULL) { + + } else { + + } + file_name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), file_name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceContext.file_name) +} + +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_google_2fprotobuf_2fsource_5fcontext_2eproto__INCLUDED diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc new file mode 100644 index 00000000..4b81bcc9 --- /dev/null +++ b/src/google/protobuf/struct.pb.cc @@ -0,0 +1,1447 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/struct.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "google/protobuf/struct.pb.h" + +#include <algorithm> + +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/once.h> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/wire_format_lite_inl.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/generated_message_reflection.h> +#include <google/protobuf/reflection_ops.h> +#include <google/protobuf/wire_format.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +namespace { + +const ::google::protobuf::Descriptor* Struct_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Struct_reflection_ = NULL; +const ::google::protobuf::Descriptor* Struct_FieldsEntry_descriptor_ = NULL; +const ::google::protobuf::Descriptor* Value_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Value_reflection_ = NULL; +struct ValueOneofInstance { + int null_value_; + double number_value_; + ::google::protobuf::internal::ArenaStringPtr string_value_; + bool bool_value_; + const ::google::protobuf::Struct* struct_value_; + const ::google::protobuf::ListValue* list_value_; +}* Value_default_oneof_instance_ = NULL; +const ::google::protobuf::Descriptor* ListValue_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + ListValue_reflection_ = NULL; +const ::google::protobuf::EnumDescriptor* NullValue_descriptor_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "google/protobuf/struct.proto"); + GOOGLE_CHECK(file != NULL); + Struct_descriptor_ = file->message_type(0); + static const int Struct_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Struct, fields_), + }; + Struct_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Struct_descriptor_, + Struct::default_instance_, + Struct_offsets_, + -1, + -1, + -1, + sizeof(Struct), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Struct, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Struct, _is_default_instance_)); + Struct_FieldsEntry_descriptor_ = Struct_descriptor_->nested_type(0); + Value_descriptor_ = file->message_type(1); + static const int Value_offsets_[7] = { + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, null_value_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, number_value_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, string_value_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, bool_value_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, struct_value_), + PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Value_default_oneof_instance_, list_value_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, kind_), + }; + Value_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Value_descriptor_, + Value::default_instance_, + Value_offsets_, + -1, + -1, + -1, + Value_default_oneof_instance_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _oneof_case_[0]), + sizeof(Value), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Value, _is_default_instance_)); + ListValue_descriptor_ = file->message_type(2); + static const int ListValue_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListValue, values_), + }; + ListValue_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + ListValue_descriptor_, + ListValue::default_instance_, + ListValue_offsets_, + -1, + -1, + -1, + sizeof(ListValue), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ListValue, _is_default_instance_)); + NullValue_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_google_2fprotobuf_2fstruct_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Struct_descriptor_, &Struct::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Struct_FieldsEntry_descriptor_, + ::google::protobuf::internal::MapEntry< + ::std::string, + ::google::protobuf::Value, + ::google::protobuf::internal::WireFormatLite::TYPE_STRING, + ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, + 0>::CreateDefaultInstance( + Struct_FieldsEntry_descriptor_)); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Value_descriptor_, &Value::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + ListValue_descriptor_, &ListValue::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto() { + delete Struct::default_instance_; + delete Struct_reflection_; + delete Value::default_instance_; + delete Value_default_oneof_instance_; + delete Value_reflection_; + delete ListValue::default_instance_; + delete ListValue_reflection_; +} + +void protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n\034google/protobuf/struct.proto\022\017google.p" + "rotobuf\"\204\001\n\006Struct\0223\n\006fields\030\001 \003(\0132#.goo" + "gle.protobuf.Struct.FieldsEntry\032E\n\013Field" + "sEntry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026.goo" + "gle.protobuf.Value:\0028\001\"\352\001\n\005Value\0220\n\nnull" + "_value\030\001 \001(\0162\032.google.protobuf.NullValue" + "H\000\022\026\n\014number_value\030\002 \001(\001H\000\022\026\n\014string_val" + "ue\030\003 \001(\tH\000\022\024\n\nbool_value\030\004 \001(\010H\000\022/\n\014stru" + "ct_value\030\005 \001(\0132\027.google.protobuf.StructH" + "\000\0220\n\nlist_value\030\006 \001(\0132\032.google.protobuf." + "ListValueH\000B\006\n\004kind\"3\n\tListValue\022&\n\006valu" + "es\030\001 \003(\0132\026.google.protobuf.Value*\033\n\tNull" + "Value\022\016\n\nNULL_VALUE\020\000B-\n\023com.google.prot" + "obufB\013StructProtoP\001\240\001\001\242\002\003GPBb\006proto3", 556); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "google/protobuf/struct.proto", &protobuf_RegisterTypes); + Struct::default_instance_ = new Struct(); + Value::default_instance_ = new Value(); + Value_default_oneof_instance_ = new ValueOneofInstance(); + ListValue::default_instance_ = new ListValue(); + Struct::default_instance_->InitAsDefaultInstance(); + Value::default_instance_->InitAsDefaultInstance(); + ListValue::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_google_2fprotobuf_2fstruct_2eproto { + StaticDescriptorInitializer_google_2fprotobuf_2fstruct_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto(); + } +} static_descriptor_initializer_google_2fprotobuf_2fstruct_2eproto_; +const ::google::protobuf::EnumDescriptor* NullValue_descriptor() { + protobuf_AssignDescriptorsOnce(); + return NullValue_descriptor_; +} +bool NullValue_IsValid(int value) { + switch(value) { + case 0: + return true; + default: + return false; + } +} + + +namespace { + +static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD; +static void MergeFromFail(int line) { + GOOGLE_CHECK(false) << __FILE__ << ":" << line; +} + +} // namespace + + +// =================================================================== + +#ifndef _MSC_VER +const int Struct::kFieldsFieldNumber; +#endif // !_MSC_VER + +Struct::Struct() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Struct) +} + +void Struct::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +Struct::Struct(const Struct& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Struct) +} + +void Struct::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; + fields_.SetAssignDescriptorCallback( + protobuf_AssignDescriptorsOnce); + fields_.SetEntryDescriptor( + &::google::protobuf::Struct_FieldsEntry_descriptor_); +} + +Struct::~Struct() { + // @@protoc_insertion_point(destructor:google.protobuf.Struct) + SharedDtor(); +} + +void Struct::SharedDtor() { + if (this != default_instance_) { + } +} + +void Struct::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Struct::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Struct_descriptor_; +} + +const Struct& Struct::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto(); + return *default_instance_; +} + +Struct* Struct::default_instance_ = NULL; + +Struct* Struct::New(::google::protobuf::Arena* arena) const { + Struct* n = new Struct; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Struct::Clear() { + fields_.Clear(); +} + +bool Struct::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Struct) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // map<string, .google.protobuf.Value> fields = 1; + case 1: { + if (tag == 10) { + parse_fields: + ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry(fields_.NewEntry()); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, entry.get())); + (*mutable_fields())[entry->key()].Swap(entry->mutable_value()); + } else { + goto handle_unusual; + } + if (input->ExpectTag(10)) goto parse_fields; + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Struct) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Struct) + return false; +#undef DO_ +} + +void Struct::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Struct) + // map<string, .google.protobuf.Value> fields = 1; + { + ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; + for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator + it = fields().begin(); it != fields().end(); ++it) { + entry.reset(fields_.NewEntryWrapper(it->first, it->second)); + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 1, *entry, output); + } + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.Struct) +} + +::google::protobuf::uint8* Struct::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Struct) + // map<string, .google.protobuf.Value> fields = 1; + { + ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; + for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator + it = fields().begin(); it != fields().end(); ++it) { + entry.reset(fields_.NewEntryWrapper(it->first, it->second)); + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 1, *entry, target); + } + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Struct) + return target; +} + +int Struct::ByteSize() const { + int total_size = 0; + + // map<string, .google.protobuf.Value> fields = 1; + total_size += 1 * this->fields_size(); + { + ::google::protobuf::scoped_ptr<Struct_FieldsEntry> entry; + for (::google::protobuf::Map< ::std::string, ::google::protobuf::Value >::const_iterator + it = fields().begin(); it != fields().end(); ++it) { + entry.reset(fields_.NewEntryWrapper(it->first, it->second)); + total_size += ::google::protobuf::internal::WireFormatLite:: + MessageSizeNoVirtual(*entry); + } + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Struct::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Struct* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Struct*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Struct::MergeFrom(const Struct& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + fields_.MergeFrom(from.fields_); +} + +void Struct::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Struct::CopyFrom(const Struct& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Struct::IsInitialized() const { + + return true; +} + +void Struct::Swap(Struct* other) { + if (other == this) return; + InternalSwap(other); +} +void Struct::InternalSwap(Struct* other) { + fields_.Swap(&other->fields_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Struct::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Struct_descriptor_; + metadata.reflection = Struct_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Struct + +// map<string, .google.protobuf.Value> fields = 1; + int Struct::fields_size() const { + return fields_.size(); +} + void Struct::clear_fields() { + fields_.Clear(); +} + const ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >& +Struct::fields() const { + // @@protoc_insertion_point(field_map:google.protobuf.Struct.fields) + return fields_.GetMap(); +} + ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >* +Struct::mutable_fields() { + // @@protoc_insertion_point(field_mutable_map:google.protobuf.Struct.fields) + return fields_.MutableMap(); +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int Value::kNullValueFieldNumber; +const int Value::kNumberValueFieldNumber; +const int Value::kStringValueFieldNumber; +const int Value::kBoolValueFieldNumber; +const int Value::kStructValueFieldNumber; +const int Value::kListValueFieldNumber; +#endif // !_MSC_VER + +Value::Value() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Value) +} + +void Value::InitAsDefaultInstance() { + _is_default_instance_ = true; + Value_default_oneof_instance_->null_value_ = 0; + Value_default_oneof_instance_->number_value_ = 0; + Value_default_oneof_instance_->string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + Value_default_oneof_instance_->bool_value_ = false; + Value_default_oneof_instance_->struct_value_ = const_cast< ::google::protobuf::Struct*>(&::google::protobuf::Struct::default_instance()); + Value_default_oneof_instance_->list_value_ = const_cast< ::google::protobuf::ListValue*>(&::google::protobuf::ListValue::default_instance()); +} + +Value::Value(const Value& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Value) +} + +void Value::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + clear_has_kind(); +} + +Value::~Value() { + // @@protoc_insertion_point(destructor:google.protobuf.Value) + SharedDtor(); +} + +void Value::SharedDtor() { + if (has_kind()) { + clear_kind(); + } + if (this != default_instance_) { + } +} + +void Value::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Value::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Value_descriptor_; +} + +const Value& Value::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto(); + return *default_instance_; +} + +Value* Value::default_instance_ = NULL; + +Value* Value::New(::google::protobuf::Arena* arena) const { + Value* n = new Value; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Value::clear_kind() { + switch(kind_case()) { + case kNullValue: { + // No need to clear + break; + } + case kNumberValue: { + // No need to clear + break; + } + case kStringValue: { + kind_.string_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + break; + } + case kBoolValue: { + // No need to clear + break; + } + case kStructValue: { + delete kind_.struct_value_; + break; + } + case kListValue: { + delete kind_.list_value_; + break; + } + case KIND_NOT_SET: { + break; + } + } + _oneof_case_[0] = KIND_NOT_SET; +} + + +void Value::Clear() { + clear_kind(); +} + +bool Value::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Value) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional .google.protobuf.NullValue null_value = 1; + case 1: { + if (tag == 8) { + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + set_null_value(static_cast< ::google::protobuf::NullValue >(value)); + } else { + goto handle_unusual; + } + if (input->ExpectTag(17)) goto parse_number_value; + break; + } + + // optional double number_value = 2; + case 2: { + if (tag == 17) { + parse_number_value: + clear_kind(); + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( + input, &kind_.number_value_))); + set_has_number_value(); + } else { + goto handle_unusual; + } + if (input->ExpectTag(26)) goto parse_string_value; + break; + } + + // optional string string_value = 3; + case 3: { + if (tag == 26) { + parse_string_value: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_string_value())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->string_value().data(), this->string_value().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.Value.string_value"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(32)) goto parse_bool_value; + break; + } + + // optional bool bool_value = 4; + case 4: { + if (tag == 32) { + parse_bool_value: + clear_kind(); + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &kind_.bool_value_))); + set_has_bool_value(); + } else { + goto handle_unusual; + } + if (input->ExpectTag(42)) goto parse_struct_value; + break; + } + + // optional .google.protobuf.Struct struct_value = 5; + case 5: { + if (tag == 42) { + parse_struct_value: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_struct_value())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(50)) goto parse_list_value; + break; + } + + // optional .google.protobuf.ListValue list_value = 6; + case 6: { + if (tag == 50) { + parse_list_value: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_list_value())); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Value) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Value) + return false; +#undef DO_ +} + +void Value::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Value) + // optional .google.protobuf.NullValue null_value = 1; + if (has_null_value()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->null_value(), output); + } + + // optional double number_value = 2; + if (has_number_value()) { + ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->number_value(), output); + } + + // optional string string_value = 3; + if (has_string_value()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->string_value().data(), this->string_value().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Value.string_value"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 3, this->string_value(), output); + } + + // optional bool bool_value = 4; + if (has_bool_value()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(4, this->bool_value(), output); + } + + // optional .google.protobuf.Struct struct_value = 5; + if (has_struct_value()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 5, *kind_.struct_value_, output); + } + + // optional .google.protobuf.ListValue list_value = 6; + if (has_list_value()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 6, *kind_.list_value_, output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.Value) +} + +::google::protobuf::uint8* Value::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Value) + // optional .google.protobuf.NullValue null_value = 1; + if (has_null_value()) { + target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( + 1, this->null_value(), target); + } + + // optional double number_value = 2; + if (has_number_value()) { + target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(2, this->number_value(), target); + } + + // optional string string_value = 3; + if (has_string_value()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->string_value().data(), this->string_value().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Value.string_value"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 3, this->string_value(), target); + } + + // optional bool bool_value = 4; + if (has_bool_value()) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(4, this->bool_value(), target); + } + + // optional .google.protobuf.Struct struct_value = 5; + if (has_struct_value()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 5, *kind_.struct_value_, target); + } + + // optional .google.protobuf.ListValue list_value = 6; + if (has_list_value()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 6, *kind_.list_value_, target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Value) + return target; +} + +int Value::ByteSize() const { + int total_size = 0; + + switch (kind_case()) { + // optional .google.protobuf.NullValue null_value = 1; + case kNullValue: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->null_value()); + break; + } + // optional double number_value = 2; + case kNumberValue: { + total_size += 1 + 8; + break; + } + // optional string string_value = 3; + case kStringValue: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->string_value()); + break; + } + // optional bool bool_value = 4; + case kBoolValue: { + total_size += 1 + 1; + break; + } + // optional .google.protobuf.Struct struct_value = 5; + case kStructValue: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *kind_.struct_value_); + break; + } + // optional .google.protobuf.ListValue list_value = 6; + case kListValue: { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *kind_.list_value_); + break; + } + case KIND_NOT_SET: { + break; + } + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Value::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Value* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Value*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Value::MergeFrom(const Value& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + switch (from.kind_case()) { + case kNullValue: { + set_null_value(from.null_value()); + break; + } + case kNumberValue: { + set_number_value(from.number_value()); + break; + } + case kStringValue: { + set_string_value(from.string_value()); + break; + } + case kBoolValue: { + set_bool_value(from.bool_value()); + break; + } + case kStructValue: { + mutable_struct_value()->::google::protobuf::Struct::MergeFrom(from.struct_value()); + break; + } + case kListValue: { + mutable_list_value()->::google::protobuf::ListValue::MergeFrom(from.list_value()); + break; + } + case KIND_NOT_SET: { + break; + } + } +} + +void Value::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Value::CopyFrom(const Value& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Value::IsInitialized() const { + + return true; +} + +void Value::Swap(Value* other) { + if (other == this) return; + InternalSwap(other); +} +void Value::InternalSwap(Value* other) { + std::swap(kind_, other->kind_); + std::swap(_oneof_case_[0], other->_oneof_case_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Value::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Value_descriptor_; + metadata.reflection = Value_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Value + +// optional .google.protobuf.NullValue null_value = 1; + bool Value::has_null_value() const { + return kind_case() == kNullValue; +} + void Value::set_has_null_value() { + _oneof_case_[0] = kNullValue; +} + void Value::clear_null_value() { + if (has_null_value()) { + kind_.null_value_ = 0; + clear_has_kind(); + } +} + ::google::protobuf::NullValue Value::null_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.null_value) + if (has_null_value()) { + return static_cast< ::google::protobuf::NullValue >(kind_.null_value_); + } + return static_cast< ::google::protobuf::NullValue >(0); +} + void Value::set_null_value(::google::protobuf::NullValue value) { + if (!has_null_value()) { + clear_kind(); + set_has_null_value(); + } + kind_.null_value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Value.null_value) +} + +// optional double number_value = 2; + bool Value::has_number_value() const { + return kind_case() == kNumberValue; +} + void Value::set_has_number_value() { + _oneof_case_[0] = kNumberValue; +} + void Value::clear_number_value() { + if (has_number_value()) { + kind_.number_value_ = 0; + clear_has_kind(); + } +} + double Value::number_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.number_value) + if (has_number_value()) { + return kind_.number_value_; + } + return 0; +} + void Value::set_number_value(double value) { + if (!has_number_value()) { + clear_kind(); + set_has_number_value(); + } + kind_.number_value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Value.number_value) +} + +// optional string string_value = 3; + bool Value::has_string_value() const { + return kind_case() == kStringValue; +} + void Value::set_has_string_value() { + _oneof_case_[0] = kStringValue; +} + void Value::clear_string_value() { + if (has_string_value()) { + kind_.string_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_kind(); + } +} + const ::std::string& Value::string_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.string_value) + if (has_string_value()) { + return kind_.string_value_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); +} + void Value::set_string_value(const ::std::string& value) { + // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value) + if (!has_string_value()) { + clear_kind(); + set_has_string_value(); + kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + kind_.string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value) +} + void Value::set_string_value(const char* value) { + if (!has_string_value()) { + clear_kind(); + set_has_string_value(); + kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + kind_.string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Value.string_value) +} + void Value::set_string_value(const char* value, size_t size) { + if (!has_string_value()) { + clear_kind(); + set_has_string_value(); + kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + kind_.string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Value.string_value) +} + ::std::string* Value::mutable_string_value() { + if (!has_string_value()) { + clear_kind(); + set_has_string_value(); + kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Value.string_value) + return kind_.string_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* Value::release_string_value() { + if (has_string_value()) { + clear_has_kind(); + return kind_.string_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; + } +} + void Value::set_allocated_string_value(::std::string* string_value) { + if (!has_string_value()) { + kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_kind(); + if (string_value != NULL) { + set_has_string_value(); + kind_.string_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + string_value); + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.string_value) +} + +// optional bool bool_value = 4; + bool Value::has_bool_value() const { + return kind_case() == kBoolValue; +} + void Value::set_has_bool_value() { + _oneof_case_[0] = kBoolValue; +} + void Value::clear_bool_value() { + if (has_bool_value()) { + kind_.bool_value_ = false; + clear_has_kind(); + } +} + bool Value::bool_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.bool_value) + if (has_bool_value()) { + return kind_.bool_value_; + } + return false; +} + void Value::set_bool_value(bool value) { + if (!has_bool_value()) { + clear_kind(); + set_has_bool_value(); + } + kind_.bool_value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Value.bool_value) +} + +// optional .google.protobuf.Struct struct_value = 5; + bool Value::has_struct_value() const { + return kind_case() == kStructValue; +} + void Value::set_has_struct_value() { + _oneof_case_[0] = kStructValue; +} + void Value::clear_struct_value() { + if (has_struct_value()) { + delete kind_.struct_value_; + clear_has_kind(); + } +} + const ::google::protobuf::Struct& Value::struct_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value) + return has_struct_value() ? *kind_.struct_value_ + : ::google::protobuf::Struct::default_instance(); +} + ::google::protobuf::Struct* Value::mutable_struct_value() { + if (!has_struct_value()) { + clear_kind(); + set_has_struct_value(); + kind_.struct_value_ = new ::google::protobuf::Struct; + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value) + return kind_.struct_value_; +} + ::google::protobuf::Struct* Value::release_struct_value() { + if (has_struct_value()) { + clear_has_kind(); + ::google::protobuf::Struct* temp = kind_.struct_value_; + kind_.struct_value_ = NULL; + return temp; + } else { + return NULL; + } +} + void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) { + clear_kind(); + if (struct_value) { + set_has_struct_value(); + kind_.struct_value_ = struct_value; + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value) +} + +// optional .google.protobuf.ListValue list_value = 6; + bool Value::has_list_value() const { + return kind_case() == kListValue; +} + void Value::set_has_list_value() { + _oneof_case_[0] = kListValue; +} + void Value::clear_list_value() { + if (has_list_value()) { + delete kind_.list_value_; + clear_has_kind(); + } +} + const ::google::protobuf::ListValue& Value::list_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value) + return has_list_value() ? *kind_.list_value_ + : ::google::protobuf::ListValue::default_instance(); +} + ::google::protobuf::ListValue* Value::mutable_list_value() { + if (!has_list_value()) { + clear_kind(); + set_has_list_value(); + kind_.list_value_ = new ::google::protobuf::ListValue; + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value) + return kind_.list_value_; +} + ::google::protobuf::ListValue* Value::release_list_value() { + if (has_list_value()) { + clear_has_kind(); + ::google::protobuf::ListValue* temp = kind_.list_value_; + kind_.list_value_ = NULL; + return temp; + } else { + return NULL; + } +} + void Value::set_allocated_list_value(::google::protobuf::ListValue* list_value) { + clear_kind(); + if (list_value) { + set_has_list_value(); + kind_.list_value_ = list_value; + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.list_value) +} + + bool Value::has_kind() const { + return kind_case() != KIND_NOT_SET; +} + void Value::clear_has_kind() { + _oneof_case_[0] = KIND_NOT_SET; +} +Value::KindCase Value::kind_case() const { + return Value::KindCase(_oneof_case_[0]); +} +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int ListValue::kValuesFieldNumber; +#endif // !_MSC_VER + +ListValue::ListValue() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.ListValue) +} + +void ListValue::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +ListValue::ListValue(const ListValue& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.ListValue) +} + +void ListValue::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; +} + +ListValue::~ListValue() { + // @@protoc_insertion_point(destructor:google.protobuf.ListValue) + SharedDtor(); +} + +void ListValue::SharedDtor() { + if (this != default_instance_) { + } +} + +void ListValue::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* ListValue::descriptor() { + protobuf_AssignDescriptorsOnce(); + return ListValue_descriptor_; +} + +const ListValue& ListValue::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto(); + return *default_instance_; +} + +ListValue* ListValue::default_instance_ = NULL; + +ListValue* ListValue::New(::google::protobuf::Arena* arena) const { + ListValue* n = new ListValue; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void ListValue::Clear() { + values_.Clear(); +} + +bool ListValue::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.ListValue) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .google.protobuf.Value values = 1; + case 1: { + if (tag == 10) { + parse_values: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_values())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(10)) goto parse_values; + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.ListValue) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.ListValue) + return false; +#undef DO_ +} + +void ListValue::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.ListValue) + // repeated .google.protobuf.Value values = 1; + for (unsigned int i = 0, n = this->values_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 1, this->values(i), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.ListValue) +} + +::google::protobuf::uint8* ListValue::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ListValue) + // repeated .google.protobuf.Value values = 1; + for (unsigned int i = 0, n = this->values_size(); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 1, this->values(i), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.ListValue) + return target; +} + +int ListValue::ByteSize() const { + int total_size = 0; + + // repeated .google.protobuf.Value values = 1; + total_size += 1 * this->values_size(); + for (int i = 0; i < this->values_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->values(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ListValue::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const ListValue* source = + ::google::protobuf::internal::dynamic_cast_if_available<const ListValue*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void ListValue::MergeFrom(const ListValue& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + values_.MergeFrom(from.values_); +} + +void ListValue::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void ListValue::CopyFrom(const ListValue& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ListValue::IsInitialized() const { + + return true; +} + +void ListValue::Swap(ListValue* other) { + if (other == this) return; + InternalSwap(other); +} +void ListValue::InternalSwap(ListValue* other) { + values_.UnsafeArenaSwap(&other->values_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata ListValue::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = ListValue_descriptor_; + metadata.reflection = ListValue_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// ListValue + +// repeated .google.protobuf.Value values = 1; + int ListValue::values_size() const { + return values_.size(); +} + void ListValue::clear_values() { + values_.Clear(); +} + const ::google::protobuf::Value& ListValue::values(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.ListValue.values) + return values_.Get(index); +} + ::google::protobuf::Value* ListValue::mutable_values(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.ListValue.values) + return values_.Mutable(index); +} + ::google::protobuf::Value* ListValue::add_values() { + // @@protoc_insertion_point(field_add:google.protobuf.ListValue.values) + return values_.Add(); +} + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >& +ListValue::values() const { + // @@protoc_insertion_point(field_list:google.protobuf.ListValue.values) + return values_; +} + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >* +ListValue::mutable_values() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.ListValue.values) + return &values_; +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h new file mode 100644 index 00000000..46482142 --- /dev/null +++ b/src/google/protobuf/struct.pb.h @@ -0,0 +1,760 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/struct.proto + +#ifndef PROTOBUF_google_2fprotobuf_2fstruct_2eproto__INCLUDED +#define PROTOBUF_google_2fprotobuf_2fstruct_2eproto__INCLUDED + +#include <string> + +#include <google/protobuf/stubs/common.h> + +#if GOOGLE_PROTOBUF_VERSION < 3000000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/metadata.h> +#include <google/protobuf/message.h> +#include <google/protobuf/repeated_field.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/map.h> +#include <google/protobuf/map_field_inl.h> +#include <google/protobuf/generated_enum_reflection.h> +#include <google/protobuf/unknown_field_set.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +// Internal implementation detail -- do not call these. +void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto(); +void protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto(); +void protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto(); + +class Struct; +class Value; +class ListValue; + +enum NullValue { + NULL_VALUE = 0, + NullValue_INT_MIN_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32min, + NullValue_INT_MAX_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32max +}; +LIBPROTOBUF_EXPORT bool NullValue_IsValid(int value); +const NullValue NullValue_MIN = NULL_VALUE; +const NullValue NullValue_MAX = NULL_VALUE; +const int NullValue_ARRAYSIZE = NullValue_MAX + 1; + +LIBPROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* NullValue_descriptor(); +inline const ::std::string& NullValue_Name(NullValue value) { + return ::google::protobuf::internal::NameOfEnum( + NullValue_descriptor(), value); +} +inline bool NullValue_Parse( + const ::std::string& name, NullValue* value) { + return ::google::protobuf::internal::ParseNamedEnum<NullValue>( + NullValue_descriptor(), name, value); +} +// =================================================================== + +class LIBPROTOBUF_EXPORT Struct : public ::google::protobuf::Message { + public: + Struct(); + virtual ~Struct(); + + Struct(const Struct& from); + + inline Struct& operator=(const Struct& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Struct& default_instance(); + + void Swap(Struct* other); + + // implements Message ---------------------------------------------- + + inline Struct* New() const { return New(NULL); } + + Struct* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Struct& from); + void MergeFrom(const Struct& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Struct* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + + // accessors ------------------------------------------------------- + + // map<string, .google.protobuf.Value> fields = 1; + int fields_size() const; + void clear_fields(); + static const int kFieldsFieldNumber = 1; + const ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >& + fields() const; + ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >* + mutable_fields(); + + // @@protoc_insertion_point(class_scope:google.protobuf.Struct) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + typedef ::google::protobuf::internal::MapEntryLite< + ::std::string, ::google::protobuf::Value, + ::google::protobuf::internal::WireFormatLite::TYPE_STRING, + ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, + 0 > + Struct_FieldsEntry; + ::google::protobuf::internal::MapField< + ::std::string, ::google::protobuf::Value, + ::google::protobuf::internal::WireFormatLite::TYPE_STRING, + ::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE, + 0 > fields_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto(); + + void InitAsDefaultInstance(); + static Struct* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message { + public: + Value(); + virtual ~Value(); + + Value(const Value& from); + + inline Value& operator=(const Value& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Value& default_instance(); + + enum KindCase { + kNullValue = 1, + kNumberValue = 2, + kStringValue = 3, + kBoolValue = 4, + kStructValue = 5, + kListValue = 6, + KIND_NOT_SET = 0, + }; + + void Swap(Value* other); + + // implements Message ---------------------------------------------- + + inline Value* New() const { return New(NULL); } + + Value* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Value& from); + void MergeFrom(const Value& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Value* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional .google.protobuf.NullValue null_value = 1; + private: + bool has_null_value() const; + public: + void clear_null_value(); + static const int kNullValueFieldNumber = 1; + ::google::protobuf::NullValue null_value() const; + void set_null_value(::google::protobuf::NullValue value); + + // optional double number_value = 2; + private: + bool has_number_value() const; + public: + void clear_number_value(); + static const int kNumberValueFieldNumber = 2; + double number_value() const; + void set_number_value(double value); + + // optional string string_value = 3; + private: + bool has_string_value() const; + public: + void clear_string_value(); + static const int kStringValueFieldNumber = 3; + const ::std::string& string_value() const; + void set_string_value(const ::std::string& value); + void set_string_value(const char* value); + void set_string_value(const char* value, size_t size); + ::std::string* mutable_string_value(); + ::std::string* release_string_value(); + void set_allocated_string_value(::std::string* string_value); + + // optional bool bool_value = 4; + private: + bool has_bool_value() const; + public: + void clear_bool_value(); + static const int kBoolValueFieldNumber = 4; + bool bool_value() const; + void set_bool_value(bool value); + + // optional .google.protobuf.Struct struct_value = 5; + bool has_struct_value() const; + void clear_struct_value(); + static const int kStructValueFieldNumber = 5; + const ::google::protobuf::Struct& struct_value() const; + ::google::protobuf::Struct* mutable_struct_value(); + ::google::protobuf::Struct* release_struct_value(); + void set_allocated_struct_value(::google::protobuf::Struct* struct_value); + + // optional .google.protobuf.ListValue list_value = 6; + bool has_list_value() const; + void clear_list_value(); + static const int kListValueFieldNumber = 6; + const ::google::protobuf::ListValue& list_value() const; + ::google::protobuf::ListValue* mutable_list_value(); + ::google::protobuf::ListValue* release_list_value(); + void set_allocated_list_value(::google::protobuf::ListValue* list_value); + + KindCase kind_case() const; + // @@protoc_insertion_point(class_scope:google.protobuf.Value) + private: + inline void set_has_null_value(); + inline void set_has_number_value(); + inline void set_has_string_value(); + inline void set_has_bool_value(); + inline void set_has_struct_value(); + inline void set_has_list_value(); + + inline bool has_kind() const; + void clear_kind(); + inline void clear_has_kind(); + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + union KindUnion { + KindUnion() {} + int null_value_; + double number_value_; + ::google::protobuf::internal::ArenaStringPtr string_value_; + bool bool_value_; + ::google::protobuf::Struct* struct_value_; + ::google::protobuf::ListValue* list_value_; + } kind_; + mutable int _cached_size_; + ::google::protobuf::uint32 _oneof_case_[1]; + + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto(); + + void InitAsDefaultInstance(); + static Value* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT ListValue : public ::google::protobuf::Message { + public: + ListValue(); + virtual ~ListValue(); + + ListValue(const ListValue& from); + + inline ListValue& operator=(const ListValue& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ListValue& default_instance(); + + void Swap(ListValue* other); + + // implements Message ---------------------------------------------- + + inline ListValue* New() const { return New(NULL); } + + ListValue* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const ListValue& from); + void MergeFrom(const ListValue& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ListValue* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .google.protobuf.Value values = 1; + int values_size() const; + void clear_values(); + static const int kValuesFieldNumber = 1; + const ::google::protobuf::Value& values(int index) const; + ::google::protobuf::Value* mutable_values(int index); + ::google::protobuf::Value* add_values(); + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >& + values() const; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >* + mutable_values(); + + // @@protoc_insertion_point(class_scope:google.protobuf.ListValue) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value > values_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto(); + + void InitAsDefaultInstance(); + static ListValue* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +#if !PROTOBUF_INLINE_NOT_IN_HEADERS +// Struct + +// map<string, .google.protobuf.Value> fields = 1; +inline int Struct::fields_size() const { + return fields_.size(); +} +inline void Struct::clear_fields() { + fields_.Clear(); +} +inline const ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >& +Struct::fields() const { + // @@protoc_insertion_point(field_map:google.protobuf.Struct.fields) + return fields_.GetMap(); +} +inline ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >* +Struct::mutable_fields() { + // @@protoc_insertion_point(field_mutable_map:google.protobuf.Struct.fields) + return fields_.MutableMap(); +} + +// ------------------------------------------------------------------- + +// Value + +// optional .google.protobuf.NullValue null_value = 1; +inline bool Value::has_null_value() const { + return kind_case() == kNullValue; +} +inline void Value::set_has_null_value() { + _oneof_case_[0] = kNullValue; +} +inline void Value::clear_null_value() { + if (has_null_value()) { + kind_.null_value_ = 0; + clear_has_kind(); + } +} +inline ::google::protobuf::NullValue Value::null_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.null_value) + if (has_null_value()) { + return static_cast< ::google::protobuf::NullValue >(kind_.null_value_); + } + return static_cast< ::google::protobuf::NullValue >(0); +} +inline void Value::set_null_value(::google::protobuf::NullValue value) { + if (!has_null_value()) { + clear_kind(); + set_has_null_value(); + } + kind_.null_value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Value.null_value) +} + +// optional double number_value = 2; +inline bool Value::has_number_value() const { + return kind_case() == kNumberValue; +} +inline void Value::set_has_number_value() { + _oneof_case_[0] = kNumberValue; +} +inline void Value::clear_number_value() { + if (has_number_value()) { + kind_.number_value_ = 0; + clear_has_kind(); + } +} +inline double Value::number_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.number_value) + if (has_number_value()) { + return kind_.number_value_; + } + return 0; +} +inline void Value::set_number_value(double value) { + if (!has_number_value()) { + clear_kind(); + set_has_number_value(); + } + kind_.number_value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Value.number_value) +} + +// optional string string_value = 3; +inline bool Value::has_string_value() const { + return kind_case() == kStringValue; +} +inline void Value::set_has_string_value() { + _oneof_case_[0] = kStringValue; +} +inline void Value::clear_string_value() { + if (has_string_value()) { + kind_.string_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_kind(); + } +} +inline const ::std::string& Value::string_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.string_value) + if (has_string_value()) { + return kind_.string_value_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + return *&::google::protobuf::internal::GetEmptyStringAlreadyInited(); +} +inline void Value::set_string_value(const ::std::string& value) { + // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value) + if (!has_string_value()) { + clear_kind(); + set_has_string_value(); + kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + kind_.string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Value.string_value) +} +inline void Value::set_string_value(const char* value) { + if (!has_string_value()) { + clear_kind(); + set_has_string_value(); + kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + kind_.string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Value.string_value) +} +inline void Value::set_string_value(const char* value, size_t size) { + if (!has_string_value()) { + clear_kind(); + set_has_string_value(); + kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + kind_.string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string( + reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Value.string_value) +} +inline ::std::string* Value::mutable_string_value() { + if (!has_string_value()) { + clear_kind(); + set_has_string_value(); + kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Value.string_value) + return kind_.string_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* Value::release_string_value() { + if (has_string_value()) { + clear_has_kind(); + return kind_.string_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } else { + return NULL; + } +} +inline void Value::set_allocated_string_value(::std::string* string_value) { + if (!has_string_value()) { + kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + clear_kind(); + if (string_value != NULL) { + set_has_string_value(); + kind_.string_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + string_value); + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.string_value) +} + +// optional bool bool_value = 4; +inline bool Value::has_bool_value() const { + return kind_case() == kBoolValue; +} +inline void Value::set_has_bool_value() { + _oneof_case_[0] = kBoolValue; +} +inline void Value::clear_bool_value() { + if (has_bool_value()) { + kind_.bool_value_ = false; + clear_has_kind(); + } +} +inline bool Value::bool_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.bool_value) + if (has_bool_value()) { + return kind_.bool_value_; + } + return false; +} +inline void Value::set_bool_value(bool value) { + if (!has_bool_value()) { + clear_kind(); + set_has_bool_value(); + } + kind_.bool_value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Value.bool_value) +} + +// optional .google.protobuf.Struct struct_value = 5; +inline bool Value::has_struct_value() const { + return kind_case() == kStructValue; +} +inline void Value::set_has_struct_value() { + _oneof_case_[0] = kStructValue; +} +inline void Value::clear_struct_value() { + if (has_struct_value()) { + delete kind_.struct_value_; + clear_has_kind(); + } +} +inline const ::google::protobuf::Struct& Value::struct_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value) + return has_struct_value() ? *kind_.struct_value_ + : ::google::protobuf::Struct::default_instance(); +} +inline ::google::protobuf::Struct* Value::mutable_struct_value() { + if (!has_struct_value()) { + clear_kind(); + set_has_struct_value(); + kind_.struct_value_ = new ::google::protobuf::Struct; + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value) + return kind_.struct_value_; +} +inline ::google::protobuf::Struct* Value::release_struct_value() { + if (has_struct_value()) { + clear_has_kind(); + ::google::protobuf::Struct* temp = kind_.struct_value_; + kind_.struct_value_ = NULL; + return temp; + } else { + return NULL; + } +} +inline void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) { + clear_kind(); + if (struct_value) { + set_has_struct_value(); + kind_.struct_value_ = struct_value; + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value) +} + +// optional .google.protobuf.ListValue list_value = 6; +inline bool Value::has_list_value() const { + return kind_case() == kListValue; +} +inline void Value::set_has_list_value() { + _oneof_case_[0] = kListValue; +} +inline void Value::clear_list_value() { + if (has_list_value()) { + delete kind_.list_value_; + clear_has_kind(); + } +} +inline const ::google::protobuf::ListValue& Value::list_value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Value.list_value) + return has_list_value() ? *kind_.list_value_ + : ::google::protobuf::ListValue::default_instance(); +} +inline ::google::protobuf::ListValue* Value::mutable_list_value() { + if (!has_list_value()) { + clear_kind(); + set_has_list_value(); + kind_.list_value_ = new ::google::protobuf::ListValue; + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value) + return kind_.list_value_; +} +inline ::google::protobuf::ListValue* Value::release_list_value() { + if (has_list_value()) { + clear_has_kind(); + ::google::protobuf::ListValue* temp = kind_.list_value_; + kind_.list_value_ = NULL; + return temp; + } else { + return NULL; + } +} +inline void Value::set_allocated_list_value(::google::protobuf::ListValue* list_value) { + clear_kind(); + if (list_value) { + set_has_list_value(); + kind_.list_value_ = list_value; + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.list_value) +} + +inline bool Value::has_kind() const { + return kind_case() != KIND_NOT_SET; +} +inline void Value::clear_has_kind() { + _oneof_case_[0] = KIND_NOT_SET; +} +inline Value::KindCase Value::kind_case() const { + return Value::KindCase(_oneof_case_[0]); +} +// ------------------------------------------------------------------- + +// ListValue + +// repeated .google.protobuf.Value values = 1; +inline int ListValue::values_size() const { + return values_.size(); +} +inline void ListValue::clear_values() { + values_.Clear(); +} +inline const ::google::protobuf::Value& ListValue::values(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.ListValue.values) + return values_.Get(index); +} +inline ::google::protobuf::Value* ListValue::mutable_values(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.ListValue.values) + return values_.Mutable(index); +} +inline ::google::protobuf::Value* ListValue::add_values() { + // @@protoc_insertion_point(field_add:google.protobuf.ListValue.values) + return values_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >& +ListValue::values() const { + // @@protoc_insertion_point(field_list:google.protobuf.ListValue.values) + return values_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >* +ListValue::mutable_values() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.ListValue.values) + return &values_; +} + +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +#ifndef SWIG +namespace google { +namespace protobuf { + +template <> struct is_proto_enum< ::google::protobuf::NullValue> : ::google::protobuf::internal::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::NullValue>() { + return ::google::protobuf::NullValue_descriptor(); +} + +} // namespace protobuf +} // namespace google +#endif // SWIG + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_google_2fprotobuf_2fstruct_2eproto__INCLUDED diff --git a/src/google/protobuf/struct.proto b/src/google/protobuf/struct.proto index 04d59f77..cd102731 100644 --- a/src/google/protobuf/struct.proto +++ b/src/google/protobuf/struct.proto @@ -35,6 +35,7 @@ option java_generate_equals_and_hash = true; option java_multiple_files = true; option java_outer_classname = "StructProto"; option java_package = "com.google.protobuf"; +option csharp_namespace = "Google.ProtocolBuffers"; option objc_class_prefix = "GPB"; diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc new file mode 100644 index 00000000..0df53f63 --- /dev/null +++ b/src/google/protobuf/timestamp.pb.cc @@ -0,0 +1,406 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/timestamp.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "google/protobuf/timestamp.pb.h" + +#include <algorithm> + +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/once.h> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/wire_format_lite_inl.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/generated_message_reflection.h> +#include <google/protobuf/reflection_ops.h> +#include <google/protobuf/wire_format.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +namespace { + +const ::google::protobuf::Descriptor* Timestamp_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Timestamp_reflection_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_google_2fprotobuf_2ftimestamp_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2ftimestamp_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "google/protobuf/timestamp.proto"); + GOOGLE_CHECK(file != NULL); + Timestamp_descriptor_ = file->message_type(0); + static const int Timestamp_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Timestamp, seconds_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Timestamp, nanos_), + }; + Timestamp_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Timestamp_descriptor_, + Timestamp::default_instance_, + Timestamp_offsets_, + -1, + -1, + -1, + sizeof(Timestamp), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Timestamp, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Timestamp, _is_default_instance_)); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_google_2fprotobuf_2ftimestamp_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Timestamp_descriptor_, &Timestamp::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_google_2fprotobuf_2ftimestamp_2eproto() { + delete Timestamp::default_instance_; + delete Timestamp_reflection_; +} + +void protobuf_AddDesc_google_2fprotobuf_2ftimestamp_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n\037google/protobuf/timestamp.proto\022\017googl" + "e.protobuf\"+\n\tTimestamp\022\017\n\007seconds\030\001 \001(\003" + "\022\r\n\005nanos\030\002 \001(\005B0\n\023com.google.protobufB\016" + "TimestampProtoP\001\240\001\001\242\002\003GPBb\006proto3", 153); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "google/protobuf/timestamp.proto", &protobuf_RegisterTypes); + Timestamp::default_instance_ = new Timestamp(); + Timestamp::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2ftimestamp_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_google_2fprotobuf_2ftimestamp_2eproto { + StaticDescriptorInitializer_google_2fprotobuf_2ftimestamp_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2ftimestamp_2eproto(); + } +} static_descriptor_initializer_google_2fprotobuf_2ftimestamp_2eproto_; + +namespace { + +static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD; +static void MergeFromFail(int line) { + GOOGLE_CHECK(false) << __FILE__ << ":" << line; +} + +} // namespace + + +// =================================================================== + +#ifndef _MSC_VER +const int Timestamp::kSecondsFieldNumber; +const int Timestamp::kNanosFieldNumber; +#endif // !_MSC_VER + +Timestamp::Timestamp() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Timestamp) +} + +void Timestamp::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +Timestamp::Timestamp(const Timestamp& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Timestamp) +} + +void Timestamp::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; + seconds_ = GOOGLE_LONGLONG(0); + nanos_ = 0; +} + +Timestamp::~Timestamp() { + // @@protoc_insertion_point(destructor:google.protobuf.Timestamp) + SharedDtor(); +} + +void Timestamp::SharedDtor() { + if (this != default_instance_) { + } +} + +void Timestamp::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Timestamp::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Timestamp_descriptor_; +} + +const Timestamp& Timestamp::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2ftimestamp_2eproto(); + return *default_instance_; +} + +Timestamp* Timestamp::default_instance_ = NULL; + +Timestamp* Timestamp::New(::google::protobuf::Arena* arena) const { + Timestamp* n = new Timestamp; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Timestamp::Clear() { +#define ZR_HELPER_(f) reinterpret_cast<char*>(\ + &reinterpret_cast<Timestamp*>(16)->f) + +#define ZR_(first, last) do {\ + ::memset(&first, 0,\ + ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\ +} while (0) + + ZR_(seconds_, nanos_); + +#undef ZR_HELPER_ +#undef ZR_ + +} + +bool Timestamp::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Timestamp) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional int64 seconds = 1; + case 1: { + if (tag == 8) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &seconds_))); + + } else { + goto handle_unusual; + } + if (input->ExpectTag(16)) goto parse_nanos; + break; + } + + // optional int32 nanos = 2; + case 2: { + if (tag == 16) { + parse_nanos: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &nanos_))); + + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Timestamp) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Timestamp) + return false; +#undef DO_ +} + +void Timestamp::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Timestamp) + // optional int64 seconds = 1; + if (this->seconds() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(1, this->seconds(), output); + } + + // optional int32 nanos = 2; + if (this->nanos() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->nanos(), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.Timestamp) +} + +::google::protobuf::uint8* Timestamp::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Timestamp) + // optional int64 seconds = 1; + if (this->seconds() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(1, this->seconds(), target); + } + + // optional int32 nanos = 2; + if (this->nanos() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->nanos(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Timestamp) + return target; +} + +int Timestamp::ByteSize() const { + int total_size = 0; + + // optional int64 seconds = 1; + if (this->seconds() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->seconds()); + } + + // optional int32 nanos = 2; + if (this->nanos() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->nanos()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Timestamp::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Timestamp* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Timestamp*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Timestamp::MergeFrom(const Timestamp& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.seconds() != 0) { + set_seconds(from.seconds()); + } + if (from.nanos() != 0) { + set_nanos(from.nanos()); + } +} + +void Timestamp::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Timestamp::CopyFrom(const Timestamp& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Timestamp::IsInitialized() const { + + return true; +} + +void Timestamp::Swap(Timestamp* other) { + if (other == this) return; + InternalSwap(other); +} +void Timestamp::InternalSwap(Timestamp* other) { + std::swap(seconds_, other->seconds_); + std::swap(nanos_, other->nanos_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Timestamp::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Timestamp_descriptor_; + metadata.reflection = Timestamp_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Timestamp + +// optional int64 seconds = 1; + void Timestamp::clear_seconds() { + seconds_ = GOOGLE_LONGLONG(0); +} + ::google::protobuf::int64 Timestamp::seconds() const { + // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.seconds) + return seconds_; +} + void Timestamp::set_seconds(::google::protobuf::int64 value) { + + seconds_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.seconds) +} + +// optional int32 nanos = 2; + void Timestamp::clear_nanos() { + nanos_ = 0; +} + ::google::protobuf::int32 Timestamp::nanos() const { + // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.nanos) + return nanos_; +} + void Timestamp::set_nanos(::google::protobuf::int32 value) { + + nanos_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.nanos) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h new file mode 100644 index 00000000..85fc1242 --- /dev/null +++ b/src/google/protobuf/timestamp.pb.h @@ -0,0 +1,172 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/timestamp.proto + +#ifndef PROTOBUF_google_2fprotobuf_2ftimestamp_2eproto__INCLUDED +#define PROTOBUF_google_2fprotobuf_2ftimestamp_2eproto__INCLUDED + +#include <string> + +#include <google/protobuf/stubs/common.h> + +#if GOOGLE_PROTOBUF_VERSION < 3000000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/metadata.h> +#include <google/protobuf/message.h> +#include <google/protobuf/repeated_field.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/unknown_field_set.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +// Internal implementation detail -- do not call these. +void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2ftimestamp_2eproto(); +void protobuf_AssignDesc_google_2fprotobuf_2ftimestamp_2eproto(); +void protobuf_ShutdownFile_google_2fprotobuf_2ftimestamp_2eproto(); + +class Timestamp; + +// =================================================================== + +class LIBPROTOBUF_EXPORT Timestamp : public ::google::protobuf::Message { + public: + Timestamp(); + virtual ~Timestamp(); + + Timestamp(const Timestamp& from); + + inline Timestamp& operator=(const Timestamp& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Timestamp& default_instance(); + + void Swap(Timestamp* other); + + // implements Message ---------------------------------------------- + + inline Timestamp* New() const { return New(NULL); } + + Timestamp* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Timestamp& from); + void MergeFrom(const Timestamp& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Timestamp* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int64 seconds = 1; + void clear_seconds(); + static const int kSecondsFieldNumber = 1; + ::google::protobuf::int64 seconds() const; + void set_seconds(::google::protobuf::int64 value); + + // optional int32 nanos = 2; + void clear_nanos(); + static const int kNanosFieldNumber = 2; + ::google::protobuf::int32 nanos() const; + void set_nanos(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:google.protobuf.Timestamp) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::int64 seconds_; + ::google::protobuf::int32 nanos_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2ftimestamp_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2ftimestamp_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2ftimestamp_2eproto(); + + void InitAsDefaultInstance(); + static Timestamp* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +#if !PROTOBUF_INLINE_NOT_IN_HEADERS +// Timestamp + +// optional int64 seconds = 1; +inline void Timestamp::clear_seconds() { + seconds_ = GOOGLE_LONGLONG(0); +} +inline ::google::protobuf::int64 Timestamp::seconds() const { + // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.seconds) + return seconds_; +} +inline void Timestamp::set_seconds(::google::protobuf::int64 value) { + + seconds_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.seconds) +} + +// optional int32 nanos = 2; +inline void Timestamp::clear_nanos() { + nanos_ = 0; +} +inline ::google::protobuf::int32 Timestamp::nanos() const { + // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.nanos) + return nanos_; +} +inline void Timestamp::set_nanos(::google::protobuf::int32 value) { + + nanos_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.nanos) +} + +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_google_2fprotobuf_2ftimestamp_2eproto__INCLUDED diff --git a/src/google/protobuf/timestamp.proto b/src/google/protobuf/timestamp.proto index 72e8914c..381ff997 100644 --- a/src/google/protobuf/timestamp.proto +++ b/src/google/protobuf/timestamp.proto @@ -35,6 +35,7 @@ option java_generate_equals_and_hash = true; option java_multiple_files = true; option java_outer_classname = "TimestampProto"; option java_package = "com.google.protobuf"; +option csharp_namespace = "Google.ProtocolBuffers"; option objc_class_prefix = "GPB"; diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc new file mode 100644 index 00000000..d77bc6ce --- /dev/null +++ b/src/google/protobuf/type.pb.cc @@ -0,0 +1,2882 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/type.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "google/protobuf/type.pb.h" + +#include <algorithm> + +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/once.h> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/wire_format_lite_inl.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/generated_message_reflection.h> +#include <google/protobuf/reflection_ops.h> +#include <google/protobuf/wire_format.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +namespace { + +const ::google::protobuf::Descriptor* Type_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Type_reflection_ = NULL; +const ::google::protobuf::Descriptor* Field_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Field_reflection_ = NULL; +const ::google::protobuf::EnumDescriptor* Field_Kind_descriptor_ = NULL; +const ::google::protobuf::EnumDescriptor* Field_Cardinality_descriptor_ = NULL; +const ::google::protobuf::Descriptor* Enum_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Enum_reflection_ = NULL; +const ::google::protobuf::Descriptor* EnumValue_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + EnumValue_reflection_ = NULL; +const ::google::protobuf::Descriptor* Option_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Option_reflection_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_google_2fprotobuf_2ftype_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "google/protobuf/type.proto"); + GOOGLE_CHECK(file != NULL); + Type_descriptor_ = file->message_type(0); + static const int Type_offsets_[5] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, fields_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, oneofs_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, source_context_), + }; + Type_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Type_descriptor_, + Type::default_instance_, + Type_offsets_, + -1, + -1, + -1, + sizeof(Type), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Type, _is_default_instance_)); + Field_descriptor_ = file->message_type(1); + static const int Field_offsets_[8] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, kind_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, cardinality_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, number_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, type_url_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, oneof_index_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, packed_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, options_), + }; + Field_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Field_descriptor_, + Field::default_instance_, + Field_offsets_, + -1, + -1, + -1, + sizeof(Field), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Field, _is_default_instance_)); + Field_Kind_descriptor_ = Field_descriptor_->enum_type(0); + Field_Cardinality_descriptor_ = Field_descriptor_->enum_type(1); + Enum_descriptor_ = file->message_type(2); + static const int Enum_offsets_[4] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, enumvalue_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, options_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, source_context_), + }; + Enum_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Enum_descriptor_, + Enum::default_instance_, + Enum_offsets_, + -1, + -1, + -1, + sizeof(Enum), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Enum, _is_default_instance_)); + EnumValue_descriptor_ = file->message_type(3); + static const int EnumValue_offsets_[3] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValue, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValue, number_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValue, options_), + }; + EnumValue_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + EnumValue_descriptor_, + EnumValue::default_instance_, + EnumValue_offsets_, + -1, + -1, + -1, + sizeof(EnumValue), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(EnumValue, _is_default_instance_)); + Option_descriptor_ = file->message_type(4); + static const int Option_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Option, name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Option, value_), + }; + Option_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Option_descriptor_, + Option::default_instance_, + Option_offsets_, + -1, + -1, + -1, + sizeof(Option), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Option, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Option, _is_default_instance_)); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_google_2fprotobuf_2ftype_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Type_descriptor_, &Type::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Field_descriptor_, &Field::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Enum_descriptor_, &Enum::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + EnumValue_descriptor_, &EnumValue::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Option_descriptor_, &Option::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_google_2fprotobuf_2ftype_2eproto() { + delete Type::default_instance_; + delete Type_reflection_; + delete Field::default_instance_; + delete Field_reflection_; + delete Enum::default_instance_; + delete Enum_reflection_; + delete EnumValue::default_instance_; + delete EnumValue_reflection_; + delete Option::default_instance_; + delete Option_reflection_; +} + +void protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fany_2eproto(); + ::google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fsource_5fcontext_2eproto(); + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n\032google/protobuf/type.proto\022\017google.pro" + "tobuf\032\031google/protobuf/any.proto\032$google" + "/protobuf/source_context.proto\"\256\001\n\004Type\022" + "\014\n\004name\030\001 \001(\t\022&\n\006fields\030\002 \003(\0132\026.google.p" + "rotobuf.Field\022\016\n\006oneofs\030\003 \003(\t\022(\n\007options" + "\030\004 \003(\0132\027.google.protobuf.Option\0226\n\016sourc" + "e_context\030\005 \001(\0132\036.google.protobuf.Source" + "Context\"\233\005\n\005Field\022)\n\004kind\030\001 \001(\0162\033.google" + ".protobuf.Field.Kind\0227\n\013cardinality\030\002 \001(" + "\0162\".google.protobuf.Field.Cardinality\022\016\n" + "\006number\030\003 \001(\005\022\014\n\004name\030\004 \001(\t\022\020\n\010type_url\030" + "\006 \001(\t\022\023\n\013oneof_index\030\007 \001(\005\022\016\n\006packed\030\010 \001" + "(\010\022(\n\007options\030\t \003(\0132\027.google.protobuf.Op" + "tion\"\270\002\n\004Kind\022\020\n\014TYPE_UNKNOWN\020\000\022\017\n\013TYPE_" + "DOUBLE\020\001\022\016\n\nTYPE_FLOAT\020\002\022\016\n\nTYPE_INT64\020\003" + "\022\017\n\013TYPE_UINT64\020\004\022\016\n\nTYPE_INT32\020\005\022\020\n\014TYP" + "E_FIXED64\020\006\022\020\n\014TYPE_FIXED32\020\007\022\r\n\tTYPE_BO" + "OL\020\010\022\017\n\013TYPE_STRING\020\t\022\020\n\014TYPE_MESSAGE\020\013\022" + "\016\n\nTYPE_BYTES\020\014\022\017\n\013TYPE_UINT32\020\r\022\r\n\tTYPE" + "_ENUM\020\016\022\021\n\rTYPE_SFIXED32\020\017\022\021\n\rTYPE_SFIXE" + "D64\020\020\022\017\n\013TYPE_SINT32\020\021\022\017\n\013TYPE_SINT64\020\022\"" + "t\n\013Cardinality\022\027\n\023CARDINALITY_UNKNOWN\020\000\022" + "\030\n\024CARDINALITY_OPTIONAL\020\001\022\030\n\024CARDINALITY" + "_REQUIRED\020\002\022\030\n\024CARDINALITY_REPEATED\020\003\"\245\001" + "\n\004Enum\022\014\n\004name\030\001 \001(\t\022-\n\tenumvalue\030\002 \003(\0132" + "\032.google.protobuf.EnumValue\022(\n\007options\030\003" + " \003(\0132\027.google.protobuf.Option\0226\n\016source_" + "context\030\004 \001(\0132\036.google.protobuf.SourceCo" + "ntext\"S\n\tEnumValue\022\014\n\004name\030\001 \001(\t\022\016\n\006numb" + "er\030\002 \001(\005\022(\n\007options\030\003 \003(\0132\027.google.proto" + "buf.Option\";\n\006Option\022\014\n\004name\030\001 \001(\t\022#\n\005va" + "lue\030\002 \001(\0132\024.google.protobuf.AnyB(\n\023com.g" + "oogle.protobufB\tTypeProtoP\001\242\002\003GPBb\006proto" + "3", 1321); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "google/protobuf/type.proto", &protobuf_RegisterTypes); + Type::default_instance_ = new Type(); + Field::default_instance_ = new Field(); + Enum::default_instance_ = new Enum(); + EnumValue::default_instance_ = new EnumValue(); + Option::default_instance_ = new Option(); + Type::default_instance_->InitAsDefaultInstance(); + Field::default_instance_->InitAsDefaultInstance(); + Enum::default_instance_->InitAsDefaultInstance(); + EnumValue::default_instance_->InitAsDefaultInstance(); + Option::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2ftype_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_google_2fprotobuf_2ftype_2eproto { + StaticDescriptorInitializer_google_2fprotobuf_2ftype_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); + } +} static_descriptor_initializer_google_2fprotobuf_2ftype_2eproto_; + +namespace { + +static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD; +static void MergeFromFail(int line) { + GOOGLE_CHECK(false) << __FILE__ << ":" << line; +} + +} // namespace + + +// =================================================================== + +#ifndef _MSC_VER +const int Type::kNameFieldNumber; +const int Type::kFieldsFieldNumber; +const int Type::kOneofsFieldNumber; +const int Type::kOptionsFieldNumber; +const int Type::kSourceContextFieldNumber; +#endif // !_MSC_VER + +Type::Type() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Type) +} + +void Type::InitAsDefaultInstance() { + _is_default_instance_ = true; + source_context_ = const_cast< ::google::protobuf::SourceContext*>(&::google::protobuf::SourceContext::default_instance()); +} + +Type::Type(const Type& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Type) +} + +void Type::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + source_context_ = NULL; +} + +Type::~Type() { + // @@protoc_insertion_point(destructor:google.protobuf.Type) + SharedDtor(); +} + +void Type::SharedDtor() { + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + delete source_context_; + } +} + +void Type::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Type::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Type_descriptor_; +} + +const Type& Type::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); + return *default_instance_; +} + +Type* Type::default_instance_ = NULL; + +Type* Type::New(::google::protobuf::Arena* arena) const { + Type* n = new Type; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Type::Clear() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (source_context_ != NULL) delete source_context_; + source_context_ = NULL; + fields_.Clear(); + oneofs_.Clear(); + options_.Clear(); +} + +bool Type::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Type) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.Type.name"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(18)) goto parse_fields; + break; + } + + // repeated .google.protobuf.Field fields = 2; + case 2: { + if (tag == 18) { + parse_fields: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_fields())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(18)) goto parse_fields; + if (input->ExpectTag(26)) goto parse_oneofs; + break; + } + + // repeated string oneofs = 3; + case 3: { + if (tag == 26) { + parse_oneofs: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->add_oneofs())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->oneofs(this->oneofs_size() - 1).data(), + this->oneofs(this->oneofs_size() - 1).length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.Type.oneofs"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(26)) goto parse_oneofs; + if (input->ExpectTag(34)) goto parse_options; + break; + } + + // repeated .google.protobuf.Option options = 4; + case 4: { + if (tag == 34) { + parse_options: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_options())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(34)) goto parse_options; + if (input->ExpectTag(42)) goto parse_source_context; + break; + } + + // optional .google.protobuf.SourceContext source_context = 5; + case 5: { + if (tag == 42) { + parse_source_context: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_source_context())); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Type) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Type) + return false; +#undef DO_ +} + +void Type::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Type) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Type.name"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->name(), output); + } + + // repeated .google.protobuf.Field fields = 2; + for (unsigned int i = 0, n = this->fields_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 2, this->fields(i), output); + } + + // repeated string oneofs = 3; + for (int i = 0; i < this->oneofs_size(); i++) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->oneofs(i).data(), this->oneofs(i).length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Type.oneofs"); + ::google::protobuf::internal::WireFormatLite::WriteString( + 3, this->oneofs(i), output); + } + + // repeated .google.protobuf.Option options = 4; + for (unsigned int i = 0, n = this->options_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 4, this->options(i), output); + } + + // optional .google.protobuf.SourceContext source_context = 5; + if (this->has_source_context()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 5, *this->source_context_, output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.Type) +} + +::google::protobuf::uint8* Type::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Type) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Type.name"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // repeated .google.protobuf.Field fields = 2; + for (unsigned int i = 0, n = this->fields_size(); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 2, this->fields(i), target); + } + + // repeated string oneofs = 3; + for (int i = 0; i < this->oneofs_size(); i++) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->oneofs(i).data(), this->oneofs(i).length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Type.oneofs"); + target = ::google::protobuf::internal::WireFormatLite:: + WriteStringToArray(3, this->oneofs(i), target); + } + + // repeated .google.protobuf.Option options = 4; + for (unsigned int i = 0, n = this->options_size(); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 4, this->options(i), target); + } + + // optional .google.protobuf.SourceContext source_context = 5; + if (this->has_source_context()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 5, *this->source_context_, target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Type) + return target; +} + +int Type::ByteSize() const { + int total_size = 0; + + // optional string name = 1; + if (this->name().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional .google.protobuf.SourceContext source_context = 5; + if (this->has_source_context()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *this->source_context_); + } + + // repeated .google.protobuf.Field fields = 2; + total_size += 1 * this->fields_size(); + for (int i = 0; i < this->fields_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->fields(i)); + } + + // repeated string oneofs = 3; + total_size += 1 * this->oneofs_size(); + for (int i = 0; i < this->oneofs_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this->oneofs(i)); + } + + // repeated .google.protobuf.Option options = 4; + total_size += 1 * this->options_size(); + for (int i = 0; i < this->options_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->options(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Type::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Type* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Type*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Type::MergeFrom(const Type& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + fields_.MergeFrom(from.fields_); + oneofs_.MergeFrom(from.oneofs_); + options_.MergeFrom(from.options_); + if (from.name().size() > 0) { + + name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + } + if (from.has_source_context()) { + mutable_source_context()->::google::protobuf::SourceContext::MergeFrom(from.source_context()); + } +} + +void Type::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Type::CopyFrom(const Type& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Type::IsInitialized() const { + + return true; +} + +void Type::Swap(Type* other) { + if (other == this) return; + InternalSwap(other); +} +void Type::InternalSwap(Type* other) { + name_.Swap(&other->name_); + fields_.UnsafeArenaSwap(&other->fields_); + oneofs_.UnsafeArenaSwap(&other->oneofs_); + options_.UnsafeArenaSwap(&other->options_); + std::swap(source_context_, other->source_context_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Type::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Type_descriptor_; + metadata.reflection = Type_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Type + +// optional string name = 1; + void Type::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& Type::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.Type.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Type::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Type.name) +} + void Type::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Type.name) +} + void Type::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Type.name) +} + ::std::string* Type::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Type.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* Type::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Type::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.name) +} + +// repeated .google.protobuf.Field fields = 2; + int Type::fields_size() const { + return fields_.size(); +} + void Type::clear_fields() { + fields_.Clear(); +} + const ::google::protobuf::Field& Type::fields(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Type.fields) + return fields_.Get(index); +} + ::google::protobuf::Field* Type::mutable_fields(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Type.fields) + return fields_.Mutable(index); +} + ::google::protobuf::Field* Type::add_fields() { + // @@protoc_insertion_point(field_add:google.protobuf.Type.fields) + return fields_.Add(); +} + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >& +Type::fields() const { + // @@protoc_insertion_point(field_list:google.protobuf.Type.fields) + return fields_; +} + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >* +Type::mutable_fields() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.fields) + return &fields_; +} + +// repeated string oneofs = 3; + int Type::oneofs_size() const { + return oneofs_.size(); +} + void Type::clear_oneofs() { + oneofs_.Clear(); +} + const ::std::string& Type::oneofs(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Type.oneofs) + return oneofs_.Get(index); +} + ::std::string* Type::mutable_oneofs(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Type.oneofs) + return oneofs_.Mutable(index); +} + void Type::set_oneofs(int index, const ::std::string& value) { + // @@protoc_insertion_point(field_set:google.protobuf.Type.oneofs) + oneofs_.Mutable(index)->assign(value); +} + void Type::set_oneofs(int index, const char* value) { + oneofs_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.Type.oneofs) +} + void Type::set_oneofs(int index, const char* value, size_t size) { + oneofs_.Mutable(index)->assign( + reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Type.oneofs) +} + ::std::string* Type::add_oneofs() { + return oneofs_.Add(); +} + void Type::add_oneofs(const ::std::string& value) { + oneofs_.Add()->assign(value); + // @@protoc_insertion_point(field_add:google.protobuf.Type.oneofs) +} + void Type::add_oneofs(const char* value) { + oneofs_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:google.protobuf.Type.oneofs) +} + void Type::add_oneofs(const char* value, size_t size) { + oneofs_.Add()->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_add_pointer:google.protobuf.Type.oneofs) +} + const ::google::protobuf::RepeatedPtrField< ::std::string>& +Type::oneofs() const { + // @@protoc_insertion_point(field_list:google.protobuf.Type.oneofs) + return oneofs_; +} + ::google::protobuf::RepeatedPtrField< ::std::string>* +Type::mutable_oneofs() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.oneofs) + return &oneofs_; +} + +// repeated .google.protobuf.Option options = 4; + int Type::options_size() const { + return options_.size(); +} + void Type::clear_options() { + options_.Clear(); +} + const ::google::protobuf::Option& Type::options(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Type.options) + return options_.Get(index); +} + ::google::protobuf::Option* Type::mutable_options(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Type.options) + return options_.Mutable(index); +} + ::google::protobuf::Option* Type::add_options() { + // @@protoc_insertion_point(field_add:google.protobuf.Type.options) + return options_.Add(); +} + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& +Type::options() const { + // @@protoc_insertion_point(field_list:google.protobuf.Type.options) + return options_; +} + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* +Type::mutable_options() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.options) + return &options_; +} + +// optional .google.protobuf.SourceContext source_context = 5; + bool Type::has_source_context() const { + return !_is_default_instance_ && source_context_ != NULL; +} + void Type::clear_source_context() { + if (source_context_ != NULL) delete source_context_; + source_context_ = NULL; +} + const ::google::protobuf::SourceContext& Type::source_context() const { + // @@protoc_insertion_point(field_get:google.protobuf.Type.source_context) + return source_context_ != NULL ? *source_context_ : *default_instance_->source_context_; +} + ::google::protobuf::SourceContext* Type::mutable_source_context() { + + if (source_context_ == NULL) { + source_context_ = new ::google::protobuf::SourceContext; + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Type.source_context) + return source_context_; +} + ::google::protobuf::SourceContext* Type::release_source_context() { + + ::google::protobuf::SourceContext* temp = source_context_; + source_context_ = NULL; + return temp; +} + void Type::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { + delete source_context_; + source_context_ = source_context; + if (source_context) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.source_context) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +const ::google::protobuf::EnumDescriptor* Field_Kind_descriptor() { + protobuf_AssignDescriptorsOnce(); + return Field_Kind_descriptor_; +} +bool Field_Kind_IsValid(int value) { + switch(value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const Field_Kind Field::TYPE_UNKNOWN; +const Field_Kind Field::TYPE_DOUBLE; +const Field_Kind Field::TYPE_FLOAT; +const Field_Kind Field::TYPE_INT64; +const Field_Kind Field::TYPE_UINT64; +const Field_Kind Field::TYPE_INT32; +const Field_Kind Field::TYPE_FIXED64; +const Field_Kind Field::TYPE_FIXED32; +const Field_Kind Field::TYPE_BOOL; +const Field_Kind Field::TYPE_STRING; +const Field_Kind Field::TYPE_MESSAGE; +const Field_Kind Field::TYPE_BYTES; +const Field_Kind Field::TYPE_UINT32; +const Field_Kind Field::TYPE_ENUM; +const Field_Kind Field::TYPE_SFIXED32; +const Field_Kind Field::TYPE_SFIXED64; +const Field_Kind Field::TYPE_SINT32; +const Field_Kind Field::TYPE_SINT64; +const Field_Kind Field::Kind_MIN; +const Field_Kind Field::Kind_MAX; +const int Field::Kind_ARRAYSIZE; +#endif // _MSC_VER +const ::google::protobuf::EnumDescriptor* Field_Cardinality_descriptor() { + protobuf_AssignDescriptorsOnce(); + return Field_Cardinality_descriptor_; +} +bool Field_Cardinality_IsValid(int value) { + switch(value) { + case 0: + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const Field_Cardinality Field::CARDINALITY_UNKNOWN; +const Field_Cardinality Field::CARDINALITY_OPTIONAL; +const Field_Cardinality Field::CARDINALITY_REQUIRED; +const Field_Cardinality Field::CARDINALITY_REPEATED; +const Field_Cardinality Field::Cardinality_MIN; +const Field_Cardinality Field::Cardinality_MAX; +const int Field::Cardinality_ARRAYSIZE; +#endif // _MSC_VER +#ifndef _MSC_VER +const int Field::kKindFieldNumber; +const int Field::kCardinalityFieldNumber; +const int Field::kNumberFieldNumber; +const int Field::kNameFieldNumber; +const int Field::kTypeUrlFieldNumber; +const int Field::kOneofIndexFieldNumber; +const int Field::kPackedFieldNumber; +const int Field::kOptionsFieldNumber; +#endif // !_MSC_VER + +Field::Field() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Field) +} + +void Field::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +Field::Field(const Field& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Field) +} + +void Field::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + kind_ = 0; + cardinality_ = 0; + number_ = 0; + name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + type_url_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + oneof_index_ = 0; + packed_ = false; +} + +Field::~Field() { + // @@protoc_insertion_point(destructor:google.protobuf.Field) + SharedDtor(); +} + +void Field::SharedDtor() { + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + type_url_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void Field::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Field::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Field_descriptor_; +} + +const Field& Field::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); + return *default_instance_; +} + +Field* Field::default_instance_ = NULL; + +Field* Field::New(::google::protobuf::Arena* arena) const { + Field* n = new Field; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Field::Clear() { +#define ZR_HELPER_(f) reinterpret_cast<char*>(\ + &reinterpret_cast<Field*>(16)->f) + +#define ZR_(first, last) do {\ + ::memset(&first, 0,\ + ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\ +} while (0) + + ZR_(kind_, cardinality_); + ZR_(number_, oneof_index_); + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + packed_ = false; + +#undef ZR_HELPER_ +#undef ZR_ + + options_.Clear(); +} + +bool Field::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Field) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional .google.protobuf.Field.Kind kind = 1; + case 1: { + if (tag == 8) { + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + set_kind(static_cast< ::google::protobuf::Field_Kind >(value)); + } else { + goto handle_unusual; + } + if (input->ExpectTag(16)) goto parse_cardinality; + break; + } + + // optional .google.protobuf.Field.Cardinality cardinality = 2; + case 2: { + if (tag == 16) { + parse_cardinality: + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + set_cardinality(static_cast< ::google::protobuf::Field_Cardinality >(value)); + } else { + goto handle_unusual; + } + if (input->ExpectTag(24)) goto parse_number; + break; + } + + // optional int32 number = 3; + case 3: { + if (tag == 24) { + parse_number: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &number_))); + + } else { + goto handle_unusual; + } + if (input->ExpectTag(34)) goto parse_name; + break; + } + + // optional string name = 4; + case 4: { + if (tag == 34) { + parse_name: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.Field.name"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(50)) goto parse_type_url; + break; + } + + // optional string type_url = 6; + case 6: { + if (tag == 50) { + parse_type_url: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_type_url())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->type_url().data(), this->type_url().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.Field.type_url"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(56)) goto parse_oneof_index; + break; + } + + // optional int32 oneof_index = 7; + case 7: { + if (tag == 56) { + parse_oneof_index: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &oneof_index_))); + + } else { + goto handle_unusual; + } + if (input->ExpectTag(64)) goto parse_packed; + break; + } + + // optional bool packed = 8; + case 8: { + if (tag == 64) { + parse_packed: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &packed_))); + + } else { + goto handle_unusual; + } + if (input->ExpectTag(74)) goto parse_options; + break; + } + + // repeated .google.protobuf.Option options = 9; + case 9: { + if (tag == 74) { + parse_options: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_options())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(74)) goto parse_options; + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Field) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Field) + return false; +#undef DO_ +} + +void Field::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Field) + // optional .google.protobuf.Field.Kind kind = 1; + if (this->kind() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->kind(), output); + } + + // optional .google.protobuf.Field.Cardinality cardinality = 2; + if (this->cardinality() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 2, this->cardinality(), output); + } + + // optional int32 number = 3; + if (this->number() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->number(), output); + } + + // optional string name = 4; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Field.name"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 4, this->name(), output); + } + + // optional string type_url = 6; + if (this->type_url().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->type_url().data(), this->type_url().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Field.type_url"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 6, this->type_url(), output); + } + + // optional int32 oneof_index = 7; + if (this->oneof_index() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(7, this->oneof_index(), output); + } + + // optional bool packed = 8; + if (this->packed() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteBool(8, this->packed(), output); + } + + // repeated .google.protobuf.Option options = 9; + for (unsigned int i = 0, n = this->options_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 9, this->options(i), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.Field) +} + +::google::protobuf::uint8* Field::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Field) + // optional .google.protobuf.Field.Kind kind = 1; + if (this->kind() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( + 1, this->kind(), target); + } + + // optional .google.protobuf.Field.Cardinality cardinality = 2; + if (this->cardinality() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray( + 2, this->cardinality(), target); + } + + // optional int32 number = 3; + if (this->number() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->number(), target); + } + + // optional string name = 4; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Field.name"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 4, this->name(), target); + } + + // optional string type_url = 6; + if (this->type_url().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->type_url().data(), this->type_url().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Field.type_url"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 6, this->type_url(), target); + } + + // optional int32 oneof_index = 7; + if (this->oneof_index() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(7, this->oneof_index(), target); + } + + // optional bool packed = 8; + if (this->packed() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(8, this->packed(), target); + } + + // repeated .google.protobuf.Option options = 9; + for (unsigned int i = 0, n = this->options_size(); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 9, this->options(i), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Field) + return target; +} + +int Field::ByteSize() const { + int total_size = 0; + + // optional .google.protobuf.Field.Kind kind = 1; + if (this->kind() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->kind()); + } + + // optional .google.protobuf.Field.Cardinality cardinality = 2; + if (this->cardinality() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->cardinality()); + } + + // optional int32 number = 3; + if (this->number() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->number()); + } + + // optional string name = 4; + if (this->name().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional string type_url = 6; + if (this->type_url().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->type_url()); + } + + // optional int32 oneof_index = 7; + if (this->oneof_index() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->oneof_index()); + } + + // optional bool packed = 8; + if (this->packed() != 0) { + total_size += 1 + 1; + } + + // repeated .google.protobuf.Option options = 9; + total_size += 1 * this->options_size(); + for (int i = 0; i < this->options_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->options(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Field::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Field* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Field*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Field::MergeFrom(const Field& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + options_.MergeFrom(from.options_); + if (from.kind() != 0) { + set_kind(from.kind()); + } + if (from.cardinality() != 0) { + set_cardinality(from.cardinality()); + } + if (from.number() != 0) { + set_number(from.number()); + } + if (from.name().size() > 0) { + + name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + } + if (from.type_url().size() > 0) { + + type_url_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.type_url_); + } + if (from.oneof_index() != 0) { + set_oneof_index(from.oneof_index()); + } + if (from.packed() != 0) { + set_packed(from.packed()); + } +} + +void Field::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Field::CopyFrom(const Field& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Field::IsInitialized() const { + + return true; +} + +void Field::Swap(Field* other) { + if (other == this) return; + InternalSwap(other); +} +void Field::InternalSwap(Field* other) { + std::swap(kind_, other->kind_); + std::swap(cardinality_, other->cardinality_); + std::swap(number_, other->number_); + name_.Swap(&other->name_); + type_url_.Swap(&other->type_url_); + std::swap(oneof_index_, other->oneof_index_); + std::swap(packed_, other->packed_); + options_.UnsafeArenaSwap(&other->options_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Field::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Field_descriptor_; + metadata.reflection = Field_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Field + +// optional .google.protobuf.Field.Kind kind = 1; + void Field::clear_kind() { + kind_ = 0; +} + ::google::protobuf::Field_Kind Field::kind() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.kind) + return static_cast< ::google::protobuf::Field_Kind >(kind_); +} + void Field::set_kind(::google::protobuf::Field_Kind value) { + + kind_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Field.kind) +} + +// optional .google.protobuf.Field.Cardinality cardinality = 2; + void Field::clear_cardinality() { + cardinality_ = 0; +} + ::google::protobuf::Field_Cardinality Field::cardinality() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.cardinality) + return static_cast< ::google::protobuf::Field_Cardinality >(cardinality_); +} + void Field::set_cardinality(::google::protobuf::Field_Cardinality value) { + + cardinality_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Field.cardinality) +} + +// optional int32 number = 3; + void Field::clear_number() { + number_ = 0; +} + ::google::protobuf::int32 Field::number() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.number) + return number_; +} + void Field::set_number(::google::protobuf::int32 value) { + + number_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Field.number) +} + +// optional string name = 4; + void Field::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& Field::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Field::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Field.name) +} + void Field::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Field.name) +} + void Field::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.name) +} + ::std::string* Field::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Field.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* Field::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Field::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.name) +} + +// optional string type_url = 6; + void Field::clear_type_url() { + type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& Field::type_url() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.type_url) + return type_url_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Field::set_type_url(const ::std::string& value) { + + type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Field.type_url) +} + void Field::set_type_url(const char* value) { + + type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Field.type_url) +} + void Field::set_type_url(const char* value, size_t size) { + + type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.type_url) +} + ::std::string* Field::mutable_type_url() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Field.type_url) + return type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* Field::release_type_url() { + + return type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Field::set_allocated_type_url(::std::string* type_url) { + if (type_url != NULL) { + + } else { + + } + type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_url); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.type_url) +} + +// optional int32 oneof_index = 7; + void Field::clear_oneof_index() { + oneof_index_ = 0; +} + ::google::protobuf::int32 Field::oneof_index() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.oneof_index) + return oneof_index_; +} + void Field::set_oneof_index(::google::protobuf::int32 value) { + + oneof_index_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Field.oneof_index) +} + +// optional bool packed = 8; + void Field::clear_packed() { + packed_ = false; +} + bool Field::packed() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.packed) + return packed_; +} + void Field::set_packed(bool value) { + + packed_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Field.packed) +} + +// repeated .google.protobuf.Option options = 9; + int Field::options_size() const { + return options_.size(); +} + void Field::clear_options() { + options_.Clear(); +} + const ::google::protobuf::Option& Field::options(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.options) + return options_.Get(index); +} + ::google::protobuf::Option* Field::mutable_options(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Field.options) + return options_.Mutable(index); +} + ::google::protobuf::Option* Field::add_options() { + // @@protoc_insertion_point(field_add:google.protobuf.Field.options) + return options_.Add(); +} + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& +Field::options() const { + // @@protoc_insertion_point(field_list:google.protobuf.Field.options) + return options_; +} + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* +Field::mutable_options() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Field.options) + return &options_; +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int Enum::kNameFieldNumber; +const int Enum::kEnumvalueFieldNumber; +const int Enum::kOptionsFieldNumber; +const int Enum::kSourceContextFieldNumber; +#endif // !_MSC_VER + +Enum::Enum() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Enum) +} + +void Enum::InitAsDefaultInstance() { + _is_default_instance_ = true; + source_context_ = const_cast< ::google::protobuf::SourceContext*>(&::google::protobuf::SourceContext::default_instance()); +} + +Enum::Enum(const Enum& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Enum) +} + +void Enum::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + source_context_ = NULL; +} + +Enum::~Enum() { + // @@protoc_insertion_point(destructor:google.protobuf.Enum) + SharedDtor(); +} + +void Enum::SharedDtor() { + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + delete source_context_; + } +} + +void Enum::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Enum::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Enum_descriptor_; +} + +const Enum& Enum::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); + return *default_instance_; +} + +Enum* Enum::default_instance_ = NULL; + +Enum* Enum::New(::google::protobuf::Arena* arena) const { + Enum* n = new Enum; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Enum::Clear() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (source_context_ != NULL) delete source_context_; + source_context_ = NULL; + enumvalue_.Clear(); + options_.Clear(); +} + +bool Enum::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Enum) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.Enum.name"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(18)) goto parse_enumvalue; + break; + } + + // repeated .google.protobuf.EnumValue enumvalue = 2; + case 2: { + if (tag == 18) { + parse_enumvalue: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_enumvalue())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(18)) goto parse_enumvalue; + if (input->ExpectTag(26)) goto parse_options; + break; + } + + // repeated .google.protobuf.Option options = 3; + case 3: { + if (tag == 26) { + parse_options: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_options())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(26)) goto parse_options; + if (input->ExpectTag(34)) goto parse_source_context; + break; + } + + // optional .google.protobuf.SourceContext source_context = 4; + case 4: { + if (tag == 34) { + parse_source_context: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_source_context())); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Enum) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Enum) + return false; +#undef DO_ +} + +void Enum::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Enum) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Enum.name"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->name(), output); + } + + // repeated .google.protobuf.EnumValue enumvalue = 2; + for (unsigned int i = 0, n = this->enumvalue_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 2, this->enumvalue(i), output); + } + + // repeated .google.protobuf.Option options = 3; + for (unsigned int i = 0, n = this->options_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 3, this->options(i), output); + } + + // optional .google.protobuf.SourceContext source_context = 4; + if (this->has_source_context()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 4, *this->source_context_, output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.Enum) +} + +::google::protobuf::uint8* Enum::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Enum) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Enum.name"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // repeated .google.protobuf.EnumValue enumvalue = 2; + for (unsigned int i = 0, n = this->enumvalue_size(); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 2, this->enumvalue(i), target); + } + + // repeated .google.protobuf.Option options = 3; + for (unsigned int i = 0, n = this->options_size(); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 3, this->options(i), target); + } + + // optional .google.protobuf.SourceContext source_context = 4; + if (this->has_source_context()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 4, *this->source_context_, target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Enum) + return target; +} + +int Enum::ByteSize() const { + int total_size = 0; + + // optional string name = 1; + if (this->name().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional .google.protobuf.SourceContext source_context = 4; + if (this->has_source_context()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *this->source_context_); + } + + // repeated .google.protobuf.EnumValue enumvalue = 2; + total_size += 1 * this->enumvalue_size(); + for (int i = 0; i < this->enumvalue_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->enumvalue(i)); + } + + // repeated .google.protobuf.Option options = 3; + total_size += 1 * this->options_size(); + for (int i = 0; i < this->options_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->options(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Enum::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Enum* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Enum*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Enum::MergeFrom(const Enum& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + enumvalue_.MergeFrom(from.enumvalue_); + options_.MergeFrom(from.options_); + if (from.name().size() > 0) { + + name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + } + if (from.has_source_context()) { + mutable_source_context()->::google::protobuf::SourceContext::MergeFrom(from.source_context()); + } +} + +void Enum::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Enum::CopyFrom(const Enum& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Enum::IsInitialized() const { + + return true; +} + +void Enum::Swap(Enum* other) { + if (other == this) return; + InternalSwap(other); +} +void Enum::InternalSwap(Enum* other) { + name_.Swap(&other->name_); + enumvalue_.UnsafeArenaSwap(&other->enumvalue_); + options_.UnsafeArenaSwap(&other->options_); + std::swap(source_context_, other->source_context_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Enum::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Enum_descriptor_; + metadata.reflection = Enum_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Enum + +// optional string name = 1; + void Enum::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& Enum::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.Enum.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Enum::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Enum.name) +} + void Enum::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Enum.name) +} + void Enum::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Enum.name) +} + ::std::string* Enum::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* Enum::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Enum::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.name) +} + +// repeated .google.protobuf.EnumValue enumvalue = 2; + int Enum::enumvalue_size() const { + return enumvalue_.size(); +} + void Enum::clear_enumvalue() { + enumvalue_.Clear(); +} + const ::google::protobuf::EnumValue& Enum::enumvalue(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Enum.enumvalue) + return enumvalue_.Get(index); +} + ::google::protobuf::EnumValue* Enum::mutable_enumvalue(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.enumvalue) + return enumvalue_.Mutable(index); +} + ::google::protobuf::EnumValue* Enum::add_enumvalue() { + // @@protoc_insertion_point(field_add:google.protobuf.Enum.enumvalue) + return enumvalue_.Add(); +} + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >& +Enum::enumvalue() const { + // @@protoc_insertion_point(field_list:google.protobuf.Enum.enumvalue) + return enumvalue_; +} + ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >* +Enum::mutable_enumvalue() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.enumvalue) + return &enumvalue_; +} + +// repeated .google.protobuf.Option options = 3; + int Enum::options_size() const { + return options_.size(); +} + void Enum::clear_options() { + options_.Clear(); +} + const ::google::protobuf::Option& Enum::options(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Enum.options) + return options_.Get(index); +} + ::google::protobuf::Option* Enum::mutable_options(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.options) + return options_.Mutable(index); +} + ::google::protobuf::Option* Enum::add_options() { + // @@protoc_insertion_point(field_add:google.protobuf.Enum.options) + return options_.Add(); +} + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& +Enum::options() const { + // @@protoc_insertion_point(field_list:google.protobuf.Enum.options) + return options_; +} + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* +Enum::mutable_options() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.options) + return &options_; +} + +// optional .google.protobuf.SourceContext source_context = 4; + bool Enum::has_source_context() const { + return !_is_default_instance_ && source_context_ != NULL; +} + void Enum::clear_source_context() { + if (source_context_ != NULL) delete source_context_; + source_context_ = NULL; +} + const ::google::protobuf::SourceContext& Enum::source_context() const { + // @@protoc_insertion_point(field_get:google.protobuf.Enum.source_context) + return source_context_ != NULL ? *source_context_ : *default_instance_->source_context_; +} + ::google::protobuf::SourceContext* Enum::mutable_source_context() { + + if (source_context_ == NULL) { + source_context_ = new ::google::protobuf::SourceContext; + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.source_context) + return source_context_; +} + ::google::protobuf::SourceContext* Enum::release_source_context() { + + ::google::protobuf::SourceContext* temp = source_context_; + source_context_ = NULL; + return temp; +} + void Enum::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { + delete source_context_; + source_context_ = source_context; + if (source_context) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.source_context) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int EnumValue::kNameFieldNumber; +const int EnumValue::kNumberFieldNumber; +const int EnumValue::kOptionsFieldNumber; +#endif // !_MSC_VER + +EnumValue::EnumValue() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.EnumValue) +} + +void EnumValue::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +EnumValue::EnumValue(const EnumValue& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValue) +} + +void EnumValue::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + number_ = 0; +} + +EnumValue::~EnumValue() { + // @@protoc_insertion_point(destructor:google.protobuf.EnumValue) + SharedDtor(); +} + +void EnumValue::SharedDtor() { + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void EnumValue::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* EnumValue::descriptor() { + protobuf_AssignDescriptorsOnce(); + return EnumValue_descriptor_; +} + +const EnumValue& EnumValue::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); + return *default_instance_; +} + +EnumValue* EnumValue::default_instance_ = NULL; + +EnumValue* EnumValue::New(::google::protobuf::Arena* arena) const { + EnumValue* n = new EnumValue; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void EnumValue::Clear() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + number_ = 0; + options_.Clear(); +} + +bool EnumValue::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.EnumValue) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.EnumValue.name"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(16)) goto parse_number; + break; + } + + // optional int32 number = 2; + case 2: { + if (tag == 16) { + parse_number: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &number_))); + + } else { + goto handle_unusual; + } + if (input->ExpectTag(26)) goto parse_options; + break; + } + + // repeated .google.protobuf.Option options = 3; + case 3: { + if (tag == 26) { + parse_options: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_options())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(26)) goto parse_options; + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.EnumValue) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.EnumValue) + return false; +#undef DO_ +} + +void EnumValue::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.EnumValue) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.EnumValue.name"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->name(), output); + } + + // optional int32 number = 2; + if (this->number() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->number(), output); + } + + // repeated .google.protobuf.Option options = 3; + for (unsigned int i = 0, n = this->options_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 3, this->options(i), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.EnumValue) +} + +::google::protobuf::uint8* EnumValue::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValue) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.EnumValue.name"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // optional int32 number = 2; + if (this->number() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->number(), target); + } + + // repeated .google.protobuf.Option options = 3; + for (unsigned int i = 0, n = this->options_size(); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 3, this->options(i), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.EnumValue) + return target; +} + +int EnumValue::ByteSize() const { + int total_size = 0; + + // optional string name = 1; + if (this->name().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional int32 number = 2; + if (this->number() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->number()); + } + + // repeated .google.protobuf.Option options = 3; + total_size += 1 * this->options_size(); + for (int i = 0; i < this->options_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->options(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void EnumValue::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const EnumValue* source = + ::google::protobuf::internal::dynamic_cast_if_available<const EnumValue*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void EnumValue::MergeFrom(const EnumValue& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + options_.MergeFrom(from.options_); + if (from.name().size() > 0) { + + name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + } + if (from.number() != 0) { + set_number(from.number()); + } +} + +void EnumValue::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void EnumValue::CopyFrom(const EnumValue& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool EnumValue::IsInitialized() const { + + return true; +} + +void EnumValue::Swap(EnumValue* other) { + if (other == this) return; + InternalSwap(other); +} +void EnumValue::InternalSwap(EnumValue* other) { + name_.Swap(&other->name_); + std::swap(number_, other->number_); + options_.UnsafeArenaSwap(&other->options_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata EnumValue::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = EnumValue_descriptor_; + metadata.reflection = EnumValue_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// EnumValue + +// optional string name = 1; + void EnumValue::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& EnumValue::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void EnumValue::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.name) +} + void EnumValue::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.EnumValue.name) +} + void EnumValue::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumValue.name) +} + ::std::string* EnumValue::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* EnumValue::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void EnumValue::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValue.name) +} + +// optional int32 number = 2; + void EnumValue::clear_number() { + number_ = 0; +} + ::google::protobuf::int32 EnumValue::number() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.number) + return number_; +} + void EnumValue::set_number(::google::protobuf::int32 value) { + + number_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.number) +} + +// repeated .google.protobuf.Option options = 3; + int EnumValue::options_size() const { + return options_.size(); +} + void EnumValue::clear_options() { + options_.Clear(); +} + const ::google::protobuf::Option& EnumValue::options(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.options) + return options_.Get(index); +} + ::google::protobuf::Option* EnumValue::mutable_options(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.options) + return options_.Mutable(index); +} + ::google::protobuf::Option* EnumValue::add_options() { + // @@protoc_insertion_point(field_add:google.protobuf.EnumValue.options) + return options_.Add(); +} + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& +EnumValue::options() const { + // @@protoc_insertion_point(field_list:google.protobuf.EnumValue.options) + return options_; +} + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* +EnumValue::mutable_options() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValue.options) + return &options_; +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int Option::kNameFieldNumber; +const int Option::kValueFieldNumber; +#endif // !_MSC_VER + +Option::Option() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Option) +} + +void Option::InitAsDefaultInstance() { + _is_default_instance_ = true; + value_ = const_cast< ::google::protobuf::Any*>(&::google::protobuf::Any::default_instance()); +} + +Option::Option(const Option& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Option) +} + +void Option::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + value_ = NULL; +} + +Option::~Option() { + // @@protoc_insertion_point(destructor:google.protobuf.Option) + SharedDtor(); +} + +void Option::SharedDtor() { + name_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + delete value_; + } +} + +void Option::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Option::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Option_descriptor_; +} + +const Option& Option::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); + return *default_instance_; +} + +Option* Option::default_instance_ = NULL; + +Option* Option::New(::google::protobuf::Arena* arena) const { + Option* n = new Option; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Option::Clear() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (value_ != NULL) delete value_; + value_ = NULL; +} + +bool Option::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Option) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string name = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.Option.name"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(18)) goto parse_value; + break; + } + + // optional .google.protobuf.Any value = 2; + case 2: { + if (tag == 18) { + parse_value: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_value())); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Option) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Option) + return false; +#undef DO_ +} + +void Option::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Option) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Option.name"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->name(), output); + } + + // optional .google.protobuf.Any value = 2; + if (this->has_value()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 2, *this->value_, output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.Option) +} + +::google::protobuf::uint8* Option::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Option) + // optional string name = 1; + if (this->name().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->name().data(), this->name().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.Option.name"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->name(), target); + } + + // optional .google.protobuf.Any value = 2; + if (this->has_value()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 2, *this->value_, target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Option) + return target; +} + +int Option::ByteSize() const { + int total_size = 0; + + // optional string name = 1; + if (this->name().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // optional .google.protobuf.Any value = 2; + if (this->has_value()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + *this->value_); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Option::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Option* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Option*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Option::MergeFrom(const Option& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.name().size() > 0) { + + name_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.name_); + } + if (from.has_value()) { + mutable_value()->::google::protobuf::Any::MergeFrom(from.value()); + } +} + +void Option::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Option::CopyFrom(const Option& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Option::IsInitialized() const { + + return true; +} + +void Option::Swap(Option* other) { + if (other == this) return; + InternalSwap(other); +} +void Option::InternalSwap(Option* other) { + name_.Swap(&other->name_); + std::swap(value_, other->value_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Option::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Option_descriptor_; + metadata.reflection = Option_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Option + +// optional string name = 1; + void Option::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& Option::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.Option.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Option::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Option.name) +} + void Option::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Option.name) +} + void Option::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Option.name) +} + ::std::string* Option::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Option.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* Option::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void Option::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.name) +} + +// optional .google.protobuf.Any value = 2; + bool Option::has_value() const { + return !_is_default_instance_ && value_ != NULL; +} + void Option::clear_value() { + if (value_ != NULL) delete value_; + value_ = NULL; +} + const ::google::protobuf::Any& Option::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Option.value) + return value_ != NULL ? *value_ : *default_instance_->value_; +} + ::google::protobuf::Any* Option::mutable_value() { + + if (value_ == NULL) { + value_ = new ::google::protobuf::Any; + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Option.value) + return value_; +} + ::google::protobuf::Any* Option::release_value() { + + ::google::protobuf::Any* temp = value_; + value_ = NULL; + return temp; +} + void Option::set_allocated_value(::google::protobuf::Any* value) { + delete value_; + value_ = value; + if (value) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.value) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h new file mode 100644 index 00000000..a14edd4a --- /dev/null +++ b/src/google/protobuf/type.pb.h @@ -0,0 +1,1508 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/type.proto + +#ifndef PROTOBUF_google_2fprotobuf_2ftype_2eproto__INCLUDED +#define PROTOBUF_google_2fprotobuf_2ftype_2eproto__INCLUDED + +#include <string> + +#include <google/protobuf/stubs/common.h> + +#if GOOGLE_PROTOBUF_VERSION < 3000000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/metadata.h> +#include <google/protobuf/message.h> +#include <google/protobuf/repeated_field.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/generated_enum_reflection.h> +#include <google/protobuf/unknown_field_set.h> +#include "google/protobuf/any.pb.h" +#include "google/protobuf/source_context.pb.h" +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +// Internal implementation detail -- do not call these. +void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); +void protobuf_AssignDesc_google_2fprotobuf_2ftype_2eproto(); +void protobuf_ShutdownFile_google_2fprotobuf_2ftype_2eproto(); + +class Type; +class Field; +class Enum; +class EnumValue; +class Option; + +enum Field_Kind { + Field_Kind_TYPE_UNKNOWN = 0, + Field_Kind_TYPE_DOUBLE = 1, + Field_Kind_TYPE_FLOAT = 2, + Field_Kind_TYPE_INT64 = 3, + Field_Kind_TYPE_UINT64 = 4, + Field_Kind_TYPE_INT32 = 5, + Field_Kind_TYPE_FIXED64 = 6, + Field_Kind_TYPE_FIXED32 = 7, + Field_Kind_TYPE_BOOL = 8, + Field_Kind_TYPE_STRING = 9, + Field_Kind_TYPE_MESSAGE = 11, + Field_Kind_TYPE_BYTES = 12, + Field_Kind_TYPE_UINT32 = 13, + Field_Kind_TYPE_ENUM = 14, + Field_Kind_TYPE_SFIXED32 = 15, + Field_Kind_TYPE_SFIXED64 = 16, + Field_Kind_TYPE_SINT32 = 17, + Field_Kind_TYPE_SINT64 = 18, + Field_Kind_Field_Kind_INT_MIN_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32min, + Field_Kind_Field_Kind_INT_MAX_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32max +}; +LIBPROTOBUF_EXPORT bool Field_Kind_IsValid(int value); +const Field_Kind Field_Kind_Kind_MIN = Field_Kind_TYPE_UNKNOWN; +const Field_Kind Field_Kind_Kind_MAX = Field_Kind_TYPE_SINT64; +const int Field_Kind_Kind_ARRAYSIZE = Field_Kind_Kind_MAX + 1; + +LIBPROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* Field_Kind_descriptor(); +inline const ::std::string& Field_Kind_Name(Field_Kind value) { + return ::google::protobuf::internal::NameOfEnum( + Field_Kind_descriptor(), value); +} +inline bool Field_Kind_Parse( + const ::std::string& name, Field_Kind* value) { + return ::google::protobuf::internal::ParseNamedEnum<Field_Kind>( + Field_Kind_descriptor(), name, value); +} +enum Field_Cardinality { + Field_Cardinality_CARDINALITY_UNKNOWN = 0, + Field_Cardinality_CARDINALITY_OPTIONAL = 1, + Field_Cardinality_CARDINALITY_REQUIRED = 2, + Field_Cardinality_CARDINALITY_REPEATED = 3, + Field_Cardinality_Field_Cardinality_INT_MIN_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32min, + Field_Cardinality_Field_Cardinality_INT_MAX_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32max +}; +LIBPROTOBUF_EXPORT bool Field_Cardinality_IsValid(int value); +const Field_Cardinality Field_Cardinality_Cardinality_MIN = Field_Cardinality_CARDINALITY_UNKNOWN; +const Field_Cardinality Field_Cardinality_Cardinality_MAX = Field_Cardinality_CARDINALITY_REPEATED; +const int Field_Cardinality_Cardinality_ARRAYSIZE = Field_Cardinality_Cardinality_MAX + 1; + +LIBPROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* Field_Cardinality_descriptor(); +inline const ::std::string& Field_Cardinality_Name(Field_Cardinality value) { + return ::google::protobuf::internal::NameOfEnum( + Field_Cardinality_descriptor(), value); +} +inline bool Field_Cardinality_Parse( + const ::std::string& name, Field_Cardinality* value) { + return ::google::protobuf::internal::ParseNamedEnum<Field_Cardinality>( + Field_Cardinality_descriptor(), name, value); +} +// =================================================================== + +class LIBPROTOBUF_EXPORT Type : public ::google::protobuf::Message { + public: + Type(); + virtual ~Type(); + + Type(const Type& from); + + inline Type& operator=(const Type& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Type& default_instance(); + + void Swap(Type* other); + + // implements Message ---------------------------------------------- + + inline Type* New() const { return New(NULL); } + + Type* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Type& from); + void MergeFrom(const Type& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Type* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + void clear_name(); + static const int kNameFieldNumber = 1; + const ::std::string& name() const; + void set_name(const ::std::string& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + ::std::string* mutable_name(); + ::std::string* release_name(); + void set_allocated_name(::std::string* name); + + // repeated .google.protobuf.Field fields = 2; + int fields_size() const; + void clear_fields(); + static const int kFieldsFieldNumber = 2; + const ::google::protobuf::Field& fields(int index) const; + ::google::protobuf::Field* mutable_fields(int index); + ::google::protobuf::Field* add_fields(); + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >& + fields() const; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >* + mutable_fields(); + + // repeated string oneofs = 3; + int oneofs_size() const; + void clear_oneofs(); + static const int kOneofsFieldNumber = 3; + const ::std::string& oneofs(int index) const; + ::std::string* mutable_oneofs(int index); + void set_oneofs(int index, const ::std::string& value); + void set_oneofs(int index, const char* value); + void set_oneofs(int index, const char* value, size_t size); + ::std::string* add_oneofs(); + void add_oneofs(const ::std::string& value); + void add_oneofs(const char* value); + void add_oneofs(const char* value, size_t size); + const ::google::protobuf::RepeatedPtrField< ::std::string>& oneofs() const; + ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_oneofs(); + + // repeated .google.protobuf.Option options = 4; + int options_size() const; + void clear_options(); + static const int kOptionsFieldNumber = 4; + const ::google::protobuf::Option& options(int index) const; + ::google::protobuf::Option* mutable_options(int index); + ::google::protobuf::Option* add_options(); + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& + options() const; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* + mutable_options(); + + // optional .google.protobuf.SourceContext source_context = 5; + bool has_source_context() const; + void clear_source_context(); + static const int kSourceContextFieldNumber = 5; + const ::google::protobuf::SourceContext& source_context() const; + ::google::protobuf::SourceContext* mutable_source_context(); + ::google::protobuf::SourceContext* release_source_context(); + void set_allocated_source_context(::google::protobuf::SourceContext* source_context); + + // @@protoc_insertion_point(class_scope:google.protobuf.Type) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Field > fields_; + ::google::protobuf::RepeatedPtrField< ::std::string> oneofs_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; + ::google::protobuf::SourceContext* source_context_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2ftype_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2ftype_2eproto(); + + void InitAsDefaultInstance(); + static Type* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT Field : public ::google::protobuf::Message { + public: + Field(); + virtual ~Field(); + + Field(const Field& from); + + inline Field& operator=(const Field& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Field& default_instance(); + + void Swap(Field* other); + + // implements Message ---------------------------------------------- + + inline Field* New() const { return New(NULL); } + + Field* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Field& from); + void MergeFrom(const Field& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Field* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + typedef Field_Kind Kind; + static const Kind TYPE_UNKNOWN = Field_Kind_TYPE_UNKNOWN; + static const Kind TYPE_DOUBLE = Field_Kind_TYPE_DOUBLE; + static const Kind TYPE_FLOAT = Field_Kind_TYPE_FLOAT; + static const Kind TYPE_INT64 = Field_Kind_TYPE_INT64; + static const Kind TYPE_UINT64 = Field_Kind_TYPE_UINT64; + static const Kind TYPE_INT32 = Field_Kind_TYPE_INT32; + static const Kind TYPE_FIXED64 = Field_Kind_TYPE_FIXED64; + static const Kind TYPE_FIXED32 = Field_Kind_TYPE_FIXED32; + static const Kind TYPE_BOOL = Field_Kind_TYPE_BOOL; + static const Kind TYPE_STRING = Field_Kind_TYPE_STRING; + static const Kind TYPE_MESSAGE = Field_Kind_TYPE_MESSAGE; + static const Kind TYPE_BYTES = Field_Kind_TYPE_BYTES; + static const Kind TYPE_UINT32 = Field_Kind_TYPE_UINT32; + static const Kind TYPE_ENUM = Field_Kind_TYPE_ENUM; + static const Kind TYPE_SFIXED32 = Field_Kind_TYPE_SFIXED32; + static const Kind TYPE_SFIXED64 = Field_Kind_TYPE_SFIXED64; + static const Kind TYPE_SINT32 = Field_Kind_TYPE_SINT32; + static const Kind TYPE_SINT64 = Field_Kind_TYPE_SINT64; + static inline bool Kind_IsValid(int value) { + return Field_Kind_IsValid(value); + } + static const Kind Kind_MIN = + Field_Kind_Kind_MIN; + static const Kind Kind_MAX = + Field_Kind_Kind_MAX; + static const int Kind_ARRAYSIZE = + Field_Kind_Kind_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* + Kind_descriptor() { + return Field_Kind_descriptor(); + } + static inline const ::std::string& Kind_Name(Kind value) { + return Field_Kind_Name(value); + } + static inline bool Kind_Parse(const ::std::string& name, + Kind* value) { + return Field_Kind_Parse(name, value); + } + + typedef Field_Cardinality Cardinality; + static const Cardinality CARDINALITY_UNKNOWN = Field_Cardinality_CARDINALITY_UNKNOWN; + static const Cardinality CARDINALITY_OPTIONAL = Field_Cardinality_CARDINALITY_OPTIONAL; + static const Cardinality CARDINALITY_REQUIRED = Field_Cardinality_CARDINALITY_REQUIRED; + static const Cardinality CARDINALITY_REPEATED = Field_Cardinality_CARDINALITY_REPEATED; + static inline bool Cardinality_IsValid(int value) { + return Field_Cardinality_IsValid(value); + } + static const Cardinality Cardinality_MIN = + Field_Cardinality_Cardinality_MIN; + static const Cardinality Cardinality_MAX = + Field_Cardinality_Cardinality_MAX; + static const int Cardinality_ARRAYSIZE = + Field_Cardinality_Cardinality_ARRAYSIZE; + static inline const ::google::protobuf::EnumDescriptor* + Cardinality_descriptor() { + return Field_Cardinality_descriptor(); + } + static inline const ::std::string& Cardinality_Name(Cardinality value) { + return Field_Cardinality_Name(value); + } + static inline bool Cardinality_Parse(const ::std::string& name, + Cardinality* value) { + return Field_Cardinality_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + // optional .google.protobuf.Field.Kind kind = 1; + void clear_kind(); + static const int kKindFieldNumber = 1; + ::google::protobuf::Field_Kind kind() const; + void set_kind(::google::protobuf::Field_Kind value); + + // optional .google.protobuf.Field.Cardinality cardinality = 2; + void clear_cardinality(); + static const int kCardinalityFieldNumber = 2; + ::google::protobuf::Field_Cardinality cardinality() const; + void set_cardinality(::google::protobuf::Field_Cardinality value); + + // optional int32 number = 3; + void clear_number(); + static const int kNumberFieldNumber = 3; + ::google::protobuf::int32 number() const; + void set_number(::google::protobuf::int32 value); + + // optional string name = 4; + void clear_name(); + static const int kNameFieldNumber = 4; + const ::std::string& name() const; + void set_name(const ::std::string& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + ::std::string* mutable_name(); + ::std::string* release_name(); + void set_allocated_name(::std::string* name); + + // optional string type_url = 6; + void clear_type_url(); + static const int kTypeUrlFieldNumber = 6; + const ::std::string& type_url() const; + void set_type_url(const ::std::string& value); + void set_type_url(const char* value); + void set_type_url(const char* value, size_t size); + ::std::string* mutable_type_url(); + ::std::string* release_type_url(); + void set_allocated_type_url(::std::string* type_url); + + // optional int32 oneof_index = 7; + void clear_oneof_index(); + static const int kOneofIndexFieldNumber = 7; + ::google::protobuf::int32 oneof_index() const; + void set_oneof_index(::google::protobuf::int32 value); + + // optional bool packed = 8; + void clear_packed(); + static const int kPackedFieldNumber = 8; + bool packed() const; + void set_packed(bool value); + + // repeated .google.protobuf.Option options = 9; + int options_size() const; + void clear_options(); + static const int kOptionsFieldNumber = 9; + const ::google::protobuf::Option& options(int index) const; + ::google::protobuf::Option* mutable_options(int index); + ::google::protobuf::Option* add_options(); + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& + options() const; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* + mutable_options(); + + // @@protoc_insertion_point(class_scope:google.protobuf.Field) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + int kind_; + int cardinality_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::google::protobuf::int32 number_; + ::google::protobuf::int32 oneof_index_; + ::google::protobuf::internal::ArenaStringPtr type_url_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; + bool packed_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2ftype_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2ftype_2eproto(); + + void InitAsDefaultInstance(); + static Field* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT Enum : public ::google::protobuf::Message { + public: + Enum(); + virtual ~Enum(); + + Enum(const Enum& from); + + inline Enum& operator=(const Enum& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Enum& default_instance(); + + void Swap(Enum* other); + + // implements Message ---------------------------------------------- + + inline Enum* New() const { return New(NULL); } + + Enum* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Enum& from); + void MergeFrom(const Enum& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Enum* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + void clear_name(); + static const int kNameFieldNumber = 1; + const ::std::string& name() const; + void set_name(const ::std::string& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + ::std::string* mutable_name(); + ::std::string* release_name(); + void set_allocated_name(::std::string* name); + + // repeated .google.protobuf.EnumValue enumvalue = 2; + int enumvalue_size() const; + void clear_enumvalue(); + static const int kEnumvalueFieldNumber = 2; + const ::google::protobuf::EnumValue& enumvalue(int index) const; + ::google::protobuf::EnumValue* mutable_enumvalue(int index); + ::google::protobuf::EnumValue* add_enumvalue(); + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >& + enumvalue() const; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >* + mutable_enumvalue(); + + // repeated .google.protobuf.Option options = 3; + int options_size() const; + void clear_options(); + static const int kOptionsFieldNumber = 3; + const ::google::protobuf::Option& options(int index) const; + ::google::protobuf::Option* mutable_options(int index); + ::google::protobuf::Option* add_options(); + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& + options() const; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* + mutable_options(); + + // optional .google.protobuf.SourceContext source_context = 4; + bool has_source_context() const; + void clear_source_context(); + static const int kSourceContextFieldNumber = 4; + const ::google::protobuf::SourceContext& source_context() const; + ::google::protobuf::SourceContext* mutable_source_context(); + ::google::protobuf::SourceContext* release_source_context(); + void set_allocated_source_context(::google::protobuf::SourceContext* source_context); + + // @@protoc_insertion_point(class_scope:google.protobuf.Enum) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue > enumvalue_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; + ::google::protobuf::SourceContext* source_context_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2ftype_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2ftype_2eproto(); + + void InitAsDefaultInstance(); + static Enum* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT EnumValue : public ::google::protobuf::Message { + public: + EnumValue(); + virtual ~EnumValue(); + + EnumValue(const EnumValue& from); + + inline EnumValue& operator=(const EnumValue& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const EnumValue& default_instance(); + + void Swap(EnumValue* other); + + // implements Message ---------------------------------------------- + + inline EnumValue* New() const { return New(NULL); } + + EnumValue* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const EnumValue& from); + void MergeFrom(const EnumValue& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(EnumValue* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + void clear_name(); + static const int kNameFieldNumber = 1; + const ::std::string& name() const; + void set_name(const ::std::string& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + ::std::string* mutable_name(); + ::std::string* release_name(); + void set_allocated_name(::std::string* name); + + // optional int32 number = 2; + void clear_number(); + static const int kNumberFieldNumber = 2; + ::google::protobuf::int32 number() const; + void set_number(::google::protobuf::int32 value); + + // repeated .google.protobuf.Option options = 3; + int options_size() const; + void clear_options(); + static const int kOptionsFieldNumber = 3; + const ::google::protobuf::Option& options(int index) const; + ::google::protobuf::Option* mutable_options(int index); + ::google::protobuf::Option* add_options(); + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& + options() const; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* + mutable_options(); + + // @@protoc_insertion_point(class_scope:google.protobuf.EnumValue) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_; + ::google::protobuf::int32 number_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2ftype_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2ftype_2eproto(); + + void InitAsDefaultInstance(); + static EnumValue* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT Option : public ::google::protobuf::Message { + public: + Option(); + virtual ~Option(); + + Option(const Option& from); + + inline Option& operator=(const Option& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Option& default_instance(); + + void Swap(Option* other); + + // implements Message ---------------------------------------------- + + inline Option* New() const { return New(NULL); } + + Option* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Option& from); + void MergeFrom(const Option& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Option* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string name = 1; + void clear_name(); + static const int kNameFieldNumber = 1; + const ::std::string& name() const; + void set_name(const ::std::string& value); + void set_name(const char* value); + void set_name(const char* value, size_t size); + ::std::string* mutable_name(); + ::std::string* release_name(); + void set_allocated_name(::std::string* name); + + // optional .google.protobuf.Any value = 2; + bool has_value() const; + void clear_value(); + static const int kValueFieldNumber = 2; + const ::google::protobuf::Any& value() const; + ::google::protobuf::Any* mutable_value(); + ::google::protobuf::Any* release_value(); + void set_allocated_value(::google::protobuf::Any* value); + + // @@protoc_insertion_point(class_scope:google.protobuf.Option) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr name_; + ::google::protobuf::Any* value_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2ftype_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2ftype_2eproto(); + + void InitAsDefaultInstance(); + static Option* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +#if !PROTOBUF_INLINE_NOT_IN_HEADERS +// Type + +// optional string name = 1; +inline void Type::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& Type::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.Type.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Type::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Type.name) +} +inline void Type::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Type.name) +} +inline void Type::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Type.name) +} +inline ::std::string* Type::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Type.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* Type::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Type::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.name) +} + +// repeated .google.protobuf.Field fields = 2; +inline int Type::fields_size() const { + return fields_.size(); +} +inline void Type::clear_fields() { + fields_.Clear(); +} +inline const ::google::protobuf::Field& Type::fields(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Type.fields) + return fields_.Get(index); +} +inline ::google::protobuf::Field* Type::mutable_fields(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Type.fields) + return fields_.Mutable(index); +} +inline ::google::protobuf::Field* Type::add_fields() { + // @@protoc_insertion_point(field_add:google.protobuf.Type.fields) + return fields_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >& +Type::fields() const { + // @@protoc_insertion_point(field_list:google.protobuf.Type.fields) + return fields_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Field >* +Type::mutable_fields() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.fields) + return &fields_; +} + +// repeated string oneofs = 3; +inline int Type::oneofs_size() const { + return oneofs_.size(); +} +inline void Type::clear_oneofs() { + oneofs_.Clear(); +} +inline const ::std::string& Type::oneofs(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Type.oneofs) + return oneofs_.Get(index); +} +inline ::std::string* Type::mutable_oneofs(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Type.oneofs) + return oneofs_.Mutable(index); +} +inline void Type::set_oneofs(int index, const ::std::string& value) { + // @@protoc_insertion_point(field_set:google.protobuf.Type.oneofs) + oneofs_.Mutable(index)->assign(value); +} +inline void Type::set_oneofs(int index, const char* value) { + oneofs_.Mutable(index)->assign(value); + // @@protoc_insertion_point(field_set_char:google.protobuf.Type.oneofs) +} +inline void Type::set_oneofs(int index, const char* value, size_t size) { + oneofs_.Mutable(index)->assign( + reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Type.oneofs) +} +inline ::std::string* Type::add_oneofs() { + return oneofs_.Add(); +} +inline void Type::add_oneofs(const ::std::string& value) { + oneofs_.Add()->assign(value); + // @@protoc_insertion_point(field_add:google.protobuf.Type.oneofs) +} +inline void Type::add_oneofs(const char* value) { + oneofs_.Add()->assign(value); + // @@protoc_insertion_point(field_add_char:google.protobuf.Type.oneofs) +} +inline void Type::add_oneofs(const char* value, size_t size) { + oneofs_.Add()->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_add_pointer:google.protobuf.Type.oneofs) +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +Type::oneofs() const { + // @@protoc_insertion_point(field_list:google.protobuf.Type.oneofs) + return oneofs_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +Type::mutable_oneofs() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.oneofs) + return &oneofs_; +} + +// repeated .google.protobuf.Option options = 4; +inline int Type::options_size() const { + return options_.size(); +} +inline void Type::clear_options() { + options_.Clear(); +} +inline const ::google::protobuf::Option& Type::options(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Type.options) + return options_.Get(index); +} +inline ::google::protobuf::Option* Type::mutable_options(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Type.options) + return options_.Mutable(index); +} +inline ::google::protobuf::Option* Type::add_options() { + // @@protoc_insertion_point(field_add:google.protobuf.Type.options) + return options_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& +Type::options() const { + // @@protoc_insertion_point(field_list:google.protobuf.Type.options) + return options_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* +Type::mutable_options() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Type.options) + return &options_; +} + +// optional .google.protobuf.SourceContext source_context = 5; +inline bool Type::has_source_context() const { + return !_is_default_instance_ && source_context_ != NULL; +} +inline void Type::clear_source_context() { + if (source_context_ != NULL) delete source_context_; + source_context_ = NULL; +} +inline const ::google::protobuf::SourceContext& Type::source_context() const { + // @@protoc_insertion_point(field_get:google.protobuf.Type.source_context) + return source_context_ != NULL ? *source_context_ : *default_instance_->source_context_; +} +inline ::google::protobuf::SourceContext* Type::mutable_source_context() { + + if (source_context_ == NULL) { + source_context_ = new ::google::protobuf::SourceContext; + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Type.source_context) + return source_context_; +} +inline ::google::protobuf::SourceContext* Type::release_source_context() { + + ::google::protobuf::SourceContext* temp = source_context_; + source_context_ = NULL; + return temp; +} +inline void Type::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { + delete source_context_; + source_context_ = source_context; + if (source_context) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.source_context) +} + +// ------------------------------------------------------------------- + +// Field + +// optional .google.protobuf.Field.Kind kind = 1; +inline void Field::clear_kind() { + kind_ = 0; +} +inline ::google::protobuf::Field_Kind Field::kind() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.kind) + return static_cast< ::google::protobuf::Field_Kind >(kind_); +} +inline void Field::set_kind(::google::protobuf::Field_Kind value) { + + kind_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Field.kind) +} + +// optional .google.protobuf.Field.Cardinality cardinality = 2; +inline void Field::clear_cardinality() { + cardinality_ = 0; +} +inline ::google::protobuf::Field_Cardinality Field::cardinality() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.cardinality) + return static_cast< ::google::protobuf::Field_Cardinality >(cardinality_); +} +inline void Field::set_cardinality(::google::protobuf::Field_Cardinality value) { + + cardinality_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Field.cardinality) +} + +// optional int32 number = 3; +inline void Field::clear_number() { + number_ = 0; +} +inline ::google::protobuf::int32 Field::number() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.number) + return number_; +} +inline void Field::set_number(::google::protobuf::int32 value) { + + number_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Field.number) +} + +// optional string name = 4; +inline void Field::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& Field::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Field::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Field.name) +} +inline void Field::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Field.name) +} +inline void Field::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.name) +} +inline ::std::string* Field::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Field.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* Field::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Field::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.name) +} + +// optional string type_url = 6; +inline void Field::clear_type_url() { + type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& Field::type_url() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.type_url) + return type_url_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Field::set_type_url(const ::std::string& value) { + + type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Field.type_url) +} +inline void Field::set_type_url(const char* value) { + + type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Field.type_url) +} +inline void Field::set_type_url(const char* value, size_t size) { + + type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Field.type_url) +} +inline ::std::string* Field::mutable_type_url() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Field.type_url) + return type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* Field::release_type_url() { + + return type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Field::set_allocated_type_url(::std::string* type_url) { + if (type_url != NULL) { + + } else { + + } + type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_url); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.type_url) +} + +// optional int32 oneof_index = 7; +inline void Field::clear_oneof_index() { + oneof_index_ = 0; +} +inline ::google::protobuf::int32 Field::oneof_index() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.oneof_index) + return oneof_index_; +} +inline void Field::set_oneof_index(::google::protobuf::int32 value) { + + oneof_index_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Field.oneof_index) +} + +// optional bool packed = 8; +inline void Field::clear_packed() { + packed_ = false; +} +inline bool Field::packed() const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.packed) + return packed_; +} +inline void Field::set_packed(bool value) { + + packed_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Field.packed) +} + +// repeated .google.protobuf.Option options = 9; +inline int Field::options_size() const { + return options_.size(); +} +inline void Field::clear_options() { + options_.Clear(); +} +inline const ::google::protobuf::Option& Field::options(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Field.options) + return options_.Get(index); +} +inline ::google::protobuf::Option* Field::mutable_options(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Field.options) + return options_.Mutable(index); +} +inline ::google::protobuf::Option* Field::add_options() { + // @@protoc_insertion_point(field_add:google.protobuf.Field.options) + return options_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& +Field::options() const { + // @@protoc_insertion_point(field_list:google.protobuf.Field.options) + return options_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* +Field::mutable_options() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Field.options) + return &options_; +} + +// ------------------------------------------------------------------- + +// Enum + +// optional string name = 1; +inline void Enum::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& Enum::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.Enum.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Enum::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Enum.name) +} +inline void Enum::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Enum.name) +} +inline void Enum::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Enum.name) +} +inline ::std::string* Enum::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* Enum::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Enum::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.name) +} + +// repeated .google.protobuf.EnumValue enumvalue = 2; +inline int Enum::enumvalue_size() const { + return enumvalue_.size(); +} +inline void Enum::clear_enumvalue() { + enumvalue_.Clear(); +} +inline const ::google::protobuf::EnumValue& Enum::enumvalue(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Enum.enumvalue) + return enumvalue_.Get(index); +} +inline ::google::protobuf::EnumValue* Enum::mutable_enumvalue(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.enumvalue) + return enumvalue_.Mutable(index); +} +inline ::google::protobuf::EnumValue* Enum::add_enumvalue() { + // @@protoc_insertion_point(field_add:google.protobuf.Enum.enumvalue) + return enumvalue_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >& +Enum::enumvalue() const { + // @@protoc_insertion_point(field_list:google.protobuf.Enum.enumvalue) + return enumvalue_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValue >* +Enum::mutable_enumvalue() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.enumvalue) + return &enumvalue_; +} + +// repeated .google.protobuf.Option options = 3; +inline int Enum::options_size() const { + return options_.size(); +} +inline void Enum::clear_options() { + options_.Clear(); +} +inline const ::google::protobuf::Option& Enum::options(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.Enum.options) + return options_.Get(index); +} +inline ::google::protobuf::Option* Enum::mutable_options(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.options) + return options_.Mutable(index); +} +inline ::google::protobuf::Option* Enum::add_options() { + // @@protoc_insertion_point(field_add:google.protobuf.Enum.options) + return options_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& +Enum::options() const { + // @@protoc_insertion_point(field_list:google.protobuf.Enum.options) + return options_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* +Enum::mutable_options() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.Enum.options) + return &options_; +} + +// optional .google.protobuf.SourceContext source_context = 4; +inline bool Enum::has_source_context() const { + return !_is_default_instance_ && source_context_ != NULL; +} +inline void Enum::clear_source_context() { + if (source_context_ != NULL) delete source_context_; + source_context_ = NULL; +} +inline const ::google::protobuf::SourceContext& Enum::source_context() const { + // @@protoc_insertion_point(field_get:google.protobuf.Enum.source_context) + return source_context_ != NULL ? *source_context_ : *default_instance_->source_context_; +} +inline ::google::protobuf::SourceContext* Enum::mutable_source_context() { + + if (source_context_ == NULL) { + source_context_ = new ::google::protobuf::SourceContext; + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Enum.source_context) + return source_context_; +} +inline ::google::protobuf::SourceContext* Enum::release_source_context() { + + ::google::protobuf::SourceContext* temp = source_context_; + source_context_ = NULL; + return temp; +} +inline void Enum::set_allocated_source_context(::google::protobuf::SourceContext* source_context) { + delete source_context_; + source_context_ = source_context; + if (source_context) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.source_context) +} + +// ------------------------------------------------------------------- + +// EnumValue + +// optional string name = 1; +inline void EnumValue::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& EnumValue::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void EnumValue::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.name) +} +inline void EnumValue::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.EnumValue.name) +} +inline void EnumValue::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.EnumValue.name) +} +inline ::std::string* EnumValue::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* EnumValue::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void EnumValue::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValue.name) +} + +// optional int32 number = 2; +inline void EnumValue::clear_number() { + number_ = 0; +} +inline ::google::protobuf::int32 EnumValue::number() const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.number) + return number_; +} +inline void EnumValue::set_number(::google::protobuf::int32 value) { + + number_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.number) +} + +// repeated .google.protobuf.Option options = 3; +inline int EnumValue::options_size() const { + return options_.size(); +} +inline void EnumValue::clear_options() { + options_.Clear(); +} +inline const ::google::protobuf::Option& EnumValue::options(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.options) + return options_.Get(index); +} +inline ::google::protobuf::Option* EnumValue::mutable_options(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.EnumValue.options) + return options_.Mutable(index); +} +inline ::google::protobuf::Option* EnumValue::add_options() { + // @@protoc_insertion_point(field_add:google.protobuf.EnumValue.options) + return options_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >& +EnumValue::options() const { + // @@protoc_insertion_point(field_list:google.protobuf.EnumValue.options) + return options_; +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >* +EnumValue::mutable_options() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.EnumValue.options) + return &options_; +} + +// ------------------------------------------------------------------- + +// Option + +// optional string name = 1; +inline void Option::clear_name() { + name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& Option::name() const { + // @@protoc_insertion_point(field_get:google.protobuf.Option.name) + return name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Option::set_name(const ::std::string& value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.Option.name) +} +inline void Option::set_name(const char* value) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.Option.name) +} +inline void Option::set_name(const char* value, size_t size) { + + name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.Option.name) +} +inline ::std::string* Option::mutable_name() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.Option.name) + return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* Option::release_name() { + + return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void Option::set_allocated_name(::std::string* name) { + if (name != NULL) { + + } else { + + } + name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.name) +} + +// optional .google.protobuf.Any value = 2; +inline bool Option::has_value() const { + return !_is_default_instance_ && value_ != NULL; +} +inline void Option::clear_value() { + if (value_ != NULL) delete value_; + value_ = NULL; +} +inline const ::google::protobuf::Any& Option::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Option.value) + return value_ != NULL ? *value_ : *default_instance_->value_; +} +inline ::google::protobuf::Any* Option::mutable_value() { + + if (value_ == NULL) { + value_ = new ::google::protobuf::Any; + } + // @@protoc_insertion_point(field_mutable:google.protobuf.Option.value) + return value_; +} +inline ::google::protobuf::Any* Option::release_value() { + + ::google::protobuf::Any* temp = value_; + value_ = NULL; + return temp; +} +inline void Option::set_allocated_value(::google::protobuf::Any* value) { + delete value_; + value_ = value; + if (value) { + + } else { + + } + // @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.value) +} + +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +#ifndef SWIG +namespace google { +namespace protobuf { + +template <> struct is_proto_enum< ::google::protobuf::Field_Kind> : ::google::protobuf::internal::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::Field_Kind>() { + return ::google::protobuf::Field_Kind_descriptor(); +} +template <> struct is_proto_enum< ::google::protobuf::Field_Cardinality> : ::google::protobuf::internal::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::Field_Cardinality>() { + return ::google::protobuf::Field_Cardinality_descriptor(); +} + +} // namespace protobuf +} // namespace google +#endif // SWIG + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_google_2fprotobuf_2ftype_2eproto__INCLUDED diff --git a/src/google/protobuf/unittest.proto b/src/google/protobuf/unittest.proto index 745f77c5..a32291e0 100644 --- a/src/google/protobuf/unittest.proto +++ b/src/google/protobuf/unittest.proto @@ -42,6 +42,7 @@ option cc_generic_services = true; // auto-added option java_generic_services = true; // auto-added option py_generic_services = true; // auto-added option cc_enable_arenas = true; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; import "google/protobuf/unittest_import.proto"; diff --git a/src/google/protobuf/unittest_custom_options.proto b/src/google/protobuf/unittest_custom_options.proto index d4d6e869..8f9fb582 100644 --- a/src/google/protobuf/unittest_custom_options.proto +++ b/src/google/protobuf/unittest_custom_options.proto @@ -41,6 +41,7 @@ syntax = "proto2"; option cc_generic_services = true; // auto-added option java_generic_services = true; // auto-added option py_generic_services = true; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; // A custom file option (defined below). option (file_opt1) = 9876543210; diff --git a/src/google/protobuf/unittest_drop_unknown_fields.proto b/src/google/protobuf/unittest_drop_unknown_fields.proto index 2e513eb3..1b35fad0 100644 --- a/src/google/protobuf/unittest_drop_unknown_fields.proto +++ b/src/google/protobuf/unittest_drop_unknown_fields.proto @@ -33,6 +33,8 @@ syntax = "proto3"; package unittest_drop_unknown_fields; option objc_class_prefix = "DropUnknowns"; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; + message Foo { enum NestedEnum { FOO = 0; diff --git a/src/google/protobuf/unittest_embed_optimize_for.proto b/src/google/protobuf/unittest_embed_optimize_for.proto index d8b0f9b9..c4ccccb7 100644 --- a/src/google/protobuf/unittest_embed_optimize_for.proto +++ b/src/google/protobuf/unittest_embed_optimize_for.proto @@ -39,6 +39,8 @@ import "google/protobuf/unittest_optimize_for.proto"; package protobuf_unittest; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; + // We optimize for speed here, but we are importing a proto that is optimized // for code size. option optimize_for = SPEED; diff --git a/src/google/protobuf/unittest_enormous_descriptor.proto b/src/google/protobuf/unittest_enormous_descriptor.proto index 2250261d..f8fcc9c0 100644 --- a/src/google/protobuf/unittest_enormous_descriptor.proto +++ b/src/google/protobuf/unittest_enormous_descriptor.proto @@ -33,12 +33,14 @@ // Sanjay Ghemawat, Jeff Dean, and others. // // A proto file that has an extremely large descriptor. Used to test that -// descriptors over 64k don't break the string literal length limit in Java. +// descriptors over 64k don't break language-specific limits in generated code, +// such as the string literal length limit in Java. syntax = "proto2"; package google.protobuf; option java_package = "com.google.protobuf"; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; // Avoid generating insanely long methods. option optimize_for = CODE_SIZE; diff --git a/src/google/protobuf/unittest_import.proto b/src/google/protobuf/unittest_import.proto index 7e165220..ae2e90b8 100644 --- a/src/google/protobuf/unittest_import.proto +++ b/src/google/protobuf/unittest_import.proto @@ -47,6 +47,7 @@ option cc_enable_arenas = true; // Exercise the java_package option. option java_package = "com.google.protobuf.test"; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; // Do not set a java_outer_classname here to verify that Proto2 works without // one. diff --git a/src/google/protobuf/unittest_import_lite.proto b/src/google/protobuf/unittest_import_lite.proto index a7afa452..ca208582 100644 --- a/src/google/protobuf/unittest_import_lite.proto +++ b/src/google/protobuf/unittest_import_lite.proto @@ -38,6 +38,7 @@ package protobuf_unittest_import; option optimize_for = LITE_RUNTIME; option java_package = "com.google.protobuf"; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; import public "google/protobuf/unittest_import_public_lite.proto"; diff --git a/src/google/protobuf/unittest_import_public.proto b/src/google/protobuf/unittest_import_public.proto index ffaf7736..0bc5d617 100644 --- a/src/google/protobuf/unittest_import_public.proto +++ b/src/google/protobuf/unittest_import_public.proto @@ -35,6 +35,7 @@ syntax = "proto2"; package protobuf_unittest_import; option java_package = "com.google.protobuf.test"; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; message PublicImportMessage { optional int32 e = 1; diff --git a/src/google/protobuf/unittest_import_public_lite.proto b/src/google/protobuf/unittest_import_public_lite.proto index 33549c22..231ab9dd 100644 --- a/src/google/protobuf/unittest_import_public_lite.proto +++ b/src/google/protobuf/unittest_import_public_lite.proto @@ -37,6 +37,7 @@ package protobuf_unittest_import; option optimize_for = LITE_RUNTIME; option java_package = "com.google.protobuf"; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; message PublicImportMessageLite { optional int32 e = 1; diff --git a/src/google/protobuf/unittest_lite.proto b/src/google/protobuf/unittest_lite.proto index 662c0e46..0040874b 100644 --- a/src/google/protobuf/unittest_lite.proto +++ b/src/google/protobuf/unittest_lite.proto @@ -40,6 +40,7 @@ import "google/protobuf/unittest_import_lite.proto"; option optimize_for = LITE_RUNTIME; option java_package = "com.google.protobuf"; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; // Same as TestAllTypes but with the lite runtime. message TestAllTypesLite { diff --git a/src/google/protobuf/unittest_lite_imports_nonlite.proto b/src/google/protobuf/unittest_lite_imports_nonlite.proto index 132d6a82..d955cc14 100644 --- a/src/google/protobuf/unittest_lite_imports_nonlite.proto +++ b/src/google/protobuf/unittest_lite_imports_nonlite.proto @@ -38,6 +38,7 @@ package protobuf_unittest; import "google/protobuf/unittest.proto"; option optimize_for = LITE_RUNTIME; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; message TestLiteImportsNonlite { optional TestAllTypes message = 1; diff --git a/src/google/protobuf/unittest_mset.proto b/src/google/protobuf/unittest_mset.proto index 3aa31fa9..425c9a5a 100644 --- a/src/google/protobuf/unittest_mset.proto +++ b/src/google/protobuf/unittest_mset.proto @@ -39,6 +39,7 @@ package protobuf_unittest; option cc_enable_arenas = true; option optimize_for = SPEED; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; // A message with message_set_wire_format. message TestMessageSet { diff --git a/src/google/protobuf/unittest_no_field_presence.proto b/src/google/protobuf/unittest_no_field_presence.proto index e04da0ac..f261b58e 100644 --- a/src/google/protobuf/unittest_no_field_presence.proto +++ b/src/google/protobuf/unittest_no_field_presence.proto @@ -37,6 +37,8 @@ import "google/protobuf/unittest.proto"; package proto2_nofieldpresence_unittest; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos.Proto3"; + // This proto includes every type of field in both singular and repeated // forms. message TestAllTypes { diff --git a/src/google/protobuf/unittest_optimize_for.proto b/src/google/protobuf/unittest_optimize_for.proto index ee9cc7bd..2bcd16e4 100644 --- a/src/google/protobuf/unittest_optimize_for.proto +++ b/src/google/protobuf/unittest_optimize_for.proto @@ -40,6 +40,7 @@ import "google/protobuf/unittest.proto"; package protobuf_unittest; option optimize_for = CODE_SIZE; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; message TestOptimizedForSize { optional int32 i = 1; diff --git a/src/google/protobuf/unittest_preserve_unknown_enum.proto b/src/google/protobuf/unittest_preserve_unknown_enum.proto index e7929699..24e6828f 100644 --- a/src/google/protobuf/unittest_preserve_unknown_enum.proto +++ b/src/google/protobuf/unittest_preserve_unknown_enum.proto @@ -33,6 +33,8 @@ syntax = "proto3"; package proto3_preserve_unknown_enum_unittest; option objc_class_prefix = "UnknownEnums"; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; + enum MyEnum { FOO = 0; BAR = 1; diff --git a/src/google/protobuf/unittest_preserve_unknown_enum2.proto b/src/google/protobuf/unittest_preserve_unknown_enum2.proto index adf42968..168b2407 100644 --- a/src/google/protobuf/unittest_preserve_unknown_enum2.proto +++ b/src/google/protobuf/unittest_preserve_unknown_enum2.proto @@ -32,6 +32,8 @@ syntax = "proto2"; package proto2_preserve_unknown_enum_unittest; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; + enum MyEnum { FOO = 0; BAR = 1; diff --git a/src/google/protobuf/unittest_well_known_types.proto b/src/google/protobuf/unittest_well_known_types.proto new file mode 100644 index 00000000..2d422d8c --- /dev/null +++ b/src/google/protobuf/unittest_well_known_types.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; + +package protobuf_unittest; + +import "google/protobuf/any.proto"; +import "google/protobuf/api.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/source_context.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/type.proto"; +import "google/protobuf/wrappers.proto"; + +// Test that we can include all well-known types. +message TestWellKnownTypes { + google.protobuf.Any any_field = 1; + google.protobuf.Api api_field = 2; + google.protobuf.Duration duration_field = 3; + google.protobuf.Empty empty_field = 4; + google.protobuf.FieldMask field_mask_field = 5; + google.protobuf.SourceContext source_context_field = 6; + google.protobuf.Struct struct_field = 7; + google.protobuf.Timestamp timestamp_field = 8; + google.protobuf.Type type_field = 9; + google.protobuf.Int32Value int32_field = 10; +} diff --git a/src/google/protobuf/unknown_enum_test.proto b/src/google/protobuf/unknown_enum_test.proto index caafadcd..3c549cc7 100644 --- a/src/google/protobuf/unknown_enum_test.proto +++ b/src/google/protobuf/unknown_enum_test.proto @@ -36,6 +36,7 @@ syntax = "proto2"; package google.protobuf.util; +option csharp_namespace = "Google.ProtocolBuffers.TestProtos"; message DownRevision { enum Enum { diff --git a/src/google/protobuf/well_known_types_unittest.cc b/src/google/protobuf/well_known_types_unittest.cc new file mode 100644 index 00000000..c9a9aa10 --- /dev/null +++ b/src/google/protobuf/well_known_types_unittest.cc @@ -0,0 +1,60 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include <google/protobuf/unittest_well_known_types.pb.h> + +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/testing/googletest.h> +#include <gtest/gtest.h> +#include <google/protobuf/stubs/stl_util.h> + +namespace google { +namespace protobuf { +namespace { + +// This test only checks whether well-known types are included in protobuf +// runtime library. The test passes if it compiles. +TEST(WellKnownTypesTest, AllKnownTypesAreIncluded) { + protobuf_unittest::TestWellKnownTypes message; + EXPECT_EQ(0, message.any_field().ByteSize()); + EXPECT_EQ(0, message.api_field().ByteSize()); + EXPECT_EQ(0, message.duration_field().ByteSize()); + EXPECT_EQ(0, message.empty_field().ByteSize()); + EXPECT_EQ(0, message.field_mask_field().ByteSize()); + EXPECT_EQ(0, message.source_context_field().ByteSize()); + EXPECT_EQ(0, message.struct_field().ByteSize()); + EXPECT_EQ(0, message.timestamp_field().ByteSize()); + EXPECT_EQ(0, message.type_field().ByteSize()); + EXPECT_EQ(0, message.int32_field().ByteSize()); +} + +} // namespace + +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc new file mode 100644 index 00000000..f7b33e55 --- /dev/null +++ b/src/google/protobuf/wrappers.pb.cc @@ -0,0 +1,2419 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/wrappers.proto + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "google/protobuf/wrappers.pb.h" + +#include <algorithm> + +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/once.h> +#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/wire_format_lite_inl.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/generated_message_reflection.h> +#include <google/protobuf/reflection_ops.h> +#include <google/protobuf/wire_format.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +namespace { + +const ::google::protobuf::Descriptor* DoubleValue_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + DoubleValue_reflection_ = NULL; +const ::google::protobuf::Descriptor* FloatValue_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + FloatValue_reflection_ = NULL; +const ::google::protobuf::Descriptor* Int64Value_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Int64Value_reflection_ = NULL; +const ::google::protobuf::Descriptor* UInt64Value_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + UInt64Value_reflection_ = NULL; +const ::google::protobuf::Descriptor* Int32Value_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + Int32Value_reflection_ = NULL; +const ::google::protobuf::Descriptor* UInt32Value_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + UInt32Value_reflection_ = NULL; +const ::google::protobuf::Descriptor* BoolValue_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + BoolValue_reflection_ = NULL; +const ::google::protobuf::Descriptor* StringValue_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + StringValue_reflection_ = NULL; +const ::google::protobuf::Descriptor* BytesValue_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + BytesValue_reflection_ = NULL; + +} // namespace + + +void protobuf_AssignDesc_google_2fprotobuf_2fwrappers_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + const ::google::protobuf::FileDescriptor* file = + ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( + "google/protobuf/wrappers.proto"); + GOOGLE_CHECK(file != NULL); + DoubleValue_descriptor_ = file->message_type(0); + static const int DoubleValue_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DoubleValue, value_), + }; + DoubleValue_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + DoubleValue_descriptor_, + DoubleValue::default_instance_, + DoubleValue_offsets_, + -1, + -1, + -1, + sizeof(DoubleValue), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DoubleValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DoubleValue, _is_default_instance_)); + FloatValue_descriptor_ = file->message_type(1); + static const int FloatValue_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FloatValue, value_), + }; + FloatValue_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + FloatValue_descriptor_, + FloatValue::default_instance_, + FloatValue_offsets_, + -1, + -1, + -1, + sizeof(FloatValue), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FloatValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FloatValue, _is_default_instance_)); + Int64Value_descriptor_ = file->message_type(2); + static const int Int64Value_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int64Value, value_), + }; + Int64Value_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Int64Value_descriptor_, + Int64Value::default_instance_, + Int64Value_offsets_, + -1, + -1, + -1, + sizeof(Int64Value), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int64Value, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int64Value, _is_default_instance_)); + UInt64Value_descriptor_ = file->message_type(3); + static const int UInt64Value_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt64Value, value_), + }; + UInt64Value_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + UInt64Value_descriptor_, + UInt64Value::default_instance_, + UInt64Value_offsets_, + -1, + -1, + -1, + sizeof(UInt64Value), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt64Value, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt64Value, _is_default_instance_)); + Int32Value_descriptor_ = file->message_type(4); + static const int Int32Value_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int32Value, value_), + }; + Int32Value_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + Int32Value_descriptor_, + Int32Value::default_instance_, + Int32Value_offsets_, + -1, + -1, + -1, + sizeof(Int32Value), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int32Value, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Int32Value, _is_default_instance_)); + UInt32Value_descriptor_ = file->message_type(5); + static const int UInt32Value_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt32Value, value_), + }; + UInt32Value_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + UInt32Value_descriptor_, + UInt32Value::default_instance_, + UInt32Value_offsets_, + -1, + -1, + -1, + sizeof(UInt32Value), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt32Value, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UInt32Value, _is_default_instance_)); + BoolValue_descriptor_ = file->message_type(6); + static const int BoolValue_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BoolValue, value_), + }; + BoolValue_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + BoolValue_descriptor_, + BoolValue::default_instance_, + BoolValue_offsets_, + -1, + -1, + -1, + sizeof(BoolValue), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BoolValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BoolValue, _is_default_instance_)); + StringValue_descriptor_ = file->message_type(7); + static const int StringValue_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StringValue, value_), + }; + StringValue_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + StringValue_descriptor_, + StringValue::default_instance_, + StringValue_offsets_, + -1, + -1, + -1, + sizeof(StringValue), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StringValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StringValue, _is_default_instance_)); + BytesValue_descriptor_ = file->message_type(8); + static const int BytesValue_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BytesValue, value_), + }; + BytesValue_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + BytesValue_descriptor_, + BytesValue::default_instance_, + BytesValue_offsets_, + -1, + -1, + -1, + sizeof(BytesValue), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BytesValue, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BytesValue, _is_default_instance_)); +} + +namespace { + +GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); +inline void protobuf_AssignDescriptorsOnce() { + ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, + &protobuf_AssignDesc_google_2fprotobuf_2fwrappers_2eproto); +} + +void protobuf_RegisterTypes(const ::std::string&) { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + DoubleValue_descriptor_, &DoubleValue::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + FloatValue_descriptor_, &FloatValue::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Int64Value_descriptor_, &Int64Value::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + UInt64Value_descriptor_, &UInt64Value::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + Int32Value_descriptor_, &Int32Value::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + UInt32Value_descriptor_, &UInt32Value::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + BoolValue_descriptor_, &BoolValue::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + StringValue_descriptor_, &StringValue::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + BytesValue_descriptor_, &BytesValue::default_instance()); +} + +} // namespace + +void protobuf_ShutdownFile_google_2fprotobuf_2fwrappers_2eproto() { + delete DoubleValue::default_instance_; + delete DoubleValue_reflection_; + delete FloatValue::default_instance_; + delete FloatValue_reflection_; + delete Int64Value::default_instance_; + delete Int64Value_reflection_; + delete UInt64Value::default_instance_; + delete UInt64Value_reflection_; + delete Int32Value::default_instance_; + delete Int32Value_reflection_; + delete UInt32Value::default_instance_; + delete UInt32Value_reflection_; + delete BoolValue::default_instance_; + delete BoolValue_reflection_; + delete StringValue::default_instance_; + delete StringValue_reflection_; + delete BytesValue::default_instance_; + delete BytesValue_reflection_; +} + +void protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( + "\n\036google/protobuf/wrappers.proto\022\017google" + ".protobuf\"\034\n\013DoubleValue\022\r\n\005value\030\001 \001(\001\"" + "\033\n\nFloatValue\022\r\n\005value\030\001 \001(\002\"\033\n\nInt64Val" + "ue\022\r\n\005value\030\001 \001(\003\"\034\n\013UInt64Value\022\r\n\005valu" + "e\030\001 \001(\004\"\033\n\nInt32Value\022\r\n\005value\030\001 \001(\005\"\034\n\013" + "UInt32Value\022\r\n\005value\030\001 \001(\r\"\032\n\tBoolValue\022" + "\r\n\005value\030\001 \001(\010\"\034\n\013StringValue\022\r\n\005value\030\001" + " \001(\t\"\033\n\nBytesValue\022\r\n\005value\030\001 \001(\014B,\n\023com" + ".google.protobufB\rWrappersProtoP\001\242\002\003GPBb" + "\006proto3", 367); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( + "google/protobuf/wrappers.proto", &protobuf_RegisterTypes); + DoubleValue::default_instance_ = new DoubleValue(); + FloatValue::default_instance_ = new FloatValue(); + Int64Value::default_instance_ = new Int64Value(); + UInt64Value::default_instance_ = new UInt64Value(); + Int32Value::default_instance_ = new Int32Value(); + UInt32Value::default_instance_ = new UInt32Value(); + BoolValue::default_instance_ = new BoolValue(); + StringValue::default_instance_ = new StringValue(); + BytesValue::default_instance_ = new BytesValue(); + DoubleValue::default_instance_->InitAsDefaultInstance(); + FloatValue::default_instance_->InitAsDefaultInstance(); + Int64Value::default_instance_->InitAsDefaultInstance(); + UInt64Value::default_instance_->InitAsDefaultInstance(); + Int32Value::default_instance_->InitAsDefaultInstance(); + UInt32Value::default_instance_->InitAsDefaultInstance(); + BoolValue::default_instance_->InitAsDefaultInstance(); + StringValue::default_instance_->InitAsDefaultInstance(); + BytesValue::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fwrappers_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_google_2fprotobuf_2fwrappers_2eproto { + StaticDescriptorInitializer_google_2fprotobuf_2fwrappers_2eproto() { + protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + } +} static_descriptor_initializer_google_2fprotobuf_2fwrappers_2eproto_; + +namespace { + +static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD; +static void MergeFromFail(int line) { + GOOGLE_CHECK(false) << __FILE__ << ":" << line; +} + +} // namespace + + +// =================================================================== + +#ifndef _MSC_VER +const int DoubleValue::kValueFieldNumber; +#endif // !_MSC_VER + +DoubleValue::DoubleValue() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.DoubleValue) +} + +void DoubleValue::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +DoubleValue::DoubleValue(const DoubleValue& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.DoubleValue) +} + +void DoubleValue::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; + value_ = 0; +} + +DoubleValue::~DoubleValue() { + // @@protoc_insertion_point(destructor:google.protobuf.DoubleValue) + SharedDtor(); +} + +void DoubleValue::SharedDtor() { + if (this != default_instance_) { + } +} + +void DoubleValue::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* DoubleValue::descriptor() { + protobuf_AssignDescriptorsOnce(); + return DoubleValue_descriptor_; +} + +const DoubleValue& DoubleValue::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + return *default_instance_; +} + +DoubleValue* DoubleValue::default_instance_ = NULL; + +DoubleValue* DoubleValue::New(::google::protobuf::Arena* arena) const { + DoubleValue* n = new DoubleValue; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void DoubleValue::Clear() { + value_ = 0; +} + +bool DoubleValue::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.DoubleValue) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional double value = 1; + case 1: { + if (tag == 9) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( + input, &value_))); + + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.DoubleValue) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.DoubleValue) + return false; +#undef DO_ +} + +void DoubleValue::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.DoubleValue) + // optional double value = 1; + if (this->value() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteDouble(1, this->value(), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.DoubleValue) +} + +::google::protobuf::uint8* DoubleValue::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DoubleValue) + // optional double value = 1; + if (this->value() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(1, this->value(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.DoubleValue) + return target; +} + +int DoubleValue::ByteSize() const { + int total_size = 0; + + // optional double value = 1; + if (this->value() != 0) { + total_size += 1 + 8; + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void DoubleValue::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const DoubleValue* source = + ::google::protobuf::internal::dynamic_cast_if_available<const DoubleValue*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void DoubleValue::MergeFrom(const DoubleValue& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.value() != 0) { + set_value(from.value()); + } +} + +void DoubleValue::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void DoubleValue::CopyFrom(const DoubleValue& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool DoubleValue::IsInitialized() const { + + return true; +} + +void DoubleValue::Swap(DoubleValue* other) { + if (other == this) return; + InternalSwap(other); +} +void DoubleValue::InternalSwap(DoubleValue* other) { + std::swap(value_, other->value_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata DoubleValue::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = DoubleValue_descriptor_; + metadata.reflection = DoubleValue_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// DoubleValue + +// optional double value = 1; + void DoubleValue::clear_value() { + value_ = 0; +} + double DoubleValue::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.DoubleValue.value) + return value_; +} + void DoubleValue::set_value(double value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.DoubleValue.value) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int FloatValue::kValueFieldNumber; +#endif // !_MSC_VER + +FloatValue::FloatValue() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.FloatValue) +} + +void FloatValue::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +FloatValue::FloatValue(const FloatValue& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.FloatValue) +} + +void FloatValue::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; + value_ = 0; +} + +FloatValue::~FloatValue() { + // @@protoc_insertion_point(destructor:google.protobuf.FloatValue) + SharedDtor(); +} + +void FloatValue::SharedDtor() { + if (this != default_instance_) { + } +} + +void FloatValue::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* FloatValue::descriptor() { + protobuf_AssignDescriptorsOnce(); + return FloatValue_descriptor_; +} + +const FloatValue& FloatValue::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + return *default_instance_; +} + +FloatValue* FloatValue::default_instance_ = NULL; + +FloatValue* FloatValue::New(::google::protobuf::Arena* arena) const { + FloatValue* n = new FloatValue; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void FloatValue::Clear() { + value_ = 0; +} + +bool FloatValue::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.FloatValue) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional float value = 1; + case 1: { + if (tag == 13) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( + input, &value_))); + + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.FloatValue) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.FloatValue) + return false; +#undef DO_ +} + +void FloatValue::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.FloatValue) + // optional float value = 1; + if (this->value() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteFloat(1, this->value(), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.FloatValue) +} + +::google::protobuf::uint8* FloatValue::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FloatValue) + // optional float value = 1; + if (this->value() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(1, this->value(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.FloatValue) + return target; +} + +int FloatValue::ByteSize() const { + int total_size = 0; + + // optional float value = 1; + if (this->value() != 0) { + total_size += 1 + 4; + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void FloatValue::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const FloatValue* source = + ::google::protobuf::internal::dynamic_cast_if_available<const FloatValue*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void FloatValue::MergeFrom(const FloatValue& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.value() != 0) { + set_value(from.value()); + } +} + +void FloatValue::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void FloatValue::CopyFrom(const FloatValue& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FloatValue::IsInitialized() const { + + return true; +} + +void FloatValue::Swap(FloatValue* other) { + if (other == this) return; + InternalSwap(other); +} +void FloatValue::InternalSwap(FloatValue* other) { + std::swap(value_, other->value_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata FloatValue::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = FloatValue_descriptor_; + metadata.reflection = FloatValue_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// FloatValue + +// optional float value = 1; + void FloatValue::clear_value() { + value_ = 0; +} + float FloatValue::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.FloatValue.value) + return value_; +} + void FloatValue::set_value(float value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FloatValue.value) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int Int64Value::kValueFieldNumber; +#endif // !_MSC_VER + +Int64Value::Int64Value() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Int64Value) +} + +void Int64Value::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +Int64Value::Int64Value(const Int64Value& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Int64Value) +} + +void Int64Value::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; + value_ = GOOGLE_LONGLONG(0); +} + +Int64Value::~Int64Value() { + // @@protoc_insertion_point(destructor:google.protobuf.Int64Value) + SharedDtor(); +} + +void Int64Value::SharedDtor() { + if (this != default_instance_) { + } +} + +void Int64Value::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Int64Value::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Int64Value_descriptor_; +} + +const Int64Value& Int64Value::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + return *default_instance_; +} + +Int64Value* Int64Value::default_instance_ = NULL; + +Int64Value* Int64Value::New(::google::protobuf::Arena* arena) const { + Int64Value* n = new Int64Value; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Int64Value::Clear() { + value_ = GOOGLE_LONGLONG(0); +} + +bool Int64Value::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Int64Value) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional int64 value = 1; + case 1: { + if (tag == 8) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &value_))); + + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Int64Value) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Int64Value) + return false; +#undef DO_ +} + +void Int64Value::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Int64Value) + // optional int64 value = 1; + if (this->value() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(1, this->value(), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.Int64Value) +} + +::google::protobuf::uint8* Int64Value::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int64Value) + // optional int64 value = 1; + if (this->value() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt64ToArray(1, this->value(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Int64Value) + return target; +} + +int Int64Value::ByteSize() const { + int total_size = 0; + + // optional int64 value = 1; + if (this->value() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->value()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Int64Value::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Int64Value* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Int64Value*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Int64Value::MergeFrom(const Int64Value& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.value() != 0) { + set_value(from.value()); + } +} + +void Int64Value::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Int64Value::CopyFrom(const Int64Value& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Int64Value::IsInitialized() const { + + return true; +} + +void Int64Value::Swap(Int64Value* other) { + if (other == this) return; + InternalSwap(other); +} +void Int64Value::InternalSwap(Int64Value* other) { + std::swap(value_, other->value_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Int64Value::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Int64Value_descriptor_; + metadata.reflection = Int64Value_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Int64Value + +// optional int64 value = 1; + void Int64Value::clear_value() { + value_ = GOOGLE_LONGLONG(0); +} + ::google::protobuf::int64 Int64Value::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Int64Value.value) + return value_; +} + void Int64Value::set_value(::google::protobuf::int64 value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Int64Value.value) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int UInt64Value::kValueFieldNumber; +#endif // !_MSC_VER + +UInt64Value::UInt64Value() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.UInt64Value) +} + +void UInt64Value::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +UInt64Value::UInt64Value(const UInt64Value& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.UInt64Value) +} + +void UInt64Value::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; + value_ = GOOGLE_ULONGLONG(0); +} + +UInt64Value::~UInt64Value() { + // @@protoc_insertion_point(destructor:google.protobuf.UInt64Value) + SharedDtor(); +} + +void UInt64Value::SharedDtor() { + if (this != default_instance_) { + } +} + +void UInt64Value::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* UInt64Value::descriptor() { + protobuf_AssignDescriptorsOnce(); + return UInt64Value_descriptor_; +} + +const UInt64Value& UInt64Value::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + return *default_instance_; +} + +UInt64Value* UInt64Value::default_instance_ = NULL; + +UInt64Value* UInt64Value::New(::google::protobuf::Arena* arena) const { + UInt64Value* n = new UInt64Value; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void UInt64Value::Clear() { + value_ = GOOGLE_ULONGLONG(0); +} + +bool UInt64Value::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.UInt64Value) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional uint64 value = 1; + case 1: { + if (tag == 8) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>( + input, &value_))); + + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.UInt64Value) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.UInt64Value) + return false; +#undef DO_ +} + +void UInt64Value::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.UInt64Value) + // optional uint64 value = 1; + if (this->value() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->value(), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.UInt64Value) +} + +::google::protobuf::uint8* UInt64Value::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt64Value) + // optional uint64 value = 1; + if (this->value() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->value(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UInt64Value) + return target; +} + +int UInt64Value::ByteSize() const { + int total_size = 0; + + // optional uint64 value = 1; + if (this->value() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::UInt64Size( + this->value()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void UInt64Value::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const UInt64Value* source = + ::google::protobuf::internal::dynamic_cast_if_available<const UInt64Value*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void UInt64Value::MergeFrom(const UInt64Value& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.value() != 0) { + set_value(from.value()); + } +} + +void UInt64Value::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void UInt64Value::CopyFrom(const UInt64Value& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool UInt64Value::IsInitialized() const { + + return true; +} + +void UInt64Value::Swap(UInt64Value* other) { + if (other == this) return; + InternalSwap(other); +} +void UInt64Value::InternalSwap(UInt64Value* other) { + std::swap(value_, other->value_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata UInt64Value::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = UInt64Value_descriptor_; + metadata.reflection = UInt64Value_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// UInt64Value + +// optional uint64 value = 1; + void UInt64Value::clear_value() { + value_ = GOOGLE_ULONGLONG(0); +} + ::google::protobuf::uint64 UInt64Value::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.UInt64Value.value) + return value_; +} + void UInt64Value::set_value(::google::protobuf::uint64 value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.UInt64Value.value) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int Int32Value::kValueFieldNumber; +#endif // !_MSC_VER + +Int32Value::Int32Value() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.Int32Value) +} + +void Int32Value::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +Int32Value::Int32Value(const Int32Value& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.Int32Value) +} + +void Int32Value::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; + value_ = 0; +} + +Int32Value::~Int32Value() { + // @@protoc_insertion_point(destructor:google.protobuf.Int32Value) + SharedDtor(); +} + +void Int32Value::SharedDtor() { + if (this != default_instance_) { + } +} + +void Int32Value::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* Int32Value::descriptor() { + protobuf_AssignDescriptorsOnce(); + return Int32Value_descriptor_; +} + +const Int32Value& Int32Value::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + return *default_instance_; +} + +Int32Value* Int32Value::default_instance_ = NULL; + +Int32Value* Int32Value::New(::google::protobuf::Arena* arena) const { + Int32Value* n = new Int32Value; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void Int32Value::Clear() { + value_ = 0; +} + +bool Int32Value::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.Int32Value) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional int32 value = 1; + case 1: { + if (tag == 8) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &value_))); + + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.Int32Value) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.Int32Value) + return false; +#undef DO_ +} + +void Int32Value::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.Int32Value) + // optional int32 value = 1; + if (this->value() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->value(), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.Int32Value) +} + +::google::protobuf::uint8* Int32Value::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int32Value) + // optional int32 value = 1; + if (this->value() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(1, this->value(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.Int32Value) + return target; +} + +int Int32Value::ByteSize() const { + int total_size = 0; + + // optional int32 value = 1; + if (this->value() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->value()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void Int32Value::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const Int32Value* source = + ::google::protobuf::internal::dynamic_cast_if_available<const Int32Value*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void Int32Value::MergeFrom(const Int32Value& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.value() != 0) { + set_value(from.value()); + } +} + +void Int32Value::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void Int32Value::CopyFrom(const Int32Value& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool Int32Value::IsInitialized() const { + + return true; +} + +void Int32Value::Swap(Int32Value* other) { + if (other == this) return; + InternalSwap(other); +} +void Int32Value::InternalSwap(Int32Value* other) { + std::swap(value_, other->value_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata Int32Value::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = Int32Value_descriptor_; + metadata.reflection = Int32Value_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// Int32Value + +// optional int32 value = 1; + void Int32Value::clear_value() { + value_ = 0; +} + ::google::protobuf::int32 Int32Value::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Int32Value.value) + return value_; +} + void Int32Value::set_value(::google::protobuf::int32 value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Int32Value.value) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int UInt32Value::kValueFieldNumber; +#endif // !_MSC_VER + +UInt32Value::UInt32Value() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.UInt32Value) +} + +void UInt32Value::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +UInt32Value::UInt32Value(const UInt32Value& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.UInt32Value) +} + +void UInt32Value::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; + value_ = 0u; +} + +UInt32Value::~UInt32Value() { + // @@protoc_insertion_point(destructor:google.protobuf.UInt32Value) + SharedDtor(); +} + +void UInt32Value::SharedDtor() { + if (this != default_instance_) { + } +} + +void UInt32Value::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* UInt32Value::descriptor() { + protobuf_AssignDescriptorsOnce(); + return UInt32Value_descriptor_; +} + +const UInt32Value& UInt32Value::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + return *default_instance_; +} + +UInt32Value* UInt32Value::default_instance_ = NULL; + +UInt32Value* UInt32Value::New(::google::protobuf::Arena* arena) const { + UInt32Value* n = new UInt32Value; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void UInt32Value::Clear() { + value_ = 0u; +} + +bool UInt32Value::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.UInt32Value) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional uint32 value = 1; + case 1: { + if (tag == 8) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( + input, &value_))); + + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.UInt32Value) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.UInt32Value) + return false; +#undef DO_ +} + +void UInt32Value::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.UInt32Value) + // optional uint32 value = 1; + if (this->value() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->value(), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.UInt32Value) +} + +::google::protobuf::uint8* UInt32Value::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt32Value) + // optional uint32 value = 1; + if (this->value() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->value(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.UInt32Value) + return target; +} + +int UInt32Value::ByteSize() const { + int total_size = 0; + + // optional uint32 value = 1; + if (this->value() != 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::UInt32Size( + this->value()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void UInt32Value::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const UInt32Value* source = + ::google::protobuf::internal::dynamic_cast_if_available<const UInt32Value*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void UInt32Value::MergeFrom(const UInt32Value& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.value() != 0) { + set_value(from.value()); + } +} + +void UInt32Value::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void UInt32Value::CopyFrom(const UInt32Value& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool UInt32Value::IsInitialized() const { + + return true; +} + +void UInt32Value::Swap(UInt32Value* other) { + if (other == this) return; + InternalSwap(other); +} +void UInt32Value::InternalSwap(UInt32Value* other) { + std::swap(value_, other->value_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata UInt32Value::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = UInt32Value_descriptor_; + metadata.reflection = UInt32Value_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// UInt32Value + +// optional uint32 value = 1; + void UInt32Value::clear_value() { + value_ = 0u; +} + ::google::protobuf::uint32 UInt32Value::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.UInt32Value.value) + return value_; +} + void UInt32Value::set_value(::google::protobuf::uint32 value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.UInt32Value.value) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int BoolValue::kValueFieldNumber; +#endif // !_MSC_VER + +BoolValue::BoolValue() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.BoolValue) +} + +void BoolValue::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +BoolValue::BoolValue(const BoolValue& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.BoolValue) +} + +void BoolValue::SharedCtor() { + _is_default_instance_ = false; + _cached_size_ = 0; + value_ = false; +} + +BoolValue::~BoolValue() { + // @@protoc_insertion_point(destructor:google.protobuf.BoolValue) + SharedDtor(); +} + +void BoolValue::SharedDtor() { + if (this != default_instance_) { + } +} + +void BoolValue::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* BoolValue::descriptor() { + protobuf_AssignDescriptorsOnce(); + return BoolValue_descriptor_; +} + +const BoolValue& BoolValue::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + return *default_instance_; +} + +BoolValue* BoolValue::default_instance_ = NULL; + +BoolValue* BoolValue::New(::google::protobuf::Arena* arena) const { + BoolValue* n = new BoolValue; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void BoolValue::Clear() { + value_ = false; +} + +bool BoolValue::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.BoolValue) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional bool value = 1; + case 1: { + if (tag == 8) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &value_))); + + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.BoolValue) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.BoolValue) + return false; +#undef DO_ +} + +void BoolValue::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.BoolValue) + // optional bool value = 1; + if (this->value() != 0) { + ::google::protobuf::internal::WireFormatLite::WriteBool(1, this->value(), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.BoolValue) +} + +::google::protobuf::uint8* BoolValue::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BoolValue) + // optional bool value = 1; + if (this->value() != 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->value(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.BoolValue) + return target; +} + +int BoolValue::ByteSize() const { + int total_size = 0; + + // optional bool value = 1; + if (this->value() != 0) { + total_size += 1 + 1; + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void BoolValue::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const BoolValue* source = + ::google::protobuf::internal::dynamic_cast_if_available<const BoolValue*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void BoolValue::MergeFrom(const BoolValue& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.value() != 0) { + set_value(from.value()); + } +} + +void BoolValue::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void BoolValue::CopyFrom(const BoolValue& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool BoolValue::IsInitialized() const { + + return true; +} + +void BoolValue::Swap(BoolValue* other) { + if (other == this) return; + InternalSwap(other); +} +void BoolValue::InternalSwap(BoolValue* other) { + std::swap(value_, other->value_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata BoolValue::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = BoolValue_descriptor_; + metadata.reflection = BoolValue_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// BoolValue + +// optional bool value = 1; + void BoolValue::clear_value() { + value_ = false; +} + bool BoolValue::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.BoolValue.value) + return value_; +} + void BoolValue::set_value(bool value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.BoolValue.value) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int StringValue::kValueFieldNumber; +#endif // !_MSC_VER + +StringValue::StringValue() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.StringValue) +} + +void StringValue::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +StringValue::StringValue(const StringValue& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.StringValue) +} + +void StringValue::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +StringValue::~StringValue() { + // @@protoc_insertion_point(destructor:google.protobuf.StringValue) + SharedDtor(); +} + +void StringValue::SharedDtor() { + value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void StringValue::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* StringValue::descriptor() { + protobuf_AssignDescriptorsOnce(); + return StringValue_descriptor_; +} + +const StringValue& StringValue::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + return *default_instance_; +} + +StringValue* StringValue::default_instance_ = NULL; + +StringValue* StringValue::New(::google::protobuf::Arena* arena) const { + StringValue* n = new StringValue; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void StringValue::Clear() { + value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +bool StringValue::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.StringValue) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string value = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_value())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->value().data(), this->value().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.StringValue.value"); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.StringValue) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.StringValue) + return false; +#undef DO_ +} + +void StringValue::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.StringValue) + // optional string value = 1; + if (this->value().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->value().data(), this->value().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.StringValue.value"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 1, this->value(), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.StringValue) +} + +::google::protobuf::uint8* StringValue::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.StringValue) + // optional string value = 1; + if (this->value().size() > 0) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->value().data(), this->value().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.StringValue.value"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 1, this->value(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.StringValue) + return target; +} + +int StringValue::ByteSize() const { + int total_size = 0; + + // optional string value = 1; + if (this->value().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->value()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void StringValue::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const StringValue* source = + ::google::protobuf::internal::dynamic_cast_if_available<const StringValue*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void StringValue::MergeFrom(const StringValue& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.value().size() > 0) { + + value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.value_); + } +} + +void StringValue::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void StringValue::CopyFrom(const StringValue& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool StringValue::IsInitialized() const { + + return true; +} + +void StringValue::Swap(StringValue* other) { + if (other == this) return; + InternalSwap(other); +} +void StringValue::InternalSwap(StringValue* other) { + value_.Swap(&other->value_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata StringValue::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = StringValue_descriptor_; + metadata.reflection = StringValue_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// StringValue + +// optional string value = 1; + void StringValue::clear_value() { + value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& StringValue::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.StringValue.value) + return value_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void StringValue::set_value(const ::std::string& value) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.StringValue.value) +} + void StringValue::set_value(const char* value) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.StringValue.value) +} + void StringValue::set_value(const char* value, size_t size) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.StringValue.value) +} + ::std::string* StringValue::mutable_value() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.StringValue.value) + return value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* StringValue::release_value() { + + return value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void StringValue::set_allocated_value(::std::string* value) { + if (value != NULL) { + + } else { + + } + value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.StringValue.value) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// =================================================================== + +#ifndef _MSC_VER +const int BytesValue::kValueFieldNumber; +#endif // !_MSC_VER + +BytesValue::BytesValue() + : ::google::protobuf::Message() , _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.BytesValue) +} + +void BytesValue::InitAsDefaultInstance() { + _is_default_instance_ = true; +} + +BytesValue::BytesValue(const BytesValue& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.BytesValue) +} + +void BytesValue::SharedCtor() { + _is_default_instance_ = false; + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +BytesValue::~BytesValue() { + // @@protoc_insertion_point(destructor:google.protobuf.BytesValue) + SharedDtor(); +} + +void BytesValue::SharedDtor() { + value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void BytesValue::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* BytesValue::descriptor() { + protobuf_AssignDescriptorsOnce(); + return BytesValue_descriptor_; +} + +const BytesValue& BytesValue::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + return *default_instance_; +} + +BytesValue* BytesValue::default_instance_ = NULL; + +BytesValue* BytesValue::New(::google::protobuf::Arena* arena) const { + BytesValue* n = new BytesValue; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void BytesValue::Clear() { + value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + +bool BytesValue::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.BytesValue) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional bytes value = 1; + case 1: { + if (tag == 10) { + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_value())); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.BytesValue) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.BytesValue) + return false; +#undef DO_ +} + +void BytesValue::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.BytesValue) + // optional bytes value = 1; + if (this->value().size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased( + 1, this->value(), output); + } + + // @@protoc_insertion_point(serialize_end:google.protobuf.BytesValue) +} + +::google::protobuf::uint8* BytesValue::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BytesValue) + // optional bytes value = 1; + if (this->value().size() > 0) { + target = + ::google::protobuf::internal::WireFormatLite::WriteBytesToArray( + 1, this->value(), target); + } + + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.BytesValue) + return target; +} + +int BytesValue::ByteSize() const { + int total_size = 0; + + // optional bytes value = 1; + if (this->value().size() > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->value()); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void BytesValue::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const BytesValue* source = + ::google::protobuf::internal::dynamic_cast_if_available<const BytesValue*>( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void BytesValue::MergeFrom(const BytesValue& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + if (from.value().size() > 0) { + + value_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.value_); + } +} + +void BytesValue::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void BytesValue::CopyFrom(const BytesValue& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool BytesValue::IsInitialized() const { + + return true; +} + +void BytesValue::Swap(BytesValue* other) { + if (other == this) return; + InternalSwap(other); +} +void BytesValue::InternalSwap(BytesValue* other) { + value_.Swap(&other->value_); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata BytesValue::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = BytesValue_descriptor_; + metadata.reflection = BytesValue_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// BytesValue + +// optional bytes value = 1; + void BytesValue::clear_value() { + value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + const ::std::string& BytesValue::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.BytesValue.value) + return value_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void BytesValue::set_value(const ::std::string& value) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.BytesValue.value) +} + void BytesValue::set_value(const char* value) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.BytesValue.value) +} + void BytesValue::set_value(const void* value, size_t size) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.BytesValue.value) +} + ::std::string* BytesValue::mutable_value() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.BytesValue.value) + return value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* BytesValue::release_value() { + + return value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void BytesValue::set_allocated_value(::std::string* value) { + if (value != NULL) { + + } else { + + } + value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.BytesValue.value) +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h new file mode 100644 index 00000000..c318f950 --- /dev/null +++ b/src/google/protobuf/wrappers.pb.h @@ -0,0 +1,995 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/wrappers.proto + +#ifndef PROTOBUF_google_2fprotobuf_2fwrappers_2eproto__INCLUDED +#define PROTOBUF_google_2fprotobuf_2fwrappers_2eproto__INCLUDED + +#include <string> + +#include <google/protobuf/stubs/common.h> + +#if GOOGLE_PROTOBUF_VERSION < 3000000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include <google/protobuf/arena.h> +#include <google/protobuf/arenastring.h> +#include <google/protobuf/generated_message_util.h> +#include <google/protobuf/metadata.h> +#include <google/protobuf/message.h> +#include <google/protobuf/repeated_field.h> +#include <google/protobuf/extension_set.h> +#include <google/protobuf/unknown_field_set.h> +// @@protoc_insertion_point(includes) + +namespace google { +namespace protobuf { + +// Internal implementation detail -- do not call these. +void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); +void protobuf_AssignDesc_google_2fprotobuf_2fwrappers_2eproto(); +void protobuf_ShutdownFile_google_2fprotobuf_2fwrappers_2eproto(); + +class DoubleValue; +class FloatValue; +class Int64Value; +class UInt64Value; +class Int32Value; +class UInt32Value; +class BoolValue; +class StringValue; +class BytesValue; + +// =================================================================== + +class LIBPROTOBUF_EXPORT DoubleValue : public ::google::protobuf::Message { + public: + DoubleValue(); + virtual ~DoubleValue(); + + DoubleValue(const DoubleValue& from); + + inline DoubleValue& operator=(const DoubleValue& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const DoubleValue& default_instance(); + + void Swap(DoubleValue* other); + + // implements Message ---------------------------------------------- + + inline DoubleValue* New() const { return New(NULL); } + + DoubleValue* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const DoubleValue& from); + void MergeFrom(const DoubleValue& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(DoubleValue* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional double value = 1; + void clear_value(); + static const int kValueFieldNumber = 1; + double value() const; + void set_value(double value); + + // @@protoc_insertion_point(class_scope:google.protobuf.DoubleValue) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + double value_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fwrappers_2eproto(); + + void InitAsDefaultInstance(); + static DoubleValue* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT FloatValue : public ::google::protobuf::Message { + public: + FloatValue(); + virtual ~FloatValue(); + + FloatValue(const FloatValue& from); + + inline FloatValue& operator=(const FloatValue& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const FloatValue& default_instance(); + + void Swap(FloatValue* other); + + // implements Message ---------------------------------------------- + + inline FloatValue* New() const { return New(NULL); } + + FloatValue* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const FloatValue& from); + void MergeFrom(const FloatValue& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FloatValue* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional float value = 1; + void clear_value(); + static const int kValueFieldNumber = 1; + float value() const; + void set_value(float value); + + // @@protoc_insertion_point(class_scope:google.protobuf.FloatValue) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + float value_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fwrappers_2eproto(); + + void InitAsDefaultInstance(); + static FloatValue* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT Int64Value : public ::google::protobuf::Message { + public: + Int64Value(); + virtual ~Int64Value(); + + Int64Value(const Int64Value& from); + + inline Int64Value& operator=(const Int64Value& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Int64Value& default_instance(); + + void Swap(Int64Value* other); + + // implements Message ---------------------------------------------- + + inline Int64Value* New() const { return New(NULL); } + + Int64Value* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Int64Value& from); + void MergeFrom(const Int64Value& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Int64Value* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int64 value = 1; + void clear_value(); + static const int kValueFieldNumber = 1; + ::google::protobuf::int64 value() const; + void set_value(::google::protobuf::int64 value); + + // @@protoc_insertion_point(class_scope:google.protobuf.Int64Value) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::int64 value_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fwrappers_2eproto(); + + void InitAsDefaultInstance(); + static Int64Value* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT UInt64Value : public ::google::protobuf::Message { + public: + UInt64Value(); + virtual ~UInt64Value(); + + UInt64Value(const UInt64Value& from); + + inline UInt64Value& operator=(const UInt64Value& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const UInt64Value& default_instance(); + + void Swap(UInt64Value* other); + + // implements Message ---------------------------------------------- + + inline UInt64Value* New() const { return New(NULL); } + + UInt64Value* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const UInt64Value& from); + void MergeFrom(const UInt64Value& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(UInt64Value* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional uint64 value = 1; + void clear_value(); + static const int kValueFieldNumber = 1; + ::google::protobuf::uint64 value() const; + void set_value(::google::protobuf::uint64 value); + + // @@protoc_insertion_point(class_scope:google.protobuf.UInt64Value) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::uint64 value_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fwrappers_2eproto(); + + void InitAsDefaultInstance(); + static UInt64Value* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT Int32Value : public ::google::protobuf::Message { + public: + Int32Value(); + virtual ~Int32Value(); + + Int32Value(const Int32Value& from); + + inline Int32Value& operator=(const Int32Value& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const Int32Value& default_instance(); + + void Swap(Int32Value* other); + + // implements Message ---------------------------------------------- + + inline Int32Value* New() const { return New(NULL); } + + Int32Value* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const Int32Value& from); + void MergeFrom(const Int32Value& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(Int32Value* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional int32 value = 1; + void clear_value(); + static const int kValueFieldNumber = 1; + ::google::protobuf::int32 value() const; + void set_value(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:google.protobuf.Int32Value) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::int32 value_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fwrappers_2eproto(); + + void InitAsDefaultInstance(); + static Int32Value* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT UInt32Value : public ::google::protobuf::Message { + public: + UInt32Value(); + virtual ~UInt32Value(); + + UInt32Value(const UInt32Value& from); + + inline UInt32Value& operator=(const UInt32Value& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const UInt32Value& default_instance(); + + void Swap(UInt32Value* other); + + // implements Message ---------------------------------------------- + + inline UInt32Value* New() const { return New(NULL); } + + UInt32Value* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const UInt32Value& from); + void MergeFrom(const UInt32Value& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(UInt32Value* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional uint32 value = 1; + void clear_value(); + static const int kValueFieldNumber = 1; + ::google::protobuf::uint32 value() const; + void set_value(::google::protobuf::uint32 value); + + // @@protoc_insertion_point(class_scope:google.protobuf.UInt32Value) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::uint32 value_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fwrappers_2eproto(); + + void InitAsDefaultInstance(); + static UInt32Value* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT BoolValue : public ::google::protobuf::Message { + public: + BoolValue(); + virtual ~BoolValue(); + + BoolValue(const BoolValue& from); + + inline BoolValue& operator=(const BoolValue& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const BoolValue& default_instance(); + + void Swap(BoolValue* other); + + // implements Message ---------------------------------------------- + + inline BoolValue* New() const { return New(NULL); } + + BoolValue* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const BoolValue& from); + void MergeFrom(const BoolValue& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(BoolValue* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional bool value = 1; + void clear_value(); + static const int kValueFieldNumber = 1; + bool value() const; + void set_value(bool value); + + // @@protoc_insertion_point(class_scope:google.protobuf.BoolValue) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + bool value_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fwrappers_2eproto(); + + void InitAsDefaultInstance(); + static BoolValue* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT StringValue : public ::google::protobuf::Message { + public: + StringValue(); + virtual ~StringValue(); + + StringValue(const StringValue& from); + + inline StringValue& operator=(const StringValue& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const StringValue& default_instance(); + + void Swap(StringValue* other); + + // implements Message ---------------------------------------------- + + inline StringValue* New() const { return New(NULL); } + + StringValue* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const StringValue& from); + void MergeFrom(const StringValue& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(StringValue* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string value = 1; + void clear_value(); + static const int kValueFieldNumber = 1; + const ::std::string& value() const; + void set_value(const ::std::string& value); + void set_value(const char* value); + void set_value(const char* value, size_t size); + ::std::string* mutable_value(); + ::std::string* release_value(); + void set_allocated_value(::std::string* value); + + // @@protoc_insertion_point(class_scope:google.protobuf.StringValue) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr value_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fwrappers_2eproto(); + + void InitAsDefaultInstance(); + static StringValue* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT BytesValue : public ::google::protobuf::Message { + public: + BytesValue(); + virtual ~BytesValue(); + + BytesValue(const BytesValue& from); + + inline BytesValue& operator=(const BytesValue& from) { + CopyFrom(from); + return *this; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const BytesValue& default_instance(); + + void Swap(BytesValue* other); + + // implements Message ---------------------------------------------- + + inline BytesValue* New() const { return New(NULL); } + + BytesValue* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const BytesValue& from); + void MergeFrom(const BytesValue& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(BytesValue* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional bytes value = 1; + void clear_value(); + static const int kValueFieldNumber = 1; + const ::std::string& value() const; + void set_value(const ::std::string& value); + void set_value(const char* value); + void set_value(const void* value, size_t size); + ::std::string* mutable_value(); + ::std::string* release_value(); + void set_allocated_value(::std::string* value); + + // @@protoc_insertion_point(class_scope:google.protobuf.BytesValue) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + bool _is_default_instance_; + ::google::protobuf::internal::ArenaStringPtr value_; + mutable int _cached_size_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fwrappers_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fwrappers_2eproto(); + + void InitAsDefaultInstance(); + static BytesValue* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +#if !PROTOBUF_INLINE_NOT_IN_HEADERS +// DoubleValue + +// optional double value = 1; +inline void DoubleValue::clear_value() { + value_ = 0; +} +inline double DoubleValue::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.DoubleValue.value) + return value_; +} +inline void DoubleValue::set_value(double value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.DoubleValue.value) +} + +// ------------------------------------------------------------------- + +// FloatValue + +// optional float value = 1; +inline void FloatValue::clear_value() { + value_ = 0; +} +inline float FloatValue::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.FloatValue.value) + return value_; +} +inline void FloatValue::set_value(float value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.FloatValue.value) +} + +// ------------------------------------------------------------------- + +// Int64Value + +// optional int64 value = 1; +inline void Int64Value::clear_value() { + value_ = GOOGLE_LONGLONG(0); +} +inline ::google::protobuf::int64 Int64Value::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Int64Value.value) + return value_; +} +inline void Int64Value::set_value(::google::protobuf::int64 value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Int64Value.value) +} + +// ------------------------------------------------------------------- + +// UInt64Value + +// optional uint64 value = 1; +inline void UInt64Value::clear_value() { + value_ = GOOGLE_ULONGLONG(0); +} +inline ::google::protobuf::uint64 UInt64Value::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.UInt64Value.value) + return value_; +} +inline void UInt64Value::set_value(::google::protobuf::uint64 value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.UInt64Value.value) +} + +// ------------------------------------------------------------------- + +// Int32Value + +// optional int32 value = 1; +inline void Int32Value::clear_value() { + value_ = 0; +} +inline ::google::protobuf::int32 Int32Value::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.Int32Value.value) + return value_; +} +inline void Int32Value::set_value(::google::protobuf::int32 value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.Int32Value.value) +} + +// ------------------------------------------------------------------- + +// UInt32Value + +// optional uint32 value = 1; +inline void UInt32Value::clear_value() { + value_ = 0u; +} +inline ::google::protobuf::uint32 UInt32Value::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.UInt32Value.value) + return value_; +} +inline void UInt32Value::set_value(::google::protobuf::uint32 value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.UInt32Value.value) +} + +// ------------------------------------------------------------------- + +// BoolValue + +// optional bool value = 1; +inline void BoolValue::clear_value() { + value_ = false; +} +inline bool BoolValue::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.BoolValue.value) + return value_; +} +inline void BoolValue::set_value(bool value) { + + value_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.BoolValue.value) +} + +// ------------------------------------------------------------------- + +// StringValue + +// optional string value = 1; +inline void StringValue::clear_value() { + value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& StringValue::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.StringValue.value) + return value_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void StringValue::set_value(const ::std::string& value) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.StringValue.value) +} +inline void StringValue::set_value(const char* value) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.StringValue.value) +} +inline void StringValue::set_value(const char* value, size_t size) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.StringValue.value) +} +inline ::std::string* StringValue::mutable_value() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.StringValue.value) + return value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* StringValue::release_value() { + + return value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void StringValue::set_allocated_value(::std::string* value) { + if (value != NULL) { + + } else { + + } + value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.StringValue.value) +} + +// ------------------------------------------------------------------- + +// BytesValue + +// optional bytes value = 1; +inline void BytesValue::clear_value() { + value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline const ::std::string& BytesValue::value() const { + // @@protoc_insertion_point(field_get:google.protobuf.BytesValue.value) + return value_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void BytesValue::set_value(const ::std::string& value) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.BytesValue.value) +} +inline void BytesValue::set_value(const char* value) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.BytesValue.value) +} +inline void BytesValue::set_value(const void* value, size_t size) { + + value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast<const char*>(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.BytesValue.value) +} +inline ::std::string* BytesValue::mutable_value() { + + // @@protoc_insertion_point(field_mutable:google.protobuf.BytesValue.value) + return value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* BytesValue::release_value() { + + return value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void BytesValue::set_allocated_value(::std::string* value) { + if (value != NULL) { + + } else { + + } + value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.BytesValue.value) +} + +#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS + +// @@protoc_insertion_point(namespace_scope) + +} // namespace protobuf +} // namespace google + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_google_2fprotobuf_2fwrappers_2eproto__INCLUDED diff --git a/src/google/protobuf/wrappers.proto b/src/google/protobuf/wrappers.proto index 4c902d44..a13e6edb 100644 --- a/src/google/protobuf/wrappers.proto +++ b/src/google/protobuf/wrappers.proto @@ -40,6 +40,7 @@ package google.protobuf; option java_multiple_files = true; option java_outer_classname = "WrappersProto"; option java_package = "com.google.protobuf"; +option csharp_namespace = "Google.ProtocolBuffers"; option objc_class_prefix = "GPB"; |