diff options
author | paxakor <paxakor@yandex-team.ru> | 2022-02-10 16:47:32 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:32 +0300 |
commit | 40d35c046ee3a61ee2a581f42499c5ce56ac589a (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /contrib | |
parent | 7fdbed62e54b804e2c12b86a2c2bab12f61065df (diff) | |
download | ydb-40d35c046ee3a61ee2a581f42499c5ce56ac589a.tar.gz |
Restoring authorship annotation for <paxakor@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib')
79 files changed, 3087 insertions, 3087 deletions
diff --git a/contrib/libs/protobuf/python/ya.make b/contrib/libs/protobuf/python/ya.make index 2779f32843..42bc625109 100644 --- a/contrib/libs/protobuf/python/ya.make +++ b/contrib/libs/protobuf/python/ya.make @@ -1,5 +1,5 @@ -PACKAGE() - +PACKAGE() + WITHOUT_LICENSE_TEXTS() LICENSE(BSD-3-Clause) @@ -8,7 +8,7 @@ OWNER( g:contrib g:cpp-contrib ) - + GENERATE_PY_PROTOS(contrib/libs/protobuf/src/google/protobuf/descriptor.proto) - -END() + +END() diff --git a/contrib/libs/protobuf/src/google/protobuf/any.pb.h b/contrib/libs/protobuf/src/google/protobuf/any.pb.h index e928c9cce2..f45f983ffb 100644 --- a/contrib/libs/protobuf/src/google/protobuf/any.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/any.pb.h @@ -218,12 +218,12 @@ class PROTOBUF_EXPORT Any final : }; // string type_url = 1; void clear_type_url(); - const TProtoStringType& type_url() const; + const TProtoStringType& type_url() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_type_url(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_type_url(); + TProtoStringType* mutable_type_url(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_type_url(); - void set_allocated_type_url(TProtoStringType* type_url); + void set_allocated_type_url(TProtoStringType* type_url); private: const TProtoStringType& _internal_type_url() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_type_url(const TProtoStringType& value); @@ -232,12 +232,12 @@ class PROTOBUF_EXPORT Any final : // bytes value = 2; void clear_value(); - const TProtoStringType& value() const; + const TProtoStringType& value() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_value(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_value(); + TProtoStringType* mutable_value(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_value(); - void set_allocated_value(TProtoStringType* value); + void set_allocated_value(TProtoStringType* value); private: const TProtoStringType& _internal_value() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_value(const TProtoStringType& value); @@ -272,7 +272,7 @@ class PROTOBUF_EXPORT Any final : inline void Any::clear_type_url() { type_url_.ClearToEmpty(); } -inline const TProtoStringType& Any::type_url() const { +inline const TProtoStringType& Any::type_url() const { // @@protoc_insertion_point(field_get:google.protobuf.Any.type_url) return _internal_type_url(); } @@ -299,11 +299,11 @@ inline TProtoStringType* Any::_internal_mutable_type_url() { return type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Any::release_type_url() { +inline TProtoStringType* Any::release_type_url() { // @@protoc_insertion_point(field_release:google.protobuf.Any.type_url) return type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Any::set_allocated_type_url(TProtoStringType* type_url) { +inline void Any::set_allocated_type_url(TProtoStringType* type_url) { if (type_url != nullptr) { } else { @@ -318,7 +318,7 @@ inline void Any::set_allocated_type_url(TProtoStringType* type_url) { inline void Any::clear_value() { value_.ClearToEmpty(); } -inline const TProtoStringType& Any::value() const { +inline const TProtoStringType& Any::value() const { // @@protoc_insertion_point(field_get:google.protobuf.Any.value) return _internal_value(); } @@ -345,11 +345,11 @@ inline TProtoStringType* Any::_internal_mutable_value() { return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Any::release_value() { +inline TProtoStringType* Any::release_value() { // @@protoc_insertion_point(field_release:google.protobuf.Any.value) return value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Any::set_allocated_value(TProtoStringType* value) { +inline void Any::set_allocated_value(TProtoStringType* value) { if (value != nullptr) { } else { diff --git a/contrib/libs/protobuf/src/google/protobuf/api.pb.h b/contrib/libs/protobuf/src/google/protobuf/api.pb.h index 9dc9de7411..09482c7fee 100644 --- a/contrib/libs/protobuf/src/google/protobuf/api.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/api.pb.h @@ -268,12 +268,12 @@ class PROTOBUF_EXPORT Api final : // string version = 4; void clear_version(); - const TProtoStringType& version() const; + const TProtoStringType& version() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_version(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_version(); + TProtoStringType* mutable_version(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_version(); - void set_allocated_version(TProtoStringType* version); + void set_allocated_version(TProtoStringType* version); private: const TProtoStringType& _internal_version() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_version(const TProtoStringType& value); @@ -469,12 +469,12 @@ class PROTOBUF_EXPORT Method final : // string name = 1; void clear_name(); - const TProtoStringType& name() const; + const TProtoStringType& name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_name(); + TProtoStringType* mutable_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); - void set_allocated_name(TProtoStringType* name); + void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const TProtoStringType& value); @@ -483,12 +483,12 @@ class PROTOBUF_EXPORT Method final : // string request_type_url = 2; void clear_request_type_url(); - const TProtoStringType& request_type_url() const; + const TProtoStringType& request_type_url() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_request_type_url(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_request_type_url(); + TProtoStringType* mutable_request_type_url(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_request_type_url(); - void set_allocated_request_type_url(TProtoStringType* request_type_url); + void set_allocated_request_type_url(TProtoStringType* request_type_url); private: const TProtoStringType& _internal_request_type_url() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_request_type_url(const TProtoStringType& value); @@ -497,12 +497,12 @@ class PROTOBUF_EXPORT Method final : // string response_type_url = 4; void clear_response_type_url(); - const TProtoStringType& response_type_url() const; + const TProtoStringType& response_type_url() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_response_type_url(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_response_type_url(); + TProtoStringType* mutable_response_type_url(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_response_type_url(); - void set_allocated_response_type_url(TProtoStringType* response_type_url); + void set_allocated_response_type_url(TProtoStringType* response_type_url); private: const TProtoStringType& _internal_response_type_url() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_response_type_url(const TProtoStringType& value); @@ -675,12 +675,12 @@ class PROTOBUF_EXPORT Mixin final : }; // string name = 1; void clear_name(); - const TProtoStringType& name() const; + const TProtoStringType& name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_name(); + TProtoStringType* mutable_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); - void set_allocated_name(TProtoStringType* name); + void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const TProtoStringType& value); @@ -689,12 +689,12 @@ class PROTOBUF_EXPORT Mixin final : // string root = 2; void clear_root(); - const TProtoStringType& root() const; + const TProtoStringType& root() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_root(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_root(); + TProtoStringType* mutable_root(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_root(); - void set_allocated_root(TProtoStringType* root); + void set_allocated_root(TProtoStringType* root); private: const TProtoStringType& _internal_root() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_root(const TProtoStringType& value); @@ -728,7 +728,7 @@ class PROTOBUF_EXPORT Mixin final : inline void Api::clear_name() { name_.ClearToEmpty(); } -inline const TProtoStringType& Api::name() const { +inline const TProtoStringType& Api::name() const { // @@protoc_insertion_point(field_get:google.protobuf.Api.name) return _internal_name(); } @@ -755,11 +755,11 @@ inline TProtoStringType* Api::_internal_mutable_name() { return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Api::release_name() { +inline TProtoStringType* Api::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.Api.name) return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Api::set_allocated_name(TProtoStringType* name) { +inline void Api::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { } else { @@ -851,7 +851,7 @@ Api::options() const { inline void Api::clear_version() { version_.ClearToEmpty(); } -inline const TProtoStringType& Api::version() const { +inline const TProtoStringType& Api::version() const { // @@protoc_insertion_point(field_get:google.protobuf.Api.version) return _internal_version(); } @@ -878,11 +878,11 @@ inline TProtoStringType* Api::_internal_mutable_version() { return version_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Api::release_version() { +inline TProtoStringType* Api::release_version() { // @@protoc_insertion_point(field_release:google.protobuf.Api.version) return version_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Api::set_allocated_version(TProtoStringType* version) { +inline void Api::set_allocated_version(TProtoStringType* version) { if (version != nullptr) { } else { @@ -1047,7 +1047,7 @@ inline void Api::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { inline void Method::clear_name() { name_.ClearToEmpty(); } -inline const TProtoStringType& Method::name() const { +inline const TProtoStringType& Method::name() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.name) return _internal_name(); } @@ -1074,11 +1074,11 @@ inline TProtoStringType* Method::_internal_mutable_name() { return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Method::release_name() { +inline TProtoStringType* Method::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.Method.name) return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Method::set_allocated_name(TProtoStringType* name) { +inline void Method::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { } else { @@ -1093,7 +1093,7 @@ inline void Method::set_allocated_name(TProtoStringType* name) { inline void Method::clear_request_type_url() { request_type_url_.ClearToEmpty(); } -inline const TProtoStringType& Method::request_type_url() const { +inline const TProtoStringType& Method::request_type_url() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.request_type_url) return _internal_request_type_url(); } @@ -1120,11 +1120,11 @@ inline TProtoStringType* Method::_internal_mutable_request_type_url() { return request_type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Method::release_request_type_url() { +inline TProtoStringType* Method::release_request_type_url() { // @@protoc_insertion_point(field_release:google.protobuf.Method.request_type_url) return request_type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Method::set_allocated_request_type_url(TProtoStringType* request_type_url) { +inline void Method::set_allocated_request_type_url(TProtoStringType* request_type_url) { if (request_type_url != nullptr) { } else { @@ -1159,7 +1159,7 @@ inline void Method::set_request_streaming(bool value) { inline void Method::clear_response_type_url() { response_type_url_.ClearToEmpty(); } -inline const TProtoStringType& Method::response_type_url() const { +inline const TProtoStringType& Method::response_type_url() const { // @@protoc_insertion_point(field_get:google.protobuf.Method.response_type_url) return _internal_response_type_url(); } @@ -1186,11 +1186,11 @@ inline TProtoStringType* Method::_internal_mutable_response_type_url() { return response_type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Method::release_response_type_url() { +inline TProtoStringType* Method::release_response_type_url() { // @@protoc_insertion_point(field_release:google.protobuf.Method.response_type_url) return response_type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Method::set_allocated_response_type_url(TProtoStringType* response_type_url) { +inline void Method::set_allocated_response_type_url(TProtoStringType* response_type_url) { if (response_type_url != nullptr) { } else { @@ -1286,7 +1286,7 @@ inline void Method::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { inline void Mixin::clear_name() { name_.ClearToEmpty(); } -inline const TProtoStringType& Mixin::name() const { +inline const TProtoStringType& Mixin::name() const { // @@protoc_insertion_point(field_get:google.protobuf.Mixin.name) return _internal_name(); } @@ -1313,11 +1313,11 @@ inline TProtoStringType* Mixin::_internal_mutable_name() { return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Mixin::release_name() { +inline TProtoStringType* Mixin::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.Mixin.name) return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Mixin::set_allocated_name(TProtoStringType* name) { +inline void Mixin::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { } else { @@ -1332,7 +1332,7 @@ inline void Mixin::set_allocated_name(TProtoStringType* name) { inline void Mixin::clear_root() { root_.ClearToEmpty(); } -inline const TProtoStringType& Mixin::root() const { +inline const TProtoStringType& Mixin::root() const { // @@protoc_insertion_point(field_get:google.protobuf.Mixin.root) return _internal_root(); } @@ -1359,11 +1359,11 @@ inline TProtoStringType* Mixin::_internal_mutable_root() { return root_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Mixin::release_root() { +inline TProtoStringType* Mixin::release_root() { // @@protoc_insertion_point(field_release:google.protobuf.Mixin.root) return root_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Mixin::set_allocated_root(TProtoStringType* root) { +inline void Mixin::set_allocated_root(TProtoStringType* root) { if (root != nullptr) { } else { diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.cc b/contrib/libs/protobuf/src/google/protobuf/descriptor.cc index 7ec575c431..8b8d7fd9cf 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor.cc +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.cc @@ -462,7 +462,7 @@ typedef HASH_MAP<EnumIntPair, const EnumValueDescriptor*, // through all the extensions that extend a given Descriptor, and an // ordered data structure that implements lower_bound is convenient // for that. -typedef std::map<DescriptorIntPair, const FieldDescriptor*> +typedef std::map<DescriptorIntPair, const FieldDescriptor*> ExtensionsGroupedByDescriptorMap; typedef HASH_MAP<TProtoStringType, const SourceCodeInfo_Location*> LocationsByPathMap; @@ -589,7 +589,7 @@ class DescriptorPool::Tables { inline const FieldDescriptor* FindExtension(const Descriptor* extendee, int number) const; inline void FindAllExtensions(const Descriptor* extendee, - std::vector<const FieldDescriptor*>* out) const; + std::vector<const FieldDescriptor*>* out) const; // ----------------------------------------------------------------- // Adding items. @@ -673,10 +673,10 @@ class DescriptorPool::Tables { int pending_files_before_checkpoint; int pending_extensions_before_checkpoint; }; - std::vector<CheckPoint> checkpoints_; + std::vector<CheckPoint> checkpoints_; std::vector<const char*> symbols_after_checkpoint_; std::vector<const char*> files_after_checkpoint_; - std::vector<DescriptorIntPair> extensions_after_checkpoint_; + std::vector<DescriptorIntPair> extensions_after_checkpoint_; // Allocate some bytes which will be reclaimed when the pool is // destroyed. @@ -743,14 +743,14 @@ class FileDescriptorTables { // Populates p->first->locations_by_path_ from p->second. // Unusual signature dictated by internal::call_once. static void BuildLocationsByPath( - std::pair<const FileDescriptorTables*, const SourceCodeInfo*>* p); + std::pair<const FileDescriptorTables*, const SourceCodeInfo*>* p); // Returns the location denoted by the specified path through info, // or nullptr if not found. // The value of info must be that of the corresponding FileDescriptor. // (Conceptually a pure function, but stateful as an optimisation.) const SourceCodeInfo_Location* GetSourceLocation( - const std::vector<int>& path, const SourceCodeInfo* info) const; + const std::vector<int>& path, const SourceCodeInfo* info) const; // Must be called after BuildFileImpl(), even if the build failed and // we are going to roll back to the last checkpoint. @@ -1210,7 +1210,7 @@ void* DescriptorPool::Tables::AllocateBytes(int size) { } void FileDescriptorTables::BuildLocationsByPath( - std::pair<const FileDescriptorTables*, const SourceCodeInfo*>* p) { + std::pair<const FileDescriptorTables*, const SourceCodeInfo*>* p) { for (int i = 0, len = p->second->location_size(); i < len; ++i) { const SourceCodeInfo_Location* loc = &p->second->location().Get(i); p->first->locations_by_path_[Join(loc->path(), ",")] = loc; @@ -1218,8 +1218,8 @@ void FileDescriptorTables::BuildLocationsByPath( } const SourceCodeInfo_Location* FileDescriptorTables::GetSourceLocation( - const std::vector<int>& path, const SourceCodeInfo* info) const { - std::pair<const FileDescriptorTables*, const SourceCodeInfo*> p( + const std::vector<int>& path, const SourceCodeInfo* info) const { + std::pair<const FileDescriptorTables*, const SourceCodeInfo*> p( std::make_pair(this, info)); internal::call_once(locations_by_path_once_, FileDescriptorTables::BuildLocationsByPath, &p); @@ -1554,7 +1554,7 @@ void DescriptorPool::FindAllExtensions( // (but do this only once per descriptor). if (fallback_database_ != nullptr && tables_->extensions_loaded_from_db_.count(extendee) == 0) { - std::vector<int> numbers; + std::vector<int> numbers; if (fallback_database_->FindAllExtensionNumbers(extendee->full_name(), &numbers)) { for (int number : numbers) { @@ -2262,7 +2262,7 @@ bool RetrieveOptionsAssumingRightPool( std::vector<TProtoStringType>* option_entries) { option_entries->clear(); const Reflection* reflection = options.GetReflection(); - std::vector<const FieldDescriptor*> fields; + std::vector<const FieldDescriptor*> fields; reflection->ListFields(options, &fields); for (const FieldDescriptor* field : fields) { int count = 1; @@ -2316,7 +2316,7 @@ bool RetrieveOptions(int depth, const Message& options, // descriptor.proto is not in the pool. This means no custom options are // used so we are safe to proceed with the compiled options message type. return RetrieveOptionsAssumingRightPool(depth, options, option_entries); - } + } DynamicMessageFactory factory; std::unique_ptr<Message> dynamic_options( factory.GetPrototype(option_descriptor)->New()); @@ -2328,9 +2328,9 @@ bool RetrieveOptions(int depth, const Message& options, << options.GetDescriptor()->full_name(); return RetrieveOptionsAssumingRightPool(depth, options, option_entries); } - } -} - + } +} + // Formats options that all appear together in brackets. Does not include // brackets. bool FormatBracketedOptions(int depth, const Message& options, @@ -2367,7 +2367,7 @@ class SourceLocationCommentPrinter { options.include_comments && desc->GetSourceLocation(&source_loc_); } SourceLocationCommentPrinter(const FileDescriptor* file, - const std::vector<int>& path, + const std::vector<int>& path, const TProtoStringType& prefix, const DebugStringOptions& options) : options_(options), prefix_(prefix) { @@ -2428,7 +2428,7 @@ TProtoStringType FileDescriptor::DebugStringWithOptions( const DebugStringOptions& debug_string_options) const { TProtoStringType contents; { - std::vector<int> path; + std::vector<int> path; path.push_back(FileDescriptorProto::kSyntaxFieldNumber); SourceLocationCommentPrinter syntax_comment(this, path, "", debug_string_options); @@ -2441,8 +2441,8 @@ TProtoStringType FileDescriptor::DebugStringWithOptions( SourceLocationCommentPrinter comment_printer(this, "", debug_string_options); comment_printer.AddPreComment(&contents); - std::set<int> public_dependencies; - std::set<int> weak_dependencies; + std::set<int> public_dependencies; + std::set<int> weak_dependencies; public_dependencies.insert(public_dependencies_, public_dependencies_ + public_dependency_count_); weak_dependencies.insert(weak_dependencies_, @@ -2462,7 +2462,7 @@ TProtoStringType FileDescriptor::DebugStringWithOptions( } if (!package().empty()) { - std::vector<int> path; + std::vector<int> path; path.push_back(FileDescriptorProto::kPackageFieldNumber); SourceLocationCommentPrinter package_comment(this, path, "", debug_string_options); @@ -2471,7 +2471,7 @@ TProtoStringType FileDescriptor::DebugStringWithOptions( package_comment.AddPostComment(&contents); } - if (FormatLineOptions(0, options(), pool(), &contents)) { + if (FormatLineOptions(0, options(), pool(), &contents)) { contents.append("\n"); // add some space if we had options } @@ -2482,7 +2482,7 @@ TProtoStringType FileDescriptor::DebugStringWithOptions( // Find all the 'group' type extensions; we will not output their nested // definitions (those will be done with their group field descriptor). - std::set<const Descriptor*> groups; + std::set<const Descriptor*> groups; for (int i = 0; i < extension_count(); i++) { if (extension(i)->type() == FieldDescriptor::TYPE_GROUP) { groups.insert(extension(i)->message_type()); @@ -2550,12 +2550,12 @@ void Descriptor::DebugString(int depth, TProtoStringType* contents, } contents->append(" {\n"); - FormatLineOptions(depth, options(), file()->pool(), contents); + FormatLineOptions(depth, options(), file()->pool(), contents); // Find all the 'group' types for fields and extensions; we will not output // their nested definitions (those will be done with their group field // descriptor). - std::set<const Descriptor*> groups; + std::set<const Descriptor*> groups; for (int i = 0; i < field_count(); i++) { if (field(i)->type() == FieldDescriptor::TYPE_GROUP) { groups.insert(field(i)->message_type()); @@ -2805,7 +2805,7 @@ void EnumDescriptor::DebugString( strings::SubstituteAndAppend(contents, "$0enum $1 {\n", prefix, name()); - FormatLineOptions(depth, options(), file()->pool(), contents); + FormatLineOptions(depth, options(), file()->pool(), contents); for (int i = 0; i < value_count(); i++) { value(i)->DebugString(depth, contents, debug_string_options); @@ -2895,7 +2895,7 @@ void ServiceDescriptor::DebugString( strings::SubstituteAndAppend(contents, "service $0 {\n", name()); - FormatLineOptions(1, options(), file()->pool(), contents); + FormatLineOptions(1, options(), file()->pool(), contents); for (int i = 0; i < method_count(); i++) { method(i)->DebugString(1, contents, debug_string_options); @@ -2948,7 +2948,7 @@ void MethodDescriptor::DebugString( // Location methods =============================================== -bool FileDescriptor::GetSourceLocation(const std::vector<int>& path, +bool FileDescriptor::GetSourceLocation(const std::vector<int>& path, SourceLocation* out_location) const { GOOGLE_CHECK(out_location != nullptr); if (source_code_info_) { @@ -2974,7 +2974,7 @@ bool FileDescriptor::GetSourceLocation(const std::vector<int>& path, } bool FileDescriptor::GetSourceLocation(SourceLocation* out_location) const { - std::vector<int> path; // empty path for root FileDescriptor + std::vector<int> path; // empty path for root FileDescriptor return GetSourceLocation(path, out_location); } @@ -2988,49 +2988,49 @@ bool FieldDescriptor::is_packed() const { } bool Descriptor::GetSourceLocation(SourceLocation* out_location) const { - std::vector<int> path; + std::vector<int> path; GetLocationPath(&path); return file()->GetSourceLocation(path, out_location); } bool FieldDescriptor::GetSourceLocation(SourceLocation* out_location) const { - std::vector<int> path; + std::vector<int> path; GetLocationPath(&path); return file()->GetSourceLocation(path, out_location); } bool OneofDescriptor::GetSourceLocation(SourceLocation* out_location) const { - std::vector<int> path; + std::vector<int> path; GetLocationPath(&path); return containing_type()->file()->GetSourceLocation(path, out_location); } bool EnumDescriptor::GetSourceLocation(SourceLocation* out_location) const { - std::vector<int> path; + std::vector<int> path; GetLocationPath(&path); return file()->GetSourceLocation(path, out_location); } bool MethodDescriptor::GetSourceLocation(SourceLocation* out_location) const { - std::vector<int> path; + std::vector<int> path; GetLocationPath(&path); return service()->file()->GetSourceLocation(path, out_location); } bool ServiceDescriptor::GetSourceLocation(SourceLocation* out_location) const { - std::vector<int> path; + std::vector<int> path; GetLocationPath(&path); return file()->GetSourceLocation(path, out_location); } bool EnumValueDescriptor::GetSourceLocation( SourceLocation* out_location) const { - std::vector<int> path; + std::vector<int> path; GetLocationPath(&path); return type()->file()->GetSourceLocation(path, out_location); } -void Descriptor::GetLocationPath(std::vector<int>* output) const { +void Descriptor::GetLocationPath(std::vector<int>* output) const { if (containing_type()) { containing_type()->GetLocationPath(output); output->push_back(DescriptorProto::kNestedTypeFieldNumber); @@ -3041,7 +3041,7 @@ void Descriptor::GetLocationPath(std::vector<int>* output) const { } } -void FieldDescriptor::GetLocationPath(std::vector<int>* output) const { +void FieldDescriptor::GetLocationPath(std::vector<int>* output) const { if (is_extension()) { if (extension_scope() == nullptr) { output->push_back(FileDescriptorProto::kExtensionFieldNumber); @@ -3058,13 +3058,13 @@ void FieldDescriptor::GetLocationPath(std::vector<int>* output) const { } } -void OneofDescriptor::GetLocationPath(std::vector<int>* output) const { +void OneofDescriptor::GetLocationPath(std::vector<int>* output) const { containing_type()->GetLocationPath(output); output->push_back(DescriptorProto::kOneofDeclFieldNumber); output->push_back(index()); } -void EnumDescriptor::GetLocationPath(std::vector<int>* output) const { +void EnumDescriptor::GetLocationPath(std::vector<int>* output) const { if (containing_type()) { containing_type()->GetLocationPath(output); output->push_back(DescriptorProto::kEnumTypeFieldNumber); @@ -3075,18 +3075,18 @@ void EnumDescriptor::GetLocationPath(std::vector<int>* output) const { } } -void EnumValueDescriptor::GetLocationPath(std::vector<int>* output) const { +void EnumValueDescriptor::GetLocationPath(std::vector<int>* output) const { type()->GetLocationPath(output); output->push_back(EnumDescriptorProto::kValueFieldNumber); output->push_back(index()); } -void ServiceDescriptor::GetLocationPath(std::vector<int>* output) const { +void ServiceDescriptor::GetLocationPath(std::vector<int>* output) const { output->push_back(FileDescriptorProto::kServiceFieldNumber); output->push_back(index()); } -void MethodDescriptor::GetLocationPath(std::vector<int>* output) const { +void MethodDescriptor::GetLocationPath(std::vector<int>* output) const { service()->GetLocationPath(output); output->push_back(ServiceDescriptorProto::kMethodFieldNumber); output->push_back(index()); @@ -3140,17 +3140,17 @@ class DescriptorBuilder { // As we build descriptors we store copies of the options messages in // them. We put pointers to those copies in this vector, as we build, so we // can later (after cross-linking) interpret those options. - std::vector<OptionsToInterpret> options_to_interpret_; + std::vector<OptionsToInterpret> options_to_interpret_; bool had_errors_; TProtoStringType filename_; FileDescriptor* file_; FileDescriptorTables* file_tables_; - std::set<const FileDescriptor*> dependencies_; + std::set<const FileDescriptor*> dependencies_; // unused_dependency_ is used to record the unused imported files. // Note: public import is not considered. - std::set<const FileDescriptor*> unused_dependency_; + std::set<const FileDescriptor*> unused_dependency_; // If LookupSymbol() finds a symbol that is in a file which is not a declared // dependency of this file, it will fail, but will set @@ -4408,7 +4408,7 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( result->dependencies_names_ = nullptr; } unused_dependency_.clear(); - std::set<int> weak_deps; + std::set<int> weak_deps; for (int i = 0; i < proto.weak_dependency_size(); ++i) { weak_deps.insert(proto.weak_dependency(i)); } @@ -4528,7 +4528,7 @@ FileDescriptor* DescriptorBuilder::BuildFileImpl( // extension options known, so all interpretations should now succeed. if (!had_errors_) { OptionInterpreter option_interpreter(this); - for (std::vector<OptionsToInterpret>::iterator iter = + for (std::vector<OptionsToInterpret>::iterator iter = options_to_interpret_.begin(); iter != options_to_interpret_.end(); ++iter) { option_interpreter.InterpretOptions(&(*iter)); @@ -6515,7 +6515,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption( // name in |debug_msg_name|, for use in error messages. const Descriptor* descriptor = options_descriptor; const FieldDescriptor* field = nullptr; - std::vector<const FieldDescriptor*> intermediate_fields; + std::vector<const FieldDescriptor*> intermediate_fields; TProtoStringType debug_msg_name = ""; std::vector<int> dest_path = options_path; @@ -6633,7 +6633,7 @@ bool DescriptorBuilder::OptionInterpreter::InterpretSingleOption( // Now wrap the UnknownFieldSet with UnknownFieldSets corresponding to all // the intermediate messages. - for (std::vector<const FieldDescriptor*>::reverse_iterator iter = + for (std::vector<const FieldDescriptor*>::reverse_iterator iter = intermediate_fields.rbegin(); iter != intermediate_fields.rend(); ++iter) { std::unique_ptr<UnknownFieldSet> parent_unknown_fields( @@ -6786,7 +6786,7 @@ void DescriptorBuilder::OptionInterpreter::AddWithoutInterpreting( bool DescriptorBuilder::OptionInterpreter::ExamineIfOptionIsSet( std::vector<const FieldDescriptor*>::const_iterator intermediate_fields_iter, - std::vector<const FieldDescriptor*>::const_iterator intermediate_fields_end, + std::vector<const FieldDescriptor*>::const_iterator intermediate_fields_end, const FieldDescriptor* innermost_field, const TProtoStringType& debug_msg_name, const UnknownFieldSet& unknown_fields) { // We do linear searches of the UnknownFieldSet and its sub-groups. This diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h index 16484d7e83..0df49109cd 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor.pb.h @@ -625,14 +625,14 @@ class PROTOBUF_EXPORT FileDescriptorProto final : int _internal_dependency_size() const; public: void clear_dependency(); - const TProtoStringType& dependency(int index) const; - TProtoStringType* mutable_dependency(int index); - void set_dependency(int index, const TProtoStringType& value); + const TProtoStringType& dependency(int index) const; + TProtoStringType* mutable_dependency(int index); + void set_dependency(int index, const TProtoStringType& value); void set_dependency(int index, TProtoStringType&& value); void set_dependency(int index, const char* value); void set_dependency(int index, const char* value, size_t size); - TProtoStringType* add_dependency(); - void add_dependency(const TProtoStringType& value); + TProtoStringType* add_dependency(); + void add_dependency(const TProtoStringType& value); void add_dependency(TProtoStringType&& value); void add_dependency(const char* value); void add_dependency(const char* value, size_t size); @@ -1494,14 +1494,14 @@ class PROTOBUF_EXPORT DescriptorProto final : int _internal_reserved_name_size() const; public: void clear_reserved_name(); - const TProtoStringType& reserved_name(int index) const; - TProtoStringType* mutable_reserved_name(int index); - void set_reserved_name(int index, const TProtoStringType& value); + const TProtoStringType& reserved_name(int index) const; + TProtoStringType* mutable_reserved_name(int index); + void set_reserved_name(int index, const TProtoStringType& value); void set_reserved_name(int index, TProtoStringType&& value); void set_reserved_name(int index, const char* value); void set_reserved_name(int index, const char* value, size_t size); - TProtoStringType* add_reserved_name(); - void add_reserved_name(const TProtoStringType& value); + TProtoStringType* add_reserved_name(); + void add_reserved_name(const TProtoStringType& value); void add_reserved_name(TProtoStringType&& value); void add_reserved_name(const char* value); void add_reserved_name(const char* value, size_t size); @@ -1963,12 +1963,12 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : bool _internal_has_name() const; public: void clear_name(); - const TProtoStringType& name() const; + const TProtoStringType& name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_name(); + TProtoStringType* mutable_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); - void set_allocated_name(TProtoStringType* name); + void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const TProtoStringType& value); @@ -1999,12 +1999,12 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : bool _internal_has_type_name() const; public: void clear_type_name(); - const TProtoStringType& type_name() const; + const TProtoStringType& type_name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_type_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_type_name(); + TProtoStringType* mutable_type_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_type_name(); - void set_allocated_type_name(TProtoStringType* type_name); + void set_allocated_type_name(TProtoStringType* type_name); private: const TProtoStringType& _internal_type_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_type_name(const TProtoStringType& value); @@ -2017,12 +2017,12 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : bool _internal_has_default_value() const; public: void clear_default_value(); - const TProtoStringType& default_value() const; + const TProtoStringType& default_value() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_default_value(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_default_value(); + TProtoStringType* mutable_default_value(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_default_value(); - void set_allocated_default_value(TProtoStringType* default_value); + void set_allocated_default_value(TProtoStringType* default_value); private: const TProtoStringType& _internal_default_value() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_default_value(const TProtoStringType& value); @@ -2035,12 +2035,12 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : bool _internal_has_json_name() const; public: void clear_json_name(); - const TProtoStringType& json_name() const; + const TProtoStringType& json_name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_json_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_json_name(); + TProtoStringType* mutable_json_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_json_name(); - void set_allocated_json_name(TProtoStringType* json_name); + void set_allocated_json_name(TProtoStringType* json_name); private: const TProtoStringType& _internal_json_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_json_name(const TProtoStringType& value); @@ -2285,12 +2285,12 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : bool _internal_has_name() const; public: void clear_name(); - const TProtoStringType& name() const; + const TProtoStringType& name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_name(); + TProtoStringType* mutable_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); - void set_allocated_name(TProtoStringType* name); + void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const TProtoStringType& value); @@ -2692,12 +2692,12 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : bool _internal_has_name() const; public: void clear_name(); - const TProtoStringType& name() const; + const TProtoStringType& name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_name(); + TProtoStringType* mutable_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); - void set_allocated_name(TProtoStringType* name); + void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const TProtoStringType& value); @@ -2872,12 +2872,12 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : bool _internal_has_name() const; public: void clear_name(); - const TProtoStringType& name() const; + const TProtoStringType& name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_name(); + TProtoStringType* mutable_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); - void set_allocated_name(TProtoStringType* name); + void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const TProtoStringType& value); @@ -3081,12 +3081,12 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : bool _internal_has_name() const; public: void clear_name(); - const TProtoStringType& name() const; + const TProtoStringType& name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_name(); + TProtoStringType* mutable_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); - void set_allocated_name(TProtoStringType* name); + void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const TProtoStringType& value); @@ -3262,12 +3262,12 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : bool _internal_has_name() const; public: void clear_name(); - const TProtoStringType& name() const; + const TProtoStringType& name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_name(); + TProtoStringType* mutable_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); - void set_allocated_name(TProtoStringType* name); + void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const TProtoStringType& value); @@ -3280,12 +3280,12 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : bool _internal_has_input_type() const; public: void clear_input_type(); - const TProtoStringType& input_type() const; + const TProtoStringType& input_type() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_input_type(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_input_type(); + TProtoStringType* mutable_input_type(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_input_type(); - void set_allocated_input_type(TProtoStringType* input_type); + void set_allocated_input_type(TProtoStringType* input_type); private: const TProtoStringType& _internal_input_type() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_input_type(const TProtoStringType& value); @@ -3298,12 +3298,12 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : bool _internal_has_output_type() const; public: void clear_output_type(); - const TProtoStringType& output_type() const; + const TProtoStringType& output_type() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_output_type(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_output_type(); + TProtoStringType* mutable_output_type(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_output_type(); - void set_allocated_output_type(TProtoStringType* output_type); + void set_allocated_output_type(TProtoStringType* output_type); private: const TProtoStringType& _internal_output_type() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_output_type(const TProtoStringType& value); @@ -3573,12 +3573,12 @@ class PROTOBUF_EXPORT FileOptions final : bool _internal_has_java_package() const; public: void clear_java_package(); - const TProtoStringType& java_package() const; + const TProtoStringType& java_package() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_java_package(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_java_package(); + TProtoStringType* mutable_java_package(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_java_package(); - void set_allocated_java_package(TProtoStringType* java_package); + void set_allocated_java_package(TProtoStringType* java_package); private: const TProtoStringType& _internal_java_package() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_java_package(const TProtoStringType& value); @@ -3591,12 +3591,12 @@ class PROTOBUF_EXPORT FileOptions final : bool _internal_has_java_outer_classname() const; public: void clear_java_outer_classname(); - const TProtoStringType& java_outer_classname() const; + const TProtoStringType& java_outer_classname() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_java_outer_classname(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_java_outer_classname(); + TProtoStringType* mutable_java_outer_classname(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_java_outer_classname(); - void set_allocated_java_outer_classname(TProtoStringType* java_outer_classname); + void set_allocated_java_outer_classname(TProtoStringType* java_outer_classname); private: const TProtoStringType& _internal_java_outer_classname() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_java_outer_classname(const TProtoStringType& value); @@ -5493,12 +5493,12 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : bool _internal_has_name_part() const; public: void clear_name_part(); - const TProtoStringType& name_part() const; + const TProtoStringType& name_part() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name_part(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_name_part(); + TProtoStringType* mutable_name_part(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name_part(); - void set_allocated_name_part(TProtoStringType* name_part); + void set_allocated_name_part(TProtoStringType* name_part); private: const TProtoStringType& _internal_name_part() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name_part(const TProtoStringType& value); @@ -5692,12 +5692,12 @@ class PROTOBUF_EXPORT UninterpretedOption final : bool _internal_has_identifier_value() const; public: void clear_identifier_value(); - const TProtoStringType& identifier_value() const; + const TProtoStringType& identifier_value() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_identifier_value(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_identifier_value(); + TProtoStringType* mutable_identifier_value(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_identifier_value(); - void set_allocated_identifier_value(TProtoStringType* identifier_value); + void set_allocated_identifier_value(TProtoStringType* identifier_value); private: const TProtoStringType& _internal_identifier_value() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_identifier_value(const TProtoStringType& value); @@ -5710,12 +5710,12 @@ class PROTOBUF_EXPORT UninterpretedOption final : bool _internal_has_string_value() const; public: void clear_string_value(); - const TProtoStringType& string_value() const; + const TProtoStringType& string_value() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_string_value(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_string_value(); + TProtoStringType* mutable_string_value(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_string_value(); - void set_allocated_string_value(TProtoStringType* string_value); + void set_allocated_string_value(TProtoStringType* string_value); private: const TProtoStringType& _internal_string_value() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_string_value(const TProtoStringType& value); @@ -5728,12 +5728,12 @@ class PROTOBUF_EXPORT UninterpretedOption final : bool _internal_has_aggregate_value() const; public: void clear_aggregate_value(); - const TProtoStringType& aggregate_value() const; + const TProtoStringType& aggregate_value() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_aggregate_value(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_aggregate_value(); + TProtoStringType* mutable_aggregate_value(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_aggregate_value(); - void set_allocated_aggregate_value(TProtoStringType* aggregate_value); + void set_allocated_aggregate_value(TProtoStringType* aggregate_value); private: const TProtoStringType& _internal_aggregate_value() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_aggregate_value(const TProtoStringType& value); @@ -6001,12 +6001,12 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : bool _internal_has_leading_comments() const; public: void clear_leading_comments(); - const TProtoStringType& leading_comments() const; + const TProtoStringType& leading_comments() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_leading_comments(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_leading_comments(); + TProtoStringType* mutable_leading_comments(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_leading_comments(); - void set_allocated_leading_comments(TProtoStringType* leading_comments); + void set_allocated_leading_comments(TProtoStringType* leading_comments); private: const TProtoStringType& _internal_leading_comments() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_leading_comments(const TProtoStringType& value); @@ -6019,12 +6019,12 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : bool _internal_has_trailing_comments() const; public: void clear_trailing_comments(); - const TProtoStringType& trailing_comments() const; + const TProtoStringType& trailing_comments() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_trailing_comments(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_trailing_comments(); + TProtoStringType* mutable_trailing_comments(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_trailing_comments(); - void set_allocated_trailing_comments(TProtoStringType* trailing_comments); + void set_allocated_trailing_comments(TProtoStringType* trailing_comments); private: const TProtoStringType& _internal_trailing_comments() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_trailing_comments(const TProtoStringType& value); @@ -6363,12 +6363,12 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : bool _internal_has_source_file() const; public: void clear_source_file(); - const TProtoStringType& source_file() const; + const TProtoStringType& source_file() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_source_file(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_source_file(); + TProtoStringType* mutable_source_file(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_source_file(); - void set_allocated_source_file(TProtoStringType* source_file); + void set_allocated_source_file(TProtoStringType* source_file); private: const TProtoStringType& _internal_source_file() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_source_file(const TProtoStringType& value); @@ -6641,7 +6641,7 @@ inline void FileDescriptorProto::clear_name() { name_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& FileDescriptorProto::name() const { +inline const TProtoStringType& FileDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.name) return _internal_name(); } @@ -6668,7 +6668,7 @@ inline TProtoStringType* FileDescriptorProto::_internal_mutable_name() { _has_bits_[0] |= 0x00000001u; return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* FileDescriptorProto::release_name() { +inline TProtoStringType* FileDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.name) if (!_internal_has_name()) { return nullptr; @@ -6676,7 +6676,7 @@ inline TProtoStringType* FileDescriptorProto::release_name() { _has_bits_[0] &= ~0x00000001u; return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void FileDescriptorProto::set_allocated_name(TProtoStringType* name) { +inline void FileDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -6699,7 +6699,7 @@ inline void FileDescriptorProto::clear_package() { package_.ClearToEmpty(); _has_bits_[0] &= ~0x00000002u; } -inline const TProtoStringType& FileDescriptorProto::package() const { +inline const TProtoStringType& FileDescriptorProto::package() const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.package) return _internal_package(); } @@ -6726,7 +6726,7 @@ inline TProtoStringType* FileDescriptorProto::_internal_mutable_package() { _has_bits_[0] |= 0x00000002u; return package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* FileDescriptorProto::release_package() { +inline TProtoStringType* FileDescriptorProto::release_package() { // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.package) if (!_internal_has_package()) { return nullptr; @@ -6734,7 +6734,7 @@ inline TProtoStringType* FileDescriptorProto::release_package() { _has_bits_[0] &= ~0x00000002u; return package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void FileDescriptorProto::set_allocated_package(TProtoStringType* package) { +inline void FileDescriptorProto::set_allocated_package(TProtoStringType* package) { if (package != nullptr) { _has_bits_[0] |= 0x00000002u; } else { @@ -6763,15 +6763,15 @@ inline TProtoStringType* FileDescriptorProto::add_dependency() { inline const TProtoStringType& FileDescriptorProto::_internal_dependency(int index) const { return dependency_.Get(index); } -inline const TProtoStringType& FileDescriptorProto::dependency(int index) const { +inline const TProtoStringType& FileDescriptorProto::dependency(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.dependency) return _internal_dependency(index); } -inline TProtoStringType* FileDescriptorProto::mutable_dependency(int index) { +inline TProtoStringType* FileDescriptorProto::mutable_dependency(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.FileDescriptorProto.dependency) return dependency_.Mutable(index); } -inline void FileDescriptorProto::set_dependency(int index, const TProtoStringType& value) { +inline void FileDescriptorProto::set_dependency(int index, const TProtoStringType& value) { dependency_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.dependency) } @@ -6792,7 +6792,7 @@ inline void FileDescriptorProto::set_dependency(int index, const char* value, si inline TProtoStringType* FileDescriptorProto::_internal_add_dependency() { return dependency_.Add(); } -inline void FileDescriptorProto::add_dependency(const TProtoStringType& value) { +inline void FileDescriptorProto::add_dependency(const TProtoStringType& value) { dependency_.Add()->assign(value); // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.dependency) } @@ -7266,7 +7266,7 @@ inline void FileDescriptorProto::clear_syntax() { syntax_.ClearToEmpty(); _has_bits_[0] &= ~0x00000004u; } -inline const TProtoStringType& FileDescriptorProto::syntax() const { +inline const TProtoStringType& FileDescriptorProto::syntax() const { // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.syntax) return _internal_syntax(); } @@ -7293,7 +7293,7 @@ inline TProtoStringType* FileDescriptorProto::_internal_mutable_syntax() { _has_bits_[0] |= 0x00000004u; return syntax_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* FileDescriptorProto::release_syntax() { +inline TProtoStringType* FileDescriptorProto::release_syntax() { // @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.syntax) if (!_internal_has_syntax()) { return nullptr; @@ -7301,7 +7301,7 @@ inline TProtoStringType* FileDescriptorProto::release_syntax() { _has_bits_[0] &= ~0x00000004u; return syntax_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void FileDescriptorProto::set_allocated_syntax(TProtoStringType* syntax) { +inline void FileDescriptorProto::set_allocated_syntax(TProtoStringType* syntax) { if (syntax != nullptr) { _has_bits_[0] |= 0x00000004u; } else { @@ -7538,7 +7538,7 @@ inline void DescriptorProto::clear_name() { name_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& DescriptorProto::name() const { +inline const TProtoStringType& DescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.name) return _internal_name(); } @@ -7565,7 +7565,7 @@ inline TProtoStringType* DescriptorProto::_internal_mutable_name() { _has_bits_[0] |= 0x00000001u; return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* DescriptorProto::release_name() { +inline TProtoStringType* DescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.name) if (!_internal_has_name()) { return nullptr; @@ -7573,7 +7573,7 @@ inline TProtoStringType* DescriptorProto::release_name() { _has_bits_[0] &= ~0x00000001u; return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void DescriptorProto::set_allocated_name(TProtoStringType* name) { +inline void DescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -7972,15 +7972,15 @@ inline TProtoStringType* DescriptorProto::add_reserved_name() { inline const TProtoStringType& DescriptorProto::_internal_reserved_name(int index) const { return reserved_name_.Get(index); } -inline const TProtoStringType& DescriptorProto::reserved_name(int index) const { +inline const TProtoStringType& DescriptorProto::reserved_name(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.reserved_name) return _internal_reserved_name(index); } -inline TProtoStringType* DescriptorProto::mutable_reserved_name(int index) { +inline TProtoStringType* DescriptorProto::mutable_reserved_name(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.DescriptorProto.reserved_name) return reserved_name_.Mutable(index); } -inline void DescriptorProto::set_reserved_name(int index, const TProtoStringType& value) { +inline void DescriptorProto::set_reserved_name(int index, const TProtoStringType& value) { reserved_name_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.reserved_name) } @@ -8001,7 +8001,7 @@ inline void DescriptorProto::set_reserved_name(int index, const char* value, siz inline TProtoStringType* DescriptorProto::_internal_add_reserved_name() { return reserved_name_.Add(); } -inline void DescriptorProto::add_reserved_name(const TProtoStringType& value) { +inline void DescriptorProto::add_reserved_name(const TProtoStringType& value) { reserved_name_.Add()->assign(value); // @@protoc_insertion_point(field_add:google.protobuf.DescriptorProto.reserved_name) } @@ -8089,7 +8089,7 @@ inline void FieldDescriptorProto::clear_name() { name_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& FieldDescriptorProto::name() const { +inline const TProtoStringType& FieldDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.name) return _internal_name(); } @@ -8116,7 +8116,7 @@ inline TProtoStringType* FieldDescriptorProto::_internal_mutable_name() { _has_bits_[0] |= 0x00000001u; return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* FieldDescriptorProto::release_name() { +inline TProtoStringType* FieldDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.name) if (!_internal_has_name()) { return nullptr; @@ -8124,7 +8124,7 @@ inline TProtoStringType* FieldDescriptorProto::release_name() { _has_bits_[0] &= ~0x00000001u; return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void FieldDescriptorProto::set_allocated_name(TProtoStringType* name) { +inline void FieldDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -8233,7 +8233,7 @@ inline void FieldDescriptorProto::clear_type_name() { type_name_.ClearToEmpty(); _has_bits_[0] &= ~0x00000004u; } -inline const TProtoStringType& FieldDescriptorProto::type_name() const { +inline const TProtoStringType& FieldDescriptorProto::type_name() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.type_name) return _internal_type_name(); } @@ -8260,7 +8260,7 @@ inline TProtoStringType* FieldDescriptorProto::_internal_mutable_type_name() { _has_bits_[0] |= 0x00000004u; return type_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* FieldDescriptorProto::release_type_name() { +inline TProtoStringType* FieldDescriptorProto::release_type_name() { // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.type_name) if (!_internal_has_type_name()) { return nullptr; @@ -8268,7 +8268,7 @@ inline TProtoStringType* FieldDescriptorProto::release_type_name() { _has_bits_[0] &= ~0x00000004u; return type_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void FieldDescriptorProto::set_allocated_type_name(TProtoStringType* type_name) { +inline void FieldDescriptorProto::set_allocated_type_name(TProtoStringType* type_name) { if (type_name != nullptr) { _has_bits_[0] |= 0x00000004u; } else { @@ -8291,7 +8291,7 @@ inline void FieldDescriptorProto::clear_extendee() { extendee_.ClearToEmpty(); _has_bits_[0] &= ~0x00000002u; } -inline const TProtoStringType& FieldDescriptorProto::extendee() const { +inline const TProtoStringType& FieldDescriptorProto::extendee() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.extendee) return _internal_extendee(); } @@ -8318,7 +8318,7 @@ inline TProtoStringType* FieldDescriptorProto::_internal_mutable_extendee() { _has_bits_[0] |= 0x00000002u; return extendee_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* FieldDescriptorProto::release_extendee() { +inline TProtoStringType* FieldDescriptorProto::release_extendee() { // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.extendee) if (!_internal_has_extendee()) { return nullptr; @@ -8326,7 +8326,7 @@ inline TProtoStringType* FieldDescriptorProto::release_extendee() { _has_bits_[0] &= ~0x00000002u; return extendee_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void FieldDescriptorProto::set_allocated_extendee(TProtoStringType* extendee) { +inline void FieldDescriptorProto::set_allocated_extendee(TProtoStringType* extendee) { if (extendee != nullptr) { _has_bits_[0] |= 0x00000002u; } else { @@ -8349,7 +8349,7 @@ inline void FieldDescriptorProto::clear_default_value() { default_value_.ClearToEmpty(); _has_bits_[0] &= ~0x00000008u; } -inline const TProtoStringType& FieldDescriptorProto::default_value() const { +inline const TProtoStringType& FieldDescriptorProto::default_value() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.default_value) return _internal_default_value(); } @@ -8376,7 +8376,7 @@ inline TProtoStringType* FieldDescriptorProto::_internal_mutable_default_value() _has_bits_[0] |= 0x00000008u; return default_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* FieldDescriptorProto::release_default_value() { +inline TProtoStringType* FieldDescriptorProto::release_default_value() { // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.default_value) if (!_internal_has_default_value()) { return nullptr; @@ -8384,7 +8384,7 @@ inline TProtoStringType* FieldDescriptorProto::release_default_value() { _has_bits_[0] &= ~0x00000008u; return default_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void FieldDescriptorProto::set_allocated_default_value(TProtoStringType* default_value) { +inline void FieldDescriptorProto::set_allocated_default_value(TProtoStringType* default_value) { if (default_value != nullptr) { _has_bits_[0] |= 0x00000008u; } else { @@ -8435,7 +8435,7 @@ inline void FieldDescriptorProto::clear_json_name() { json_name_.ClearToEmpty(); _has_bits_[0] &= ~0x00000010u; } -inline const TProtoStringType& FieldDescriptorProto::json_name() const { +inline const TProtoStringType& FieldDescriptorProto::json_name() const { // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.json_name) return _internal_json_name(); } @@ -8462,7 +8462,7 @@ inline TProtoStringType* FieldDescriptorProto::_internal_mutable_json_name() { _has_bits_[0] |= 0x00000010u; return json_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* FieldDescriptorProto::release_json_name() { +inline TProtoStringType* FieldDescriptorProto::release_json_name() { // @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.json_name) if (!_internal_has_json_name()) { return nullptr; @@ -8470,7 +8470,7 @@ inline TProtoStringType* FieldDescriptorProto::release_json_name() { _has_bits_[0] &= ~0x00000010u; return json_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void FieldDescriptorProto::set_allocated_json_name(TProtoStringType* json_name) { +inline void FieldDescriptorProto::set_allocated_json_name(TProtoStringType* json_name) { if (json_name != nullptr) { _has_bits_[0] |= 0x00000010u; } else { @@ -8615,7 +8615,7 @@ inline void OneofDescriptorProto::clear_name() { name_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& OneofDescriptorProto::name() const { +inline const TProtoStringType& OneofDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.OneofDescriptorProto.name) return _internal_name(); } @@ -8642,7 +8642,7 @@ inline TProtoStringType* OneofDescriptorProto::_internal_mutable_name() { _has_bits_[0] |= 0x00000001u; return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* OneofDescriptorProto::release_name() { +inline TProtoStringType* OneofDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.name) if (!_internal_has_name()) { return nullptr; @@ -8650,7 +8650,7 @@ inline TProtoStringType* OneofDescriptorProto::release_name() { _has_bits_[0] &= ~0x00000001u; return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void OneofDescriptorProto::set_allocated_name(TProtoStringType* name) { +inline void OneofDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -8827,7 +8827,7 @@ inline void EnumDescriptorProto::clear_name() { name_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& EnumDescriptorProto::name() const { +inline const TProtoStringType& EnumDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.name) return _internal_name(); } @@ -8854,7 +8854,7 @@ inline TProtoStringType* EnumDescriptorProto::_internal_mutable_name() { _has_bits_[0] |= 0x00000001u; return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* EnumDescriptorProto::release_name() { +inline TProtoStringType* EnumDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.name) if (!_internal_has_name()) { return nullptr; @@ -8862,7 +8862,7 @@ inline TProtoStringType* EnumDescriptorProto::release_name() { _has_bits_[0] &= ~0x00000001u; return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void EnumDescriptorProto::set_allocated_name(TProtoStringType* name) { +inline void EnumDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -9134,7 +9134,7 @@ inline void EnumValueDescriptorProto::clear_name() { name_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& EnumValueDescriptorProto::name() const { +inline const TProtoStringType& EnumValueDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.name) return _internal_name(); } @@ -9161,7 +9161,7 @@ inline TProtoStringType* EnumValueDescriptorProto::_internal_mutable_name() { _has_bits_[0] |= 0x00000001u; return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* EnumValueDescriptorProto::release_name() { +inline TProtoStringType* EnumValueDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.name) if (!_internal_has_name()) { return nullptr; @@ -9169,7 +9169,7 @@ inline TProtoStringType* EnumValueDescriptorProto::release_name() { _has_bits_[0] &= ~0x00000001u; return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void EnumValueDescriptorProto::set_allocated_name(TProtoStringType* name) { +inline void EnumValueDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -9314,7 +9314,7 @@ inline void ServiceDescriptorProto::clear_name() { name_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& ServiceDescriptorProto::name() const { +inline const TProtoStringType& ServiceDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.ServiceDescriptorProto.name) return _internal_name(); } @@ -9341,7 +9341,7 @@ inline TProtoStringType* ServiceDescriptorProto::_internal_mutable_name() { _has_bits_[0] |= 0x00000001u; return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* ServiceDescriptorProto::release_name() { +inline TProtoStringType* ServiceDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.name) if (!_internal_has_name()) { return nullptr; @@ -9349,7 +9349,7 @@ inline TProtoStringType* ServiceDescriptorProto::release_name() { _has_bits_[0] &= ~0x00000001u; return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void ServiceDescriptorProto::set_allocated_name(TProtoStringType* name) { +inline void ServiceDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -9506,7 +9506,7 @@ inline void MethodDescriptorProto::clear_name() { name_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& MethodDescriptorProto::name() const { +inline const TProtoStringType& MethodDescriptorProto::name() const { // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.name) return _internal_name(); } @@ -9533,7 +9533,7 @@ inline TProtoStringType* MethodDescriptorProto::_internal_mutable_name() { _has_bits_[0] |= 0x00000001u; return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* MethodDescriptorProto::release_name() { +inline TProtoStringType* MethodDescriptorProto::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.name) if (!_internal_has_name()) { return nullptr; @@ -9541,7 +9541,7 @@ inline TProtoStringType* MethodDescriptorProto::release_name() { _has_bits_[0] &= ~0x00000001u; return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void MethodDescriptorProto::set_allocated_name(TProtoStringType* name) { +inline void MethodDescriptorProto::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -9564,7 +9564,7 @@ inline void MethodDescriptorProto::clear_input_type() { input_type_.ClearToEmpty(); _has_bits_[0] &= ~0x00000002u; } -inline const TProtoStringType& MethodDescriptorProto::input_type() const { +inline const TProtoStringType& MethodDescriptorProto::input_type() const { // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.input_type) return _internal_input_type(); } @@ -9591,7 +9591,7 @@ inline TProtoStringType* MethodDescriptorProto::_internal_mutable_input_type() { _has_bits_[0] |= 0x00000002u; return input_type_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* MethodDescriptorProto::release_input_type() { +inline TProtoStringType* MethodDescriptorProto::release_input_type() { // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.input_type) if (!_internal_has_input_type()) { return nullptr; @@ -9599,7 +9599,7 @@ inline TProtoStringType* MethodDescriptorProto::release_input_type() { _has_bits_[0] &= ~0x00000002u; return input_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void MethodDescriptorProto::set_allocated_input_type(TProtoStringType* input_type) { +inline void MethodDescriptorProto::set_allocated_input_type(TProtoStringType* input_type) { if (input_type != nullptr) { _has_bits_[0] |= 0x00000002u; } else { @@ -9622,7 +9622,7 @@ inline void MethodDescriptorProto::clear_output_type() { output_type_.ClearToEmpty(); _has_bits_[0] &= ~0x00000004u; } -inline const TProtoStringType& MethodDescriptorProto::output_type() const { +inline const TProtoStringType& MethodDescriptorProto::output_type() const { // @@protoc_insertion_point(field_get:google.protobuf.MethodDescriptorProto.output_type) return _internal_output_type(); } @@ -9649,7 +9649,7 @@ inline TProtoStringType* MethodDescriptorProto::_internal_mutable_output_type() _has_bits_[0] |= 0x00000004u; return output_type_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* MethodDescriptorProto::release_output_type() { +inline TProtoStringType* MethodDescriptorProto::release_output_type() { // @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.output_type) if (!_internal_has_output_type()) { return nullptr; @@ -9657,7 +9657,7 @@ inline TProtoStringType* MethodDescriptorProto::release_output_type() { _has_bits_[0] &= ~0x00000004u; return output_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void MethodDescriptorProto::set_allocated_output_type(TProtoStringType* output_type) { +inline void MethodDescriptorProto::set_allocated_output_type(TProtoStringType* output_type) { if (output_type != nullptr) { _has_bits_[0] |= 0x00000004u; } else { @@ -9830,7 +9830,7 @@ inline void FileOptions::clear_java_package() { java_package_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& FileOptions::java_package() const { +inline const TProtoStringType& FileOptions::java_package() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_package) return _internal_java_package(); } @@ -9857,7 +9857,7 @@ inline TProtoStringType* FileOptions::_internal_mutable_java_package() { _has_bits_[0] |= 0x00000001u; return java_package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* FileOptions::release_java_package() { +inline TProtoStringType* FileOptions::release_java_package() { // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_package) if (!_internal_has_java_package()) { return nullptr; @@ -9865,7 +9865,7 @@ inline TProtoStringType* FileOptions::release_java_package() { _has_bits_[0] &= ~0x00000001u; return java_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void FileOptions::set_allocated_java_package(TProtoStringType* java_package) { +inline void FileOptions::set_allocated_java_package(TProtoStringType* java_package) { if (java_package != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -9888,7 +9888,7 @@ inline void FileOptions::clear_java_outer_classname() { java_outer_classname_.ClearToEmpty(); _has_bits_[0] &= ~0x00000002u; } -inline const TProtoStringType& FileOptions::java_outer_classname() const { +inline const TProtoStringType& FileOptions::java_outer_classname() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.java_outer_classname) return _internal_java_outer_classname(); } @@ -9915,7 +9915,7 @@ inline TProtoStringType* FileOptions::_internal_mutable_java_outer_classname() { _has_bits_[0] |= 0x00000002u; return java_outer_classname_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* FileOptions::release_java_outer_classname() { +inline TProtoStringType* FileOptions::release_java_outer_classname() { // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_outer_classname) if (!_internal_has_java_outer_classname()) { return nullptr; @@ -9923,7 +9923,7 @@ inline TProtoStringType* FileOptions::release_java_outer_classname() { _has_bits_[0] &= ~0x00000002u; return java_outer_classname_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void FileOptions::set_allocated_java_outer_classname(TProtoStringType* java_outer_classname) { +inline void FileOptions::set_allocated_java_outer_classname(TProtoStringType* java_outer_classname) { if (java_outer_classname != nullptr) { _has_bits_[0] |= 0x00000002u; } else { @@ -10059,7 +10059,7 @@ inline void FileOptions::clear_go_package() { go_package_.ClearToEmpty(); _has_bits_[0] &= ~0x00000004u; } -inline const TProtoStringType& FileOptions::go_package() const { +inline const TProtoStringType& FileOptions::go_package() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.go_package) return _internal_go_package(); } @@ -10086,7 +10086,7 @@ inline TProtoStringType* FileOptions::_internal_mutable_go_package() { _has_bits_[0] |= 0x00000004u; return go_package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* FileOptions::release_go_package() { +inline TProtoStringType* FileOptions::release_go_package() { // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.go_package) if (!_internal_has_go_package()) { return nullptr; @@ -10094,7 +10094,7 @@ inline TProtoStringType* FileOptions::release_go_package() { _has_bits_[0] &= ~0x00000004u; return go_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void FileOptions::set_allocated_go_package(TProtoStringType* go_package) { +inline void FileOptions::set_allocated_go_package(TProtoStringType* go_package) { if (go_package != nullptr) { _has_bits_[0] |= 0x00000004u; } else { @@ -10285,7 +10285,7 @@ inline void FileOptions::clear_objc_class_prefix() { objc_class_prefix_.ClearToEmpty(); _has_bits_[0] &= ~0x00000008u; } -inline const TProtoStringType& FileOptions::objc_class_prefix() const { +inline const TProtoStringType& FileOptions::objc_class_prefix() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.objc_class_prefix) return _internal_objc_class_prefix(); } @@ -10312,7 +10312,7 @@ inline TProtoStringType* FileOptions::_internal_mutable_objc_class_prefix() { _has_bits_[0] |= 0x00000008u; return objc_class_prefix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* FileOptions::release_objc_class_prefix() { +inline TProtoStringType* FileOptions::release_objc_class_prefix() { // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.objc_class_prefix) if (!_internal_has_objc_class_prefix()) { return nullptr; @@ -10320,7 +10320,7 @@ inline TProtoStringType* FileOptions::release_objc_class_prefix() { _has_bits_[0] &= ~0x00000008u; return objc_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void FileOptions::set_allocated_objc_class_prefix(TProtoStringType* objc_class_prefix) { +inline void FileOptions::set_allocated_objc_class_prefix(TProtoStringType* objc_class_prefix) { if (objc_class_prefix != nullptr) { _has_bits_[0] |= 0x00000008u; } else { @@ -10343,7 +10343,7 @@ inline void FileOptions::clear_csharp_namespace() { csharp_namespace_.ClearToEmpty(); _has_bits_[0] &= ~0x00000010u; } -inline const TProtoStringType& FileOptions::csharp_namespace() const { +inline const TProtoStringType& FileOptions::csharp_namespace() const { // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.csharp_namespace) return _internal_csharp_namespace(); } @@ -10370,7 +10370,7 @@ inline TProtoStringType* FileOptions::_internal_mutable_csharp_namespace() { _has_bits_[0] |= 0x00000010u; return csharp_namespace_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* FileOptions::release_csharp_namespace() { +inline TProtoStringType* FileOptions::release_csharp_namespace() { // @@protoc_insertion_point(field_release:google.protobuf.FileOptions.csharp_namespace) if (!_internal_has_csharp_namespace()) { return nullptr; @@ -10378,7 +10378,7 @@ inline TProtoStringType* FileOptions::release_csharp_namespace() { _has_bits_[0] &= ~0x00000010u; return csharp_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void FileOptions::set_allocated_csharp_namespace(TProtoStringType* csharp_namespace) { +inline void FileOptions::set_allocated_csharp_namespace(TProtoStringType* csharp_namespace) { if (csharp_namespace != nullptr) { _has_bits_[0] |= 0x00000010u; } else { @@ -11494,7 +11494,7 @@ inline void UninterpretedOption_NamePart::clear_name_part() { name_part_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& UninterpretedOption_NamePart::name_part() const { +inline const TProtoStringType& UninterpretedOption_NamePart::name_part() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.NamePart.name_part) return _internal_name_part(); } @@ -11521,7 +11521,7 @@ inline TProtoStringType* UninterpretedOption_NamePart::_internal_mutable_name_pa _has_bits_[0] |= 0x00000001u; return name_part_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* UninterpretedOption_NamePart::release_name_part() { +inline TProtoStringType* UninterpretedOption_NamePart::release_name_part() { // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.NamePart.name_part) if (!_internal_has_name_part()) { return nullptr; @@ -11529,7 +11529,7 @@ inline TProtoStringType* UninterpretedOption_NamePart::release_name_part() { _has_bits_[0] &= ~0x00000001u; return name_part_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void UninterpretedOption_NamePart::set_allocated_name_part(TProtoStringType* name_part) { +inline void UninterpretedOption_NamePart::set_allocated_name_part(TProtoStringType* name_part) { if (name_part != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -11624,7 +11624,7 @@ inline void UninterpretedOption::clear_identifier_value() { identifier_value_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& UninterpretedOption::identifier_value() const { +inline const TProtoStringType& UninterpretedOption::identifier_value() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.identifier_value) return _internal_identifier_value(); } @@ -11651,7 +11651,7 @@ inline TProtoStringType* UninterpretedOption::_internal_mutable_identifier_value _has_bits_[0] |= 0x00000001u; return identifier_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* UninterpretedOption::release_identifier_value() { +inline TProtoStringType* UninterpretedOption::release_identifier_value() { // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.identifier_value) if (!_internal_has_identifier_value()) { return nullptr; @@ -11659,7 +11659,7 @@ inline TProtoStringType* UninterpretedOption::release_identifier_value() { _has_bits_[0] &= ~0x00000001u; return identifier_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void UninterpretedOption::set_allocated_identifier_value(TProtoStringType* identifier_value) { +inline void UninterpretedOption::set_allocated_identifier_value(TProtoStringType* identifier_value) { if (identifier_value != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -11766,7 +11766,7 @@ inline void UninterpretedOption::clear_string_value() { string_value_.ClearToEmpty(); _has_bits_[0] &= ~0x00000002u; } -inline const TProtoStringType& UninterpretedOption::string_value() const { +inline const TProtoStringType& UninterpretedOption::string_value() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.string_value) return _internal_string_value(); } @@ -11793,7 +11793,7 @@ inline TProtoStringType* UninterpretedOption::_internal_mutable_string_value() { _has_bits_[0] |= 0x00000002u; return string_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* UninterpretedOption::release_string_value() { +inline TProtoStringType* UninterpretedOption::release_string_value() { // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.string_value) if (!_internal_has_string_value()) { return nullptr; @@ -11801,7 +11801,7 @@ inline TProtoStringType* UninterpretedOption::release_string_value() { _has_bits_[0] &= ~0x00000002u; return string_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void UninterpretedOption::set_allocated_string_value(TProtoStringType* string_value) { +inline void UninterpretedOption::set_allocated_string_value(TProtoStringType* string_value) { if (string_value != nullptr) { _has_bits_[0] |= 0x00000002u; } else { @@ -11824,7 +11824,7 @@ inline void UninterpretedOption::clear_aggregate_value() { aggregate_value_.ClearToEmpty(); _has_bits_[0] &= ~0x00000004u; } -inline const TProtoStringType& UninterpretedOption::aggregate_value() const { +inline const TProtoStringType& UninterpretedOption::aggregate_value() const { // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.aggregate_value) return _internal_aggregate_value(); } @@ -11851,7 +11851,7 @@ inline TProtoStringType* UninterpretedOption::_internal_mutable_aggregate_value( _has_bits_[0] |= 0x00000004u; return aggregate_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* UninterpretedOption::release_aggregate_value() { +inline TProtoStringType* UninterpretedOption::release_aggregate_value() { // @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.aggregate_value) if (!_internal_has_aggregate_value()) { return nullptr; @@ -11859,7 +11859,7 @@ inline TProtoStringType* UninterpretedOption::release_aggregate_value() { _has_bits_[0] &= ~0x00000004u; return aggregate_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void UninterpretedOption::set_allocated_aggregate_value(TProtoStringType* aggregate_value) { +inline void UninterpretedOption::set_allocated_aggregate_value(TProtoStringType* aggregate_value) { if (aggregate_value != nullptr) { _has_bits_[0] |= 0x00000004u; } else { @@ -11980,7 +11980,7 @@ inline void SourceCodeInfo_Location::clear_leading_comments() { leading_comments_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& SourceCodeInfo_Location::leading_comments() const { +inline const TProtoStringType& SourceCodeInfo_Location::leading_comments() const { // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_comments) return _internal_leading_comments(); } @@ -12007,7 +12007,7 @@ inline TProtoStringType* SourceCodeInfo_Location::_internal_mutable_leading_comm _has_bits_[0] |= 0x00000001u; return leading_comments_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* SourceCodeInfo_Location::release_leading_comments() { +inline TProtoStringType* SourceCodeInfo_Location::release_leading_comments() { // @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.leading_comments) if (!_internal_has_leading_comments()) { return nullptr; @@ -12015,7 +12015,7 @@ inline TProtoStringType* SourceCodeInfo_Location::release_leading_comments() { _has_bits_[0] &= ~0x00000001u; return leading_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void SourceCodeInfo_Location::set_allocated_leading_comments(TProtoStringType* leading_comments) { +inline void SourceCodeInfo_Location::set_allocated_leading_comments(TProtoStringType* leading_comments) { if (leading_comments != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -12038,7 +12038,7 @@ inline void SourceCodeInfo_Location::clear_trailing_comments() { trailing_comments_.ClearToEmpty(); _has_bits_[0] &= ~0x00000002u; } -inline const TProtoStringType& SourceCodeInfo_Location::trailing_comments() const { +inline const TProtoStringType& SourceCodeInfo_Location::trailing_comments() const { // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.trailing_comments) return _internal_trailing_comments(); } @@ -12065,7 +12065,7 @@ inline TProtoStringType* SourceCodeInfo_Location::_internal_mutable_trailing_com _has_bits_[0] |= 0x00000002u; return trailing_comments_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* SourceCodeInfo_Location::release_trailing_comments() { +inline TProtoStringType* SourceCodeInfo_Location::release_trailing_comments() { // @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.trailing_comments) if (!_internal_has_trailing_comments()) { return nullptr; @@ -12073,7 +12073,7 @@ inline TProtoStringType* SourceCodeInfo_Location::release_trailing_comments() { _has_bits_[0] &= ~0x00000002u; return trailing_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void SourceCodeInfo_Location::set_allocated_trailing_comments(TProtoStringType* trailing_comments) { +inline void SourceCodeInfo_Location::set_allocated_trailing_comments(TProtoStringType* trailing_comments) { if (trailing_comments != nullptr) { _has_bits_[0] |= 0x00000002u; } else { @@ -12102,15 +12102,15 @@ inline TProtoStringType* SourceCodeInfo_Location::add_leading_detached_comments( inline const TProtoStringType& SourceCodeInfo_Location::_internal_leading_detached_comments(int index) const { return leading_detached_comments_.Get(index); } -inline const TProtoStringType& SourceCodeInfo_Location::leading_detached_comments(int index) const { +inline const TProtoStringType& SourceCodeInfo_Location::leading_detached_comments(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) return _internal_leading_detached_comments(index); } -inline TProtoStringType* SourceCodeInfo_Location::mutable_leading_detached_comments(int index) { +inline TProtoStringType* SourceCodeInfo_Location::mutable_leading_detached_comments(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) return leading_detached_comments_.Mutable(index); } -inline void SourceCodeInfo_Location::set_leading_detached_comments(int index, const TProtoStringType& value) { +inline void SourceCodeInfo_Location::set_leading_detached_comments(int index, const TProtoStringType& value) { leading_detached_comments_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) } @@ -12131,7 +12131,7 @@ inline void SourceCodeInfo_Location::set_leading_detached_comments(int index, co inline TProtoStringType* SourceCodeInfo_Location::_internal_add_leading_detached_comments() { return leading_detached_comments_.Add(); } -inline void SourceCodeInfo_Location::add_leading_detached_comments(const TProtoStringType& value) { +inline void SourceCodeInfo_Location::add_leading_detached_comments(const TProtoStringType& value) { leading_detached_comments_.Add()->assign(value); // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.leading_detached_comments) } @@ -12266,7 +12266,7 @@ inline void GeneratedCodeInfo_Annotation::clear_source_file() { source_file_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& GeneratedCodeInfo_Annotation::source_file() const { +inline const TProtoStringType& GeneratedCodeInfo_Annotation::source_file() const { // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.source_file) return _internal_source_file(); } @@ -12293,7 +12293,7 @@ inline TProtoStringType* GeneratedCodeInfo_Annotation::_internal_mutable_source_ _has_bits_[0] |= 0x00000001u; return source_file_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* GeneratedCodeInfo_Annotation::release_source_file() { +inline TProtoStringType* GeneratedCodeInfo_Annotation::release_source_file() { // @@protoc_insertion_point(field_release:google.protobuf.GeneratedCodeInfo.Annotation.source_file) if (!_internal_has_source_file()) { return nullptr; @@ -12301,7 +12301,7 @@ inline TProtoStringType* GeneratedCodeInfo_Annotation::release_source_file() { _has_bits_[0] &= ~0x00000001u; return source_file_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(TProtoStringType* source_file) { +inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(TProtoStringType* source_file) { if (source_file != nullptr) { _has_bits_[0] |= 0x00000001u; } else { diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc b/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc index b35e0d94fe..d9104f8a2e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor_database.cc @@ -928,7 +928,7 @@ bool DescriptorPoolDatabase::FindAllExtensionNumbers( const Descriptor* extendee = pool_.FindMessageTypeByName(extendee_type); if (extendee == NULL) return false; - std::vector<const FieldDescriptor*> extensions; + std::vector<const FieldDescriptor*> extensions; pool_.FindAllExtensions(extendee, &extensions); for (const FieldDescriptor* extension : extensions) { @@ -946,7 +946,7 @@ MergedDescriptorDatabase::MergedDescriptorDatabase( sources_.push_back(source2); } MergedDescriptorDatabase::MergedDescriptorDatabase( - const std::vector<DescriptorDatabase*>& sources) + const std::vector<DescriptorDatabase*>& sources) : sources_(sources) {} MergedDescriptorDatabase::~MergedDescriptorDatabase() {} @@ -1006,8 +1006,8 @@ bool MergedDescriptorDatabase::FindFileContainingExtension( bool MergedDescriptorDatabase::FindAllExtensionNumbers( const TProtoStringType& extendee_type, std::vector<int>* output) { - std::set<int> merged_results; - std::vector<int> results; + std::set<int> merged_results; + std::vector<int> results; bool success = false; for (DescriptorDatabase* source : sources_) { @@ -1021,7 +1021,7 @@ bool MergedDescriptorDatabase::FindAllExtensionNumbers( } std::copy(merged_results.begin(), merged_results.end(), - std::insert_iterator<std::vector<int> >(*output, output->end())); + std::insert_iterator<std::vector<int> >(*output, output->end())); return success; } diff --git a/contrib/libs/protobuf/src/google/protobuf/descriptor_database.h b/contrib/libs/protobuf/src/google/protobuf/descriptor_database.h index 0735c0998d..ac89ff6e39 100644 --- a/contrib/libs/protobuf/src/google/protobuf/descriptor_database.h +++ b/contrib/libs/protobuf/src/google/protobuf/descriptor_database.h @@ -103,7 +103,7 @@ class PROTOBUF_EXPORT DescriptorDatabase { // This method has a default implementation that always returns // false. virtual bool FindAllExtensionNumbers(const TProtoStringType& /* extendee_type */, - std::vector<int>* /* output */) { + std::vector<int>* /* output */) { return false; } @@ -205,7 +205,7 @@ class PROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase { Value FindSymbol(const TProtoStringType& name); Value FindExtension(const TProtoStringType& containing_type, int field_number); bool FindAllExtensionNumbers(const TProtoStringType& containing_type, - std::vector<int>* output); + std::vector<int>* output); void FindAllFileNames(std::vector<TProtoStringType>* output); private: @@ -318,11 +318,11 @@ class PROTOBUF_EXPORT EncodedDescriptorDatabase : public DescriptorDatabase { // Keep DescriptorIndex by pointer to hide the implementation to keep a // cleaner header. std::unique_ptr<DescriptorIndex> index_; - std::vector<void*> files_to_delete_; + std::vector<void*> files_to_delete_; // If encoded_file.first is non-NULL, parse the data into *output and return // true, otherwise return false. - bool MaybeParse(std::pair<const void*, int> encoded_file, + bool MaybeParse(std::pair<const void*, int> encoded_file, FileDescriptorProto* output); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EncodedDescriptorDatabase); @@ -379,7 +379,7 @@ class PROTOBUF_EXPORT MergedDescriptorDatabase : public DescriptorDatabase { private: - std::vector<DescriptorDatabase*> sources_; + std::vector<DescriptorDatabase*> sources_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MergedDescriptorDatabase); }; diff --git a/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc b/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc index 91329ddf1d..0d79fbe571 100644 --- a/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc +++ b/contrib/libs/protobuf/src/google/protobuf/dynamic_message.cc @@ -567,7 +567,7 @@ DynamicMessage::~DynamicMessage() { switch (field->options().ctype()) { default: // TODO(kenton): Support other string reps. case FieldOptions::STRING: { - const TProtoStringType* default_value = + const TProtoStringType* default_value = reinterpret_cast<const ArenaStringPtr*>( type_info_->prototype->OffsetToPointer( type_info_->offsets[i])) diff --git a/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.h b/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.h index c31730adc6..c0c7af1a73 100644 --- a/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/field_mask.pb.h @@ -188,14 +188,14 @@ class PROTOBUF_EXPORT FieldMask final : int _internal_paths_size() const; public: void clear_paths(); - const TProtoStringType& paths(int index) const; - TProtoStringType* mutable_paths(int index); - void set_paths(int index, const TProtoStringType& value); + const TProtoStringType& paths(int index) const; + TProtoStringType* mutable_paths(int index); + void set_paths(int index, const TProtoStringType& value); void set_paths(int index, TProtoStringType&& value); void set_paths(int index, const char* value); void set_paths(int index, const char* value, size_t size); - TProtoStringType* add_paths(); - void add_paths(const TProtoStringType& value); + TProtoStringType* add_paths(); + void add_paths(const TProtoStringType& value); void add_paths(TProtoStringType&& value); void add_paths(const char* value); void add_paths(const char* value, size_t size); @@ -246,15 +246,15 @@ inline TProtoStringType* FieldMask::add_paths() { inline const TProtoStringType& FieldMask::_internal_paths(int index) const { return paths_.Get(index); } -inline const TProtoStringType& FieldMask::paths(int index) const { +inline const TProtoStringType& FieldMask::paths(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.FieldMask.paths) return _internal_paths(index); } -inline TProtoStringType* FieldMask::mutable_paths(int index) { +inline TProtoStringType* 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 TProtoStringType& value) { +inline void FieldMask::set_paths(int index, const TProtoStringType& value) { paths_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set:google.protobuf.FieldMask.paths) } @@ -275,7 +275,7 @@ inline void FieldMask::set_paths(int index, const char* value, size_t size) { inline TProtoStringType* FieldMask::_internal_add_paths() { return paths_.Add(); } -inline void FieldMask::add_paths(const TProtoStringType& value) { +inline void FieldMask::add_paths(const TProtoStringType& value) { paths_.Add()->assign(value); // @@protoc_insertion_point(field_add:google.protobuf.FieldMask.paths) } diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc b/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc index 1be6911ed7..82f48bd1c0 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_reflection.cc @@ -904,7 +904,7 @@ void Reflection::Swap(Message* message1, Message* message2) const { template <bool unsafe_shallow_swap> void Reflection::SwapFieldsImpl( Message* message1, Message* message2, - const std::vector<const FieldDescriptor*>& fields) const { + const std::vector<const FieldDescriptor*>& fields) const { if (message1 == message2) return; // TODO(kenton): Other Reflection methods should probably check this too. @@ -1299,7 +1299,7 @@ using internal::CreateUnknownEnumValues; void Reflection::ListFieldsMayFailOnStripped( const Message& message, bool should_fail, - std::vector<const FieldDescriptor*>* output) const { + std::vector<const FieldDescriptor*>* output) const { output->clear(); // Optimization: The default instance never has any fields set. diff --git a/contrib/libs/protobuf/src/google/protobuf/generated_message_util.h b/contrib/libs/protobuf/src/google/protobuf/generated_message_util.h index f4424ebc7e..2f111602ec 100644 --- a/contrib/libs/protobuf/src/google/protobuf/generated_message_util.h +++ b/contrib/libs/protobuf/src/google/protobuf/generated_message_util.h @@ -84,7 +84,7 @@ inline To DownCast(From& f) { return PROTOBUF_NAMESPACE_ID::internal::down_cast<To>(f); } - + // This fastpath inlines a single branch instead of having to make the // InitProtobufDefaults function call. // It also generates less inlined code than a function-scope static initializer. diff --git a/contrib/libs/protobuf/src/google/protobuf/io/printer.cc b/contrib/libs/protobuf/src/google/protobuf/io/printer.cc index e57d1ffc8c..83ed7d1f69 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/printer.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/printer.cc @@ -73,7 +73,7 @@ Printer::~Printer() { } bool Printer::GetSubstitutionRange(const char* varname, - std::pair<size_t, size_t>* range) { + std::pair<size_t, size_t>* range) { std::map<TProtoStringType, std::pair<size_t, size_t> >::const_iterator iter = substitutions_.find(varname); if (iter == substitutions_.end()) { @@ -96,7 +96,7 @@ void Printer::Annotate(const char* begin_varname, const char* end_varname, // Can't generate signatures with this Printer. return; } - std::pair<size_t, size_t> begin, end; + std::pair<size_t, size_t> begin, end; if (!GetSubstitutionRange(begin_varname, &begin) || !GetSubstitutionRange(end_varname, &end)) { return; diff --git a/contrib/libs/protobuf/src/google/protobuf/io/printer.h b/contrib/libs/protobuf/src/google/protobuf/io/printer.h index 45178c0bac..0f8c3b130c 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/printer.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/printer.h @@ -61,7 +61,7 @@ class PROTOBUF_EXPORT AnnotationCollector { // before end_offset are associated with the SourceCodeInfo-style path. virtual void AddAnnotation(size_t begin_offset, size_t end_offset, const TProtoStringType& file_path, - const std::vector<int>& path) = 0; + const std::vector<int>& path) = 0; // TODO(gerbens) I don't see why we need virtuals here. Just a vector of // range, payload pairs stored in a context should suffice. @@ -213,7 +213,7 @@ class PROTOBUF_EXPORT Printer { // of building the location path. return; } - std::vector<int> path; + std::vector<int> path; descriptor->GetLocationPath(&path); Annotate(begin_varname, end_varname, descriptor->file()->name(), path); } @@ -234,7 +234,7 @@ class PROTOBUF_EXPORT Printer { // Annotations aren't turned on for this Printer. return; } - std::vector<int> empty_path; + std::vector<int> empty_path; Annotate(begin_varname, end_varname, file_name, empty_path); } diff --git a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc index e35252d110..c973b6357a 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.cc @@ -635,12 +635,12 @@ bool Tokenizer::Next() { } else { // Check if the high order bit is set. // The tokenizer is used to parse tomita grammars with non-ascii utf8 chars - // if (current_char_ & 0x80) { + // if (current_char_ & 0x80) { // error_collector_->AddError( // line_, column_, - // StringPrintf("Interpreting non ascii codepoint %d.", - // static_cast<unsigned char>(current_char_))); - // } + // StringPrintf("Interpreting non ascii codepoint %d.", + // static_cast<unsigned char>(current_char_))); + // } NextChar(); current_.type = TYPE_SYMBOL; } diff --git a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h index d81c0122a3..c24b7690af 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/tokenizer.h @@ -78,7 +78,7 @@ class PROTOBUF_EXPORT ErrorCollector { // Indicates that there was a warning in the input at the given line and // column numbers. The numbers are zero-based, so you may want to add // 1 to each before printing them. - virtual void AddWarning(int /* line */, ColumnNumber /* column */, + virtual void AddWarning(int /* line */, ColumnNumber /* column */, const TProtoStringType& /* message */) {} private: diff --git a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc index 6872472259..52617e9efe 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc +++ b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc @@ -242,7 +242,7 @@ bool FileOutputStream::CopyingFileOutputStream::Write(const void* buffer, // =================================================================== -IstreamInputStream::IstreamInputStream(std::istream* input, int block_size) +IstreamInputStream::IstreamInputStream(std::istream* input, int block_size) : copying_input_(input), impl_(©ing_input_, block_size) {} bool IstreamInputStream::Next(const void** data, int* size) { @@ -256,7 +256,7 @@ bool IstreamInputStream::Skip(int count) { return impl_.Skip(count); } int64_t IstreamInputStream::ByteCount() const { return impl_.ByteCount(); } IstreamInputStream::CopyingIstreamInputStream::CopyingIstreamInputStream( - std::istream* input) + std::istream* input) : input_(input) {} IstreamInputStream::CopyingIstreamInputStream::~CopyingIstreamInputStream() {} @@ -273,7 +273,7 @@ int IstreamInputStream::CopyingIstreamInputStream::Read(void* buffer, // =================================================================== -OstreamOutputStream::OstreamOutputStream(std::ostream* output, int block_size) +OstreamOutputStream::OstreamOutputStream(std::ostream* output, int block_size) : copying_output_(output), impl_(©ing_output_, block_size) {} OstreamOutputStream::~OstreamOutputStream() { impl_.Flush(); } @@ -287,7 +287,7 @@ void OstreamOutputStream::BackUp(int count) { impl_.BackUp(count); } int64_t OstreamOutputStream::ByteCount() const { return impl_.ByteCount(); } OstreamOutputStream::CopyingOstreamOutputStream::CopyingOstreamOutputStream( - std::ostream* output) + std::ostream* output) : output_(output) {} OstreamOutputStream::CopyingOstreamOutputStream::~CopyingOstreamOutputStream() { diff --git a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h index 83bf574766..0206e3887e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h +++ b/contrib/libs/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h @@ -209,7 +209,7 @@ class PROTOBUF_EXPORT IstreamInputStream : public ZeroCopyInputStream { // If a block_size is given, it specifies the number of bytes that // should be read and returned with each call to Next(). Otherwise, // a reasonable default is used. - explicit IstreamInputStream(std::istream* stream, int block_size = -1); + explicit IstreamInputStream(std::istream* stream, int block_size = -1); // implements ZeroCopyInputStream ---------------------------------- bool Next(const void** data, int* size) override; @@ -220,7 +220,7 @@ class PROTOBUF_EXPORT IstreamInputStream : public ZeroCopyInputStream { private: class PROTOBUF_EXPORT CopyingIstreamInputStream : public CopyingInputStream { public: - CopyingIstreamInputStream(std::istream* input); + CopyingIstreamInputStream(std::istream* input); ~CopyingIstreamInputStream() override; // implements CopyingInputStream --------------------------------- @@ -229,7 +229,7 @@ class PROTOBUF_EXPORT IstreamInputStream : public ZeroCopyInputStream { private: // The stream. - std::istream* input_; + std::istream* input_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CopyingIstreamInputStream); }; @@ -252,7 +252,7 @@ class PROTOBUF_EXPORT OstreamOutputStream : public ZeroCopyOutputStream { // If a block_size is given, it specifies the size of the buffers // that should be returned by Next(). Otherwise, a reasonable default // is used. - explicit OstreamOutputStream(std::ostream* stream, int block_size = -1); + explicit OstreamOutputStream(std::ostream* stream, int block_size = -1); ~OstreamOutputStream() override; // implements ZeroCopyOutputStream --------------------------------- @@ -264,7 +264,7 @@ class PROTOBUF_EXPORT OstreamOutputStream : public ZeroCopyOutputStream { class PROTOBUF_EXPORT CopyingOstreamOutputStream : public CopyingOutputStream { public: - CopyingOstreamOutputStream(std::ostream* output); + CopyingOstreamOutputStream(std::ostream* output); ~CopyingOstreamOutputStream() override; // implements CopyingOutputStream -------------------------------- @@ -272,7 +272,7 @@ class PROTOBUF_EXPORT OstreamOutputStream : public ZeroCopyOutputStream { private: // The stream. - std::ostream* output_; + std::ostream* output_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CopyingOstreamOutputStream); }; diff --git a/contrib/libs/protobuf/src/google/protobuf/json_util.cc b/contrib/libs/protobuf/src/google/protobuf/json_util.cc index 28ef0f0f87..450ce1da57 100644 --- a/contrib/libs/protobuf/src/google/protobuf/json_util.cc +++ b/contrib/libs/protobuf/src/google/protobuf/json_util.cc @@ -1,33 +1,33 @@ #include <google/protobuf/json_util.h> - -namespace google { -namespace protobuf { -namespace io { - + +namespace google { +namespace protobuf { +namespace io { + void PrintJSONString(IOutputStream& stream, const TProtoStringType& string) { - stream << '"'; - for (const char c: string) { - switch(c) { - case '"' : stream << "\\\""; continue; - case '\\': stream << "\\\\"; continue; - case '\b': stream << "\\b"; continue; - case '\f': stream << "\\f"; continue; - case '\n': stream << "\\n"; continue; - case '\r': stream << "\\r"; continue; - case '\t': stream << "\\t"; continue; - } - if ((unsigned char)c < 0x20) { - stream << "\\u00"; - static const char hexDigits[] = "0123456789ABCDEF"; - stream << hexDigits[(c & 0xf0) >> 4]; - stream << hexDigits[(c & 0x0f)]; - continue; - } - stream << c; - } - stream << '"'; -} - -} -} -} + stream << '"'; + for (const char c: string) { + switch(c) { + case '"' : stream << "\\\""; continue; + case '\\': stream << "\\\\"; continue; + case '\b': stream << "\\b"; continue; + case '\f': stream << "\\f"; continue; + case '\n': stream << "\\n"; continue; + case '\r': stream << "\\r"; continue; + case '\t': stream << "\\t"; continue; + } + if ((unsigned char)c < 0x20) { + stream << "\\u00"; + static const char hexDigits[] = "0123456789ABCDEF"; + stream << hexDigits[(c & 0xf0) >> 4]; + stream << hexDigits[(c & 0x0f)]; + continue; + } + stream << c; + } + stream << '"'; +} + +} +} +} diff --git a/contrib/libs/protobuf/src/google/protobuf/json_util.h b/contrib/libs/protobuf/src/google/protobuf/json_util.h index e6e836a51c..ad3a4a5bfe 100644 --- a/contrib/libs/protobuf/src/google/protobuf/json_util.h +++ b/contrib/libs/protobuf/src/google/protobuf/json_util.h @@ -1,30 +1,30 @@ -#pragma once - +#pragma once + #include <google/protobuf/stubs/common.h> - -namespace google { -namespace protobuf { -namespace io { - + +namespace google { +namespace protobuf { +namespace io { + void PrintJSONString(IOutputStream& stream, const TProtoStringType& string); - -template<class T> -struct TAsJSON { -public: - TAsJSON(const T& t) - : T_(t) - { - } - - const T& T_; -}; - -template<class T> + +template<class T> +struct TAsJSON { +public: + TAsJSON(const T& t) + : T_(t) + { + } + + const T& T_; +}; + +template<class T> inline IOutputStream& operator <<(IOutputStream& stream, const TAsJSON<T>& protoAsJSON) { - protoAsJSON.T_.PrintJSON(stream); - return stream; -}; - -} -} -} + protoAsJSON.T_.PrintJSON(stream); + return stream; +}; + +} +} +} diff --git a/contrib/libs/protobuf/src/google/protobuf/message.cc b/contrib/libs/protobuf/src/google/protobuf/message.cc index 4844366628..c90ff50e72 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message.cc +++ b/contrib/libs/protobuf/src/google/protobuf/message.cc @@ -177,46 +177,46 @@ void Message::PrintJSON(IOutputStream& out) const { } bool Message::ParseFromArcadiaStream(IInputStream* input) { - bool res = false; - io::TInputStreamProxy proxy(input); - { - io::CopyingInputStreamAdaptor stream(&proxy); - res = ParseFromZeroCopyStream(&stream); - } - return res && !proxy.HasError(); -} + bool res = false; + io::TInputStreamProxy proxy(input); + { + io::CopyingInputStreamAdaptor stream(&proxy); + res = ParseFromZeroCopyStream(&stream); + } + return res && !proxy.HasError(); +} bool Message::ParsePartialFromArcadiaStream(IInputStream* input) { - bool res = false; - io::TInputStreamProxy proxy(input); - { - io::CopyingInputStreamAdaptor stream(&proxy); - res = ParsePartialFromZeroCopyStream(&stream); - } - return res && !proxy.HasError(); -} + bool res = false; + io::TInputStreamProxy proxy(input); + { + io::CopyingInputStreamAdaptor stream(&proxy); + res = ParsePartialFromZeroCopyStream(&stream); + } + return res && !proxy.HasError(); +} bool Message::SerializeToArcadiaStream(IOutputStream* output) const { - bool res = false; - io::TOutputStreamProxy proxy(output); - { - io::CopyingOutputStreamAdaptor stream(&proxy); - res = SerializeToZeroCopyStream(&stream); - } - return res && !proxy.HasError(); -} + bool res = false; + io::TOutputStreamProxy proxy(output); + { + io::CopyingOutputStreamAdaptor stream(&proxy); + res = SerializeToZeroCopyStream(&stream); + } + return res && !proxy.HasError(); +} bool Message::SerializePartialToArcadiaStream(IOutputStream* output) const { - bool res = false; - io::TOutputStreamProxy proxy(output); - { - io::CopyingOutputStreamAdaptor stream(&proxy); - res = SerializePartialToZeroCopyStream(&stream); - } - return res && !proxy.HasError(); -} -// End of Yandex-specific - + bool res = false; + io::TOutputStreamProxy proxy(output); + { + io::CopyingOutputStreamAdaptor stream(&proxy); + res = SerializePartialToZeroCopyStream(&stream); + } + return res && !proxy.HasError(); +} +// End of Yandex-specific + size_t Message::ByteSizeLong() const { size_t size = WireFormat::ByteSize(*this); SetCachedSize(internal::ToCachedSize(size)); diff --git a/contrib/libs/protobuf/src/google/protobuf/message.h b/contrib/libs/protobuf/src/google/protobuf/message.h index 28e5c33ab2..37d92ea393 100644 --- a/contrib/libs/protobuf/src/google/protobuf/message.h +++ b/contrib/libs/protobuf/src/google/protobuf/message.h @@ -338,27 +338,27 @@ class PROTOBUF_EXPORT Message : public MessageLite { uint8* _InternalSerialize(uint8* target, io::EpsCopyOutputStream* stream) const override; - // Yandex-specific + // Yandex-specific bool ParseFromArcadiaStream(IInputStream* input); bool ParsePartialFromArcadiaStream(IInputStream* input); bool SerializeToArcadiaStream(IOutputStream* output) const; bool SerializePartialToArcadiaStream(IOutputStream* output) const; virtual void PrintJSON(IOutputStream&) const; - - io::TAsJSON<Message> AsJSON() const { - return io::TAsJSON<Message>(*this); - } - + + io::TAsJSON<Message> AsJSON() const { + return io::TAsJSON<Message>(*this); + } + internal::TAsBinary AsBinary() const { return internal::TAsBinary{*this}; - } - + } + internal::TAsStreamSeq AsStreamSeq() const { return internal::TAsStreamSeq{*this}; - } - // End of Yandex-specific - + } + // End of Yandex-specific + private: // This is called only by the default implementation of ByteSize(), to // update the cached size. If you override ByteSize(), you do not need diff --git a/contrib/libs/protobuf/src/google/protobuf/messagext.cc b/contrib/libs/protobuf/src/google/protobuf/messagext.cc index e017be50a6..1923205598 100644 --- a/contrib/libs/protobuf/src/google/protobuf/messagext.cc +++ b/contrib/libs/protobuf/src/google/protobuf/messagext.cc @@ -2,22 +2,22 @@ #include <google/protobuf/io/zero_copy_stream_impl.h> #include <google/protobuf/messagext.h> #include <google/protobuf/text_format.h> - -#include <util/ysaveload.h> -#include <util/generic/yexception.h> -#include <util/stream/length.h> - -namespace { - const int MaxSizeBytes = 1 << 27; // 128 MB limits the size of a protobuf message processed by TProtoSerializer -} - + +#include <util/ysaveload.h> +#include <util/generic/yexception.h> +#include <util/stream/length.h> + +namespace { + const int MaxSizeBytes = 1 << 27; // 128 MB limits the size of a protobuf message processed by TProtoSerializer +} + namespace google::protobuf { //defined in message_lite.cc TProtoStringType InitializationErrorMessage(const char* action, const MessageLite& message); } // namespace google::protobuf - + namespace google::protobuf::internal { IOutputStream& operator <<(IOutputStream& output, const internal::TAsBinary& wrappedMessage) { @@ -38,42 +38,42 @@ namespace google::protobuf::internal { namespace google::protobuf::io { -bool ParseFromCodedStreamSeq(Message* msg, io::CodedInputStream* input) { - msg->Clear(); - ui32 size; - if (!input->ReadVarint32(&size)) { - return false; - } - - io::CodedInputStream::Limit limitState = input->PushLimit(size); - bool res = msg->ParseFromCodedStream(input); - input->PopLimit(limitState); - return res; -} - -bool ParseFromZeroCopyStreamSeq(Message* msg, io::ZeroCopyInputStream* input) { - io::CodedInputStream decoder(input); - return ParseFromCodedStreamSeq(msg, &decoder); -} - -bool SerializePartialToCodedStreamSeq(const Message* msg, io::CodedOutputStream* output) { - uint32 size = msg->ByteSize(); // Force size to be cached. - output->WriteVarint32(size); - msg->SerializeWithCachedSizes(output); - return !output->HadError(); -} - -bool SerializeToCodedStreamSeq(const Message* msg, io::CodedOutputStream* output) { - GOOGLE_DCHECK(msg->IsInitialized()) << InitializationErrorMessage("serialize", *msg); - return SerializePartialToCodedStreamSeq(msg, output); -} - -bool SerializeToZeroCopyStreamSeq(const Message* msg, io::ZeroCopyOutputStream* output) { - io::CodedOutputStream encoder(output); - return SerializeToCodedStreamSeq(msg, &encoder); -} - - +bool ParseFromCodedStreamSeq(Message* msg, io::CodedInputStream* input) { + msg->Clear(); + ui32 size; + if (!input->ReadVarint32(&size)) { + return false; + } + + io::CodedInputStream::Limit limitState = input->PushLimit(size); + bool res = msg->ParseFromCodedStream(input); + input->PopLimit(limitState); + return res; +} + +bool ParseFromZeroCopyStreamSeq(Message* msg, io::ZeroCopyInputStream* input) { + io::CodedInputStream decoder(input); + return ParseFromCodedStreamSeq(msg, &decoder); +} + +bool SerializePartialToCodedStreamSeq(const Message* msg, io::CodedOutputStream* output) { + uint32 size = msg->ByteSize(); // Force size to be cached. + output->WriteVarint32(size); + msg->SerializeWithCachedSizes(output); + return !output->HadError(); +} + +bool SerializeToCodedStreamSeq(const Message* msg, io::CodedOutputStream* output) { + GOOGLE_DCHECK(msg->IsInitialized()) << InitializationErrorMessage("serialize", *msg); + return SerializePartialToCodedStreamSeq(msg, output); +} + +bool SerializeToZeroCopyStreamSeq(const Message* msg, io::ZeroCopyOutputStream* output) { + io::CodedOutputStream encoder(output); + return SerializeToCodedStreamSeq(msg, &encoder); +} + + int TInputStreamProxy::Read(void* buffer, int size) { try { return (int)mSlave->Read(buffer, (size_t)size); @@ -85,7 +85,7 @@ int TInputStreamProxy::Read(void* buffer, int size) { TErrorState::SetError(); return -1; } - + bool TOutputStreamProxy::Write(const void* buffer, int size) { try { @@ -102,110 +102,110 @@ bool TOutputStreamProxy::Write(const void* buffer, int size) { void TProtoSerializer::Save(IOutputStream* out, const Message& msg) { - int size = msg.ByteSize(); - if (size > MaxSizeBytes) { - ythrow yexception() << "Message size " << size << " exceeds " << MaxSizeBytes; - } - - TCopyingOutputStreamAdaptor adaptor(out); - io::CodedOutputStream encoder(&adaptor); - if (!SerializeToCodedStreamSeq(&msg, &encoder)) - ythrow yexception() << "Cannot write protobuf::Message to output stream"; -} - + int size = msg.ByteSize(); + if (size > MaxSizeBytes) { + ythrow yexception() << "Message size " << size << " exceeds " << MaxSizeBytes; + } + + TCopyingOutputStreamAdaptor adaptor(out); + io::CodedOutputStream encoder(&adaptor); + if (!SerializeToCodedStreamSeq(&msg, &encoder)) + ythrow yexception() << "Cannot write protobuf::Message to output stream"; +} + // Reading varint32 directly from IInputStream (might be slow if input requires buffering). -// Copy-pasted with small modifications from protobuf/io/coded_stream (ReadVarint32FromArray) - -// Returns true if succeeded, false if stream has ended, throws exception if data is corrupted +// Copy-pasted with small modifications from protobuf/io/coded_stream (ReadVarint32FromArray) + +// Returns true if succeeded, false if stream has ended, throws exception if data is corrupted static bool ReadVarint32(IInputStream* input, ui32& size) { - size_t res; - ui8 b; - - /* if we can't read anything from stream - it is exhausted */ - if (input->Read(&b, 1) == 0) - return false; - res = (b & 0x7F) ; if (!(b & 0x80)) goto done; - ::Load(input, b); res |= (b & 0x7F) << 7; if (!(b & 0x80)) goto done; - ::Load(input, b); res |= (b & 0x7F) << 14; if (!(b & 0x80)) goto done; - ::Load(input, b); res |= (b & 0x7F) << 21; if (!(b & 0x80)) goto done; - ::Load(input, b); res |= b << 28; if (!(b & 0x80)) goto done; - - // If the input is larger than 32 bits, we still need to read it all - // and discard the high-order bits. - for (int i = 0; i < 5; i++) { - ::Load(input, b); if (!(b & 0x80)) goto done; - } - ythrow yexception() << "We have overrun the maximum size of a varint (10 bytes). Assume the data is corrupt."; - -done: - size = res; - return true; -} - -class TTempBufHelper { -public: - TTempBufHelper(size_t size) { - if (size <= SmallBufSize) { - Buffer = SmallBuf; - } else { - LargeBuf.Reset(new TTempBuf(size)); - Buffer = reinterpret_cast<ui8*>(LargeBuf->Data()); - } - } - - ui8* Data() { - return Buffer; - } - -private: - static const size_t SmallBufSize = 1024; - ui8 SmallBuf[SmallBufSize]; - - THolder<TTempBuf> LargeBuf; - - ui8* Buffer; -}; - + size_t res; + ui8 b; + + /* if we can't read anything from stream - it is exhausted */ + if (input->Read(&b, 1) == 0) + return false; + res = (b & 0x7F) ; if (!(b & 0x80)) goto done; + ::Load(input, b); res |= (b & 0x7F) << 7; if (!(b & 0x80)) goto done; + ::Load(input, b); res |= (b & 0x7F) << 14; if (!(b & 0x80)) goto done; + ::Load(input, b); res |= (b & 0x7F) << 21; if (!(b & 0x80)) goto done; + ::Load(input, b); res |= b << 28; if (!(b & 0x80)) goto done; + + // If the input is larger than 32 bits, we still need to read it all + // and discard the high-order bits. + for (int i = 0; i < 5; i++) { + ::Load(input, b); if (!(b & 0x80)) goto done; + } + ythrow yexception() << "We have overrun the maximum size of a varint (10 bytes). Assume the data is corrupt."; + +done: + size = res; + return true; +} + +class TTempBufHelper { +public: + TTempBufHelper(size_t size) { + if (size <= SmallBufSize) { + Buffer = SmallBuf; + } else { + LargeBuf.Reset(new TTempBuf(size)); + Buffer = reinterpret_cast<ui8*>(LargeBuf->Data()); + } + } + + ui8* Data() { + return Buffer; + } + +private: + static const size_t SmallBufSize = 1024; + ui8 SmallBuf[SmallBufSize]; + + THolder<TTempBuf> LargeBuf; + + ui8* Buffer; +}; + void TProtoSerializer::Load(IInputStream* input, Message& msg) { msg.Clear(); MergeFrom(input, msg); } void TProtoSerializer::MergeFrom(IInputStream* input, Message& msg) { - ui32 size; - if (!ReadVarint32(input, size)) - ythrow yexception() << "Stream is exhausted"; - - TTempBufHelper buf(size); - ::LoadPodArray(input, buf.Data(), size); - CodedInputStream decoder(buf.Data(), size); + ui32 size; + if (!ReadVarint32(input, size)) + ythrow yexception() << "Stream is exhausted"; + + TTempBufHelper buf(size); + ::LoadPodArray(input, buf.Data(), size); + CodedInputStream decoder(buf.Data(), size); decoder.SetTotalBytesLimit(MaxSizeBytes); if (!msg.MergeFromCodedStream(&decoder)) - ythrow yexception() << "Cannot read protobuf::Message (" << msg.GetTypeName() << ") from input stream"; -} - + ythrow yexception() << "Cannot read protobuf::Message (" << msg.GetTypeName() << ") from input stream"; +} + TProtoReader::TProtoReader(IInputStream* input, const size_t bufferSize) - : IStream(input) - , Buffer(bufferSize) -{ -} - - -bool TProtoReader::Load(Message& msg) { - ui32 size; - if (!ReadVarint32(IStream, size)) - return false; - - Buffer.Reserve(size); - - ::LoadPodArray(IStream, Buffer.Data(), size); - CodedInputStream decoder((const ui8*)Buffer.Data(), size); - if (!msg.ParseFromCodedStream(&decoder)) - ythrow yexception() << "Cannot read protobuf::Message from input stream"; - - return true; -} - + : IStream(input) + , Buffer(bufferSize) +{ +} + + +bool TProtoReader::Load(Message& msg) { + ui32 size; + if (!ReadVarint32(IStream, size)) + return false; + + Buffer.Reserve(size); + + ::LoadPodArray(IStream, Buffer.Data(), size); + CodedInputStream decoder((const ui8*)Buffer.Data(), size); + if (!msg.ParseFromCodedStream(&decoder)) + ythrow yexception() << "Cannot read protobuf::Message from input stream"; + + return true; +} + } // namespace google::protobuf::io TProtoStringType ShortUtf8DebugString(const google::protobuf::Message& msg) { @@ -223,4 +223,4 @@ TProtoStringType ShortUtf8DebugString(const google::protobuf::Message& msg) { } return string; -} +} diff --git a/contrib/libs/protobuf/src/google/protobuf/messagext.h b/contrib/libs/protobuf/src/google/protobuf/messagext.h index 377bf599b0..9176cee1e8 100644 --- a/contrib/libs/protobuf/src/google/protobuf/messagext.h +++ b/contrib/libs/protobuf/src/google/protobuf/messagext.h @@ -1,16 +1,16 @@ #pragma once - + #include <google/protobuf/stubs/port.h> #include <google/protobuf/io/coded_stream.h> #include <util/stream/output.h> -#include <util/generic/buffer.h> - +#include <util/generic/buffer.h> + #include <google/protobuf/io/zero_copy_stream_impl.h> - -/// this file is Yandex extensions to protobuf - -namespace google { -namespace protobuf { + +/// this file is Yandex extensions to protobuf + +namespace google { +namespace protobuf { class Message; @@ -28,139 +28,139 @@ struct TAsStreamSeq { } // namespace internal -namespace io { - -/// Parse*Seq methods read message size from stream to find a message boundary +namespace io { + +/// Parse*Seq methods read message size from stream to find a message boundary /// there is not parse from IInputStream, because it is not push-backable - -bool ParseFromCodedStreamSeq(Message* msg, io::CodedInputStream* input); -bool ParseFromZeroCopyStreamSeq(Message* msg, io::ZeroCopyInputStream* input); - -/// Serialize*Seq methods write message size as varint before writing a message + +bool ParseFromCodedStreamSeq(Message* msg, io::CodedInputStream* input); +bool ParseFromZeroCopyStreamSeq(Message* msg, io::ZeroCopyInputStream* input); + +/// Serialize*Seq methods write message size as varint before writing a message /// there is no serialize to IOutputStream, because it is not push-backable - -bool SerializePartialToCodedStreamSeq(const Message* msg, io::CodedOutputStream* output); -bool SerializeToCodedStreamSeq(const Message* msg, io::CodedOutputStream* output); -bool SerializeToZeroCopyStreamSeq(const Message* msg, io::ZeroCopyOutputStream* output); - -class TErrorState { -public: - TErrorState() - : HasError_(false) - { - } - bool HasError() const { - return HasError_; - } - void SetError() { - HasError_ = true; - } -private: - bool HasError_; -}; - -class TInputStreamProxy: public io::CopyingInputStream, public TErrorState { - public: + +bool SerializePartialToCodedStreamSeq(const Message* msg, io::CodedOutputStream* output); +bool SerializeToCodedStreamSeq(const Message* msg, io::CodedOutputStream* output); +bool SerializeToZeroCopyStreamSeq(const Message* msg, io::ZeroCopyOutputStream* output); + +class TErrorState { +public: + TErrorState() + : HasError_(false) + { + } + bool HasError() const { + return HasError_; + } + void SetError() { + HasError_ = true; + } +private: + bool HasError_; +}; + +class TInputStreamProxy: public io::CopyingInputStream, public TErrorState { + public: inline TInputStreamProxy(IInputStream* slave) - : mSlave(slave) - { - } - + : mSlave(slave) + { + } + virtual int Read(void* buffer, int size); - - private: + + private: IInputStream* mSlave; -}; - -class TOutputStreamProxy: public io::CopyingOutputStream, public TErrorState { - public: +}; + +class TOutputStreamProxy: public io::CopyingOutputStream, public TErrorState { + public: inline TOutputStreamProxy(IOutputStream* slave) - : mSlave(slave) - { - } - + : mSlave(slave) + { + } + virtual bool Write(const void* buffer, int size); - - private: + + private: IOutputStream* mSlave; -}; - - -class TCopyingInputStreamAdaptor: public TInputStreamProxy, public CopyingInputStreamAdaptor { -public: +}; + + +class TCopyingInputStreamAdaptor: public TInputStreamProxy, public CopyingInputStreamAdaptor { +public: TCopyingInputStreamAdaptor(IInputStream* inputStream) - : TInputStreamProxy(inputStream) - , CopyingInputStreamAdaptor(this) - { } -}; - -class TCopyingOutputStreamAdaptor: public TOutputStreamProxy, public CopyingOutputStreamAdaptor { -public: + : TInputStreamProxy(inputStream) + , CopyingInputStreamAdaptor(this) + { } +}; + +class TCopyingOutputStreamAdaptor: public TOutputStreamProxy, public CopyingOutputStreamAdaptor { +public: TCopyingOutputStreamAdaptor(IOutputStream* outputStream) - : TOutputStreamProxy(outputStream) - , CopyingOutputStreamAdaptor(this) - { } -}; - - -class TProtoSerializer { -public: + : TOutputStreamProxy(outputStream) + , CopyingOutputStreamAdaptor(this) + { } +}; + + +class TProtoSerializer { +public: static void Save(IOutputStream* output, const Message& msg); static void Load(IInputStream* input, Message& msg); static void MergeFrom(IInputStream* input, Message& msg); - - // similar interface for protobuf coded streams - static inline bool Save(CodedOutputStream* output, const Message& msg) { - return SerializeToCodedStreamSeq(&msg, output); - } - - static inline bool Load(CodedInputStream* input, Message& msg) { - return ParseFromCodedStreamSeq(&msg, input); - } -}; - - -/** - * Special separate simple reader of protobuf files from arcadic streams - * with static one time allocated buffer. - * - * Data can be prepared with TProtoSerializer::Save, format is the same. - * - */ -class TProtoReader { -public: + + // similar interface for protobuf coded streams + static inline bool Save(CodedOutputStream* output, const Message& msg) { + return SerializeToCodedStreamSeq(&msg, output); + } + + static inline bool Load(CodedInputStream* input, Message& msg) { + return ParseFromCodedStreamSeq(&msg, input); + } +}; + + +/** + * Special separate simple reader of protobuf files from arcadic streams + * with static one time allocated buffer. + * + * Data can be prepared with TProtoSerializer::Save, format is the same. + * + */ +class TProtoReader { +public: TProtoReader(IInputStream* input, const size_t bufferSize = DefaultBufferSize); - - /** - * Reads protobuf message - * - * @param msg binary compatible protobuf message - * @returns true if read is ok - * false if stream is exhausted - * yexception if input data is corrupted - */ - bool Load(Message& msg); - -private: + + /** + * Reads protobuf message + * + * @param msg binary compatible protobuf message + * @returns true if read is ok + * false if stream is exhausted + * yexception if input data is corrupted + */ + bool Load(Message& msg); + +private: IInputStream* IStream; - TBuffer Buffer; - - static const size_t DefaultBufferSize = (1 << 16); -}; - + TBuffer Buffer; + + static const size_t DefaultBufferSize = (1 << 16); +}; + } // namespace io } // namespace protobuf } // namespace google - -// arcadia-style serialization + +// arcadia-style serialization inline void Save(IOutputStream* output, const google::protobuf::Message& msg) { - google::protobuf::io::TProtoSerializer::Save(output, msg); -} - + google::protobuf::io::TProtoSerializer::Save(output, msg); +} + inline void Load(IInputStream* input, google::protobuf::Message& msg) { - google::protobuf::io::TProtoSerializer::Load(input, msg); -} - -// A mix of ShortDebugString and Utf8DebugString + google::protobuf::io::TProtoSerializer::Load(input, msg); +} + +// A mix of ShortDebugString and Utf8DebugString TProtoStringType ShortUtf8DebugString(const google::protobuf::Message& msg); diff --git a/contrib/libs/protobuf/src/google/protobuf/reflection_ops.cc b/contrib/libs/protobuf/src/google/protobuf/reflection_ops.cc index 798e23a76a..3c30edaa6a 100644 --- a/contrib/libs/protobuf/src/google/protobuf/reflection_ops.cc +++ b/contrib/libs/protobuf/src/google/protobuf/reflection_ops.cc @@ -83,7 +83,7 @@ void ReflectionOps::Merge(const Message& from, Message* to) { bool is_to_generated = (to_reflection->GetMessageFactory() == google::protobuf::MessageFactory::generated_factory()); - std::vector<const FieldDescriptor*> fields; + std::vector<const FieldDescriptor*> fields; from_reflection->ListFieldsOmitStripped(from, &fields); for (const FieldDescriptor* field : fields) { if (field->is_repeated()) { @@ -176,7 +176,7 @@ void ReflectionOps::Merge(const Message& from, Message* to) { void ReflectionOps::Clear(Message* message) { const Reflection* reflection = GetReflectionOrDie(*message); - std::vector<const FieldDescriptor*> fields; + std::vector<const FieldDescriptor*> fields; reflection->ListFieldsOmitStripped(*message, &fields); for (const FieldDescriptor* field : fields) { reflection->ClearField(message, field); @@ -264,7 +264,7 @@ bool ReflectionOps::IsInitialized(const Message& message) { } // Check that sub-messages are initialized. - std::vector<const FieldDescriptor*> fields; + std::vector<const FieldDescriptor*> fields; // Should be safe to skip stripped fields because required fields are not // stripped. reflection->ListFieldsOmitStripped(message, &fields); @@ -324,7 +324,7 @@ void ReflectionOps::DiscardUnknownFields(Message* message) { // Walk through the fields of this message and DiscardUnknownFields on any // messages present. - std::vector<const FieldDescriptor*> fields; + std::vector<const FieldDescriptor*> fields; reflection->ListFields(*message, &fields); for (const FieldDescriptor* field : fields) { // Skip over non-message fields. @@ -395,7 +395,7 @@ void ReflectionOps::FindInitializationErrors(const Message& message, } // Check sub-messages. - std::vector<const FieldDescriptor*> fields; + std::vector<const FieldDescriptor*> fields; reflection->ListFieldsOmitStripped(message, &fields); for (const FieldDescriptor* field : fields) { if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { diff --git a/contrib/libs/protobuf/src/google/protobuf/repeated_field.h b/contrib/libs/protobuf/src/google/protobuf/repeated_field.h index 7f961c9209..cb9205a63a 100644 --- a/contrib/libs/protobuf/src/google/protobuf/repeated_field.h +++ b/contrib/libs/protobuf/src/google/protobuf/repeated_field.h @@ -652,7 +652,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { void Reserve(int new_size); - template<typename TypeHandler> + template<typename TypeHandler> void Truncate(int new_size) { GOOGLE_DCHECK_LE(new_size, current_size_); for (int i = new_size; i < current_size_; i++) { @@ -660,7 +660,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { } current_size_ = new_size; } - + int Capacity() const; template <typename TypeHandler> @@ -1000,7 +1000,7 @@ class RepeatedPtrField : private internal::RepeatedPtrFieldBase { void Truncate(int new_size) { return RepeatedPtrFieldBase::Truncate<TypeHandler>(new_size); } - + int Capacity() const; // Gets the underlying array. This pointer is possibly invalidated by diff --git a/contrib/libs/protobuf/src/google/protobuf/source_context.pb.h b/contrib/libs/protobuf/src/google/protobuf/source_context.pb.h index 2bd515da20..d90cb42cd1 100644 --- a/contrib/libs/protobuf/src/google/protobuf/source_context.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/source_context.pb.h @@ -184,12 +184,12 @@ class PROTOBUF_EXPORT SourceContext final : }; // string file_name = 1; void clear_file_name(); - const TProtoStringType& file_name() const; + const TProtoStringType& file_name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_file_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_file_name(); + TProtoStringType* mutable_file_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_file_name(); - void set_allocated_file_name(TProtoStringType* file_name); + void set_allocated_file_name(TProtoStringType* file_name); private: const TProtoStringType& _internal_file_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_file_name(const TProtoStringType& value); @@ -222,7 +222,7 @@ class PROTOBUF_EXPORT SourceContext final : inline void SourceContext::clear_file_name() { file_name_.ClearToEmpty(); } -inline const TProtoStringType& SourceContext::file_name() const { +inline const TProtoStringType& SourceContext::file_name() const { // @@protoc_insertion_point(field_get:google.protobuf.SourceContext.file_name) return _internal_file_name(); } @@ -249,11 +249,11 @@ inline TProtoStringType* SourceContext::_internal_mutable_file_name() { return file_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* SourceContext::release_file_name() { +inline TProtoStringType* SourceContext::release_file_name() { // @@protoc_insertion_point(field_release:google.protobuf.SourceContext.file_name) return file_name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void SourceContext::set_allocated_file_name(TProtoStringType* file_name) { +inline void SourceContext::set_allocated_file_name(TProtoStringType* file_name) { if (file_name != nullptr) { } else { diff --git a/contrib/libs/protobuf/src/google/protobuf/struct.pb.h b/contrib/libs/protobuf/src/google/protobuf/struct.pb.h index 36e93ec3da..3db06d3258 100644 --- a/contrib/libs/protobuf/src/google/protobuf/struct.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/struct.pb.h @@ -446,12 +446,12 @@ class PROTOBUF_EXPORT Value final : bool _internal_has_string_value() const; public: void clear_string_value(); - const TProtoStringType& string_value() const; + const TProtoStringType& string_value() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_string_value(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_string_value(); + TProtoStringType* mutable_string_value(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_string_value(); - void set_allocated_string_value(TProtoStringType* string_value); + void set_allocated_string_value(TProtoStringType* string_value); private: const TProtoStringType& _internal_string_value() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_string_value(const TProtoStringType& value); @@ -826,7 +826,7 @@ inline void Value::clear_string_value() { clear_has_kind(); } } -inline const TProtoStringType& Value::string_value() const { +inline const TProtoStringType& Value::string_value() const { // @@protoc_insertion_point(field_get:google.protobuf.Value.string_value) return _internal_string_value(); } @@ -868,7 +868,7 @@ inline TProtoStringType* Value::_internal_mutable_string_value() { return kind_.string_value_.Mutable( ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Value::release_string_value() { +inline TProtoStringType* Value::release_string_value() { // @@protoc_insertion_point(field_release:google.protobuf.Value.string_value) if (_internal_has_string_value()) { clear_has_kind(); @@ -877,7 +877,7 @@ inline TProtoStringType* Value::release_string_value() { return nullptr; } } -inline void Value::set_allocated_string_value(TProtoStringType* string_value) { +inline void Value::set_allocated_string_value(TProtoStringType* string_value) { if (has_kind()) { clear_kind(); } diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/common.cc b/contrib/libs/protobuf/src/google/protobuf/stubs/common.cc index 8d1c480214..1bf0618a79 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/common.cc +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/common.cc @@ -43,7 +43,7 @@ #define WIN32_LEAN_AND_MEAN // We only need minimal includes #endif #include <windows.h> -#define snprintf _snprintf // see comment in strutil.cc +#define snprintf _snprintf // see comment in strutil.cc #elif defined(HAVE_PTHREAD) #include <pthread.h> #else diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/common.h b/contrib/libs/protobuf/src/google/protobuf/stubs/common.h index b1661f695a..e4fae2d68e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/common.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/common.h @@ -198,11 +198,11 @@ using string = TProtoStringType; } // namespace protobuf } // namespace google -namespace NProtoBuf { - using namespace google; - using namespace google::protobuf; -}; - +namespace NProtoBuf { + using namespace google; + using namespace google::protobuf; +}; + #include <google/protobuf/port_undef.inc> #endif // GOOGLE_PROTOBUF_COMMON_H__ diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/int128.cc b/contrib/libs/protobuf/src/google/protobuf/stubs/int128.cc index 0d1c23a95a..f008ce8d26 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/int128.cc +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/int128.cc @@ -177,7 +177,7 @@ std::ostream& operator<<(std::ostream& o, const uint128& b) { if ((flags & std::ios::adjustfield) == std::ios::left) { rep.append(width - rep.size(), o.fill()); } else { - rep.insert(static_cast<TProtoStringType::size_type>(0), + rep.insert(static_cast<TProtoStringType::size_type>(0), width - rep.size(), o.fill()); } } diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/logging.h b/contrib/libs/protobuf/src/google/protobuf/stubs/logging.h index 48d0ff15ec..61a271434f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/logging.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/logging.h @@ -75,7 +75,7 @@ class PROTOBUF_EXPORT LogMessage { LogMessage(LogLevel level, const char* filename, int line); ~LogMessage(); - LogMessage& operator<<(const TProtoStringType& value); + LogMessage& operator<<(const TProtoStringType& value); LogMessage& operator<<(const char* value); LogMessage& operator<<(char value); LogMessage& operator<<(int value); @@ -97,7 +97,7 @@ class PROTOBUF_EXPORT LogMessage { LogLevel level_; const char* filename_; int line_; - TProtoStringType message_; + TProtoStringType message_; }; // Used to make the entire "LOG(BLAH) << etc." expression have a void return @@ -201,7 +201,7 @@ T* CheckNotNull(const char* /* file */, int /* line */, #endif // !NDEBUG typedef void LogHandler(LogLevel level, const char* filename, int line, - const TProtoStringType& message); + const TProtoStringType& message); // The protobuf library sometimes writes warning and error messages to // stderr. These messages are primarily useful for developers, but may diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/port.h b/contrib/libs/protobuf/src/google/protobuf/stubs/port.h index 9cb67f2aa1..bc0be2b828 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/port.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/port.h @@ -134,13 +134,13 @@ typedef unsigned int uint; typedef int8_t int8; typedef int16_t int16; -typedef i32 int32; -typedef i64 int64; +typedef i32 int32; +typedef i64 int64; typedef uint8_t uint8; typedef uint16_t uint16; -typedef ui32 uint32; -typedef ui64 uint64; +typedef ui32 uint32; +typedef ui64 uint64; static const int32 kint32max = 0x7FFFFFFF; static const int32 kint32min = -kint32max - 1; diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc b/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc index 477451f1e1..9cb53a08a8 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.cc @@ -1246,10 +1246,10 @@ char* DoubleToBuffer(double value, char* buffer) { // this assert. static_assert(DBL_DIG < 20, "DBL_DIG_is_too_big"); - if (value == std::numeric_limits<double>::infinity()) { + if (value == std::numeric_limits<double>::infinity()) { strcpy(buffer, "inf"); return buffer; - } else if (value == -std::numeric_limits<double>::infinity()) { + } else if (value == -std::numeric_limits<double>::infinity()) { strcpy(buffer, "-inf"); return buffer; } else if (std::isnan(value)) { @@ -1364,10 +1364,10 @@ char* FloatToBuffer(float value, char* buffer) { // this assert. static_assert(FLT_DIG < 10, "FLT_DIG_is_too_big"); - if (value == std::numeric_limits<double>::infinity()) { + if (value == std::numeric_limits<double>::infinity()) { strcpy(buffer, "inf"); return buffer; - } else if (value == -std::numeric_limits<double>::infinity()) { + } else if (value == -std::numeric_limits<double>::infinity()) { strcpy(buffer, "-inf"); return buffer; } else if (std::isnan(value)) { diff --git a/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.h b/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.h index 89e41d9883..06610ccfd6 100644 --- a/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.h +++ b/contrib/libs/protobuf/src/google/protobuf/stubs/strutil.h @@ -177,11 +177,11 @@ PROTOBUF_EXPORT void StripWhitespace(TProtoStringType* s); // ---------------------------------------------------------------------- inline void LowerString(TProtoStringType* s) { - s->to_lower(); + s->to_lower(); } inline void UpperString(TProtoStringType* s) { - s->to_upper(); + s->to_upper(); } inline void ToUpper(TProtoStringType* s) { UpperString(s); } diff --git a/contrib/libs/protobuf/src/google/protobuf/text_format.cc b/contrib/libs/protobuf/src/google/protobuf/text_format.cc index fadcd7e554..93a2ea8ed3 100644 --- a/contrib/libs/protobuf/src/google/protobuf/text_format.cc +++ b/contrib/libs/protobuf/src/google/protobuf/text_format.cc @@ -162,7 +162,7 @@ TextFormat::ParseLocation TextFormat::ParseInfoTree::GetLocation( index = 0; } - const std::vector<TextFormat::ParseLocation>* locations = + const std::vector<TextFormat::ParseLocation>* locations = FindOrNull(locations_, field); if (locations == nullptr || index >= static_cast<int64>(locations->size())) { return TextFormat::ParseLocation(); @@ -2110,7 +2110,7 @@ void TextFormat::Printer::Print(const Message& message, PrintAny(message, generator)) { return; } - std::vector<const FieldDescriptor*> fields; + std::vector<const FieldDescriptor*> fields; if (descriptor->options().map_entry()) { fields.push_back(descriptor->field(0)); fields.push_back(descriptor->field(1)); diff --git a/contrib/libs/protobuf/src/google/protobuf/text_format.h b/contrib/libs/protobuf/src/google/protobuf/text_format.h index 3a7e811ed8..0b70f0640a 100644 --- a/contrib/libs/protobuf/src/google/protobuf/text_format.h +++ b/contrib/libs/protobuf/src/google/protobuf/text_format.h @@ -596,7 +596,7 @@ class PROTOBUF_EXPORT TextFormat { // if possible. void AllowUnknownField(bool allow) { allow_unknown_field_ = allow; } - + void AllowFieldNumber(bool allow) { allow_field_number_ = allow; } // Sets maximum recursion depth which parser can use. This is effectively diff --git a/contrib/libs/protobuf/src/google/protobuf/type.pb.h b/contrib/libs/protobuf/src/google/protobuf/type.pb.h index 6b0a309467..a99c06d180 100644 --- a/contrib/libs/protobuf/src/google/protobuf/type.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/type.pb.h @@ -324,14 +324,14 @@ class PROTOBUF_EXPORT Type final : int _internal_oneofs_size() const; public: void clear_oneofs(); - const TProtoStringType& oneofs(int index) const; - TProtoStringType* mutable_oneofs(int index); - void set_oneofs(int index, const TProtoStringType& value); + const TProtoStringType& oneofs(int index) const; + TProtoStringType* mutable_oneofs(int index); + void set_oneofs(int index, const TProtoStringType& value); void set_oneofs(int index, TProtoStringType&& value); void set_oneofs(int index, const char* value); void set_oneofs(int index, const char* value, size_t size); - TProtoStringType* add_oneofs(); - void add_oneofs(const TProtoStringType& value); + TProtoStringType* add_oneofs(); + void add_oneofs(const TProtoStringType& value); void add_oneofs(TProtoStringType&& value); void add_oneofs(const char* value); void add_oneofs(const char* value, size_t size); @@ -663,12 +663,12 @@ class PROTOBUF_EXPORT Field final : // string name = 4; void clear_name(); - const TProtoStringType& name() const; + const TProtoStringType& name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_name(); + TProtoStringType* mutable_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); - void set_allocated_name(TProtoStringType* name); + void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const TProtoStringType& value); @@ -677,12 +677,12 @@ class PROTOBUF_EXPORT Field final : // string type_url = 6; void clear_type_url(); - const TProtoStringType& type_url() const; + const TProtoStringType& type_url() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_type_url(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_type_url(); + TProtoStringType* mutable_type_url(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_type_url(); - void set_allocated_type_url(TProtoStringType* type_url); + void set_allocated_type_url(TProtoStringType* type_url); private: const TProtoStringType& _internal_type_url() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_type_url(const TProtoStringType& value); @@ -691,12 +691,12 @@ class PROTOBUF_EXPORT Field final : // string json_name = 10; void clear_json_name(); - const TProtoStringType& json_name() const; + const TProtoStringType& json_name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_json_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_json_name(); + TProtoStringType* mutable_json_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_json_name(); - void set_allocated_json_name(TProtoStringType* json_name); + void set_allocated_json_name(TProtoStringType* json_name); private: const TProtoStringType& _internal_json_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_json_name(const TProtoStringType& value); @@ -705,12 +705,12 @@ class PROTOBUF_EXPORT Field final : // string default_value = 11; void clear_default_value(); - const TProtoStringType& default_value() const; + const TProtoStringType& default_value() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_default_value(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_default_value(); + TProtoStringType* mutable_default_value(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_default_value(); - void set_allocated_default_value(TProtoStringType* default_value); + void set_allocated_default_value(TProtoStringType* default_value); private: const TProtoStringType& _internal_default_value() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_default_value(const TProtoStringType& value); @@ -1138,12 +1138,12 @@ class PROTOBUF_EXPORT EnumValue final : // string name = 1; void clear_name(); - const TProtoStringType& name() const; + const TProtoStringType& name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_name(); + TProtoStringType* mutable_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); - void set_allocated_name(TProtoStringType* name); + void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const TProtoStringType& value); @@ -1294,12 +1294,12 @@ class PROTOBUF_EXPORT Option final : }; // string name = 1; void clear_name(); - const TProtoStringType& name() const; + const TProtoStringType& name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_name(); + TProtoStringType* mutable_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); - void set_allocated_name(TProtoStringType* name); + void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const TProtoStringType& value); @@ -1351,7 +1351,7 @@ class PROTOBUF_EXPORT Option final : inline void Type::clear_name() { name_.ClearToEmpty(); } -inline const TProtoStringType& Type::name() const { +inline const TProtoStringType& Type::name() const { // @@protoc_insertion_point(field_get:google.protobuf.Type.name) return _internal_name(); } @@ -1378,11 +1378,11 @@ inline TProtoStringType* Type::_internal_mutable_name() { return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Type::release_name() { +inline TProtoStringType* Type::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.Type.name) return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Type::set_allocated_name(TProtoStringType* name) { +inline void Type::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { } else { @@ -1451,15 +1451,15 @@ inline TProtoStringType* Type::add_oneofs() { inline const TProtoStringType& Type::_internal_oneofs(int index) const { return oneofs_.Get(index); } -inline const TProtoStringType& Type::oneofs(int index) const { +inline const TProtoStringType& Type::oneofs(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.Type.oneofs) return _internal_oneofs(index); } -inline TProtoStringType* Type::mutable_oneofs(int index) { +inline TProtoStringType* 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 TProtoStringType& value) { +inline void Type::set_oneofs(int index, const TProtoStringType& value) { oneofs_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set:google.protobuf.Type.oneofs) } @@ -1480,7 +1480,7 @@ inline void Type::set_oneofs(int index, const char* value, size_t size) { inline TProtoStringType* Type::_internal_add_oneofs() { return oneofs_.Add(); } -inline void Type::add_oneofs(const TProtoStringType& value) { +inline void Type::add_oneofs(const TProtoStringType& value) { oneofs_.Add()->assign(value); // @@protoc_insertion_point(field_add:google.protobuf.Type.oneofs) } @@ -1722,7 +1722,7 @@ inline void Field::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) { inline void Field::clear_name() { name_.ClearToEmpty(); } -inline const TProtoStringType& Field::name() const { +inline const TProtoStringType& Field::name() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.name) return _internal_name(); } @@ -1749,11 +1749,11 @@ inline TProtoStringType* Field::_internal_mutable_name() { return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Field::release_name() { +inline TProtoStringType* Field::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.Field.name) return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Field::set_allocated_name(TProtoStringType* name) { +inline void Field::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { } else { @@ -1768,7 +1768,7 @@ inline void Field::set_allocated_name(TProtoStringType* name) { inline void Field::clear_type_url() { type_url_.ClearToEmpty(); } -inline const TProtoStringType& Field::type_url() const { +inline const TProtoStringType& Field::type_url() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.type_url) return _internal_type_url(); } @@ -1795,11 +1795,11 @@ inline TProtoStringType* Field::_internal_mutable_type_url() { return type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Field::release_type_url() { +inline TProtoStringType* Field::release_type_url() { // @@protoc_insertion_point(field_release:google.protobuf.Field.type_url) return type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Field::set_allocated_type_url(TProtoStringType* type_url) { +inline void Field::set_allocated_type_url(TProtoStringType* type_url) { if (type_url != nullptr) { } else { @@ -1894,7 +1894,7 @@ Field::options() const { inline void Field::clear_json_name() { json_name_.ClearToEmpty(); } -inline const TProtoStringType& Field::json_name() const { +inline const TProtoStringType& Field::json_name() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.json_name) return _internal_json_name(); } @@ -1921,11 +1921,11 @@ inline TProtoStringType* Field::_internal_mutable_json_name() { return json_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Field::release_json_name() { +inline TProtoStringType* Field::release_json_name() { // @@protoc_insertion_point(field_release:google.protobuf.Field.json_name) return json_name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Field::set_allocated_json_name(TProtoStringType* json_name) { +inline void Field::set_allocated_json_name(TProtoStringType* json_name) { if (json_name != nullptr) { } else { @@ -1940,7 +1940,7 @@ inline void Field::set_allocated_json_name(TProtoStringType* json_name) { inline void Field::clear_default_value() { default_value_.ClearToEmpty(); } -inline const TProtoStringType& Field::default_value() const { +inline const TProtoStringType& Field::default_value() const { // @@protoc_insertion_point(field_get:google.protobuf.Field.default_value) return _internal_default_value(); } @@ -1967,11 +1967,11 @@ inline TProtoStringType* Field::_internal_mutable_default_value() { return default_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Field::release_default_value() { +inline TProtoStringType* Field::release_default_value() { // @@protoc_insertion_point(field_release:google.protobuf.Field.default_value) return default_value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Field::set_allocated_default_value(TProtoStringType* default_value) { +inline void Field::set_allocated_default_value(TProtoStringType* default_value) { if (default_value != nullptr) { } else { @@ -1990,7 +1990,7 @@ inline void Field::set_allocated_default_value(TProtoStringType* default_value) inline void Enum::clear_name() { name_.ClearToEmpty(); } -inline const TProtoStringType& Enum::name() const { +inline const TProtoStringType& Enum::name() const { // @@protoc_insertion_point(field_get:google.protobuf.Enum.name) return _internal_name(); } @@ -2017,11 +2017,11 @@ inline TProtoStringType* Enum::_internal_mutable_name() { return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Enum::release_name() { +inline TProtoStringType* Enum::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.Enum.name) return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Enum::set_allocated_name(TProtoStringType* name) { +inline void Enum::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { } else { @@ -2226,7 +2226,7 @@ inline void Enum::set_syntax(PROTOBUF_NAMESPACE_ID::Syntax value) { inline void EnumValue::clear_name() { name_.ClearToEmpty(); } -inline const TProtoStringType& EnumValue::name() const { +inline const TProtoStringType& EnumValue::name() const { // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.name) return _internal_name(); } @@ -2253,11 +2253,11 @@ inline TProtoStringType* EnumValue::_internal_mutable_name() { return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* EnumValue::release_name() { +inline TProtoStringType* EnumValue::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.EnumValue.name) return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void EnumValue::set_allocated_name(TProtoStringType* name) { +inline void EnumValue::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { } else { @@ -2336,7 +2336,7 @@ EnumValue::options() const { inline void Option::clear_name() { name_.ClearToEmpty(); } -inline const TProtoStringType& Option::name() const { +inline const TProtoStringType& Option::name() const { // @@protoc_insertion_point(field_get:google.protobuf.Option.name) return _internal_name(); } @@ -2363,11 +2363,11 @@ inline TProtoStringType* Option::_internal_mutable_name() { return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* Option::release_name() { +inline TProtoStringType* Option::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.Option.name) return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void Option::set_allocated_name(TProtoStringType* name) { +inline void Option::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { } else { diff --git a/contrib/libs/protobuf/src/google/protobuf/util/field_comparator.h b/contrib/libs/protobuf/src/google/protobuf/util/field_comparator.h index 1eb7abb9a4..434400eb45 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/field_comparator.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/field_comparator.h @@ -178,7 +178,7 @@ class PROTOBUF_EXPORT SimpleFieldComparator : public FieldComparator { }; // Defines the map to store the tolerances for floating point comparison. - typedef std::map<const FieldDescriptor*, Tolerance> ToleranceMap; + typedef std::map<const FieldDescriptor*, Tolerance> ToleranceMap; friend class MessageDifferencer; // The following methods get executed when CompareFields is called for the diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/proto_writer.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/proto_writer.cc index a03a77f031..9257b1081f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/proto_writer.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/proto_writer.cc @@ -346,7 +346,7 @@ ProtoWriter::ProtoElement* ProtoWriter::ProtoElement::pop() { if (!proto3_) { // Calls the registered error listener for any required field(s) not yet // seen. - for (std::set<const google::protobuf::Field*>::iterator it = + for (std::set<const google::protobuf::Field*>::iterator it = required_fields_.begin(); it != required_fields_.end(); ++it) { ow_->MissingField(ow_->use_json_name_in_missing_fields_ diff --git a/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info.cc b/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info.cc index e7915a9f3a..6a4ea2a768 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/internal/type_info.cc @@ -130,7 +130,7 @@ class TypeInfoForTypeResolver : public TypeInfo { typedef std::map<StringPiece, StringPiece> CamelCaseNameTable; template <typename T> - static void DeleteCachedTypes(std::map<StringPiece, T>* cached_types) { + static void DeleteCachedTypes(std::map<StringPiece, T>* cached_types) { for (typename std::map<StringPiece, T>::iterator it = cached_types->begin(); it != cached_types->end(); ++it) { @@ -164,8 +164,8 @@ class TypeInfoForTypeResolver : public TypeInfo { // cached_types_, cached_enums_. mutable std::set<TProtoStringType> string_storage_; - mutable std::map<StringPiece, StatusOrType> cached_types_; - mutable std::map<StringPiece, StatusOrEnum> cached_enums_; + mutable std::map<StringPiece, StatusOrType> cached_types_; + mutable std::map<StringPiece, StatusOrEnum> cached_enums_; mutable std::map<const google::protobuf::Type*, CamelCaseNameTable> indexed_types_; diff --git a/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc b/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc index 73aeee9a77..2573fcdc3d 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc +++ b/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.cc @@ -114,7 +114,7 @@ class MessageDifferencer::MultipleFieldsMapKeyComparator public: MultipleFieldsMapKeyComparator( MessageDifferencer* message_differencer, - const std::vector<std::vector<const FieldDescriptor*> >& key_field_paths) + const std::vector<std::vector<const FieldDescriptor*> >& key_field_paths) : message_differencer_(message_differencer), key_field_paths_(key_field_paths) { GOOGLE_CHECK(!key_field_paths_.empty()); @@ -125,7 +125,7 @@ class MessageDifferencer::MultipleFieldsMapKeyComparator MultipleFieldsMapKeyComparator(MessageDifferencer* message_differencer, const FieldDescriptor* key) : message_differencer_(message_differencer) { - std::vector<const FieldDescriptor*> key_field_path; + std::vector<const FieldDescriptor*> key_field_path; key_field_path.push_back(key); key_field_paths_.push_back(key_field_path); } @@ -142,11 +142,11 @@ class MessageDifferencer::MultipleFieldsMapKeyComparator private: bool IsMatchInternal( const Message& message1, const Message& message2, - const std::vector<SpecificField>& parent_fields, - const std::vector<const FieldDescriptor*>& key_field_path, + const std::vector<SpecificField>& parent_fields, + const std::vector<const FieldDescriptor*>& key_field_path, int path_index) const { const FieldDescriptor* field = key_field_path[path_index]; - std::vector<SpecificField> current_parent_fields(parent_fields); + std::vector<SpecificField> current_parent_fields(parent_fields); if (path_index == static_cast<int64_t>(key_field_path.size() - 1)) { if (field->is_map()) { return message_differencer_->CompareMapField(message1, message2, field, @@ -179,7 +179,7 @@ class MessageDifferencer::MultipleFieldsMapKeyComparator } } MessageDifferencer* message_differencer_; - std::vector<std::vector<const FieldDescriptor*> > key_field_paths_; + std::vector<std::vector<const FieldDescriptor*> > key_field_paths_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MultipleFieldsMapKeyComparator); }; @@ -383,10 +383,10 @@ void MessageDifferencer::TreatAsMap(const FieldDescriptor* field, void MessageDifferencer::TreatAsMapWithMultipleFieldsAsKey( const FieldDescriptor* field, - const std::vector<const FieldDescriptor*>& key_fields) { - std::vector<std::vector<const FieldDescriptor*> > key_field_paths; + const std::vector<const FieldDescriptor*>& key_fields) { + std::vector<std::vector<const FieldDescriptor*> > key_field_paths; for (const FieldDescriptor* key_filed : key_fields) { - std::vector<const FieldDescriptor*> key_field_path; + std::vector<const FieldDescriptor*> key_field_path; key_field_path.push_back(key_filed); key_field_paths.push_back(key_field_path); } @@ -395,7 +395,7 @@ void MessageDifferencer::TreatAsMapWithMultipleFieldsAsKey( void MessageDifferencer::TreatAsMapWithMultipleFieldPathsAsKey( const FieldDescriptor* field, - const std::vector<std::vector<const FieldDescriptor*> >& key_field_paths) { + const std::vector<std::vector<const FieldDescriptor*> >& key_field_paths) { GOOGLE_CHECK(field->is_repeated()) << "Field must be repeated: " << field->full_name(); GOOGLE_CHECK_EQ(FieldDescriptor::CPPTYPE_MESSAGE, field->cpp_type()) @@ -488,7 +488,7 @@ bool MessageDifferencer::FieldBefore(const FieldDescriptor* field1, bool MessageDifferencer::Compare(const Message& message1, const Message& message2) { - std::vector<SpecificField> parent_fields; + std::vector<SpecificField> parent_fields; bool result = false; // Setup the internal reporter if need be. @@ -507,15 +507,15 @@ bool MessageDifferencer::Compare(const Message& message1, bool MessageDifferencer::CompareWithFields( const Message& message1, const Message& message2, - const std::vector<const FieldDescriptor*>& message1_fields_arg, - const std::vector<const FieldDescriptor*>& message2_fields_arg) { + const std::vector<const FieldDescriptor*>& message1_fields_arg, + const std::vector<const FieldDescriptor*>& message2_fields_arg) { if (message1.GetDescriptor() != message2.GetDescriptor()) { GOOGLE_LOG(DFATAL) << "Comparison between two messages with different " << "descriptors."; return false; } - std::vector<SpecificField> parent_fields; + std::vector<SpecificField> parent_fields; bool result = false; @@ -638,7 +638,7 @@ bool MessageDifferencer::CompareRequestedFieldsUsingSettings( const Message& message1, const Message& message2, const FieldDescriptorArray& message1_fields, const FieldDescriptorArray& message2_fields, - std::vector<SpecificField>* parent_fields) { + std::vector<SpecificField>* parent_fields) { if (scope_ == FULL) { if (message_field_comparison_ == EQUIVALENT) { // We need to merge the field lists of both messages (i.e. @@ -714,7 +714,7 @@ bool MessageDifferencer::CompareWithFieldsInternal( const Message& message1, const Message& message2, const FieldDescriptorArray& message1_fields, const FieldDescriptorArray& message2_fields, - std::vector<SpecificField>* parent_fields) { + std::vector<SpecificField>* parent_fields) { bool isDifferent = false; int field_index1 = 0; int field_index2 = 0; @@ -877,7 +877,7 @@ bool MessageDifferencer::IsMatch( const MapKeyComparator* key_comparator, const Message* message1, const Message* message2, const std::vector<SpecificField>& parent_fields, Reporter* reporter, int index1, int index2) { - std::vector<SpecificField> current_parent_fields(parent_fields); + std::vector<SpecificField> current_parent_fields(parent_fields); if (repeated_field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) { return CompareFieldValueUsingParentFields(*message1, *message2, repeated_field, index1, index2, @@ -1009,7 +1009,7 @@ bool MessageDifferencer::CompareMapFieldByMapReflection( bool MessageDifferencer::CompareMapField( const Message& message1, const Message& message2, const FieldDescriptor* repeated_field, - std::vector<SpecificField>* parent_fields) { + std::vector<SpecificField>* parent_fields) { GOOGLE_DCHECK(repeated_field->is_map()); // the input FieldDescriptor is guaranteed to be repeated field. @@ -1080,8 +1080,8 @@ bool MessageDifferencer::CompareRepeatedRep( // These two list are used for store the index of the correspondent // element in peer repeated field. - std::vector<int> match_list1; - std::vector<int> match_list2; + std::vector<int> match_list1; + std::vector<int> match_list2; const MapKeyComparator* key_comparator = GetMapKeyComparator(repeated_field); bool smart_list = IsTreatedAsSmartList(repeated_field); @@ -1214,7 +1214,7 @@ bool MessageDifferencer::CompareFieldValue(const Message& message1, bool MessageDifferencer::CompareFieldValueUsingParentFields( const Message& message1, const Message& message2, const FieldDescriptor* field, int index1, int index2, - std::vector<SpecificField>* parent_fields) { + std::vector<SpecificField>* parent_fields) { FieldContext field_context(parent_fields); FieldComparator::ComparisonResult result = GetFieldComparisonResult( message1, message2, field, index1, index2, &field_context); @@ -1255,7 +1255,7 @@ bool MessageDifferencer::CompareFieldValueUsingParentFields( } bool MessageDifferencer::CheckPathChanged( - const std::vector<SpecificField>& field_path) { + const std::vector<SpecificField>& field_path) { for (const SpecificField& specific_field : field_path) { // Don't check indexes for map entries -- maps are unordered. if (specific_field.field != nullptr && specific_field.field->is_map()) @@ -1303,7 +1303,7 @@ bool MessageDifferencer::IsTreatedAsSubset(const FieldDescriptor* field) { bool MessageDifferencer::IsIgnored( const Message& message1, const Message& message2, const FieldDescriptor* field, - const std::vector<SpecificField>& parent_fields) { + const std::vector<SpecificField>& parent_fields) { if (ignored_fields_.find(field) != ignored_fields_.end()) { return true; } @@ -1346,7 +1346,7 @@ MessageDifferencer ::GetMapKeyComparator(const FieldDescriptor* field) const { namespace { -typedef std::pair<int, const UnknownField*> IndexUnknownFieldPair; +typedef std::pair<int, const UnknownField*> IndexUnknownFieldPair; struct UnknownFieldOrdering { inline bool operator()(const IndexUnknownFieldPair& a, @@ -1397,7 +1397,7 @@ bool MessageDifferencer::CompareUnknownFields( const Message& message1, const Message& message2, const UnknownFieldSet& unknown_field_set1, const UnknownFieldSet& unknown_field_set2, - std::vector<SpecificField>* parent_field) { + std::vector<SpecificField>* parent_field) { // Ignore unknown fields in EQUIVALENT mode. if (message_field_comparison_ == EQUIVALENT) return true; @@ -1413,8 +1413,8 @@ bool MessageDifferencer::CompareUnknownFields( // two sets -- that is, differing values for the same tag. We use // IndexUnknownFieldPairs to keep track of the field's original index for // reporting purposes. - std::vector<IndexUnknownFieldPair> fields1; // unknown_field_set1, sorted - std::vector<IndexUnknownFieldPair> fields2; // unknown_field_set2, sorted + std::vector<IndexUnknownFieldPair> fields1; // unknown_field_set1, sorted + std::vector<IndexUnknownFieldPair> fields2; // unknown_field_set2, sorted fields1.reserve(unknown_field_set1.field_count()); fields2.reserve(unknown_field_set2.field_count()); @@ -1623,7 +1623,7 @@ class MaximumMatcher { // the x-th node on the right side is matched to y-th node on the left side. // match_list1[i] == -1 means the node is not matched. Same with match_list2. MaximumMatcher(int count1, int count2, NodeMatchCallback callback, - std::vector<int>* match_list1, std::vector<int>* match_list2); + std::vector<int>* match_list1, std::vector<int>* match_list2); // Find a maximum match and return the number of matched node pairs. // If early_return is true, this method will return 0 immediately when it // finds that not all nodes on the left side can be matched. @@ -1636,21 +1636,21 @@ class MaximumMatcher { // Find an argumenting path starting from the node v on the left side. If a // path can be found, update match_list2_ to reflect the path and return // true. - bool FindArgumentPathDFS(int v, std::vector<bool>* visited); + bool FindArgumentPathDFS(int v, std::vector<bool>* visited); int count1_; int count2_; NodeMatchCallback match_callback_; - std::map<std::pair<int, int>, bool> cached_match_results_; - std::vector<int>* match_list1_; - std::vector<int>* match_list2_; + std::map<std::pair<int, int>, bool> cached_match_results_; + std::vector<int>* match_list1_; + std::vector<int>* match_list2_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MaximumMatcher); }; MaximumMatcher::MaximumMatcher(int count1, int count2, NodeMatchCallback callback, - std::vector<int>* match_list1, - std::vector<int>* match_list2) + std::vector<int>* match_list1, + std::vector<int>* match_list2) : count1_(count1), count2_(count2), match_callback_(std::move(callback)), @@ -1663,7 +1663,7 @@ MaximumMatcher::MaximumMatcher(int count1, int count2, int MaximumMatcher::FindMaximumMatch(bool early_return) { int result = 0; for (int i = 0; i < count1_; ++i) { - std::vector<bool> visited(count1_); + std::vector<bool> visited(count1_); if (FindArgumentPathDFS(i, &visited)) { ++result; } else if (early_return) { @@ -1681,7 +1681,7 @@ int MaximumMatcher::FindMaximumMatch(bool early_return) { } bool MaximumMatcher::Match(int left, int right) { - std::pair<int, int> p(left, right); + std::pair<int, int> p(left, right); std::map<std::pair<int, int>, bool>::iterator it = cached_match_results_.find(p); if (it != cached_match_results_.end()) { @@ -1691,7 +1691,7 @@ bool MaximumMatcher::Match(int left, int right) { return cached_match_results_[p]; } -bool MaximumMatcher::FindArgumentPathDFS(int v, std::vector<bool>* visited) { +bool MaximumMatcher::FindArgumentPathDFS(int v, std::vector<bool>* visited) { (*visited)[v] = true; // We try to match those un-matched nodes on the right side first. This is // the step that the naive greedy matching algorithm uses. In the best cases @@ -1727,7 +1727,7 @@ bool MessageDifferencer::MatchRepeatedFieldIndices( const Message& message1, const Message& message2, const FieldDescriptor* repeated_field, const MapKeyComparator* key_comparator, - const std::vector<SpecificField>& parent_fields, + const std::vector<SpecificField>& parent_fields, std::vector<int>* match_list1, std::vector<int>* match_list2) { const int count1 = message1.GetReflection()->FieldSize(message1, repeated_field); @@ -1909,7 +1909,7 @@ MessageDifferencer::StreamReporter::~StreamReporter() { } void MessageDifferencer::StreamReporter::PrintPath( - const std::vector<SpecificField>& field_path, bool left_side) { + const std::vector<SpecificField>& field_path, bool left_side) { for (size_t i = 0; i < field_path.size(); ++i) { SpecificField specific_field = field_path[i]; @@ -2114,7 +2114,7 @@ void MessageDifferencer::StreamReporter::PrintMapKey( void MessageDifferencer::StreamReporter::ReportAdded( const Message& message1, const Message& message2, - const std::vector<SpecificField>& field_path) { + const std::vector<SpecificField>& field_path) { printer_->Print("added: "); PrintPath(field_path, false); printer_->Print(": "); @@ -2124,7 +2124,7 @@ void MessageDifferencer::StreamReporter::ReportAdded( void MessageDifferencer::StreamReporter::ReportDeleted( const Message& message1, const Message& message2, - const std::vector<SpecificField>& field_path) { + const std::vector<SpecificField>& field_path) { printer_->Print("deleted: "); PrintPath(field_path, true); printer_->Print(": "); @@ -2134,7 +2134,7 @@ void MessageDifferencer::StreamReporter::ReportDeleted( void MessageDifferencer::StreamReporter::ReportModified( const Message& message1, const Message& message2, - const std::vector<SpecificField>& field_path) { + const std::vector<SpecificField>& field_path) { if (!report_modified_aggregates_ && field_path.back().field == NULL) { if (field_path.back().unknown_field_type == UnknownField::TYPE_GROUP) { // Any changes to the subfields have already been printed. @@ -2163,7 +2163,7 @@ void MessageDifferencer::StreamReporter::ReportModified( void MessageDifferencer::StreamReporter::ReportMoved( const Message& message1, const Message& message2, - const std::vector<SpecificField>& field_path) { + const std::vector<SpecificField>& field_path) { printer_->Print("moved: "); PrintPath(field_path, true); printer_->Print(" -> "); @@ -2175,7 +2175,7 @@ void MessageDifferencer::StreamReporter::ReportMoved( void MessageDifferencer::StreamReporter::ReportMatched( const Message& message1, const Message& message2, - const std::vector<SpecificField>& field_path) { + const std::vector<SpecificField>& field_path) { printer_->Print("matched: "); PrintPath(field_path, true); if (CheckPathChanged(field_path)) { @@ -2189,7 +2189,7 @@ void MessageDifferencer::StreamReporter::ReportMatched( void MessageDifferencer::StreamReporter::ReportIgnored( const Message& message1, const Message& message2, - const std::vector<SpecificField>& field_path) { + const std::vector<SpecificField>& field_path) { printer_->Print("ignored: "); PrintPath(field_path, true); if (CheckPathChanged(field_path)) { @@ -2207,7 +2207,7 @@ void MessageDifferencer::StreamReporter::SetMessages(const Message& message1, void MessageDifferencer::StreamReporter::ReportUnknownFieldIgnored( const Message& message1, const Message& message2, - const std::vector<SpecificField>& field_path) { + const std::vector<SpecificField>& field_path) { printer_->Print("ignored: "); PrintPath(field_path, true); if (CheckPathChanged(field_path)) { diff --git a/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.h b/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.h index ac1d6f41b5..b68c24b7de 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/message_differencer.h @@ -256,12 +256,12 @@ class PROTOBUF_EXPORT MessageDifferencer { // Reports that a field has been deleted from Message1. virtual void ReportDeleted( const Message& message1, const Message& message2, - const std::vector<SpecificField>& field_path) = 0; + const std::vector<SpecificField>& field_path) = 0; // Reports that the value of a field has been modified. virtual void ReportModified( const Message& message1, const Message& message2, - const std::vector<SpecificField>& field_path) = 0; + const std::vector<SpecificField>& field_path) = 0; // Reports that a repeated field has been moved to another location. This // only applies when using TreatAsSet or TreatAsMap() -- see below. Also @@ -477,7 +477,7 @@ class PROTOBUF_EXPORT MessageDifferencer { // size of each element. void TreatAsMapWithMultipleFieldsAsKey( const FieldDescriptor* field, - const std::vector<const FieldDescriptor*>& key_fields); + const std::vector<const FieldDescriptor*>& key_fields); // Same as TreatAsMapWithMultipleFieldsAsKey, except that each of the field // do not necessarily need to be a direct subfield. Each element in // key_field_paths indicate a path from the message being compared, listing @@ -493,7 +493,7 @@ class PROTOBUF_EXPORT MessageDifferencer { // !key_field_path[i]->is_repeated() void TreatAsMapWithMultipleFieldPathsAsKey( const FieldDescriptor* field, - const std::vector<std::vector<const FieldDescriptor*> >& key_field_paths); + const std::vector<std::vector<const FieldDescriptor*> >& key_field_paths); // Uses a custom MapKeyComparator to determine if two elements have the same // key when comparing a repeated field as a map. @@ -677,7 +677,7 @@ class PROTOBUF_EXPORT MessageDifferencer { protected: // Prints the specified path of fields to the buffer. - virtual void PrintPath(const std::vector<SpecificField>& field_path, + virtual void PrintPath(const std::vector<SpecificField>& field_path, bool left_side); // Prints the value of fields to the buffer. left_side is true if the @@ -686,7 +686,7 @@ class PROTOBUF_EXPORT MessageDifferencer { // unknown_field_index1 or unknown_field_index2 when an unknown field // is encountered in field_path. virtual void PrintValue(const Message& message, - const std::vector<SpecificField>& field_path, + const std::vector<SpecificField>& field_path, bool left_side); // Prints the specified path of unknown fields to the buffer. @@ -754,12 +754,12 @@ class PROTOBUF_EXPORT MessageDifferencer { // (i.e. if the current message is an embedded message, the parent_fields // vector will contain the field that has this embedded message). bool Compare(const Message& message1, const Message& message2, - std::vector<SpecificField>* parent_fields); + std::vector<SpecificField>* parent_fields); // Compares all the unknown fields in two messages. bool CompareUnknownFields(const Message& message1, const Message& message2, const UnknownFieldSet&, const UnknownFieldSet&, - std::vector<SpecificField>* parent_fields); + std::vector<SpecificField>* parent_fields); // Compares the specified messages for the requested field lists. The field // lists are modified depending on comparison settings, and then passed to @@ -768,7 +768,7 @@ class PROTOBUF_EXPORT MessageDifferencer { const Message& message1, const Message& message2, const FieldDescriptorArray& message1_fields, const FieldDescriptorArray& message2_fields, - std::vector<SpecificField>* parent_fields); + std::vector<SpecificField>* parent_fields); // Compares the specified messages with the specified field lists. bool CompareWithFieldsInternal(const Message& message1, @@ -780,7 +780,7 @@ class PROTOBUF_EXPORT MessageDifferencer { // Compares the repeated fields, and report the error. bool CompareRepeatedField(const Message& message1, const Message& message2, const FieldDescriptor* field, - std::vector<SpecificField>* parent_fields); + std::vector<SpecificField>* parent_fields); // Compares map fields, and report the error. bool CompareMapField(const Message& message1, const Message& message2, @@ -833,7 +833,7 @@ class PROTOBUF_EXPORT MessageDifferencer { bool IsMatch(const FieldDescriptor* repeated_field, const MapKeyComparator* key_comparator, const Message* message1, const Message* message2, - const std::vector<SpecificField>& parent_fields, + const std::vector<SpecificField>& parent_fields, Reporter* reporter, int index1, int index2); // Returns true when this repeated field has been configured to be treated @@ -864,7 +864,7 @@ class PROTOBUF_EXPORT MessageDifferencer { // MessageDifferencer compares messages. bool IsUnknownFieldIgnored(const Message& message1, const Message& message2, const SpecificField& field, - const std::vector<SpecificField>& parent_fields); + const std::vector<SpecificField>& parent_fields); // Returns MapKeyComparator* when this field has been configured to be treated // as a map or its is_map() return true. If not, returns NULL. @@ -887,7 +887,7 @@ class PROTOBUF_EXPORT MessageDifferencer { std::vector<int>* match_list1, std::vector<int>* match_list2); // Checks if index is equal to new_index in all the specific fields. - static bool CheckPathChanged(const std::vector<SpecificField>& parent_fields); + static bool CheckPathChanged(const std::vector<SpecificField>& parent_fields); // CHECKs that the given repeated field can be compared according to // new_comparison. @@ -902,7 +902,7 @@ class PROTOBUF_EXPORT MessageDifferencer { // Defines a set to store field descriptors. Used for repeated fields when // they are configured as TreatAsSet. - typedef std::set<const FieldDescriptor*> FieldSet; + typedef std::set<const FieldDescriptor*> FieldSet; typedef std::map<const FieldDescriptor*, RepeatedFieldComparison> FieldMap; Reporter* reporter_; @@ -918,10 +918,10 @@ class PROTOBUF_EXPORT MessageDifferencer { // When TreatAsMap or TreatAsMapWithMultipleFieldsAsKey is called, we don't // store the supplied FieldDescriptors directly. Instead, a new // MapKeyComparator is created for comparison purpose. - std::vector<MapKeyComparator*> owned_key_comparators_; + std::vector<MapKeyComparator*> owned_key_comparators_; FieldKeyComparatorMap map_field_key_comparator_; MapEntryKeyComparator map_entry_key_comparator_; - std::vector<IgnoreCriteria*> ignore_criteria_; + std::vector<IgnoreCriteria*> ignore_criteria_; // Reused multiple times in RetrieveFields to avoid extra allocations std::vector<const FieldDescriptor*> tmp_message_fields_; @@ -952,15 +952,15 @@ class PROTOBUF_EXPORT MessageDifferencer { class PROTOBUF_EXPORT FieldContext { public: explicit FieldContext( - std::vector<MessageDifferencer::SpecificField>* parent_fields) + std::vector<MessageDifferencer::SpecificField>* parent_fields) : parent_fields_(parent_fields) {} - std::vector<MessageDifferencer::SpecificField>* parent_fields() const { + std::vector<MessageDifferencer::SpecificField>* parent_fields() const { return parent_fields_; } private: - std::vector<MessageDifferencer::SpecificField>* parent_fields_; + std::vector<MessageDifferencer::SpecificField>* parent_fields_; }; } // namespace util diff --git a/contrib/libs/protobuf/src/google/protobuf/util/time_util.h b/contrib/libs/protobuf/src/google/protobuf/util/time_util.h index 8b5296daea..0a297e9e64 100644 --- a/contrib/libs/protobuf/src/google/protobuf/util/time_util.h +++ b/contrib/libs/protobuf/src/google/protobuf/util/time_util.h @@ -251,7 +251,7 @@ inline Duration operator%(const Duration& d1, const Duration& d2) { return result %= d2; } -inline std::ostream& operator<<(std::ostream& out, const Duration& d) { +inline std::ostream& operator<<(std::ostream& out, const Duration& d) { out << ::PROTOBUF_NAMESPACE_ID::util::TimeUtil::ToString(d); return out; } @@ -300,7 +300,7 @@ inline Timestamp operator-(const Timestamp& t, const Duration& d) { } PROTOBUF_EXPORT Duration operator-(const Timestamp& t1, const Timestamp& t2); -inline std::ostream& operator<<(std::ostream& out, const Timestamp& t) { +inline std::ostream& operator<<(std::ostream& out, const Timestamp& t) { out << ::PROTOBUF_NAMESPACE_ID::util::TimeUtil::ToString(t); return out; } diff --git a/contrib/libs/protobuf/src/google/protobuf/wire_format.cc b/contrib/libs/protobuf/src/google/protobuf/wire_format.cc index 9a883f8e5b..cb0b32465f 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format.cc +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format.cc @@ -1035,7 +1035,7 @@ uint8* WireFormat::_InternalSerialize(const Message& message, uint8* target, const Descriptor* descriptor = message.GetDescriptor(); const Reflection* message_reflection = message.GetReflection(); - std::vector<const FieldDescriptor*> fields; + std::vector<const FieldDescriptor*> fields; // Fields of map entry should always be serialized. if (descriptor->options().map_entry()) { @@ -1449,7 +1449,7 @@ size_t WireFormat::ByteSize(const Message& message) { size_t our_size = 0; - std::vector<const FieldDescriptor*> fields; + std::vector<const FieldDescriptor*> fields; // Fields of map entry should always be serialized. if (descriptor->options().map_entry()) { diff --git a/contrib/libs/protobuf/src/google/protobuf/wire_format.h b/contrib/libs/protobuf/src/google/protobuf/wire_format.h index e65f914b61..d4ffbdfd7b 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format.h +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format.h @@ -372,8 +372,8 @@ inline void WireFormat::VerifyUTF8StringNamedField(const char* data, int size, #ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED WireFormatLite::VerifyUtf8String( data, size, static_cast<WireFormatLite::Operation>(op), field_name); -#else - // Avoid the compiler warning about unused variables. +#else + // Avoid the compiler warning about unused variables. (void)data; (void)size; (void)op; diff --git a/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc b/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc index 07ffb7539d..ed82bdd48e 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc +++ b/contrib/libs/protobuf/src/google/protobuf/wire_format_lite.cc @@ -562,7 +562,7 @@ bool WireFormatLite::ReadBytes(io::CodedInputStream* input, bool WireFormatLite::ReadBytes(io::CodedInputStream* input, TProtoStringType** p) { if (*p == &GetEmptyStringAlreadyInited()) { - *p = new TProtoStringType(); + *p = new TProtoStringType(); } return ReadBytesToString(input, *p); } diff --git a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h index 0673f8fca2..81e9349c07 100644 --- a/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h +++ b/contrib/libs/protobuf/src/google/protobuf/wrappers.pb.h @@ -1189,12 +1189,12 @@ class PROTOBUF_EXPORT StringValue final : }; // string value = 1; void clear_value(); - const TProtoStringType& value() const; + const TProtoStringType& value() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_value(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_value(); + TProtoStringType* mutable_value(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_value(); - void set_allocated_value(TProtoStringType* value); + void set_allocated_value(TProtoStringType* value); private: const TProtoStringType& _internal_value() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_value(const TProtoStringType& value); @@ -1333,12 +1333,12 @@ class PROTOBUF_EXPORT BytesValue final : }; // bytes value = 1; void clear_value(); - const TProtoStringType& value() const; + const TProtoStringType& value() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_value(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_value(); + TProtoStringType* mutable_value(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_value(); - void set_allocated_value(TProtoStringType* value); + void set_allocated_value(TProtoStringType* value); private: const TProtoStringType& _internal_value() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_value(const TProtoStringType& value); @@ -1539,7 +1539,7 @@ inline void BoolValue::set_value(bool value) { inline void StringValue::clear_value() { value_.ClearToEmpty(); } -inline const TProtoStringType& StringValue::value() const { +inline const TProtoStringType& StringValue::value() const { // @@protoc_insertion_point(field_get:google.protobuf.StringValue.value) return _internal_value(); } @@ -1566,11 +1566,11 @@ inline TProtoStringType* StringValue::_internal_mutable_value() { return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* StringValue::release_value() { +inline TProtoStringType* StringValue::release_value() { // @@protoc_insertion_point(field_release:google.protobuf.StringValue.value) return value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void StringValue::set_allocated_value(TProtoStringType* value) { +inline void StringValue::set_allocated_value(TProtoStringType* value) { if (value != nullptr) { } else { @@ -1589,7 +1589,7 @@ inline void StringValue::set_allocated_value(TProtoStringType* value) { inline void BytesValue::clear_value() { value_.ClearToEmpty(); } -inline const TProtoStringType& BytesValue::value() const { +inline const TProtoStringType& BytesValue::value() const { // @@protoc_insertion_point(field_get:google.protobuf.BytesValue.value) return _internal_value(); } @@ -1616,11 +1616,11 @@ inline TProtoStringType* BytesValue::_internal_mutable_value() { return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* BytesValue::release_value() { +inline TProtoStringType* BytesValue::release_value() { // @@protoc_insertion_point(field_release:google.protobuf.BytesValue.value) return value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void BytesValue::set_allocated_value(TProtoStringType* value) { +inline void BytesValue::set_allocated_value(TProtoStringType* value) { if (value != nullptr) { } else { diff --git a/contrib/libs/protobuf/ya.make b/contrib/libs/protobuf/ya.make index 2bac6fafb0..044e24badd 100644 --- a/contrib/libs/protobuf/ya.make +++ b/contrib/libs/protobuf/ya.make @@ -1,7 +1,7 @@ # Generated by devtools/yamaker from nixpkgs 21.11. -LIBRARY() - +LIBRARY() + PROVIDES(protobuf) OWNER( @@ -10,7 +10,7 @@ OWNER( ) VERSION(3.17.3) - + ORIGINAL_SOURCE(https://github.com/protocolbuffers/protobuf/archive/v3.17.3.tar.gz) LICENSE( @@ -30,9 +30,9 @@ ADDINCL( proto contrib/libs/protobuf/src ) - + NO_COMPILER_WARNINGS() - + CFLAGS( -DHAVE_CONFIG_H -DHAVE_PTHREAD=1 @@ -43,7 +43,7 @@ IF (OS_ANDROID) EXTRALIBS(log) ENDIF() -SRCS( +SRCS( GLOBAL src/google/protobuf/generated_message_util.cc src/google/protobuf/any.cc src/google/protobuf/any.pb.cc @@ -126,8 +126,8 @@ SRCS( src/google/protobuf/wire_format.cc src/google/protobuf/wire_format_lite.cc src/google/protobuf/wrappers.pb.cc -) - +) + FILES( src/google/protobuf/any.proto src/google/protobuf/api.proto @@ -142,7 +142,7 @@ FILES( src/google/protobuf/wrappers.proto ) -END() +END() RECURSE( builtin_proto diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/code_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/code_generator.cc index 46e21d9ef0..9ad4d14ef1 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/code_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/code_generator.cc @@ -92,7 +92,7 @@ io::ZeroCopyOutputStream* GeneratorContext::OpenForInsertWithGeneratedCodeInfo( } void GeneratorContext::ListParsedFiles( - std::vector<const FileDescriptor*>* output) { + std::vector<const FileDescriptor*>* output) { GOOGLE_LOG(FATAL) << "This GeneratorContext does not support ListParsedFiles"; } diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/code_generator.h b/contrib/libs/protoc/src/google/protobuf/compiler/code_generator.h index faad9e502f..03f93c49f9 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/code_generator.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/code_generator.h @@ -169,7 +169,7 @@ class PROTOC_EXPORT GeneratorContext { // Returns a vector of FileDescriptors for all the files being compiled // in this run. Useful for languages, such as Go, that treat files // differently when compiled as a set rather than individually. - virtual void ListParsedFiles(std::vector<const FileDescriptor*>* output); + virtual void ListParsedFiles(std::vector<const FileDescriptor*>* output); // Retrieves the version number of the protocol compiler associated with // this GeneratorContext. diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.cc b/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.cc index 2bfff73740..7663ea0085 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.cc @@ -382,7 +382,7 @@ class CommandLineInterface::ErrorPrinter // them all to disk on demand. class CommandLineInterface::GeneratorContextImpl : public GeneratorContext { public: - GeneratorContextImpl(const std::vector<const FileDescriptor*>& parsed_files); + GeneratorContextImpl(const std::vector<const FileDescriptor*>& parsed_files); // Write all files in the directory to disk at the given output location, // which must end in a '/'. @@ -407,7 +407,7 @@ class CommandLineInterface::GeneratorContextImpl : public GeneratorContext { io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo( const TProtoStringType& filename, const TProtoStringType& insertion_point, const google::protobuf::GeneratedCodeInfo& info); - void ListParsedFiles(std::vector<const FileDescriptor*>* output) { + void ListParsedFiles(std::vector<const FileDescriptor*>* output) { *output = parsed_files_; } @@ -418,7 +418,7 @@ class CommandLineInterface::GeneratorContextImpl : public GeneratorContext { // instead of an unordered_map so that files are written in order (good when // writing zips). std::map<TProtoStringType, TProtoStringType> files_; - const std::vector<const FileDescriptor*>& parsed_files_; + const std::vector<const FileDescriptor*>& parsed_files_; bool had_error_; }; @@ -483,7 +483,7 @@ class CommandLineInterface::MemoryOutputStream // ------------------------------------------------------------------- CommandLineInterface::GeneratorContextImpl::GeneratorContextImpl( - const std::vector<const FileDescriptor*>& parsed_files) + const std::vector<const FileDescriptor*>& parsed_files) : parsed_files_(parsed_files), had_error_(false) {} bool CommandLineInterface::GeneratorContextImpl::WriteAllToDisk( @@ -2171,7 +2171,7 @@ bool CommandLineInterface::EnforceProto3OptionalSupport( } bool CommandLineInterface::GenerateOutput( - const std::vector<const FileDescriptor*>& parsed_files, + const std::vector<const FileDescriptor*>& parsed_files, const OutputDirective& output_directive, GeneratorContext* generator_context) { // Call the generator. @@ -2222,12 +2222,12 @@ bool CommandLineInterface::GenerateOutput( } bool CommandLineInterface::GenerateDependencyManifestFile( - const std::vector<const FileDescriptor*>& parsed_files, + const std::vector<const FileDescriptor*>& parsed_files, const GeneratorContextMap& output_directories, DiskSourceTree* source_tree) { FileDescriptorSet file_set; - std::set<const FileDescriptor*> already_seen; + std::set<const FileDescriptor*> already_seen; for (int i = 0; i < parsed_files.size(); i++) { GetTransitiveDependencies(parsed_files[i], false, false, &already_seen, file_set.mutable_file()); @@ -2290,7 +2290,7 @@ bool CommandLineInterface::GenerateDependencyManifestFile( } bool CommandLineInterface::GeneratePluginOutput( - const std::vector<const FileDescriptor*>& parsed_files, + const std::vector<const FileDescriptor*>& parsed_files, const TProtoStringType& plugin_name, const TProtoStringType& parameter, GeneratorContext* generator_context, TProtoStringType* error) { CodeGeneratorRequest request; @@ -2304,7 +2304,7 @@ bool CommandLineInterface::GeneratePluginOutput( } - std::set<const FileDescriptor*> already_seen; + std::set<const FileDescriptor*> already_seen; for (int i = 0; i < parsed_files.size(); i++) { request.add_file_to_generate(parsed_files[i]->name()); GetTransitiveDependencies(parsed_files[i], @@ -2541,7 +2541,7 @@ bool CommandLineInterface::WriteDescriptorSet( void CommandLineInterface::GetTransitiveDependencies( const FileDescriptor* file, bool include_json_name, bool include_source_code_info, - std::set<const FileDescriptor*>* already_seen, + std::set<const FileDescriptor*>* already_seen, RepeatedPtrField<FileDescriptorProto>* output) { if (!already_seen->insert(file).second) { // Already saw this file. Skip. @@ -2598,11 +2598,11 @@ namespace { // parameter will contain the direct children (when groups are ignored in the // tree) of the given descriptor for the caller to traverse. The declaration // order of the nested messages is also preserved. -typedef std::pair<int, int> FieldRange; +typedef std::pair<int, int> FieldRange; void GatherOccupiedFieldRanges( const Descriptor* descriptor, std::set<FieldRange>* ranges, std::vector<const Descriptor*>* nested_messages) { - std::set<const Descriptor*> groups; + std::set<const Descriptor*> groups; for (int i = 0; i < descriptor->field_count(); ++i) { const FieldDescriptor* fd = descriptor->field(i); ranges->insert(FieldRange(fd->number(), fd->number() + 1)); @@ -2634,11 +2634,11 @@ void GatherOccupiedFieldRanges( // Actually prints the formatted free field numbers for given message name and // occupied ranges. void FormatFreeFieldNumbers(const TProtoStringType& name, - const std::set<FieldRange>& ranges) { + const std::set<FieldRange>& ranges) { TProtoStringType output; StringAppendF(&output, "%-35s free:", name.c_str()); int next_free_number = 1; - for (std::set<FieldRange>::const_iterator i = ranges.begin(); + for (std::set<FieldRange>::const_iterator i = ranges.begin(); i != ranges.end(); ++i) { // This happens when groups re-use parent field numbers, in which // case we skip the FieldRange entirely. @@ -2664,8 +2664,8 @@ void FormatFreeFieldNumbers(const TProtoStringType& name, } // namespace void CommandLineInterface::PrintFreeFieldNumbers(const Descriptor* descriptor) { - std::set<FieldRange> ranges; - std::vector<const Descriptor*> nested_messages; + std::set<FieldRange> ranges; + std::vector<const Descriptor*> nested_messages; GatherOccupiedFieldRanges(descriptor, &ranges, &nested_messages); for (int i = 0; i < nested_messages.size(); ++i) { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.h b/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.h index 3e37a17001..337475c693 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/command_line_interface.h @@ -283,7 +283,7 @@ class PROTOC_EXPORT CommandLineInterface { // Generate the given output file from the given input. struct OutputDirective; // see below - bool GenerateOutput(const std::vector<const FileDescriptor*>& parsed_files, + bool GenerateOutput(const std::vector<const FileDescriptor*>& parsed_files, const OutputDirective& output_directive, GeneratorContext* generator_context); bool GeneratePluginOutput( @@ -300,7 +300,7 @@ class PROTOC_EXPORT CommandLineInterface { // Implements the --dependency_out option bool GenerateDependencyManifestFile( - const std::vector<const FileDescriptor*>& parsed_files, + const std::vector<const FileDescriptor*>& parsed_files, const GeneratorContextMap& output_directories, DiskSourceTree* source_tree); @@ -316,7 +316,7 @@ class PROTOC_EXPORT CommandLineInterface { static void GetTransitiveDependencies( const FileDescriptor* file, bool include_json_name, bool include_source_code_info, - std::set<const FileDescriptor*>* already_seen, + std::set<const FileDescriptor*>* already_seen, RepeatedPtrField<FileDescriptorProto>* output); // Implements the --print_free_field_numbers. This function prints free field @@ -422,7 +422,7 @@ class PROTOC_EXPORT CommandLineInterface { TProtoStringType parameter; TProtoStringType output_location; }; - std::vector<OutputDirective> output_directives_; + std::vector<OutputDirective> output_directives_; // When using --encode or --decode, this names the type we are encoding or // decoding. (Empty string indicates --decode_raw.) diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum.cc index 502d4892c9..e0c80fc1c6 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_enum.cc @@ -286,7 +286,7 @@ void EnumGenerator::GenerateMethods(int idx, io::Printer* printer) { // each number once by first constructing a set containing all valid // numbers, then printing a case statement for each element. - std::set<int> numbers; + std::set<int> numbers; for (int j = 0; j < descriptor_->value_count(); j++) { const EnumValueDescriptor* value = descriptor_->value(j); numbers.insert(value->number()); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc index cf45409156..0f9660d237 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_helpers.cc @@ -688,9 +688,9 @@ TProtoStringType DefaultValue(const Options& options, const FieldDescriptor* fie return UInt64ToString(field->default_value_uint64()); case FieldDescriptor::CPPTYPE_DOUBLE: { double value = field->default_value_double(); - if (value == std::numeric_limits<double>::infinity()) { + if (value == std::numeric_limits<double>::infinity()) { return "std::numeric_limits<double>::infinity()"; - } else if (value == -std::numeric_limits<double>::infinity()) { + } else if (value == -std::numeric_limits<double>::infinity()) { return "-std::numeric_limits<double>::infinity()"; } else if (value != value) { return "std::numeric_limits<double>::quiet_NaN()"; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message.cc b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message.cc index 0f3fdefc6a..cb890d5156 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -3580,7 +3580,7 @@ void MessageGenerator::GenerateSerializeWithCachedSizesBody( std::vector<const FieldDescriptor*> ordered_fields = SortFieldsByNumber(descriptor_); - std::vector<const Descriptor::ExtensionRange*> sorted_extensions; + std::vector<const Descriptor::ExtensionRange*> sorted_extensions; sorted_extensions.reserve(descriptor_->extension_range_count()); for (int i = 0; i < descriptor_->extension_range_count(); ++i) { sorted_extensions.push_back(descriptor_->extension_range(i)); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/importer.h b/contrib/libs/protoc/src/google/protobuf/compiler/importer.h index 8da9b4ba14..f38fcf2d67 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/importer.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/importer.h @@ -313,7 +313,7 @@ class PROTOBUF_EXPORT DiskSourceTree : public SourceTree { const TProtoStringType& disk_path_param) : virtual_path(virtual_path_param), disk_path(disk_path_param) {} }; - std::vector<Mapping> mappings_; + std::vector<Mapping> mappings_; TProtoStringType last_error_message_; // Like Open(), but returns the on-disk path in disk_file if disk_file is diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_context.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_context.cc index 73e7053e87..3403cfca2c 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_context.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_context.cc @@ -107,7 +107,7 @@ void Context::InitializeFieldGeneratorInfoForMessage( for (int i = 0; i < message->nested_type_count(); ++i) { InitializeFieldGeneratorInfoForMessage(message->nested_type(i)); } - std::vector<const FieldDescriptor*> fields; + std::vector<const FieldDescriptor*> fields; fields.reserve(message->field_count()); for (int i = 0; i < message->field_count(); ++i) { fields.push_back(message->field(i)); @@ -124,10 +124,10 @@ void Context::InitializeFieldGeneratorInfoForMessage( } void Context::InitializeFieldGeneratorInfoForFields( - const std::vector<const FieldDescriptor*>& fields) { + const std::vector<const FieldDescriptor*>& fields) { // Find out all fields that conflict with some other field in the same // message. - std::vector<bool> is_conflict(fields.size()); + std::vector<bool> is_conflict(fields.size()); std::vector<TProtoStringType> conflict_reason(fields.size()); for (int i = 0; i < fields.size(); ++i) { const FieldDescriptor* field = fields[i]; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_context.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_context.h index 89ef671002..3fa6af1778 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_context.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_context.h @@ -94,7 +94,7 @@ class Context { void InitializeFieldGeneratorInfo(const FileDescriptor* file); void InitializeFieldGeneratorInfoForMessage(const Descriptor* message); void InitializeFieldGeneratorInfoForFields( - const std::vector<const FieldDescriptor*>& fields); + const std::vector<const FieldDescriptor*>& fields); std::unique_ptr<ClassNameResolver> name_resolver_; std::map<const FieldDescriptor*, FieldGeneratorInfo> diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum.h index 5444fe18d3..0a2c363b53 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum.h @@ -74,13 +74,13 @@ class EnumGenerator { // be considered equivalent. We treat the first defined constant for any // given numeric value as "canonical" and the rest as aliases of that // canonical value. - std::vector<const EnumValueDescriptor*> canonical_values_; + std::vector<const EnumValueDescriptor*> canonical_values_; struct Alias { const EnumValueDescriptor* value; const EnumValueDescriptor* canonical_value; }; - std::vector<Alias> aliases_; + std::vector<Alias> aliases_; bool immutable_api_; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_lite.h b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_lite.h index 20e688d094..50f3fe7b1a 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_lite.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_enum_lite.h @@ -74,13 +74,13 @@ class EnumLiteGenerator { // be considered equivalent. We treat the first defined constant for any // given numeric value as "canonical" and the rest as aliases of that // canonical value. - std::vector<const EnumValueDescriptor*> canonical_values_; + std::vector<const EnumValueDescriptor*> canonical_values_; struct Alias { const EnumValueDescriptor* value; const EnumValueDescriptor* canonical_value; }; - std::vector<Alias> aliases_; + std::vector<Alias> aliases_; bool immutable_api_; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_file.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_file.cc index 2d29cf86dc..0809febb8b 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_file.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_file.cc @@ -87,7 +87,7 @@ bool CollectExtensions(const Message& message, FieldDescriptorSet* extensions) { // There are unknown fields that could be extensions, thus this call fails. if (reflection->GetUnknownFields(message).field_count() > 0) return false; - std::vector<const FieldDescriptor*> fields; + std::vector<const FieldDescriptor*> fields; reflection->ListFields(message, &fields); for (int i = 0; i < fields.size(); i++) { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_generator.cc index 441d542b67..2b5728579e 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_generator.cc @@ -116,7 +116,7 @@ bool JavaGenerator::Generate(const FileDescriptor* file, std::vector<TProtoStringType> all_annotations; - std::vector<FileGenerator*> file_generators; + std::vector<FileGenerator*> file_generators; if (file_options.generate_immutable_code) { file_generators.push_back(new FileGenerator(file, file_options, /* immutable = */ true)); diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.cc index f693cc8f6c..a498388ade 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_helpers.cc @@ -584,9 +584,9 @@ TProtoStringType DefaultValue(const FieldDescriptor* field, bool immutable, "L"; case FieldDescriptor::CPPTYPE_DOUBLE: { double value = field->default_value_double(); - if (value == std::numeric_limits<double>::infinity()) { + if (value == std::numeric_limits<double>::infinity()) { return "Double.POSITIVE_INFINITY"; - } else if (value == -std::numeric_limits<double>::infinity()) { + } else if (value == -std::numeric_limits<double>::infinity()) { return "Double.NEGATIVE_INFINITY"; } else if (value != value) { return "Double.NaN"; @@ -596,9 +596,9 @@ TProtoStringType DefaultValue(const FieldDescriptor* field, bool immutable, } case FieldDescriptor::CPPTYPE_FLOAT: { float value = field->default_value_float(); - if (value == std::numeric_limits<float>::infinity()) { + if (value == std::numeric_limits<float>::infinity()) { return "Float.POSITIVE_INFINITY"; - } else if (value == -std::numeric_limits<float>::infinity()) { + } else if (value == -std::numeric_limits<float>::infinity()) { return "Float.NEGATIVE_INFINITY"; } else if (value != value) { return "Float.NaN"; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message.cc index 08f87ea2a1..029d886cde 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message.cc @@ -580,7 +580,7 @@ void ImmutableMessageGenerator::GenerateMessageSerializationMethods( std::unique_ptr<const FieldDescriptor*[]> sorted_fields( SortFieldsByNumber(descriptor_)); - std::vector<const Descriptor::ExtensionRange*> sorted_extensions; + std::vector<const Descriptor::ExtensionRange*> sorted_extensions; sorted_extensions.reserve(descriptor_->extension_range_count()); for (int i = 0; i < descriptor_->extension_range_count(); ++i) { sorted_extensions.push_back(descriptor_->extension_range(i)); @@ -822,7 +822,7 @@ void ImmutableMessageGenerator::GenerateDescriptorMethods( "fileclass", name_resolver_->GetImmutableClassName(descriptor_->file()), "identifier", UniqueFileScopeIdentifier(descriptor_)); } - std::vector<const FieldDescriptor*> map_fields; + std::vector<const FieldDescriptor*> map_fields; for (int i = 0; i < descriptor_->field_count(); i++) { const FieldDescriptor* field = descriptor_->field(i); if (GetJavaType(field) == JAVATYPE_MESSAGE && diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_builder.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_builder.cc index 5d3cc259df..510b9d785c 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_builder.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/java_message_builder.cc @@ -206,7 +206,7 @@ void MessageBuilderGenerator::GenerateDescriptorMethods(io::Printer* printer) { "fileclass", name_resolver_->GetImmutableClassName(descriptor_->file()), "identifier", UniqueFileScopeIdentifier(descriptor_)); } - std::vector<const FieldDescriptor*> map_fields; + std::vector<const FieldDescriptor*> map_fields; for (int i = 0; i < descriptor_->field_count(); i++) { const FieldDescriptor* field = descriptor_->field(i); if (GetJavaType(field) == JAVATYPE_MESSAGE && diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/main.cc b/contrib/libs/protoc/src/google/protobuf/compiler/main.cc index 4faa54f130..10de997f0c 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/main.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/main.cc @@ -97,10 +97,10 @@ int ProtobufMain(int argc, char* argv[]) { cli.RegisterGenerator("--objc_out", "--objc_opt", &objc_generator, "Generate Objective-C header and source."); - // Proto2 Perl/XS + // Proto2 Perl/XS perlxs::PerlXSGenerator perlxs_generator; - cli.RegisterGenerator("--perlxs_out", &perlxs_generator, - "Generate Perl/XS source files."); + cli.RegisterGenerator("--perlxs_out", &perlxs_generator, + "Generate Perl/XS source files."); // JavaScript js::Generator js_generator; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc b/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc index 6794eb4860..41d70aa255 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/parser.cc @@ -311,11 +311,11 @@ bool Parser::ConsumeNumber(double* output, const char* error) { input_->Next(); return true; } else if (LookingAt("inf")) { - *output = std::numeric_limits<double>::infinity(); + *output = std::numeric_limits<double>::infinity(); input_->Next(); return true; } else if (LookingAt("nan")) { - *output = std::numeric_limits<double>::quiet_NaN(); + *output = std::numeric_limits<double>::quiet_NaN(); input_->Next(); return true; } else { @@ -579,7 +579,7 @@ bool Parser::ValidateEnum(const EnumDescriptorProto* proto) { return false; } - std::set<int> used_values; + std::set<int> used_values; bool has_duplicates = false; for (int i = 0; i < proto->value_size(); ++i) { const EnumValueDescriptorProto& enum_value = proto->value(i); @@ -2387,7 +2387,7 @@ bool SourceLocationTable::Find( const Message* descriptor, DescriptorPool::ErrorCollector::ErrorLocation location, int* line, int* column) const { - const std::pair<int, int>* result = + const std::pair<int, int>* result = FindOrNull(location_map_, std::make_pair(descriptor, location)); if (result == NULL) { *line = -1; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/parser.h b/contrib/libs/protoc/src/google/protobuf/compiler/parser.h index cfa0756aa9..ca42449a95 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/parser.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/parser.h @@ -585,7 +585,7 @@ class PROTOBUF_EXPORT SourceLocationTable { void Clear(); private: - typedef std::map< + typedef std::map< std::pair<const Message*, DescriptorPool::ErrorCollector::ErrorLocation>, std::pair<int, int> > LocationMap; diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc index 7ff2387cfb..3ae4a39fd5 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc @@ -1,21 +1,21 @@ -#include <iostream> -#include <sstream> +#include <iostream> +#include <sstream> #include <memory> #include <google/protobuf/compiler/perlxs/perlxs_generator.h> #include <google/protobuf/compiler/perlxs/perlxs_helpers.h> #include <google/protobuf/descriptor.h> -#include "google/protobuf/descriptor.pb.h" +#include "google/protobuf/descriptor.pb.h" #include <google/protobuf/stubs/common.h> #include <google/protobuf/io/printer.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/io/zero_copy_stream.h> - -namespace google { -namespace protobuf { -namespace compiler { -namespace perlxs { - + +namespace google { +namespace protobuf { +namespace compiler { +namespace perlxs { + inline bool HasFieldPresence(const FileDescriptor* file) { return file->syntax() != FileDescriptor::SYNTAX_PROTO3; } @@ -31,1704 +31,1704 @@ bool HasHasMethod(const FieldDescriptor* field) { } -PerlXSGenerator::PerlXSGenerator() {} -PerlXSGenerator::~PerlXSGenerator() {} - +PerlXSGenerator::PerlXSGenerator() {} +PerlXSGenerator::~PerlXSGenerator() {} + -bool -PerlXSGenerator::Generate(const FileDescriptor* file, +bool +PerlXSGenerator::Generate(const FileDescriptor* file, const TProtoStringType& parameter, - OutputDirectory* outdir, + OutputDirectory* outdir, TProtoStringType* error) const -{ - // Each top-level message get its own XS source file, Perl module, - // and typemap. Each top-level enum gets its own Perl module. The - // files are generated in the perlxs_out directory. - - for ( int i = 0; i < file->message_type_count(); i++ ) { - const Descriptor* message_type = file->message_type(i); - - GenerateMessageXS(message_type, outdir); - GenerateMessagePOD(message_type, outdir); - GenerateMessageModule(message_type, outdir); - } - - for ( int i = 0; i < file->enum_type_count(); i++ ) { - const EnumDescriptor* enum_type = file->enum_type(i); - - GenerateEnumModule(enum_type, outdir); - } - - return true; -} - -bool +{ + // Each top-level message get its own XS source file, Perl module, + // and typemap. Each top-level enum gets its own Perl module. The + // files are generated in the perlxs_out directory. + + for ( int i = 0; i < file->message_type_count(); i++ ) { + const Descriptor* message_type = file->message_type(i); + + GenerateMessageXS(message_type, outdir); + GenerateMessagePOD(message_type, outdir); + GenerateMessageModule(message_type, outdir); + } + + for ( int i = 0; i < file->enum_type_count(); i++ ) { + const EnumDescriptor* enum_type = file->enum_type(i); + + GenerateEnumModule(enum_type, outdir); + } + + return true; +} + +bool PerlXSGenerator::ProcessOption(const TProtoStringType& option) -{ - size_t equals; - bool recognized = false; - - equals = option.find_first_of('='); +{ + size_t equals; + bool recognized = false; + + equals = option.find_first_of('='); if (equals != TProtoStringType::npos) { - TProtoStringType name = option.substr(0, equals); - TProtoStringType value; - - if (option.length() > equals) { - value = option.substr(equals + 1); - } - - // Right now, we only recognize the --perlxs-package option. - if (name == "--perlxs-package") { - perlxs_package_ = value; - recognized = true; - } - } - - return recognized; -} - -void -PerlXSGenerator::GenerateMessageXS(const Descriptor* descriptor, - OutputDirectory* outdir) const -{ + TProtoStringType name = option.substr(0, equals); + TProtoStringType value; + + if (option.length() > equals) { + value = option.substr(equals + 1); + } + + // Right now, we only recognize the --perlxs-package option. + if (name == "--perlxs-package") { + perlxs_package_ = value; + recognized = true; + } + } + + return recognized; +} + +void +PerlXSGenerator::GenerateMessageXS(const Descriptor* descriptor, + OutputDirectory* outdir) const +{ TProtoStringType filename = descriptor->name() + ".xs"; std::unique_ptr<io::ZeroCopyOutputStream> output(outdir->Open(filename)); - io::Printer printer(output.get(), '$'); // '$' works well in the .xs file - + io::Printer printer(output.get(), '$'); // '$' works well in the .xs file + TProtoStringType base = cpp::StripProto(descriptor->file()->name()); - - // Boilerplate at the top of the file. - - printer.Print( - "#include <stdint.h>\n" - "#include <sstream>\n" + + // Boilerplate at the top of the file. + + printer.Print( + "#include <stdint.h>\n" + "#include <sstream>\n" "#include <google/protobuf/stubs/common.h>\n" "#include <google/protobuf/io/zero_copy_stream.h>\n" - "#include \"$base$.pb.h\"\n" - "#ifdef __cplusplus\n" - "extern \"C\" {\n" - "#endif\n" - "#include \"EXTERN.h\"\n" - "#include \"perl.h\"\n" - "#include \"XSUB.h\"\n" - "#ifdef __cplusplus\n" - "}\n" - "#endif\n" - "#ifdef do_open\n" - "#undef do_open\n" - "#endif\n" - "#ifdef do_close\n" - "#undef do_close\n" - "#endif\n" - "#ifdef New\n" - "#undef New\n" - "#endif\n" - "\n" - // "using namespace std;\n" - "\n", - "base", - base); - - // ZeroCopyOutputStream implementation (for improved pack() performance) - - printer.Print("class $base$_OutputStream :\n" - " public google::protobuf::io::ZeroCopyOutputStream {\n" - "public:\n" - " explicit $base$_OutputStream(SV * sv) :\n" - " sv_(sv), len_(0) {}\n" - " ~$base$_OutputStream() {}\n" - "\n" - " bool Next(void** data, int* size)\n" - " {\n" - " STRLEN nlen = len_ << 1;\n" - "\n" - " if ( nlen < 16 ) nlen = 16;\n" - " SvGROW(sv_, nlen);\n" - " *data = SvEND(sv_) + len_;\n" - " *size = SvLEN(sv_) - len_;\n" - " len_ = nlen;\n" - "\n" - " return true;\n" - " }\n" - "\n" - " void BackUp(int count)\n" - " {\n" - " SvCUR_set(sv_, SvLEN(sv_) - count);\n" - " len_ -= count;\n" - " }\n" - "\n" - " void Sync() {\n" - " if ( SvCUR(sv_) == 0 ) {\n" - " SvCUR_set(sv_, len_);\n" - " }\n" - " }\n" - "\n" - " int64_t ByteCount() const\n" - " {\n" - " return (int64_t)SvCUR(sv_);\n" - " }\n" - "\n" - "private:\n" - " SV * sv_;\n" - " STRLEN len_;\n" - "\n" - " GOOGLE_DISALLOW_EVIL_CONSTRUCTORS($base$_OutputStream);\n" - "};\n" - "\n" - "\n", - "base", - base); - - // Typedefs, Statics, and XS packages - - std::set<const Descriptor*> seen; - - GenerateFileXSTypedefs(descriptor->file(), printer, seen); - - printer.Print("\n\n"); - - GenerateMessageStatics(descriptor, printer); - - printer.Print("\n\n"); - - GenerateMessageXSPackage(descriptor, printer); -} - - -void -PerlXSGenerator::GenerateMessageModule(const Descriptor* descriptor, - OutputDirectory* outdir) const -{ + "#include \"$base$.pb.h\"\n" + "#ifdef __cplusplus\n" + "extern \"C\" {\n" + "#endif\n" + "#include \"EXTERN.h\"\n" + "#include \"perl.h\"\n" + "#include \"XSUB.h\"\n" + "#ifdef __cplusplus\n" + "}\n" + "#endif\n" + "#ifdef do_open\n" + "#undef do_open\n" + "#endif\n" + "#ifdef do_close\n" + "#undef do_close\n" + "#endif\n" + "#ifdef New\n" + "#undef New\n" + "#endif\n" + "\n" + // "using namespace std;\n" + "\n", + "base", + base); + + // ZeroCopyOutputStream implementation (for improved pack() performance) + + printer.Print("class $base$_OutputStream :\n" + " public google::protobuf::io::ZeroCopyOutputStream {\n" + "public:\n" + " explicit $base$_OutputStream(SV * sv) :\n" + " sv_(sv), len_(0) {}\n" + " ~$base$_OutputStream() {}\n" + "\n" + " bool Next(void** data, int* size)\n" + " {\n" + " STRLEN nlen = len_ << 1;\n" + "\n" + " if ( nlen < 16 ) nlen = 16;\n" + " SvGROW(sv_, nlen);\n" + " *data = SvEND(sv_) + len_;\n" + " *size = SvLEN(sv_) - len_;\n" + " len_ = nlen;\n" + "\n" + " return true;\n" + " }\n" + "\n" + " void BackUp(int count)\n" + " {\n" + " SvCUR_set(sv_, SvLEN(sv_) - count);\n" + " len_ -= count;\n" + " }\n" + "\n" + " void Sync() {\n" + " if ( SvCUR(sv_) == 0 ) {\n" + " SvCUR_set(sv_, len_);\n" + " }\n" + " }\n" + "\n" + " int64_t ByteCount() const\n" + " {\n" + " return (int64_t)SvCUR(sv_);\n" + " }\n" + "\n" + "private:\n" + " SV * sv_;\n" + " STRLEN len_;\n" + "\n" + " GOOGLE_DISALLOW_EVIL_CONSTRUCTORS($base$_OutputStream);\n" + "};\n" + "\n" + "\n", + "base", + base); + + // Typedefs, Statics, and XS packages + + std::set<const Descriptor*> seen; + + GenerateFileXSTypedefs(descriptor->file(), printer, seen); + + printer.Print("\n\n"); + + GenerateMessageStatics(descriptor, printer); + + printer.Print("\n\n"); + + GenerateMessageXSPackage(descriptor, printer); +} + + +void +PerlXSGenerator::GenerateMessageModule(const Descriptor* descriptor, + OutputDirectory* outdir) const +{ TProtoStringType filename = descriptor->name() + ".pm"; std::unique_ptr<io::ZeroCopyOutputStream> output(outdir->Open(filename)); - io::Printer printer(output.get(), '*'); // '*' works well in the .pm file - + io::Printer printer(output.get(), '*'); // '*' works well in the .pm file + std::map<TProtoStringType, TProtoStringType> vars; - - vars["package"] = MessageModuleName(descriptor); - vars["message"] = descriptor->full_name(); - vars["name"] = descriptor->name(); - - printer.Print(vars, - "package *package*;\n" - "\n" - "use strict;\n" - "use warnings;\n" - "use vars qw(@ISA $AUTOLOAD $VERSION);\n" - "\n" - "$VERSION = '1.0';\n" - "\n" - "use Exporter;\n" - "\n" - "require DynaLoader;\n" - "require AutoLoader;\n" - "\n" - "@ISA = qw(DynaLoader Exporter);\n" - "\n" - "bootstrap *package* $VERSION;\n" - "\n" - "1;\n" - "\n" - "__END__\n" - "\n"); -} - - -void -PerlXSGenerator::GenerateMessagePOD(const Descriptor* descriptor, - OutputDirectory* outdir) const -{ + + vars["package"] = MessageModuleName(descriptor); + vars["message"] = descriptor->full_name(); + vars["name"] = descriptor->name(); + + printer.Print(vars, + "package *package*;\n" + "\n" + "use strict;\n" + "use warnings;\n" + "use vars qw(@ISA $AUTOLOAD $VERSION);\n" + "\n" + "$VERSION = '1.0';\n" + "\n" + "use Exporter;\n" + "\n" + "require DynaLoader;\n" + "require AutoLoader;\n" + "\n" + "@ISA = qw(DynaLoader Exporter);\n" + "\n" + "bootstrap *package* $VERSION;\n" + "\n" + "1;\n" + "\n" + "__END__\n" + "\n"); +} + + +void +PerlXSGenerator::GenerateMessagePOD(const Descriptor* descriptor, + OutputDirectory* outdir) const +{ TProtoStringType filename = descriptor->name() + ".pod"; std::unique_ptr<io::ZeroCopyOutputStream> output(outdir->Open(filename)); - io::Printer printer(output.get(), '*'); // '*' works well in the .pod file - + io::Printer printer(output.get(), '*'); // '*' works well in the .pod file + std::map<TProtoStringType, TProtoStringType> vars; - - vars["package"] = MessageModuleName(descriptor); - vars["message"] = descriptor->full_name(); - vars["name"] = descriptor->name(); - - // Generate POD documentation for the module. - - printer.Print(vars, - "=pod\n" - "\n" - "=head1 NAME\n" - "\n" - "*package* - Perl/XS interface to *message*\n" - "\n" - "=head1 SYNOPSIS\n" - "\n" - "=head2 Serializing messages\n" - "\n" - " #!/usr/bin/perl\n" - "\n" - " use strict;\n" - " use warnings;\n" - " use *package*;\n" - "\n" - " my $*name* = *package*->new;\n" - " # Set fields in $*name*...\n" - " my $pack*name* = $*name*->pack();\n" - "\n" - "=head2 Unserializing messages\n" - "\n" - " #!/usr/bin/perl\n" - "\n" - " use strict;\n" - " use warnings;\n" - " use *package*;\n" - "\n" - " my $pack*name*; # Read this from somewhere...\n" - " my $*name* = *package*->new;\n" - " if ( $*name*->unpack($pack*name*) ) {\n" - " print \"OK\"\n" - " } else {\n" - " print \"NOT OK\"\n" - " }\n" - "\n" - "=head1 DESCRIPTION\n" - "\n" - "*package* defines the following classes:\n" - "\n" - "=over 5\n" - "\n"); - - // List of classes - - GenerateDescriptorClassNamePOD(descriptor, printer); - - printer.Print("\n" - "=back\n" - "\n"); - - GenerateDescriptorMethodPOD(descriptor, printer); - - printer.Print(vars, - "=head1 AUTHOR\n" - "\n" - "Generated from *message* by the protoc compiler.\n" - "\n" - "=head1 SEE ALSO\n" - "\n"); - - // Top-level messages in dependency files (recursively expanded) - - printer.Print("http://code.google.com/p/protobuf\n" - "\n" - "=cut\n" - "\n"); -} - - -void -PerlXSGenerator::GenerateDescriptorClassNamePOD(const Descriptor* descriptor, - io::Printer& printer) const -{ - for ( int i = 0; i < descriptor->enum_type_count(); i++ ) { - printer.Print("=item C<*name*>\n" - "\n" - "A wrapper around the *enum* enum\n" - "\n", - "name", EnumClassName(descriptor->enum_type(i)), + + vars["package"] = MessageModuleName(descriptor); + vars["message"] = descriptor->full_name(); + vars["name"] = descriptor->name(); + + // Generate POD documentation for the module. + + printer.Print(vars, + "=pod\n" + "\n" + "=head1 NAME\n" + "\n" + "*package* - Perl/XS interface to *message*\n" + "\n" + "=head1 SYNOPSIS\n" + "\n" + "=head2 Serializing messages\n" + "\n" + " #!/usr/bin/perl\n" + "\n" + " use strict;\n" + " use warnings;\n" + " use *package*;\n" + "\n" + " my $*name* = *package*->new;\n" + " # Set fields in $*name*...\n" + " my $pack*name* = $*name*->pack();\n" + "\n" + "=head2 Unserializing messages\n" + "\n" + " #!/usr/bin/perl\n" + "\n" + " use strict;\n" + " use warnings;\n" + " use *package*;\n" + "\n" + " my $pack*name*; # Read this from somewhere...\n" + " my $*name* = *package*->new;\n" + " if ( $*name*->unpack($pack*name*) ) {\n" + " print \"OK\"\n" + " } else {\n" + " print \"NOT OK\"\n" + " }\n" + "\n" + "=head1 DESCRIPTION\n" + "\n" + "*package* defines the following classes:\n" + "\n" + "=over 5\n" + "\n"); + + // List of classes + + GenerateDescriptorClassNamePOD(descriptor, printer); + + printer.Print("\n" + "=back\n" + "\n"); + + GenerateDescriptorMethodPOD(descriptor, printer); + + printer.Print(vars, + "=head1 AUTHOR\n" + "\n" + "Generated from *message* by the protoc compiler.\n" + "\n" + "=head1 SEE ALSO\n" + "\n"); + + // Top-level messages in dependency files (recursively expanded) + + printer.Print("http://code.google.com/p/protobuf\n" + "\n" + "=cut\n" + "\n"); +} + + +void +PerlXSGenerator::GenerateDescriptorClassNamePOD(const Descriptor* descriptor, + io::Printer& printer) const +{ + for ( int i = 0; i < descriptor->enum_type_count(); i++ ) { + printer.Print("=item C<*name*>\n" + "\n" + "A wrapper around the *enum* enum\n" + "\n", + "name", EnumClassName(descriptor->enum_type(i)), "enum", descriptor->enum_type(i)->full_name()); - } - - for ( int i = 0; i < descriptor->nested_type_count(); i++ ) { - GenerateDescriptorClassNamePOD(descriptor->nested_type(i), printer); - } - - printer.Print("=item C<*name*>\n" - "\n" - "A wrapper around the *message* message\n" - "\n", - "name", MessageClassName(descriptor), - "message", descriptor->full_name()); -} - - -void -PerlXSGenerator::GenerateDescriptorMethodPOD(const Descriptor* descriptor, - io::Printer& printer) const -{ - for ( int i = 0; i < descriptor->enum_type_count(); i++ ) { - const EnumDescriptor * enum_descriptor = descriptor->enum_type(i); - printer.Print("=head1 C<*name*> values\n" - "\n" - "=over 4\n" - "\n", - "name", EnumClassName(enum_descriptor)); - - for ( int j = 0; j < enum_descriptor->value_count(); j++ ) { - PODPrintEnumValue(enum_descriptor->value(j), printer); - } - - printer.Print("\n" - "=back\n" - "\n"); - } - - for ( int i = 0; i < descriptor->nested_type_count(); i++ ) { - GenerateDescriptorMethodPOD(descriptor->nested_type(i), printer); - } - - // Constructor - + } + + for ( int i = 0; i < descriptor->nested_type_count(); i++ ) { + GenerateDescriptorClassNamePOD(descriptor->nested_type(i), printer); + } + + printer.Print("=item C<*name*>\n" + "\n" + "A wrapper around the *message* message\n" + "\n", + "name", MessageClassName(descriptor), + "message", descriptor->full_name()); +} + + +void +PerlXSGenerator::GenerateDescriptorMethodPOD(const Descriptor* descriptor, + io::Printer& printer) const +{ + for ( int i = 0; i < descriptor->enum_type_count(); i++ ) { + const EnumDescriptor * enum_descriptor = descriptor->enum_type(i); + printer.Print("=head1 C<*name*> values\n" + "\n" + "=over 4\n" + "\n", + "name", EnumClassName(enum_descriptor)); + + for ( int j = 0; j < enum_descriptor->value_count(); j++ ) { + PODPrintEnumValue(enum_descriptor->value(j), printer); + } + + printer.Print("\n" + "=back\n" + "\n"); + } + + for ( int i = 0; i < descriptor->nested_type_count(); i++ ) { + GenerateDescriptorMethodPOD(descriptor->nested_type(i), printer); + } + + // Constructor + std::map<TProtoStringType, TProtoStringType> vars; - - vars["name"] = MessageClassName(descriptor); - vars["value"] = descriptor->name(); - - printer.Print(vars, - "=head1 *name* Constructor\n" - "\n" - "=over 4\n" - "\n" - "=item B<$*value* = *name*-E<gt>new( [$arg] )>\n" - "\n" - "Constructs an instance of C<*name*>. If a hashref argument\n" - "is supplied, it is copied into the message instance as if\n" - "the copy_from() method were called immediately after\n" - "construction. Otherwise, if a scalar argument is supplied,\n" - "it is interpreted as a serialized instance of the message\n" - "type, and the scalar is parsed to populate the message\n" - "fields. Otherwise, if no argument is supplied, an empty\n" - "message instance is constructed.\n" - "\n" - "=back\n" - "\n" - "=head1 *name* Methods\n" - "\n" - "=over 4\n" - "\n"); - - // Common message methods - - printer.Print(vars, + + vars["name"] = MessageClassName(descriptor); + vars["value"] = descriptor->name(); + + printer.Print(vars, + "=head1 *name* Constructor\n" + "\n" + "=over 4\n" + "\n" + "=item B<$*value* = *name*-E<gt>new( [$arg] )>\n" + "\n" + "Constructs an instance of C<*name*>. If a hashref argument\n" + "is supplied, it is copied into the message instance as if\n" + "the copy_from() method were called immediately after\n" + "construction. Otherwise, if a scalar argument is supplied,\n" + "it is interpreted as a serialized instance of the message\n" + "type, and the scalar is parsed to populate the message\n" + "fields. Otherwise, if no argument is supplied, an empty\n" + "message instance is constructed.\n" + "\n" + "=back\n" + "\n" + "=head1 *name* Methods\n" + "\n" + "=over 4\n" + "\n"); + + // Common message methods + + printer.Print(vars, "=item B<$*value*2-E<gt>copy_from($*value*1)>\n" - "\n" - "Copies the contents of C<*value*1> into C<*value*2>.\n" - "C<*value*2> is another instance of the same message type.\n" - "\n" + "\n" + "Copies the contents of C<*value*1> into C<*value*2>.\n" + "C<*value*2> is another instance of the same message type.\n" + "\n" "=item B<$*value*2-E<gt>copy_from($hashref)>\n" - "\n" - "Copies the contents of C<hashref> into C<*value*2>.\n" - "C<hashref> is a Data::Dumper-style representation of an\n" - "instance of the message type.\n" - "\n" - "=item B<$*value*2-E<gt>merge_from($*value*1)>\n" - "\n" - "Merges the contents of C<*value*1> into C<*value*2>.\n" - "C<*value*2> is another instance of the same message type.\n" - "\n" + "\n" + "Copies the contents of C<hashref> into C<*value*2>.\n" + "C<hashref> is a Data::Dumper-style representation of an\n" + "instance of the message type.\n" + "\n" + "=item B<$*value*2-E<gt>merge_from($*value*1)>\n" + "\n" + "Merges the contents of C<*value*1> into C<*value*2>.\n" + "C<*value*2> is another instance of the same message type.\n" + "\n" "=item B<$*value*2-E<gt>merge_from($hashref)>\n" - "\n" - "Merges the contents of C<hashref> into C<*value*2>.\n" - "C<hashref> is a Data::Dumper-style representation of an\n" - "instance of the message type.\n" - "\n" - "=item B<$*value*-E<gt>clear()>\n" - "\n" - "Clears the contents of C<*value*>.\n" - "\n" - "=item B<$init = $*value*-E<gt>is_initialized()>\n" - "\n" - "Returns 1 if C<*value*> has been initialized with data.\n" - "\n" - "=item B<$errstr = $*value*-E<gt>error_string()>\n" - "\n" + "\n" + "Merges the contents of C<hashref> into C<*value*2>.\n" + "C<hashref> is a Data::Dumper-style representation of an\n" + "instance of the message type.\n" + "\n" + "=item B<$*value*-E<gt>clear()>\n" + "\n" + "Clears the contents of C<*value*>.\n" + "\n" + "=item B<$init = $*value*-E<gt>is_initialized()>\n" + "\n" + "Returns 1 if C<*value*> has been initialized with data.\n" + "\n" + "=item B<$errstr = $*value*-E<gt>error_string()>\n" + "\n" "Returns a comma-delimited TProtoStringType of initialization errors.\n" - "\n" - "=item B<$*value*-E<gt>discard_unknown_fields()>\n" - "\n" - "Discards unknown fields from C<*value*>.\n" - "\n" - "=item B<$dstr = $*value*-E<gt>debug_string()>\n" - "\n" + "\n" + "=item B<$*value*-E<gt>discard_unknown_fields()>\n" + "\n" + "Discards unknown fields from C<*value*>.\n" + "\n" + "=item B<$dstr = $*value*-E<gt>debug_string()>\n" + "\n" "Returns a TProtoStringType representation of C<*value*>.\n" - "\n" - "=item B<$dstr = $*value*-E<gt>short_debug_string()>\n" - "\n" + "\n" + "=item B<$dstr = $*value*-E<gt>short_debug_string()>\n" + "\n" "Returns a short TProtoStringType representation of C<*value*>.\n" - "\n" + "\n" "=item B<$ok = $*value*-E<gt>unpack($TProtoStringType)>\n" - "\n" + "\n" "Attempts to parse C<TProtoStringType> into C<*value*>, returning 1 " - "on success and 0 on failure.\n" - "\n" + "on success and 0 on failure.\n" + "\n" "=item B<$TProtoStringType = $*value*-E<gt>pack()>\n" - "\n" + "\n" "Serializes C<*value*> into C<TProtoStringType>.\n" - "\n" - "=item B<$length = $*value*-E<gt>length()>\n" - "\n" - "Returns the serialized length of C<*value*>.\n" - "\n" - "=item B<@fields = $*value*-E<gt>fields()>\n" - "\n" - "Returns the defined fields of C<*value*>.\n" - "\n" - "=item B<$hashref = $*value*-E<gt>to_hashref()>\n" - "\n" - "Exports the message to a hashref suitable for use in the\n" - "C<copy_from> or C<merge_from> methods.\n" - "\n"); - - // Message field accessors - - for ( int i = 0; i < descriptor->field_count(); i++ ) { - const FieldDescriptor* field = descriptor->field(i); - - vars["field"] = field->name(); - vars["type"] = PODFieldTypeString(field); - - // has_blah or blah_size methods - - if ( field->is_repeated() ) { - printer.Print(vars, - "=item B<$*field*_size = $*value*-E<gt>*field*_size()>\n" - "\n" - "Returns the number of C<*field*> elements present " - "in C<*value*>.\n" - "\n"); - } else { - printer.Print(vars, - "=item B<$has_*field* = $*value*-E<gt>has_*field*()>\n" - "\n" - "Returns 1 if the C<*field*> element of C<*value*> " - "is set, 0 otherwise.\n" - "\n"); - } - - // clear_blah method - - printer.Print(vars, - "=item B<$*value*-E<gt>clear_*field*()>\n" - "\n" - "Clears the C<*field*> element(s) of C<*value*>.\n" - "\n"); - - // getters - - if ( field->is_repeated() ) { - printer.Print(vars, - "=item B<@*field*_list = $*value*-E<gt>*field*()>\n" - "\n" - "Returns all values of C<*field*> in an array. Each " - "element of C<*field*_list> will be *type*.\n" - "\n" - "=item B<$*field*_elem = $*value*-E<gt>*field*($index)>\n" - "\n" - "Returns C<*field*> element C<index> from C<*value*>. " - "C<*field*> will be *type*, unless C<index> is out of " - "range, in which case it will be undef.\n" - "\n"); - } else { - printer.Print(vars, - "=item B<$*field* = $*value*-E<gt>*field*()>\n" - "\n" - "Returns C<*field*> from C<*value*>. C<*field*> will " - "be *type*.\n" - "\n"); - } - - // setters - - if ( field->is_repeated() ) { - printer.Print(vars, - "=item B<$*value*-E<gt>add_*field*($value)>\n" - "\n" - "Adds C<value> to the list of C<*field*> in C<*value*>. " - "C<value> must be *type*.\n" - "\n"); - } else { - printer.Print(vars, - "=item B<$*value*-E<gt>set_*field*($value)>\n" - "\n" - "Sets the value of C<*field*> in C<*value*> to " - "C<value>. C<value> must be *type*.\n" - "\n"); - } - } - - printer.Print("\n" - "=back\n" - "\n"); -} - - -void -PerlXSGenerator::GenerateEnumModule(const EnumDescriptor* enum_descriptor, - OutputDirectory* outdir) const -{ + "\n" + "=item B<$length = $*value*-E<gt>length()>\n" + "\n" + "Returns the serialized length of C<*value*>.\n" + "\n" + "=item B<@fields = $*value*-E<gt>fields()>\n" + "\n" + "Returns the defined fields of C<*value*>.\n" + "\n" + "=item B<$hashref = $*value*-E<gt>to_hashref()>\n" + "\n" + "Exports the message to a hashref suitable for use in the\n" + "C<copy_from> or C<merge_from> methods.\n" + "\n"); + + // Message field accessors + + for ( int i = 0; i < descriptor->field_count(); i++ ) { + const FieldDescriptor* field = descriptor->field(i); + + vars["field"] = field->name(); + vars["type"] = PODFieldTypeString(field); + + // has_blah or blah_size methods + + if ( field->is_repeated() ) { + printer.Print(vars, + "=item B<$*field*_size = $*value*-E<gt>*field*_size()>\n" + "\n" + "Returns the number of C<*field*> elements present " + "in C<*value*>.\n" + "\n"); + } else { + printer.Print(vars, + "=item B<$has_*field* = $*value*-E<gt>has_*field*()>\n" + "\n" + "Returns 1 if the C<*field*> element of C<*value*> " + "is set, 0 otherwise.\n" + "\n"); + } + + // clear_blah method + + printer.Print(vars, + "=item B<$*value*-E<gt>clear_*field*()>\n" + "\n" + "Clears the C<*field*> element(s) of C<*value*>.\n" + "\n"); + + // getters + + if ( field->is_repeated() ) { + printer.Print(vars, + "=item B<@*field*_list = $*value*-E<gt>*field*()>\n" + "\n" + "Returns all values of C<*field*> in an array. Each " + "element of C<*field*_list> will be *type*.\n" + "\n" + "=item B<$*field*_elem = $*value*-E<gt>*field*($index)>\n" + "\n" + "Returns C<*field*> element C<index> from C<*value*>. " + "C<*field*> will be *type*, unless C<index> is out of " + "range, in which case it will be undef.\n" + "\n"); + } else { + printer.Print(vars, + "=item B<$*field* = $*value*-E<gt>*field*()>\n" + "\n" + "Returns C<*field*> from C<*value*>. C<*field*> will " + "be *type*.\n" + "\n"); + } + + // setters + + if ( field->is_repeated() ) { + printer.Print(vars, + "=item B<$*value*-E<gt>add_*field*($value)>\n" + "\n" + "Adds C<value> to the list of C<*field*> in C<*value*>. " + "C<value> must be *type*.\n" + "\n"); + } else { + printer.Print(vars, + "=item B<$*value*-E<gt>set_*field*($value)>\n" + "\n" + "Sets the value of C<*field*> in C<*value*> to " + "C<value>. C<value> must be *type*.\n" + "\n"); + } + } + + printer.Print("\n" + "=back\n" + "\n"); +} + + +void +PerlXSGenerator::GenerateEnumModule(const EnumDescriptor* enum_descriptor, + OutputDirectory* outdir) const +{ TProtoStringType filename = enum_descriptor->name() + ".pm"; std::unique_ptr<io::ZeroCopyOutputStream> output(outdir->Open(filename)); - io::Printer printer(output.get(), '*'); // '*' works well in the .pm file - + io::Printer printer(output.get(), '*'); // '*' works well in the .pm file + std::map<TProtoStringType, TProtoStringType> vars; - - vars["package"] = EnumClassName(enum_descriptor); - vars["enum"] = enum_descriptor->full_name(); - - printer.Print(vars, - "package *package*;\n" - "\n" - "use strict;\n" - "use warnings;\n" - "\n"); - - // Each enum value is exported as a constant. - - for ( int i = 0; i < enum_descriptor->value_count(); i++ ) { - std::ostringstream ost; - ost << enum_descriptor->value(i)->number(); - printer.Print("use constant *value* => *number*;\n", - "value", enum_descriptor->value(i)->name(), - "number", ost.str().c_str()); - } - - printer.Print("\n" - "1;\n" - "\n" - "__END__\n" - "\n"); - - // Now generate POD for the enum. - - printer.Print(vars, - "=pod\n" - "\n" - "=head1 NAME\n" - "\n" - "*package* - Perl interface to *enum*\n" - "\n" - "=head1 SYNOPSIS\n" - "\n" - " use *package*;\n" - "\n"); - - for ( int i = 0; i < enum_descriptor->value_count(); i++ ) { - printer.Print(" my $*value* = *package*::*value*;\n", - "package", vars["package"], - "value", enum_descriptor->value(i)->name()); - } - - printer.Print(vars, - "\n" - "=head1 DESCRIPTION\n" - "\n" - "*package* defines the following constants:\n" - "\n" - "=over 4\n" - "\n"); - - for ( int i = 0; i < enum_descriptor->value_count(); i++ ) { - PODPrintEnumValue(enum_descriptor->value(i), printer); - } - - printer.Print(vars, - "\n" - "=back\n" - "\n" - "=head1 AUTHOR\n" - "\n" - "Generated from *enum* by the protoc compiler.\n" - "\n" - "=head1 SEE ALSO\n" - "\n" - "http://code.google.com/p/protobuf\n" - "\n" - "=cut\n" - "\n"); -} - - -void -PerlXSGenerator::GenerateFileXSTypedefs(const FileDescriptor* file, - io::Printer& printer, - std::set<const Descriptor*>& seen) const -{ - for ( int i = 0; i < file->dependency_count(); i++ ) { - GenerateFileXSTypedefs(file->dependency(i), printer, seen); - } - - for ( int i = 0; i < file->message_type_count(); i++ ) { - GenerateMessageXSTypedefs(file->message_type(i), printer, seen); - } -} - - -void -PerlXSGenerator::GenerateMessageXSTypedefs(const Descriptor* descriptor, - io::Printer& printer, - std::set<const Descriptor*>& seen) const -{ - for ( int i = 0; i < descriptor->nested_type_count(); i++ ) { - GenerateMessageXSTypedefs(descriptor->nested_type(i), printer, seen); - } - - if ( seen.find(descriptor) == seen.end() ) { + + vars["package"] = EnumClassName(enum_descriptor); + vars["enum"] = enum_descriptor->full_name(); + + printer.Print(vars, + "package *package*;\n" + "\n" + "use strict;\n" + "use warnings;\n" + "\n"); + + // Each enum value is exported as a constant. + + for ( int i = 0; i < enum_descriptor->value_count(); i++ ) { + std::ostringstream ost; + ost << enum_descriptor->value(i)->number(); + printer.Print("use constant *value* => *number*;\n", + "value", enum_descriptor->value(i)->name(), + "number", ost.str().c_str()); + } + + printer.Print("\n" + "1;\n" + "\n" + "__END__\n" + "\n"); + + // Now generate POD for the enum. + + printer.Print(vars, + "=pod\n" + "\n" + "=head1 NAME\n" + "\n" + "*package* - Perl interface to *enum*\n" + "\n" + "=head1 SYNOPSIS\n" + "\n" + " use *package*;\n" + "\n"); + + for ( int i = 0; i < enum_descriptor->value_count(); i++ ) { + printer.Print(" my $*value* = *package*::*value*;\n", + "package", vars["package"], + "value", enum_descriptor->value(i)->name()); + } + + printer.Print(vars, + "\n" + "=head1 DESCRIPTION\n" + "\n" + "*package* defines the following constants:\n" + "\n" + "=over 4\n" + "\n"); + + for ( int i = 0; i < enum_descriptor->value_count(); i++ ) { + PODPrintEnumValue(enum_descriptor->value(i), printer); + } + + printer.Print(vars, + "\n" + "=back\n" + "\n" + "=head1 AUTHOR\n" + "\n" + "Generated from *enum* by the protoc compiler.\n" + "\n" + "=head1 SEE ALSO\n" + "\n" + "http://code.google.com/p/protobuf\n" + "\n" + "=cut\n" + "\n"); +} + + +void +PerlXSGenerator::GenerateFileXSTypedefs(const FileDescriptor* file, + io::Printer& printer, + std::set<const Descriptor*>& seen) const +{ + for ( int i = 0; i < file->dependency_count(); i++ ) { + GenerateFileXSTypedefs(file->dependency(i), printer, seen); + } + + for ( int i = 0; i < file->message_type_count(); i++ ) { + GenerateMessageXSTypedefs(file->message_type(i), printer, seen); + } +} + + +void +PerlXSGenerator::GenerateMessageXSTypedefs(const Descriptor* descriptor, + io::Printer& printer, + std::set<const Descriptor*>& seen) const +{ + for ( int i = 0; i < descriptor->nested_type_count(); i++ ) { + GenerateMessageXSTypedefs(descriptor->nested_type(i), printer, seen); + } + + if ( seen.find(descriptor) == seen.end() ) { TProtoStringType cn = cpp::ClassName(descriptor, true); TProtoStringType un = StringReplace(cn, "::", "__", true); - - seen.insert(descriptor); - printer.Print("typedef $classname$ $underscores$;\n", - "classname", cn, - "underscores", un); - } -} - - -void -PerlXSGenerator::GenerateMessageStatics(const Descriptor* descriptor, - io::Printer& printer) const -{ - for ( int i = 0; i < descriptor->nested_type_count(); i++ ) { - GenerateMessageStatics(descriptor->nested_type(i), printer); - } - + + seen.insert(descriptor); + printer.Print("typedef $classname$ $underscores$;\n", + "classname", cn, + "underscores", un); + } +} + + +void +PerlXSGenerator::GenerateMessageStatics(const Descriptor* descriptor, + io::Printer& printer) const +{ + for ( int i = 0; i < descriptor->nested_type_count(); i++ ) { + GenerateMessageStatics(descriptor->nested_type(i), printer); + } + std::map<TProtoStringType, TProtoStringType> vars; - + TProtoStringType cn = cpp::ClassName(descriptor, true); TProtoStringType un = StringReplace(cn, "::", "__", true); - - vars["depth"] = "0"; - vars["fieldtype"] = cn; - vars["classname"] = cn; - vars["underscores"] = un; - - // from_hashref static helper - - printer.Print(vars, - "static $classname$ *\n" - "$underscores$_from_hashref ( SV * sv0 )\n" - "{\n" - " $fieldtype$ * msg$depth$ = new $fieldtype$;\n" - "\n"); - - printer.Indent(); - MessageFromHashref(descriptor, printer, vars, 0); - printer.Outdent(); - - printer.Print("\n" - " return msg0;\n" - "}\n" - "\n"); -} - - -void -PerlXSGenerator::GenerateMessageXSFieldAccessors(const FieldDescriptor* field, - io::Printer& printer, + + vars["depth"] = "0"; + vars["fieldtype"] = cn; + vars["classname"] = cn; + vars["underscores"] = un; + + // from_hashref static helper + + printer.Print(vars, + "static $classname$ *\n" + "$underscores$_from_hashref ( SV * sv0 )\n" + "{\n" + " $fieldtype$ * msg$depth$ = new $fieldtype$;\n" + "\n"); + + printer.Indent(); + MessageFromHashref(descriptor, printer, vars, 0); + printer.Outdent(); + + printer.Print("\n" + " return msg0;\n" + "}\n" + "\n"); +} + + +void +PerlXSGenerator::GenerateMessageXSFieldAccessors(const FieldDescriptor* field, + io::Printer& printer, const TProtoStringType& classname) const -{ - const Descriptor* descriptor = field->containing_type(); +{ + const Descriptor* descriptor = field->containing_type(); TProtoStringType cppname = cpp::FieldName(field); TProtoStringType perlclass = MessageClassName(descriptor); - bool repeated = field->is_repeated(); - + bool repeated = field->is_repeated(); + std::map<TProtoStringType, TProtoStringType> vars; - - vars["classname"] = classname; - vars["cppname"] = cppname; - vars["perlname"] = field->name(); - vars["perlclass"] = perlclass; - - FieldDescriptor::CppType fieldtype = field->cpp_type(); - FieldDescriptor::Type type = field->type(); - - if ( fieldtype == FieldDescriptor::CPPTYPE_MESSAGE ) { - vars["fieldtype"] = cpp::ClassName(field->message_type(), true); - vars["fieldclass"] = MessageClassName(field->message_type()); - } - - // For repeated fields, we need an index argument. - - if ( repeated ) { - vars["i"] = "index"; - } else { - vars["i"] = ""; - } - - // ------------------------------------------------------------------- - // First, the has_X method or X_size method. - // ------------------------------------------------------------------- - - if ( repeated ) { - printer.Print(vars, - "I32\n" - "$perlname$_size(svTHIS)\n" - " SV * svTHIS;\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " RETVAL = THIS->$cppname$_size();\n" - "\n" - " OUTPUT:\n" - " RETVAL\n"); + + vars["classname"] = classname; + vars["cppname"] = cppname; + vars["perlname"] = field->name(); + vars["perlclass"] = perlclass; + + FieldDescriptor::CppType fieldtype = field->cpp_type(); + FieldDescriptor::Type type = field->type(); + + if ( fieldtype == FieldDescriptor::CPPTYPE_MESSAGE ) { + vars["fieldtype"] = cpp::ClassName(field->message_type(), true); + vars["fieldclass"] = MessageClassName(field->message_type()); + } + + // For repeated fields, we need an index argument. + + if ( repeated ) { + vars["i"] = "index"; + } else { + vars["i"] = ""; + } + + // ------------------------------------------------------------------- + // First, the has_X method or X_size method. + // ------------------------------------------------------------------- + + if ( repeated ) { + printer.Print(vars, + "I32\n" + "$perlname$_size(svTHIS)\n" + " SV * svTHIS;\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " RETVAL = THIS->$cppname$_size();\n" + "\n" + " OUTPUT:\n" + " RETVAL\n"); } else if ( HasHasMethod(field) ) { - printer.Print(vars, - "I32\n" - "has_$perlname$(svTHIS)\n" - " SV * svTHIS;\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " RETVAL = THIS->has_$cppname$();\n" - "\n" - " OUTPUT:\n" - " RETVAL\n"); - } - - printer.Print("\n\n"); - - // ------------------------------------------------------------------- - // Next, the "clear" method. - // ------------------------------------------------------------------- - - printer.Print(vars, - "void\n" - "clear_$perlname$(svTHIS)\n" - " SV * svTHIS;\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " THIS->clear_$cppname$();\n" - "\n" - "\n"); - - // ------------------------------------------------------------------- - // Next, the "get" method. - // ------------------------------------------------------------------- - - // Repeated fields have an optional index argument. - - if ( repeated ) { - printer.Print(vars, - "void\n" - "$perlname$(svTHIS, ...)\n"); - } else { - printer.Print(vars, - "void\n" - "$perlname$(svTHIS)\n"); - } - - printer.Print(" SV * svTHIS;\n" - "PREINIT:\n" - " SV * sv;\n"); - - if ( repeated ) { - printer.Print(" int index = 0;\n"); - } - - // We need to store 64-bit integers as strings in Perl. - - if ( fieldtype == FieldDescriptor::CPPTYPE_INT64 || - fieldtype == FieldDescriptor::CPPTYPE_UINT64 ) { - printer.Print(" std::ostringstream ost;\n"); - } - - if ( fieldtype == FieldDescriptor::CPPTYPE_MESSAGE ) { - printer.Print(vars, - " $fieldtype$ * val = NULL;\n"); - } - - // We'll use PPCODE in either case, just to make this a little - // simpler. - - printer.Print("\n" - " PPCODE:\n"); - - GenerateTypemapInput(descriptor, printer, "THIS"); - - // For repeated fields, we need to check the usage ourselves. - - if ( repeated ) { - printer.Print(vars, - " if ( items == 2 ) {\n" - " index = SvIV(ST(1));\n" - " } else if ( items > 2 ) {\n" - " croak(\"Usage: $perlclass$::$perlname$(CLASS, [index])\");\n" - " }\n"); - } - - // There are three possibilities now: - // - // 1) The user wants a particular element of a repeated field. - // 2) The user wants all elements of a repeated field. - // 3) The user wants the value of a non-repeated field. - - if ( repeated ) { - printer.Print(vars, - " if ( THIS != NULL ) {\n" - " if ( items == 1 ) {\n" - " int count = THIS->$cppname$_size();\n" - "\n" - " EXTEND(SP, count);\n" - " for ( int index = 0; index < count; index++ ) {\n"); - PerlSVGetHelper(printer,vars,fieldtype,5); - printer.Print(vars, - " PUSHs(sv);\n" - " }\n" - " } else if ( index >= 0 &&\n" - " index < THIS->$cppname$_size() ) {\n" - " EXTEND(SP,1);\n"); - PerlSVGetHelper(printer,vars,fieldtype,4); - printer.Print(" PUSHs(sv);\n" - " } else {\n" - " EXTEND(SP,1);\n" - " PUSHs(&PL_sv_undef);\n" - " }\n" - " }\n"); - } else { - printer.Print(" if ( THIS != NULL ) {\n" - " EXTEND(SP,1);\n"); - PerlSVGetHelper(printer,vars,fieldtype,3); - printer.Print(" PUSHs(sv);\n" - " }\n"); - } - - printer.Print("\n\n"); - - // ------------------------------------------------------------------- - // Finally, the "set" method. - // ------------------------------------------------------------------- - - if ( repeated ) { - printer.Print(vars, - "void\n" - "add_$perlname$(svTHIS, svVAL)\n"); - } else { - printer.Print(vars, - "void\n" - "set_$perlname$(svTHIS, svVAL)\n"); - } - - printer.Print(" SV * svTHIS\n"); - - // What is the incoming type? - - switch ( fieldtype ) { - case FieldDescriptor::CPPTYPE_ENUM: - vars["etype"] = cpp::ClassName(field->enum_type(), true); - // Fall through - case FieldDescriptor::CPPTYPE_INT32: - case FieldDescriptor::CPPTYPE_BOOL: - vars["value"] = "svVAL"; - printer.Print(" IV svVAL\n" - "\n" - " CODE:\n"); - break; - case FieldDescriptor::CPPTYPE_UINT32: - vars["value"] = "svVAL"; - printer.Print(" UV svVAL\n" - "\n" - " CODE:\n"); - break; - case FieldDescriptor::CPPTYPE_FLOAT: - case FieldDescriptor::CPPTYPE_DOUBLE: - vars["value"] = "svVAL"; - printer.Print(" NV svVAL\n" - "\n" - " CODE:\n"); - break; - case FieldDescriptor::CPPTYPE_INT64: - vars["value"] = "lval"; - printer.Print(" char *svVAL\n" - "\n" - " PREINIT:\n" - " long long lval;\n" - "\n" - " CODE:\n" - " lval = strtoll((svVAL) ? svVAL : \"\", NULL, 0);\n"); - break; - case FieldDescriptor::CPPTYPE_UINT64: - vars["value"] = "lval"; - printer.Print(" char *svVAL\n" - "\n" - " PREINIT:\n" - " unsigned long long lval;\n" - "\n" - " CODE:\n" - " lval = strtoull((svVAL) ? svVAL : \"\", NULL, 0);\n"); - break; - case FieldDescriptor::CPPTYPE_STRING: - vars["value"] = "sval"; - printer.Print(" SV *svVAL\n" - "\n" - " PREINIT:\n" - " char * str;\n" - " STRLEN len;\n"); - if ( type == FieldDescriptor::TYPE_STRING ) { - printer.Print(vars, + printer.Print(vars, + "I32\n" + "has_$perlname$(svTHIS)\n" + " SV * svTHIS;\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " RETVAL = THIS->has_$cppname$();\n" + "\n" + " OUTPUT:\n" + " RETVAL\n"); + } + + printer.Print("\n\n"); + + // ------------------------------------------------------------------- + // Next, the "clear" method. + // ------------------------------------------------------------------- + + printer.Print(vars, + "void\n" + "clear_$perlname$(svTHIS)\n" + " SV * svTHIS;\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " THIS->clear_$cppname$();\n" + "\n" + "\n"); + + // ------------------------------------------------------------------- + // Next, the "get" method. + // ------------------------------------------------------------------- + + // Repeated fields have an optional index argument. + + if ( repeated ) { + printer.Print(vars, + "void\n" + "$perlname$(svTHIS, ...)\n"); + } else { + printer.Print(vars, + "void\n" + "$perlname$(svTHIS)\n"); + } + + printer.Print(" SV * svTHIS;\n" + "PREINIT:\n" + " SV * sv;\n"); + + if ( repeated ) { + printer.Print(" int index = 0;\n"); + } + + // We need to store 64-bit integers as strings in Perl. + + if ( fieldtype == FieldDescriptor::CPPTYPE_INT64 || + fieldtype == FieldDescriptor::CPPTYPE_UINT64 ) { + printer.Print(" std::ostringstream ost;\n"); + } + + if ( fieldtype == FieldDescriptor::CPPTYPE_MESSAGE ) { + printer.Print(vars, + " $fieldtype$ * val = NULL;\n"); + } + + // We'll use PPCODE in either case, just to make this a little + // simpler. + + printer.Print("\n" + " PPCODE:\n"); + + GenerateTypemapInput(descriptor, printer, "THIS"); + + // For repeated fields, we need to check the usage ourselves. + + if ( repeated ) { + printer.Print(vars, + " if ( items == 2 ) {\n" + " index = SvIV(ST(1));\n" + " } else if ( items > 2 ) {\n" + " croak(\"Usage: $perlclass$::$perlname$(CLASS, [index])\");\n" + " }\n"); + } + + // There are three possibilities now: + // + // 1) The user wants a particular element of a repeated field. + // 2) The user wants all elements of a repeated field. + // 3) The user wants the value of a non-repeated field. + + if ( repeated ) { + printer.Print(vars, + " if ( THIS != NULL ) {\n" + " if ( items == 1 ) {\n" + " int count = THIS->$cppname$_size();\n" + "\n" + " EXTEND(SP, count);\n" + " for ( int index = 0; index < count; index++ ) {\n"); + PerlSVGetHelper(printer,vars,fieldtype,5); + printer.Print(vars, + " PUSHs(sv);\n" + " }\n" + " } else if ( index >= 0 &&\n" + " index < THIS->$cppname$_size() ) {\n" + " EXTEND(SP,1);\n"); + PerlSVGetHelper(printer,vars,fieldtype,4); + printer.Print(" PUSHs(sv);\n" + " } else {\n" + " EXTEND(SP,1);\n" + " PUSHs(&PL_sv_undef);\n" + " }\n" + " }\n"); + } else { + printer.Print(" if ( THIS != NULL ) {\n" + " EXTEND(SP,1);\n"); + PerlSVGetHelper(printer,vars,fieldtype,3); + printer.Print(" PUSHs(sv);\n" + " }\n"); + } + + printer.Print("\n\n"); + + // ------------------------------------------------------------------- + // Finally, the "set" method. + // ------------------------------------------------------------------- + + if ( repeated ) { + printer.Print(vars, + "void\n" + "add_$perlname$(svTHIS, svVAL)\n"); + } else { + printer.Print(vars, + "void\n" + "set_$perlname$(svTHIS, svVAL)\n"); + } + + printer.Print(" SV * svTHIS\n"); + + // What is the incoming type? + + switch ( fieldtype ) { + case FieldDescriptor::CPPTYPE_ENUM: + vars["etype"] = cpp::ClassName(field->enum_type(), true); + // Fall through + case FieldDescriptor::CPPTYPE_INT32: + case FieldDescriptor::CPPTYPE_BOOL: + vars["value"] = "svVAL"; + printer.Print(" IV svVAL\n" + "\n" + " CODE:\n"); + break; + case FieldDescriptor::CPPTYPE_UINT32: + vars["value"] = "svVAL"; + printer.Print(" UV svVAL\n" + "\n" + " CODE:\n"); + break; + case FieldDescriptor::CPPTYPE_FLOAT: + case FieldDescriptor::CPPTYPE_DOUBLE: + vars["value"] = "svVAL"; + printer.Print(" NV svVAL\n" + "\n" + " CODE:\n"); + break; + case FieldDescriptor::CPPTYPE_INT64: + vars["value"] = "lval"; + printer.Print(" char *svVAL\n" + "\n" + " PREINIT:\n" + " long long lval;\n" + "\n" + " CODE:\n" + " lval = strtoll((svVAL) ? svVAL : \"\", NULL, 0);\n"); + break; + case FieldDescriptor::CPPTYPE_UINT64: + vars["value"] = "lval"; + printer.Print(" char *svVAL\n" + "\n" + " PREINIT:\n" + " unsigned long long lval;\n" + "\n" + " CODE:\n" + " lval = strtoull((svVAL) ? svVAL : \"\", NULL, 0);\n"); + break; + case FieldDescriptor::CPPTYPE_STRING: + vars["value"] = "sval"; + printer.Print(" SV *svVAL\n" + "\n" + " PREINIT:\n" + " char * str;\n" + " STRLEN len;\n"); + if ( type == FieldDescriptor::TYPE_STRING ) { + printer.Print(vars, " TString $value$;\n"); - } - printer.Print("\n" - " CODE:\n"); - break; - case FieldDescriptor::CPPTYPE_MESSAGE: - printer.Print(vars, - " SV * svVAL\n" - " CODE:\n"); - break; - default: - vars["value"] = "svVAL"; - break; - } - - GenerateTypemapInput(descriptor, printer, "THIS"); - - if ( fieldtype == FieldDescriptor::CPPTYPE_MESSAGE ) { - GenerateTypemapInput(field->message_type(), printer, "VAL"); - } - - if ( repeated ) { - if ( fieldtype == FieldDescriptor::CPPTYPE_MESSAGE ) { - printer.Print(vars, - " if ( VAL != NULL ) {\n" - " $fieldtype$ * mval = THIS->add_$cppname$();\n" - " mval->CopyFrom(*VAL);\n" - " }\n"); - } else if ( fieldtype == FieldDescriptor::CPPTYPE_ENUM ) { - printer.Print(vars, - " if ( $etype$_IsValid(svVAL) ) {\n" - " THIS->add_$cppname$(($etype$)svVAL);\n" - " }\n"); - } else if ( fieldtype == FieldDescriptor::CPPTYPE_STRING ) { - printer.Print(" str = SvPV(svVAL, len);\n"); - if ( type == FieldDescriptor::TYPE_BYTES ) { - printer.Print(vars, - " THIS->add_$cppname$(str, len);\n"); - } else if ( type == FieldDescriptor::TYPE_STRING ) { - printer.Print(vars, - " $value$.assign(str, len);\n" - " THIS->add_$cppname$($value$);\n"); - } - } else { - printer.Print(vars, - " THIS->add_$cppname$($value$);\n"); - } - } else { - if ( fieldtype == FieldDescriptor::CPPTYPE_MESSAGE ) { - printer.Print(vars, - " if ( VAL != NULL ) {\n" - " $fieldtype$ * mval = THIS->mutable_$cppname$();\n" - " mval->CopyFrom(*VAL);\n" - " }\n"); - } else if ( fieldtype == FieldDescriptor::CPPTYPE_ENUM ) { - printer.Print(vars, - " if ( $etype$_IsValid(svVAL) ) {\n" - " THIS->set_$cppname$(($etype$)svVAL);\n" - " }\n"); - } else if ( fieldtype == FieldDescriptor::CPPTYPE_STRING ) { - printer.Print(" str = SvPV(svVAL, len);\n"); - if ( type == FieldDescriptor::TYPE_STRING ) { - printer.Print(vars, - " sval.assign(str, len);\n" - " THIS->set_$cppname$($value$);\n"); - } else if ( type == FieldDescriptor::TYPE_BYTES ) { - printer.Print(vars, - " THIS->set_$cppname$(str, len);\n"); - } else { - // Can't get here - } - } else { - printer.Print(vars, - " THIS->set_$cppname$($value$);\n"); - } - } - - printer.Print("\n\n"); -} - - -void -PerlXSGenerator::GenerateMessageXSCommonMethods(const Descriptor* descriptor, - io::Printer& printer, + } + printer.Print("\n" + " CODE:\n"); + break; + case FieldDescriptor::CPPTYPE_MESSAGE: + printer.Print(vars, + " SV * svVAL\n" + " CODE:\n"); + break; + default: + vars["value"] = "svVAL"; + break; + } + + GenerateTypemapInput(descriptor, printer, "THIS"); + + if ( fieldtype == FieldDescriptor::CPPTYPE_MESSAGE ) { + GenerateTypemapInput(field->message_type(), printer, "VAL"); + } + + if ( repeated ) { + if ( fieldtype == FieldDescriptor::CPPTYPE_MESSAGE ) { + printer.Print(vars, + " if ( VAL != NULL ) {\n" + " $fieldtype$ * mval = THIS->add_$cppname$();\n" + " mval->CopyFrom(*VAL);\n" + " }\n"); + } else if ( fieldtype == FieldDescriptor::CPPTYPE_ENUM ) { + printer.Print(vars, + " if ( $etype$_IsValid(svVAL) ) {\n" + " THIS->add_$cppname$(($etype$)svVAL);\n" + " }\n"); + } else if ( fieldtype == FieldDescriptor::CPPTYPE_STRING ) { + printer.Print(" str = SvPV(svVAL, len);\n"); + if ( type == FieldDescriptor::TYPE_BYTES ) { + printer.Print(vars, + " THIS->add_$cppname$(str, len);\n"); + } else if ( type == FieldDescriptor::TYPE_STRING ) { + printer.Print(vars, + " $value$.assign(str, len);\n" + " THIS->add_$cppname$($value$);\n"); + } + } else { + printer.Print(vars, + " THIS->add_$cppname$($value$);\n"); + } + } else { + if ( fieldtype == FieldDescriptor::CPPTYPE_MESSAGE ) { + printer.Print(vars, + " if ( VAL != NULL ) {\n" + " $fieldtype$ * mval = THIS->mutable_$cppname$();\n" + " mval->CopyFrom(*VAL);\n" + " }\n"); + } else if ( fieldtype == FieldDescriptor::CPPTYPE_ENUM ) { + printer.Print(vars, + " if ( $etype$_IsValid(svVAL) ) {\n" + " THIS->set_$cppname$(($etype$)svVAL);\n" + " }\n"); + } else if ( fieldtype == FieldDescriptor::CPPTYPE_STRING ) { + printer.Print(" str = SvPV(svVAL, len);\n"); + if ( type == FieldDescriptor::TYPE_STRING ) { + printer.Print(vars, + " sval.assign(str, len);\n" + " THIS->set_$cppname$($value$);\n"); + } else if ( type == FieldDescriptor::TYPE_BYTES ) { + printer.Print(vars, + " THIS->set_$cppname$(str, len);\n"); + } else { + // Can't get here + } + } else { + printer.Print(vars, + " THIS->set_$cppname$($value$);\n"); + } + } + + printer.Print("\n\n"); +} + + +void +PerlXSGenerator::GenerateMessageXSCommonMethods(const Descriptor* descriptor, + io::Printer& printer, const TProtoStringType& classname) const -{ +{ std::map<TProtoStringType, TProtoStringType> vars; -#if (GOOGLE_PROTOBUF_VERSION >= 2002000) - FileOptions::OptimizeMode mode; -#endif // GOOGLE_PROTOBUF_VERSION +#if (GOOGLE_PROTOBUF_VERSION >= 2002000) + FileOptions::OptimizeMode mode; +#endif // GOOGLE_PROTOBUF_VERSION TProtoStringType cn = cpp::ClassName(descriptor, true); TProtoStringType un = StringReplace(cn, "::", "__", true); - -#if (GOOGLE_PROTOBUF_VERSION >= 2002000) - mode = descriptor->file()->options().optimize_for(); -#endif // GOOGLE_PROTOBUF_VERSION - - vars["classname"] = classname; - vars["perlclass"] = MessageClassName(descriptor); - vars["underscores"] = un; - - // copy_from - - printer.Print(vars, - "void\n" - "copy_from(svTHIS, sv)\n" - " SV * svTHIS\n" - " SV * sv\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " if ( THIS != NULL && sv != NULL ) {\n" - " if ( sv_derived_from(sv, \"$perlclass$\") ) {\n" - " IV tmp = SvIV((SV *)SvRV(sv));\n" - " $classname$ * other = " - "INT2PTR($underscores$ *, tmp);\n" - "\n" - " THIS->CopyFrom(*other);\n" - " } else if ( SvROK(sv) &&\n" - " SvTYPE(SvRV(sv)) == SVt_PVHV ) {\n" - " $classname$ * other = " - "$underscores$_from_hashref(sv);\n" - " THIS->CopyFrom(*other);\n" - " delete other;\n" - " }\n" - " }\n" - "\n" - "\n"); - - // merge_from - - printer.Print(vars, - "void\n" - "merge_from(svTHIS, sv)\n" - " SV * svTHIS\n" - " SV * sv\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " if ( THIS != NULL && sv != NULL ) {\n" - " if ( sv_derived_from(sv, \"$perlclass$\") ) {\n" - " IV tmp = SvIV((SV *)SvRV(sv));\n" - " $classname$ * other = " - "INT2PTR($underscores$ *, tmp);\n" - "\n" - " THIS->MergeFrom(*other);\n" - " } else if ( SvROK(sv) &&\n" - " SvTYPE(SvRV(sv)) == SVt_PVHV ) {\n" - " $classname$ * other = " - "$underscores$_from_hashref(sv);\n" - " THIS->MergeFrom(*other);\n" - " delete other;\n" - " }\n" - " }\n" - "\n" - "\n"); - - // clear - - printer.Print(vars, - "void\n" - "clear(svTHIS)\n" - " SV * svTHIS\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " if ( THIS != NULL ) {\n" - " THIS->Clear();\n" - " }\n" - "\n" - "\n"); - - // is_initialized - - printer.Print(vars, - "int\n" - "is_initialized(svTHIS)\n" - " SV * svTHIS\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " if ( THIS != NULL ) {\n" - " RETVAL = THIS->IsInitialized();\n" - " } else {\n" - " RETVAL = 0;\n" - " }\n" - "\n" - " OUTPUT:\n" - " RETVAL\n" - "\n" - "\n"); - - // error_string - - printer.Print(vars, - "SV *\n" - "error_string(svTHIS)\n" - " SV * svTHIS\n" - " PREINIT:\n" + +#if (GOOGLE_PROTOBUF_VERSION >= 2002000) + mode = descriptor->file()->options().optimize_for(); +#endif // GOOGLE_PROTOBUF_VERSION + + vars["classname"] = classname; + vars["perlclass"] = MessageClassName(descriptor); + vars["underscores"] = un; + + // copy_from + + printer.Print(vars, + "void\n" + "copy_from(svTHIS, sv)\n" + " SV * svTHIS\n" + " SV * sv\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " if ( THIS != NULL && sv != NULL ) {\n" + " if ( sv_derived_from(sv, \"$perlclass$\") ) {\n" + " IV tmp = SvIV((SV *)SvRV(sv));\n" + " $classname$ * other = " + "INT2PTR($underscores$ *, tmp);\n" + "\n" + " THIS->CopyFrom(*other);\n" + " } else if ( SvROK(sv) &&\n" + " SvTYPE(SvRV(sv)) == SVt_PVHV ) {\n" + " $classname$ * other = " + "$underscores$_from_hashref(sv);\n" + " THIS->CopyFrom(*other);\n" + " delete other;\n" + " }\n" + " }\n" + "\n" + "\n"); + + // merge_from + + printer.Print(vars, + "void\n" + "merge_from(svTHIS, sv)\n" + " SV * svTHIS\n" + " SV * sv\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " if ( THIS != NULL && sv != NULL ) {\n" + " if ( sv_derived_from(sv, \"$perlclass$\") ) {\n" + " IV tmp = SvIV((SV *)SvRV(sv));\n" + " $classname$ * other = " + "INT2PTR($underscores$ *, tmp);\n" + "\n" + " THIS->MergeFrom(*other);\n" + " } else if ( SvROK(sv) &&\n" + " SvTYPE(SvRV(sv)) == SVt_PVHV ) {\n" + " $classname$ * other = " + "$underscores$_from_hashref(sv);\n" + " THIS->MergeFrom(*other);\n" + " delete other;\n" + " }\n" + " }\n" + "\n" + "\n"); + + // clear + + printer.Print(vars, + "void\n" + "clear(svTHIS)\n" + " SV * svTHIS\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " if ( THIS != NULL ) {\n" + " THIS->Clear();\n" + " }\n" + "\n" + "\n"); + + // is_initialized + + printer.Print(vars, + "int\n" + "is_initialized(svTHIS)\n" + " SV * svTHIS\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " if ( THIS != NULL ) {\n" + " RETVAL = THIS->IsInitialized();\n" + " } else {\n" + " RETVAL = 0;\n" + " }\n" + "\n" + " OUTPUT:\n" + " RETVAL\n" + "\n" + "\n"); + + // error_string + + printer.Print(vars, + "SV *\n" + "error_string(svTHIS)\n" + " SV * svTHIS\n" + " PREINIT:\n" " TString estr;\n" - "\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " if ( THIS != NULL ) {\n" - " estr = THIS->InitializationErrorString();\n" - " }\n" - " RETVAL = newSVpv(estr.c_str(), estr.length());\n" - "\n" - " OUTPUT:\n" - " RETVAL\n" - "\n" - "\n"); - - // LITE_RUNTIME does not include certain methods. - -#if (GOOGLE_PROTOBUF_VERSION >= 2002000) - if (mode != FileOptions::LITE_RUNTIME) { -#endif // GOOGLE_PROTOBUF_VERSION - - // discard_unknown_fields - - printer.Print(vars, - "void\n" - "discard_unkown_fields(svTHIS)\n" - " SV * svTHIS\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " if ( THIS != NULL ) {\n" - " THIS->DiscardUnknownFields();\n" - " }\n" - "\n" - "\n"); - - // debug_string - - printer.Print(vars, - "SV *\n" - "debug_string(svTHIS)\n" - " SV * svTHIS\n" - " PREINIT:\n" + "\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " if ( THIS != NULL ) {\n" + " estr = THIS->InitializationErrorString();\n" + " }\n" + " RETVAL = newSVpv(estr.c_str(), estr.length());\n" + "\n" + " OUTPUT:\n" + " RETVAL\n" + "\n" + "\n"); + + // LITE_RUNTIME does not include certain methods. + +#if (GOOGLE_PROTOBUF_VERSION >= 2002000) + if (mode != FileOptions::LITE_RUNTIME) { +#endif // GOOGLE_PROTOBUF_VERSION + + // discard_unknown_fields + + printer.Print(vars, + "void\n" + "discard_unkown_fields(svTHIS)\n" + " SV * svTHIS\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " if ( THIS != NULL ) {\n" + " THIS->DiscardUnknownFields();\n" + " }\n" + "\n" + "\n"); + + // debug_string + + printer.Print(vars, + "SV *\n" + "debug_string(svTHIS)\n" + " SV * svTHIS\n" + " PREINIT:\n" " TString dstr;\n" - "\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " if ( THIS != NULL ) {\n" - " dstr = THIS->DebugString();\n" - " }\n" - " RETVAL = newSVpv(dstr.c_str(), dstr.length());\n" - "\n" - " OUTPUT:\n" - " RETVAL\n" - "\n" - "\n"); - - // short_debug_string - - printer.Print(vars, - "SV *\n" - "short_debug_string(svTHIS)\n" - " SV * svTHIS\n" - " PREINIT:\n" + "\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " if ( THIS != NULL ) {\n" + " dstr = THIS->DebugString();\n" + " }\n" + " RETVAL = newSVpv(dstr.c_str(), dstr.length());\n" + "\n" + " OUTPUT:\n" + " RETVAL\n" + "\n" + "\n"); + + // short_debug_string + + printer.Print(vars, + "SV *\n" + "short_debug_string(svTHIS)\n" + " SV * svTHIS\n" + " PREINIT:\n" " TString dstr;\n" - "\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " if ( THIS != NULL ) {\n" - " dstr = THIS->ShortDebugString();\n" - " }\n" - " RETVAL = newSVpv(dstr.c_str(), dstr.length());\n" - "\n" - " OUTPUT:\n" - " RETVAL\n" - "\n" - "\n"); -#if (GOOGLE_PROTOBUF_VERSION >= 2002000) - } -#endif // GOOGLE_PROTOBUF_VERSION - - // unpack - - printer.Print(vars, - "int\n" - "unpack(svTHIS, arg)\n" - " SV * svTHIS\n" - " SV * arg\n" - " PREINIT:\n" - " STRLEN len;\n" - " char * str;\n" - "\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " if ( THIS != NULL ) {\n" - " str = SvPV(arg, len);\n" - " if ( str != NULL ) {\n" - " RETVAL = THIS->ParseFromArray(str, len);\n" - " } else {\n" - " RETVAL = 0;\n" - " }\n" - " } else {\n" - " RETVAL = 0;\n" - " }\n" - "\n" - " OUTPUT:\n" - " RETVAL\n" - "\n" - "\n"); - - // pack - - printer.Print(vars, - "SV *\n" - "pack(svTHIS)\n" - " SV * svTHIS\n"); - - // This may be controlled by a custom option at some point. -#if NO_ZERO_COPY - printer.Print(vars, - " PREINIT:\n" + "\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " if ( THIS != NULL ) {\n" + " dstr = THIS->ShortDebugString();\n" + " }\n" + " RETVAL = newSVpv(dstr.c_str(), dstr.length());\n" + "\n" + " OUTPUT:\n" + " RETVAL\n" + "\n" + "\n"); +#if (GOOGLE_PROTOBUF_VERSION >= 2002000) + } +#endif // GOOGLE_PROTOBUF_VERSION + + // unpack + + printer.Print(vars, + "int\n" + "unpack(svTHIS, arg)\n" + " SV * svTHIS\n" + " SV * arg\n" + " PREINIT:\n" + " STRLEN len;\n" + " char * str;\n" + "\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " if ( THIS != NULL ) {\n" + " str = SvPV(arg, len);\n" + " if ( str != NULL ) {\n" + " RETVAL = THIS->ParseFromArray(str, len);\n" + " } else {\n" + " RETVAL = 0;\n" + " }\n" + " } else {\n" + " RETVAL = 0;\n" + " }\n" + "\n" + " OUTPUT:\n" + " RETVAL\n" + "\n" + "\n"); + + // pack + + printer.Print(vars, + "SV *\n" + "pack(svTHIS)\n" + " SV * svTHIS\n"); + + // This may be controlled by a custom option at some point. +#if NO_ZERO_COPY + printer.Print(vars, + " PREINIT:\n" " TProtoStringType output;\n" - "\n"); -#endif - - printer.Print(vars, - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " if ( THIS != NULL ) {\n"); - - vars["base"] = cpp::StripProto(descriptor->file()->name()); - - printer.Print(vars, - " RETVAL = newSVpvn(\"\", 0);\n" - " $base$_OutputStream os(RETVAL);\n" - " if ( THIS->IsInitialized() ) {\n" - " if ( THIS->SerializePartialToZeroCopyStream(&os)" - "!= true ) {\n" - " SvREFCNT_dec(RETVAL);\n" - " RETVAL = Nullsv;\n" - " } else {\n" - " os.Sync();\n" - " }\n" - " } else {\n" - " croak(\"Can't serialize message of type " - "'$perlclass$' because it is missing required fields: %s\",\n" - " THIS->InitializationErrorString().c_str());\n" - " }\n"); - - printer.Print(vars, - " } else {\n" - " RETVAL = Nullsv;\n" - " }\n" - "\n" - " OUTPUT:\n" - " RETVAL\n" - "\n" - "\n"); - - // length - - printer.Print(vars, - "int\n" - "length(svTHIS)\n" - " SV * svTHIS\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " if ( THIS != NULL ) {\n" - " RETVAL = THIS->ByteSize();\n" - " } else {\n" - " RETVAL = 0;\n" - " }\n" - "\n" - " OUTPUT:\n" - " RETVAL\n" - "\n" - "\n"); - - // fields - - std::ostringstream field_count; - - field_count << descriptor->field_count(); - vars["field_count"] = field_count.str(); - printer.Print(vars, - "void\n" - "fields(svTHIS)\n" - " SV * svTHIS\n" - " PPCODE:\n" - " (void)svTHIS;\n" - " EXTEND(SP, $field_count$);\n"); - - for ( int i = 0; i < descriptor->field_count(); i++ ) { - const FieldDescriptor* field = descriptor->field(i); - vars["field"] = field->name(); - printer.Print(vars, - " PUSHs(sv_2mortal(newSVpv(\"$field$\",0)));\n" - ); - } - - printer.Print("\n\n"); - - // to_hashref - - printer.Print(vars, - "SV *\n" - "to_hashref(svTHIS)\n" - " SV * svTHIS\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(vars, - " if ( THIS != NULL ) {\n" - " HV * hv0 = newHV();\n" - " $classname$ * msg0 = THIS;\n" - "\n"); - - vars["depth"] = "0"; - vars["fieldtype"] = classname; - - printer.Indent(); - printer.Indent(); - printer.Indent(); - MessageToHashref(descriptor, printer, vars, 0); - printer.Outdent(); - printer.Outdent(); - printer.Outdent(); - - printer.Print(" RETVAL = newRV_noinc((SV *)hv0);\n" - " } else {\n" - " RETVAL = Nullsv;\n" - " }\n" - "\n" - " OUTPUT:\n" - " RETVAL\n" - "\n" - "\n"); -} - -void -PerlXSGenerator::GenerateMessageXSPackage(const Descriptor* descriptor, - io::Printer& printer) const -{ - for ( int i = 0; i < descriptor->nested_type_count(); i++ ) { - GenerateMessageXSPackage(descriptor->nested_type(i), printer); - } - + "\n"); +#endif + + printer.Print(vars, + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " if ( THIS != NULL ) {\n"); + + vars["base"] = cpp::StripProto(descriptor->file()->name()); + + printer.Print(vars, + " RETVAL = newSVpvn(\"\", 0);\n" + " $base$_OutputStream os(RETVAL);\n" + " if ( THIS->IsInitialized() ) {\n" + " if ( THIS->SerializePartialToZeroCopyStream(&os)" + "!= true ) {\n" + " SvREFCNT_dec(RETVAL);\n" + " RETVAL = Nullsv;\n" + " } else {\n" + " os.Sync();\n" + " }\n" + " } else {\n" + " croak(\"Can't serialize message of type " + "'$perlclass$' because it is missing required fields: %s\",\n" + " THIS->InitializationErrorString().c_str());\n" + " }\n"); + + printer.Print(vars, + " } else {\n" + " RETVAL = Nullsv;\n" + " }\n" + "\n" + " OUTPUT:\n" + " RETVAL\n" + "\n" + "\n"); + + // length + + printer.Print(vars, + "int\n" + "length(svTHIS)\n" + " SV * svTHIS\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " if ( THIS != NULL ) {\n" + " RETVAL = THIS->ByteSize();\n" + " } else {\n" + " RETVAL = 0;\n" + " }\n" + "\n" + " OUTPUT:\n" + " RETVAL\n" + "\n" + "\n"); + + // fields + + std::ostringstream field_count; + + field_count << descriptor->field_count(); + vars["field_count"] = field_count.str(); + printer.Print(vars, + "void\n" + "fields(svTHIS)\n" + " SV * svTHIS\n" + " PPCODE:\n" + " (void)svTHIS;\n" + " EXTEND(SP, $field_count$);\n"); + + for ( int i = 0; i < descriptor->field_count(); i++ ) { + const FieldDescriptor* field = descriptor->field(i); + vars["field"] = field->name(); + printer.Print(vars, + " PUSHs(sv_2mortal(newSVpv(\"$field$\",0)));\n" + ); + } + + printer.Print("\n\n"); + + // to_hashref + + printer.Print(vars, + "SV *\n" + "to_hashref(svTHIS)\n" + " SV * svTHIS\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(vars, + " if ( THIS != NULL ) {\n" + " HV * hv0 = newHV();\n" + " $classname$ * msg0 = THIS;\n" + "\n"); + + vars["depth"] = "0"; + vars["fieldtype"] = classname; + + printer.Indent(); + printer.Indent(); + printer.Indent(); + MessageToHashref(descriptor, printer, vars, 0); + printer.Outdent(); + printer.Outdent(); + printer.Outdent(); + + printer.Print(" RETVAL = newRV_noinc((SV *)hv0);\n" + " } else {\n" + " RETVAL = Nullsv;\n" + " }\n" + "\n" + " OUTPUT:\n" + " RETVAL\n" + "\n" + "\n"); +} + +void +PerlXSGenerator::GenerateMessageXSPackage(const Descriptor* descriptor, + io::Printer& printer) const +{ + for ( int i = 0; i < descriptor->nested_type_count(); i++ ) { + GenerateMessageXSPackage(descriptor->nested_type(i), printer); + } + std::map<TProtoStringType, TProtoStringType> vars; - + TProtoStringType cn = cpp::ClassName(descriptor, true); TProtoStringType mn = MessageModuleName(descriptor); TProtoStringType pn = MessageClassName(descriptor); TProtoStringType un = StringReplace(cn, "::", "__", true); - - vars["module"] = mn; - vars["classname"] = cn; - vars["package"] = pn; - vars["underscores"] = un; - - printer.Print(vars, - "MODULE = $module$ PACKAGE = $package$\n" - "PROTOTYPES: ENABLE\n" - "\n" - "\n"); - - // BOOT (if there are enum types) - - int enum_count = descriptor->enum_type_count(); - - if ( enum_count > 0 ) { - printer.Print("BOOT:\n" - " {\n" - " HV * stash;\n\n"); - - printer.Indent(); - printer.Indent(); - for ( int i = 0; i < enum_count; i++ ) { - const EnumDescriptor * etype = descriptor->enum_type(i); - int vcount = etype->value_count(); - - printer.Print("stash = gv_stashpv(\"$package$::$name$\", TRUE);\n", - "package", pn, - "name", etype->name()); - for ( int j = 0; j < vcount; j++ ) { - const EnumValueDescriptor * vdesc = etype->value(j); - printer.Print( - "newCONSTSUB(stash, \"$name$\", newSViv($classname$::$name$));\n", - "classname", cn, - "name", vdesc->name() - ); - } - } - printer.Outdent(); - printer.Outdent(); - printer.Print(" }\n\n\n"); - } - - // Constructor - - printer.Print(vars, - "SV *\n" - "$classname$::new (...)\n" - " PREINIT:\n" - " $classname$ * rv = NULL;\n" - "\n" - " CODE:\n" - " if ( strcmp(CLASS,\"$package$\") ) {\n" - " croak(\"invalid class %s\",CLASS);\n" - " }\n" - " if ( items == 2 && ST(1) != Nullsv ) {\n" - " if ( SvROK(ST(1)) && " - "SvTYPE(SvRV(ST(1))) == SVt_PVHV ) {\n" - " rv = $underscores$_from_hashref(ST(1));\n" - " } else {\n" - " STRLEN len;\n" - " char * str;\n" - "\n" - " rv = new $classname$;\n" - " str = SvPV(ST(1), len);\n" - " if ( str != NULL ) {\n" - " rv->ParseFromArray(str, len);\n" - " }\n" - " }\n" - " } else {\n" - " rv = new $classname$;\n" - " }\n" - " RETVAL = newSV(0);\n" - " sv_setref_pv(RETVAL, \"$package$\", (void *)rv);\n" - "\n" - " OUTPUT:\n" - " RETVAL\n" - "\n" - "\n"); - - // Destructor - - printer.Print(vars, - "void\n" - "DESTROY(svTHIS)\n" - " SV * svTHIS;\n" - " CODE:\n"); - GenerateTypemapInput(descriptor, printer, "THIS"); - printer.Print(" if ( THIS != NULL ) {\n" - " delete THIS;\n" - " }\n" - "\n" - "\n"); - - // Message methods (copy_from, parse_from, etc). - - GenerateMessageXSCommonMethods(descriptor, printer, cn); - - // Field accessors - - for ( int i = 0; i < descriptor->field_count(); i++ ) { - GenerateMessageXSFieldAccessors(descriptor->field(i), printer, cn); - } -} - - -void -PerlXSGenerator::GenerateTypemapInput(const Descriptor* descriptor, - io::Printer& printer, + + vars["module"] = mn; + vars["classname"] = cn; + vars["package"] = pn; + vars["underscores"] = un; + + printer.Print(vars, + "MODULE = $module$ PACKAGE = $package$\n" + "PROTOTYPES: ENABLE\n" + "\n" + "\n"); + + // BOOT (if there are enum types) + + int enum_count = descriptor->enum_type_count(); + + if ( enum_count > 0 ) { + printer.Print("BOOT:\n" + " {\n" + " HV * stash;\n\n"); + + printer.Indent(); + printer.Indent(); + for ( int i = 0; i < enum_count; i++ ) { + const EnumDescriptor * etype = descriptor->enum_type(i); + int vcount = etype->value_count(); + + printer.Print("stash = gv_stashpv(\"$package$::$name$\", TRUE);\n", + "package", pn, + "name", etype->name()); + for ( int j = 0; j < vcount; j++ ) { + const EnumValueDescriptor * vdesc = etype->value(j); + printer.Print( + "newCONSTSUB(stash, \"$name$\", newSViv($classname$::$name$));\n", + "classname", cn, + "name", vdesc->name() + ); + } + } + printer.Outdent(); + printer.Outdent(); + printer.Print(" }\n\n\n"); + } + + // Constructor + + printer.Print(vars, + "SV *\n" + "$classname$::new (...)\n" + " PREINIT:\n" + " $classname$ * rv = NULL;\n" + "\n" + " CODE:\n" + " if ( strcmp(CLASS,\"$package$\") ) {\n" + " croak(\"invalid class %s\",CLASS);\n" + " }\n" + " if ( items == 2 && ST(1) != Nullsv ) {\n" + " if ( SvROK(ST(1)) && " + "SvTYPE(SvRV(ST(1))) == SVt_PVHV ) {\n" + " rv = $underscores$_from_hashref(ST(1));\n" + " } else {\n" + " STRLEN len;\n" + " char * str;\n" + "\n" + " rv = new $classname$;\n" + " str = SvPV(ST(1), len);\n" + " if ( str != NULL ) {\n" + " rv->ParseFromArray(str, len);\n" + " }\n" + " }\n" + " } else {\n" + " rv = new $classname$;\n" + " }\n" + " RETVAL = newSV(0);\n" + " sv_setref_pv(RETVAL, \"$package$\", (void *)rv);\n" + "\n" + " OUTPUT:\n" + " RETVAL\n" + "\n" + "\n"); + + // Destructor + + printer.Print(vars, + "void\n" + "DESTROY(svTHIS)\n" + " SV * svTHIS;\n" + " CODE:\n"); + GenerateTypemapInput(descriptor, printer, "THIS"); + printer.Print(" if ( THIS != NULL ) {\n" + " delete THIS;\n" + " }\n" + "\n" + "\n"); + + // Message methods (copy_from, parse_from, etc). + + GenerateMessageXSCommonMethods(descriptor, printer, cn); + + // Field accessors + + for ( int i = 0; i < descriptor->field_count(); i++ ) { + GenerateMessageXSFieldAccessors(descriptor->field(i), printer, cn); + } +} + + +void +PerlXSGenerator::GenerateTypemapInput(const Descriptor* descriptor, + io::Printer& printer, const TProtoStringType& svname) const -{ +{ std::map<TProtoStringType, TProtoStringType> vars; - + TProtoStringType cn = cpp::ClassName(descriptor, true); - - vars["classname"] = cn; - vars["perlclass"] = MessageClassName(descriptor); - vars["underscores"] = StringReplace(cn, "::", "__", true); - vars["svname"] = svname; - - printer.Print(vars, - " $classname$ * $svname$;\n" - " if ( sv_derived_from(sv$svname$, \"$perlclass$\") ) {\n" - " IV tmp = SvIV((SV *)SvRV(sv$svname$));\n" - " $svname$ = INT2PTR($underscores$ *, tmp);\n" - " } else {\n" - " croak(\"$svname$ is not of type $perlclass$\");\n" - " }\n"); -} - -// Returns the containing Perl module name for a message descriptor. - + + vars["classname"] = cn; + vars["perlclass"] = MessageClassName(descriptor); + vars["underscores"] = StringReplace(cn, "::", "__", true); + vars["svname"] = svname; + + printer.Print(vars, + " $classname$ * $svname$;\n" + " if ( sv_derived_from(sv$svname$, \"$perlclass$\") ) {\n" + " IV tmp = SvIV((SV *)SvRV(sv$svname$));\n" + " $svname$ = INT2PTR($underscores$ *, tmp);\n" + " } else {\n" + " croak(\"$svname$ is not of type $perlclass$\");\n" + " }\n"); +} + +// Returns the containing Perl module name for a message descriptor. + TProtoStringType -PerlXSGenerator::MessageModuleName(const Descriptor* descriptor) const -{ - const Descriptor *container = descriptor; - - while (container->containing_type() != NULL) { - container = container->containing_type(); - } - - return MessageClassName(container); -} - -// Returns the Perl class name for a message descriptor. - +PerlXSGenerator::MessageModuleName(const Descriptor* descriptor) const +{ + const Descriptor *container = descriptor; + + while (container->containing_type() != NULL) { + container = container->containing_type(); + } + + return MessageClassName(container); +} + +// Returns the Perl class name for a message descriptor. + TProtoStringType -PerlXSGenerator::MessageClassName(const Descriptor* descriptor) const -{ - return PackageName(descriptor->full_name(), descriptor->file()->package()); -} - -// Returns the Perl class name for a message descriptor. - +PerlXSGenerator::MessageClassName(const Descriptor* descriptor) const +{ + return PackageName(descriptor->full_name(), descriptor->file()->package()); +} + +// Returns the Perl class name for a message descriptor. + TProtoStringType -PerlXSGenerator::EnumClassName(const EnumDescriptor* descriptor) const -{ - return PackageName(descriptor->full_name(), descriptor->file()->package()); -} - -// Possibly replace the package prefix with the --perlxs-package value - +PerlXSGenerator::EnumClassName(const EnumDescriptor* descriptor) const +{ + return PackageName(descriptor->full_name(), descriptor->file()->package()); +} + +// Possibly replace the package prefix with the --perlxs-package value + TProtoStringType PerlXSGenerator::PackageName(const TProtoStringType& name, const TProtoStringType& package) const -{ +{ TProtoStringType output; - - if (!perlxs_package_.empty()) { - output = StringReplace(name, package.c_str(), perlxs_package_.c_str(), false); - output = StringReplace(output, ".", "::", true); - } else { - output = StringReplace(name, ".", "::", true); - } - - return output; -} - -void -PerlXSGenerator::PerlSVGetHelper(io::Printer& printer, + + if (!perlxs_package_.empty()) { + output = StringReplace(name, package.c_str(), perlxs_package_.c_str(), false); + output = StringReplace(output, ".", "::", true); + } else { + output = StringReplace(name, ".", "::", true); + } + + return output; +} + +void +PerlXSGenerator::PerlSVGetHelper(io::Printer& printer, const std::map<TProtoStringType, TProtoStringType>& vars, - FieldDescriptor::CppType fieldtype, - int depth) const -{ - for ( int i = 0; i < depth; i++ ) { - printer.Indent(); - } - - switch ( fieldtype ) { - case FieldDescriptor::CPPTYPE_INT32: - case FieldDescriptor::CPPTYPE_BOOL: - case FieldDescriptor::CPPTYPE_ENUM: - printer.Print(vars, - "sv = sv_2mortal(newSViv(THIS->$cppname$($i$)));\n"); - break; - case FieldDescriptor::CPPTYPE_UINT32: - printer.Print(vars, - "sv = sv_2mortal(newSVuv(THIS->$cppname$($i$)));\n"); - break; - case FieldDescriptor::CPPTYPE_FLOAT: - case FieldDescriptor::CPPTYPE_DOUBLE: - printer.Print(vars, - "sv = sv_2mortal(newSVnv(THIS->$cppname$($i$)));\n"); - break; - case FieldDescriptor::CPPTYPE_INT64: - case FieldDescriptor::CPPTYPE_UINT64: - printer.Print(vars, - "ost.str(\"\");\n" - "ost << THIS->$cppname$($i$);\n" - "sv = sv_2mortal(newSVpv(ost.str().c_str(),\n" - " ost.str().length()));\n"); - break; - case FieldDescriptor::CPPTYPE_STRING: - printer.Print(vars, - "sv = sv_2mortal(newSVpv(THIS->$cppname$($i$).c_str(),\n" - " " - "THIS->$cppname$($i$).length()));\n"); - break; - case FieldDescriptor::CPPTYPE_MESSAGE: - printer.Print(vars, - "val = new $fieldtype$;\n" - "val->CopyFrom(THIS->$cppname$($i$));\n" - "sv = sv_newmortal();\n" - "sv_setref_pv(sv, \"$fieldclass$\", (void *)val);\n"); - break; - default: - printer.Print("sv = &PL_sv_undef;\n"); - break; - } - - for ( int i = 0; i < depth; i++ ) { - printer.Outdent(); - } -} - -void -PerlXSGenerator::PODPrintEnumValue(const EnumValueDescriptor *value, - io::Printer& printer) const -{ - std::ostringstream ost; - printer.Print("=item B<*value*>\n" - "\n", - "value", value->name()); - ost << value->number(); - printer.Print("This constant has a value of *number*.\n" - "\n", - "number", ost.str().c_str()); -} - + FieldDescriptor::CppType fieldtype, + int depth) const +{ + for ( int i = 0; i < depth; i++ ) { + printer.Indent(); + } + + switch ( fieldtype ) { + case FieldDescriptor::CPPTYPE_INT32: + case FieldDescriptor::CPPTYPE_BOOL: + case FieldDescriptor::CPPTYPE_ENUM: + printer.Print(vars, + "sv = sv_2mortal(newSViv(THIS->$cppname$($i$)));\n"); + break; + case FieldDescriptor::CPPTYPE_UINT32: + printer.Print(vars, + "sv = sv_2mortal(newSVuv(THIS->$cppname$($i$)));\n"); + break; + case FieldDescriptor::CPPTYPE_FLOAT: + case FieldDescriptor::CPPTYPE_DOUBLE: + printer.Print(vars, + "sv = sv_2mortal(newSVnv(THIS->$cppname$($i$)));\n"); + break; + case FieldDescriptor::CPPTYPE_INT64: + case FieldDescriptor::CPPTYPE_UINT64: + printer.Print(vars, + "ost.str(\"\");\n" + "ost << THIS->$cppname$($i$);\n" + "sv = sv_2mortal(newSVpv(ost.str().c_str(),\n" + " ost.str().length()));\n"); + break; + case FieldDescriptor::CPPTYPE_STRING: + printer.Print(vars, + "sv = sv_2mortal(newSVpv(THIS->$cppname$($i$).c_str(),\n" + " " + "THIS->$cppname$($i$).length()));\n"); + break; + case FieldDescriptor::CPPTYPE_MESSAGE: + printer.Print(vars, + "val = new $fieldtype$;\n" + "val->CopyFrom(THIS->$cppname$($i$));\n" + "sv = sv_newmortal();\n" + "sv_setref_pv(sv, \"$fieldclass$\", (void *)val);\n"); + break; + default: + printer.Print("sv = &PL_sv_undef;\n"); + break; + } + + for ( int i = 0; i < depth; i++ ) { + printer.Outdent(); + } +} + +void +PerlXSGenerator::PODPrintEnumValue(const EnumValueDescriptor *value, + io::Printer& printer) const +{ + std::ostringstream ost; + printer.Print("=item B<*value*>\n" + "\n", + "value", value->name()); + ost << value->number(); + printer.Print("This constant has a value of *number*.\n" + "\n", + "number", ost.str().c_str()); +} + TProtoStringType -PerlXSGenerator::PODFieldTypeString(const FieldDescriptor* field) const -{ +PerlXSGenerator::PODFieldTypeString(const FieldDescriptor* field) const +{ TProtoStringType type; - - switch ( field->cpp_type() ) { - case FieldDescriptor::CPPTYPE_INT32: - type = "a 32-bit signed integer"; - break; - case FieldDescriptor::CPPTYPE_BOOL: - type = "a Boolean value"; - break; - case FieldDescriptor::CPPTYPE_ENUM: - type = "a value of " + EnumClassName(field->enum_type()); - break; - case FieldDescriptor::CPPTYPE_UINT32: - type = "a 32-bit unsigned integer"; - break; - case FieldDescriptor::CPPTYPE_FLOAT: - case FieldDescriptor::CPPTYPE_DOUBLE: - type = "a floating point number"; - break; - case FieldDescriptor::CPPTYPE_INT64: - type = "a 64-bit signed integer"; - break; - case FieldDescriptor::CPPTYPE_UINT64: - type = "a 64-bit unsigned integer"; - break; - case FieldDescriptor::CPPTYPE_STRING: + + switch ( field->cpp_type() ) { + case FieldDescriptor::CPPTYPE_INT32: + type = "a 32-bit signed integer"; + break; + case FieldDescriptor::CPPTYPE_BOOL: + type = "a Boolean value"; + break; + case FieldDescriptor::CPPTYPE_ENUM: + type = "a value of " + EnumClassName(field->enum_type()); + break; + case FieldDescriptor::CPPTYPE_UINT32: + type = "a 32-bit unsigned integer"; + break; + case FieldDescriptor::CPPTYPE_FLOAT: + case FieldDescriptor::CPPTYPE_DOUBLE: + type = "a floating point number"; + break; + case FieldDescriptor::CPPTYPE_INT64: + type = "a 64-bit signed integer"; + break; + case FieldDescriptor::CPPTYPE_UINT64: + type = "a 64-bit unsigned integer"; + break; + case FieldDescriptor::CPPTYPE_STRING: type = "a TProtoStringType"; - break; - case FieldDescriptor::CPPTYPE_MESSAGE: - type = "an instance of " + MessageClassName(field->message_type()); - break; - default: - type = "an unknown type"; - break; - } - - return type; -} - -void -PerlXSGenerator::StartFieldToHashref(const FieldDescriptor * field, - io::Printer& printer, + break; + case FieldDescriptor::CPPTYPE_MESSAGE: + type = "an instance of " + MessageClassName(field->message_type()); + break; + default: + type = "an unknown type"; + break; + } + + return type; +} + +void +PerlXSGenerator::StartFieldToHashref(const FieldDescriptor * field, + io::Printer& printer, std::map<TProtoStringType, TProtoStringType>& vars, - int depth) const -{ - SetupDepthVars(vars, depth); - - if ( field->is_repeated() ) { - vars["i"] = "i" + vars["pdepth"]; - printer.Print(vars, - "if ( msg$pdepth$->$cppname$_size() > 0 ) {\n"); - printer.Indent(); - printer.Print(vars, - "AV * av$pdepth$ = newAV();\n" - "SV * sv$pdepth$ = newRV_noinc((SV *)av$pdepth$);\n" - "\n" - "for ( int $i$ = 0; " - "$i$ < msg$pdepth$->$cppname$_size(); $i$++ ) {\n"); - } else { - vars["i"] = ""; + int depth) const +{ + SetupDepthVars(vars, depth); + + if ( field->is_repeated() ) { + vars["i"] = "i" + vars["pdepth"]; + printer.Print(vars, + "if ( msg$pdepth$->$cppname$_size() > 0 ) {\n"); + printer.Indent(); + printer.Print(vars, + "AV * av$pdepth$ = newAV();\n" + "SV * sv$pdepth$ = newRV_noinc((SV *)av$pdepth$);\n" + "\n" + "for ( int $i$ = 0; " + "$i$ < msg$pdepth$->$cppname$_size(); $i$++ ) {\n"); + } else { + vars["i"] = ""; if ( HasHasMethod(field) ) { printer.Print(vars, "if ( msg$pdepth$->has_$cppname$() ) {\n"); @@ -1737,309 +1737,309 @@ PerlXSGenerator::StartFieldToHashref(const FieldDescriptor * field, printer.Print(vars, "{\n"); } - } - printer.Indent(); -} - -void -PerlXSGenerator::FieldToHashrefHelper(io::Printer& printer, + } + printer.Indent(); +} + +void +PerlXSGenerator::FieldToHashrefHelper(io::Printer& printer, std::map<TProtoStringType, TProtoStringType>& vars, - const FieldDescriptor* field) const -{ - vars["msg"] = "msg" + vars["pdepth"]; - if ( field->is_repeated() ) { - vars["sv"] = "sv" + vars["depth"]; - } else { - vars["sv"] = "sv" + vars["pdepth"]; - } - - switch ( field->cpp_type() ) { - case FieldDescriptor::CPPTYPE_INT32: - case FieldDescriptor::CPPTYPE_BOOL: - case FieldDescriptor::CPPTYPE_ENUM: - printer.Print(vars, - "SV * $sv$ = newSViv($msg$->$cppname$($i$));\n"); - break; - case FieldDescriptor::CPPTYPE_UINT32: - printer.Print(vars, - "SV * $sv$ = newSVuv($msg$->$cppname$($i$));\n"); - break; - case FieldDescriptor::CPPTYPE_FLOAT: - case FieldDescriptor::CPPTYPE_DOUBLE: - printer.Print(vars, - "SV * $sv$ = newSVnv($msg$->$cppname$($i$));\n"); - break; - case FieldDescriptor::CPPTYPE_INT64: - case FieldDescriptor::CPPTYPE_UINT64: - printer.Print(vars, - "std::ostringstream ost$pdepth$;\n" - "\n" - "ost$pdepth$ << $msg$->$cppname$($i$);\n" - "SV * $sv$ = newSVpv(ost$pdepth$.str().c_str()," - " ost$pdepth$.str().length());\n"); - break; - case FieldDescriptor::CPPTYPE_STRING: - case FieldDescriptor::CPPTYPE_MESSAGE: - default: - printer.Print(vars, - "SV * $sv$ = newSVpv($msg$->" - "$cppname$($i$).c_str(), $msg$->" - "$cppname$($i$).length());\n"); - break; - } -} - -void -PerlXSGenerator::EndFieldToHashref(const FieldDescriptor * field, - io::Printer& printer, + const FieldDescriptor* field) const +{ + vars["msg"] = "msg" + vars["pdepth"]; + if ( field->is_repeated() ) { + vars["sv"] = "sv" + vars["depth"]; + } else { + vars["sv"] = "sv" + vars["pdepth"]; + } + + switch ( field->cpp_type() ) { + case FieldDescriptor::CPPTYPE_INT32: + case FieldDescriptor::CPPTYPE_BOOL: + case FieldDescriptor::CPPTYPE_ENUM: + printer.Print(vars, + "SV * $sv$ = newSViv($msg$->$cppname$($i$));\n"); + break; + case FieldDescriptor::CPPTYPE_UINT32: + printer.Print(vars, + "SV * $sv$ = newSVuv($msg$->$cppname$($i$));\n"); + break; + case FieldDescriptor::CPPTYPE_FLOAT: + case FieldDescriptor::CPPTYPE_DOUBLE: + printer.Print(vars, + "SV * $sv$ = newSVnv($msg$->$cppname$($i$));\n"); + break; + case FieldDescriptor::CPPTYPE_INT64: + case FieldDescriptor::CPPTYPE_UINT64: + printer.Print(vars, + "std::ostringstream ost$pdepth$;\n" + "\n" + "ost$pdepth$ << $msg$->$cppname$($i$);\n" + "SV * $sv$ = newSVpv(ost$pdepth$.str().c_str()," + " ost$pdepth$.str().length());\n"); + break; + case FieldDescriptor::CPPTYPE_STRING: + case FieldDescriptor::CPPTYPE_MESSAGE: + default: + printer.Print(vars, + "SV * $sv$ = newSVpv($msg$->" + "$cppname$($i$).c_str(), $msg$->" + "$cppname$($i$).length());\n"); + break; + } +} + +void +PerlXSGenerator::EndFieldToHashref(const FieldDescriptor * field, + io::Printer& printer, std::map<TProtoStringType, TProtoStringType>& vars, - int depth) const -{ - vars["field"] = field->name(); - - SetupDepthVars(vars, depth); - - if ( field->is_repeated() ) { - printer.Print(vars, - "av_push(av$pdepth$, sv$depth$);\n"); - printer.Outdent(); - printer.Print(vars, - "}\n" - "hv_store(hv$pdepth$, \"$field$\", " - "sizeof(\"$field$\") - 1, sv$pdepth$, 0);\n"); - } else { - if ( field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ) { - printer.Print(vars, - "hv_store(hv$pdepth$, \"$field$\", " - "sizeof(\"$field$\") - 1, sv$depth$, 0);\n"); - } else { - printer.Print(vars, - "hv_store(hv$pdepth$, \"$field$\", " - "sizeof(\"$field$\") - 1, sv$pdepth$, 0);\n"); - } - } - printer.Outdent(); - printer.Print("}\n"); + int depth) const +{ + vars["field"] = field->name(); + + SetupDepthVars(vars, depth); + + if ( field->is_repeated() ) { + printer.Print(vars, + "av_push(av$pdepth$, sv$depth$);\n"); + printer.Outdent(); + printer.Print(vars, + "}\n" + "hv_store(hv$pdepth$, \"$field$\", " + "sizeof(\"$field$\") - 1, sv$pdepth$, 0);\n"); + } else { + if ( field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ) { + printer.Print(vars, + "hv_store(hv$pdepth$, \"$field$\", " + "sizeof(\"$field$\") - 1, sv$depth$, 0);\n"); + } else { + printer.Print(vars, + "hv_store(hv$pdepth$, \"$field$\", " + "sizeof(\"$field$\") - 1, sv$pdepth$, 0);\n"); + } + } + printer.Outdent(); + printer.Print("}\n"); } - -void -PerlXSGenerator::MessageToHashref(const Descriptor * descriptor, - io::Printer& printer, + +void +PerlXSGenerator::MessageToHashref(const Descriptor * descriptor, + io::Printer& printer, std::map<TProtoStringType, TProtoStringType>& vars, - int depth) const -{ - int i; - - // Iterate the fields - - for ( i = 0; i < descriptor->field_count(); i++ ) { - const FieldDescriptor* field = descriptor->field(i); - FieldDescriptor::CppType fieldtype = field->cpp_type(); - - vars["field"] = field->name(); - vars["cppname"] = cpp::FieldName(field); - - StartFieldToHashref(field, printer, vars, depth); - - if ( fieldtype == FieldDescriptor::CPPTYPE_MESSAGE ) { - vars["fieldtype"] = cpp::ClassName(field->message_type(), true); - printer.Print(vars, - "$fieldtype$ * msg$ndepth$ = msg$pdepth$->" - "mutable_$cppname$($i$);\n" - "HV * hv$ndepth$ = newHV();\n" - "SV * sv$depth$ = newRV_noinc((SV *)hv$ndepth$);\n" - "\n"); - MessageToHashref(field->message_type(), printer, vars, depth + 2); - SetupDepthVars(vars, depth); - } else { - FieldToHashrefHelper(printer, vars, field); - } - - EndFieldToHashref(field, printer, vars, depth); - } -} - -void -PerlXSGenerator::FieldFromHashrefHelper(io::Printer& printer, + int depth) const +{ + int i; + + // Iterate the fields + + for ( i = 0; i < descriptor->field_count(); i++ ) { + const FieldDescriptor* field = descriptor->field(i); + FieldDescriptor::CppType fieldtype = field->cpp_type(); + + vars["field"] = field->name(); + vars["cppname"] = cpp::FieldName(field); + + StartFieldToHashref(field, printer, vars, depth); + + if ( fieldtype == FieldDescriptor::CPPTYPE_MESSAGE ) { + vars["fieldtype"] = cpp::ClassName(field->message_type(), true); + printer.Print(vars, + "$fieldtype$ * msg$ndepth$ = msg$pdepth$->" + "mutable_$cppname$($i$);\n" + "HV * hv$ndepth$ = newHV();\n" + "SV * sv$depth$ = newRV_noinc((SV *)hv$ndepth$);\n" + "\n"); + MessageToHashref(field->message_type(), printer, vars, depth + 2); + SetupDepthVars(vars, depth); + } else { + FieldToHashrefHelper(printer, vars, field); + } + + EndFieldToHashref(field, printer, vars, depth); + } +} + +void +PerlXSGenerator::FieldFromHashrefHelper(io::Printer& printer, std::map<TProtoStringType, TProtoStringType>& vars, - const FieldDescriptor * field) const -{ - vars["msg"] = "msg" + vars["pdepth"]; - vars["var"] = "*sv" + vars["depth"]; - - if ( field->is_repeated() ) { - vars["do"] = "add"; - } else { - vars["do"] = "set"; - } - - switch ( field->cpp_type() ) { - case FieldDescriptor::CPPTYPE_INT32: - case FieldDescriptor::CPPTYPE_BOOL: - printer.Print(vars, - "$msg$->$do$_$cppname$(SvIV($var$));\n"); - break; - case FieldDescriptor::CPPTYPE_ENUM: - vars["etype"] = cpp::ClassName(field->enum_type(), true); - printer.Print(vars, - "$msg$->$do$_$cppname$" - "(($etype$)SvIV($var$));\n"); - break; - case FieldDescriptor::CPPTYPE_UINT32: - printer.Print(vars, - "$msg$->$do$_$cppname$(SvUV($var$));\n"); - break; - case FieldDescriptor::CPPTYPE_FLOAT: - case FieldDescriptor::CPPTYPE_DOUBLE: - printer.Print(vars, - "$msg$->$do$_$cppname$(SvNV($var$));\n"); - break; - case FieldDescriptor::CPPTYPE_INT64: - printer.Print(vars, - "int64_t iv$pdepth$ = " - "strtoll(SvPV_nolen($var$), NULL, 0);\n" - "\n" - "$msg$->$do$_$cppname$(iv$pdepth$);\n"); - break; - case FieldDescriptor::CPPTYPE_UINT64: - printer.Print(vars, - "uint64_t uv$pdepth$ = " - "strtoull(SvPV_nolen($var$), NULL, 0);\n" - "\n" - "$msg$->$do$_$cppname$(uv$pdepth$);\n"); - break; - case FieldDescriptor::CPPTYPE_STRING: - printer.Print("STRLEN len;\n" - "char * str;\n"); - - if ( field->type() == FieldDescriptor::TYPE_STRING ) { + const FieldDescriptor * field) const +{ + vars["msg"] = "msg" + vars["pdepth"]; + vars["var"] = "*sv" + vars["depth"]; + + if ( field->is_repeated() ) { + vars["do"] = "add"; + } else { + vars["do"] = "set"; + } + + switch ( field->cpp_type() ) { + case FieldDescriptor::CPPTYPE_INT32: + case FieldDescriptor::CPPTYPE_BOOL: + printer.Print(vars, + "$msg$->$do$_$cppname$(SvIV($var$));\n"); + break; + case FieldDescriptor::CPPTYPE_ENUM: + vars["etype"] = cpp::ClassName(field->enum_type(), true); + printer.Print(vars, + "$msg$->$do$_$cppname$" + "(($etype$)SvIV($var$));\n"); + break; + case FieldDescriptor::CPPTYPE_UINT32: + printer.Print(vars, + "$msg$->$do$_$cppname$(SvUV($var$));\n"); + break; + case FieldDescriptor::CPPTYPE_FLOAT: + case FieldDescriptor::CPPTYPE_DOUBLE: + printer.Print(vars, + "$msg$->$do$_$cppname$(SvNV($var$));\n"); + break; + case FieldDescriptor::CPPTYPE_INT64: + printer.Print(vars, + "int64_t iv$pdepth$ = " + "strtoll(SvPV_nolen($var$), NULL, 0);\n" + "\n" + "$msg$->$do$_$cppname$(iv$pdepth$);\n"); + break; + case FieldDescriptor::CPPTYPE_UINT64: + printer.Print(vars, + "uint64_t uv$pdepth$ = " + "strtoull(SvPV_nolen($var$), NULL, 0);\n" + "\n" + "$msg$->$do$_$cppname$(uv$pdepth$);\n"); + break; + case FieldDescriptor::CPPTYPE_STRING: + printer.Print("STRLEN len;\n" + "char * str;\n"); + + if ( field->type() == FieldDescriptor::TYPE_STRING ) { printer.Print("TString sval;\n"); - } - - printer.Print(vars, - "\n" - "str = SvPV($var$, len);\n"); - - if ( field->type() == FieldDescriptor::TYPE_STRING ) { - printer.Print(vars, - "sval.assign(str, len);\n" - "$msg$->$do$_$cppname$(sval);\n"); - } else if ( field->type() == FieldDescriptor::TYPE_BYTES ) { - printer.Print(vars, - "$msg$->$do$_$cppname$(str, len);\n"); - } else { - // Can't get here - } - break; - case FieldDescriptor::CPPTYPE_MESSAGE: - // Should never get here. - default: - break; - } -} - -void -PerlXSGenerator::MessageFromHashref(const Descriptor * descriptor, - io::Printer& printer, + } + + printer.Print(vars, + "\n" + "str = SvPV($var$, len);\n"); + + if ( field->type() == FieldDescriptor::TYPE_STRING ) { + printer.Print(vars, + "sval.assign(str, len);\n" + "$msg$->$do$_$cppname$(sval);\n"); + } else if ( field->type() == FieldDescriptor::TYPE_BYTES ) { + printer.Print(vars, + "$msg$->$do$_$cppname$(str, len);\n"); + } else { + // Can't get here + } + break; + case FieldDescriptor::CPPTYPE_MESSAGE: + // Should never get here. + default: + break; + } +} + +void +PerlXSGenerator::MessageFromHashref(const Descriptor * descriptor, + io::Printer& printer, std::map<TProtoStringType, TProtoStringType>& vars, - int depth) const -{ - int i; - - SetupDepthVars(vars, depth); - - printer.Print(vars, - "if ( SvROK(sv$pdepth$) && " - "SvTYPE(SvRV(sv$pdepth$)) == SVt_PVHV ) {\n"); - printer.Indent(); - printer.Print(vars, - "HV * hv$pdepth$ = (HV *)SvRV(sv$pdepth$);\n" - "SV ** sv$depth$;\n" - "\n"); - - // Iterate the fields - - for ( i = 0; i < descriptor->field_count(); i++ ) { - const FieldDescriptor* field = descriptor->field(i); - - vars["field"] = field->name(); - vars["cppname"] = cpp::FieldName(field); - - if ( field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ) { - vars["fieldtype"] = cpp::ClassName(field->message_type(), true); - } - - printer.Print(vars, - "if ( (sv$depth$ = hv_fetch(hv$pdepth$, " - "\"$field$\", sizeof(\"$field$\") - 1, 0)) != NULL ) {\n"); - - printer.Indent(); - - if ( field->is_repeated() ) { - printer.Print(vars, - "if ( SvROK(*sv$depth$) && " - "SvTYPE(SvRV(*sv$depth$)) == SVt_PVAV ) {\n"); - printer.Indent(); - printer.Print(vars, - "AV * av$depth$ = (AV *)SvRV(*sv$depth$);\n" - "\n" - "for ( int i$depth$ = 0; " - "i$depth$ <= av_len(av$depth$); i$depth$++ ) {\n"); - printer.Indent(); - - if ( field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ) { - printer.Print(vars, - "$fieldtype$ * msg$ndepth$ = " - "msg$pdepth$->add_$cppname$();\n" - "SV ** sv$depth$;\n" - "SV * sv$ndepth$;\n" - "\n" - "if ( (sv$depth$ = " - "av_fetch(av$depth$, i$depth$, 0)) != NULL ) {\n" - " sv$ndepth$ = *sv$depth$;\n"); - } else { - printer.Print(vars, - "SV ** sv$depth$;\n" - "\n" - "if ( (sv$depth$ = " - "av_fetch(av$depth$, i$depth$, 0)) != NULL ) {\n"); - } - printer.Indent(); - } else { - if ( field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ) { - printer.Print(vars, - "$fieldtype$ * msg$ndepth$ = " - "msg$pdepth$->mutable_$cppname$();\n" - "SV * sv$ndepth$ = *sv$depth$;\n" - "\n"); - } - } - - if ( field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ) { - MessageFromHashref(field->message_type(), printer, vars, depth + 2); - SetupDepthVars(vars, depth); - } else { - FieldFromHashrefHelper(printer, vars, field); - } - - if ( field->is_repeated() ) { - printer.Outdent(); - printer.Print("}\n"); - printer.Outdent(); - printer.Print("}\n"); - printer.Outdent(); - printer.Print("}\n"); - } - - printer.Outdent(); - printer.Print("}\n"); - } - - printer.Outdent(); - printer.Print("}\n"); -} - -} // namespace perlxs -} // namespace compiler -} // namespace protobuf -} // namespace google + int depth) const +{ + int i; + + SetupDepthVars(vars, depth); + + printer.Print(vars, + "if ( SvROK(sv$pdepth$) && " + "SvTYPE(SvRV(sv$pdepth$)) == SVt_PVHV ) {\n"); + printer.Indent(); + printer.Print(vars, + "HV * hv$pdepth$ = (HV *)SvRV(sv$pdepth$);\n" + "SV ** sv$depth$;\n" + "\n"); + + // Iterate the fields + + for ( i = 0; i < descriptor->field_count(); i++ ) { + const FieldDescriptor* field = descriptor->field(i); + + vars["field"] = field->name(); + vars["cppname"] = cpp::FieldName(field); + + if ( field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ) { + vars["fieldtype"] = cpp::ClassName(field->message_type(), true); + } + + printer.Print(vars, + "if ( (sv$depth$ = hv_fetch(hv$pdepth$, " + "\"$field$\", sizeof(\"$field$\") - 1, 0)) != NULL ) {\n"); + + printer.Indent(); + + if ( field->is_repeated() ) { + printer.Print(vars, + "if ( SvROK(*sv$depth$) && " + "SvTYPE(SvRV(*sv$depth$)) == SVt_PVAV ) {\n"); + printer.Indent(); + printer.Print(vars, + "AV * av$depth$ = (AV *)SvRV(*sv$depth$);\n" + "\n" + "for ( int i$depth$ = 0; " + "i$depth$ <= av_len(av$depth$); i$depth$++ ) {\n"); + printer.Indent(); + + if ( field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ) { + printer.Print(vars, + "$fieldtype$ * msg$ndepth$ = " + "msg$pdepth$->add_$cppname$();\n" + "SV ** sv$depth$;\n" + "SV * sv$ndepth$;\n" + "\n" + "if ( (sv$depth$ = " + "av_fetch(av$depth$, i$depth$, 0)) != NULL ) {\n" + " sv$ndepth$ = *sv$depth$;\n"); + } else { + printer.Print(vars, + "SV ** sv$depth$;\n" + "\n" + "if ( (sv$depth$ = " + "av_fetch(av$depth$, i$depth$, 0)) != NULL ) {\n"); + } + printer.Indent(); + } else { + if ( field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ) { + printer.Print(vars, + "$fieldtype$ * msg$ndepth$ = " + "msg$pdepth$->mutable_$cppname$();\n" + "SV * sv$ndepth$ = *sv$depth$;\n" + "\n"); + } + } + + if ( field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ) { + MessageFromHashref(field->message_type(), printer, vars, depth + 2); + SetupDepthVars(vars, depth); + } else { + FieldFromHashrefHelper(printer, vars, field); + } + + if ( field->is_repeated() ) { + printer.Outdent(); + printer.Print("}\n"); + printer.Outdent(); + printer.Print("}\n"); + printer.Outdent(); + printer.Print("}\n"); + } + + printer.Outdent(); + printer.Print("}\n"); + } + + printer.Outdent(); + printer.Print("}\n"); +} + +} // namespace perlxs +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.h b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.h index 192d96a6e5..c29eac03e3 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.h @@ -1,153 +1,153 @@ -#ifndef GOOGLE_PROTOBUF_COMPILER_PERLXS_GENERATOR_H__ -#define GOOGLE_PROTOBUF_COMPILER_PERLXS_GENERATOR_H__ - -#include <iostream> -#include <vector> -#include <map> -#include <set> +#ifndef GOOGLE_PROTOBUF_COMPILER_PERLXS_GENERATOR_H__ +#define GOOGLE_PROTOBUF_COMPILER_PERLXS_GENERATOR_H__ + +#include <iostream> +#include <vector> +#include <map> +#include <set> #include <google/protobuf/descriptor.h> #include <google/protobuf/compiler/code_generator.h> #include <google/protobuf/compiler/cpp/cpp_helpers.h> #include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/strutil.h> - -namespace google { -namespace protobuf { - -class Descriptor; -class EnumDescriptor; -class EnumValueDescriptor; -class FieldDescriptor; -class ServiceDescriptor; - -namespace io { class Printer; } - -namespace compiler { -namespace perlxs { - -// CodeGenerator implementation for generated Perl/XS protocol buffer -// classes. If you create your own protocol compiler binary and you -// want it to support Perl/XS output, you can do so by registering an -// instance of this CodeGenerator with the CommandLineInterface in -// your main() function. -class LIBPROTOC_EXPORT PerlXSGenerator : public CodeGenerator { - public: - PerlXSGenerator(); - virtual ~PerlXSGenerator(); - - // implements CodeGenerator ---------------------------------------- - virtual bool Generate(const FileDescriptor* file, + +namespace google { +namespace protobuf { + +class Descriptor; +class EnumDescriptor; +class EnumValueDescriptor; +class FieldDescriptor; +class ServiceDescriptor; + +namespace io { class Printer; } + +namespace compiler { +namespace perlxs { + +// CodeGenerator implementation for generated Perl/XS protocol buffer +// classes. If you create your own protocol compiler binary and you +// want it to support Perl/XS output, you can do so by registering an +// instance of this CodeGenerator with the CommandLineInterface in +// your main() function. +class LIBPROTOC_EXPORT PerlXSGenerator : public CodeGenerator { + public: + PerlXSGenerator(); + virtual ~PerlXSGenerator(); + + // implements CodeGenerator ---------------------------------------- + virtual bool Generate(const FileDescriptor* file, const TProtoStringType& parameter, - OutputDirectory* output_directory, + OutputDirectory* output_directory, TProtoStringType* error) const; bool ProcessOption(const TProtoStringType& option); - - private: - GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PerlXSGenerator); - - private: - void GenerateXS(const FileDescriptor* file, - OutputDirectory* output_directory, + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PerlXSGenerator); + + private: + void GenerateXS(const FileDescriptor* file, + OutputDirectory* output_directory, TProtoStringType& base) const; - - void GenerateMessageXS(const Descriptor* descriptor, - OutputDirectory* outdir) const; - - void GenerateMessageModule(const Descriptor* descriptor, - OutputDirectory* outdir) const; - - void GenerateMessagePOD(const Descriptor* descriptor, - OutputDirectory* outdir) const; - - void GenerateDescriptorClassNamePOD(const Descriptor* descriptor, - io::Printer& printer) const; - - void GenerateDescriptorMethodPOD(const Descriptor* descriptor, - io::Printer& printer) const; - - void GenerateEnumModule(const EnumDescriptor* enum_descriptor, - OutputDirectory* outdir) const; - - void GenerateMessageXSFieldAccessors(const FieldDescriptor* field, - io::Printer& printer, + + void GenerateMessageXS(const Descriptor* descriptor, + OutputDirectory* outdir) const; + + void GenerateMessageModule(const Descriptor* descriptor, + OutputDirectory* outdir) const; + + void GenerateMessagePOD(const Descriptor* descriptor, + OutputDirectory* outdir) const; + + void GenerateDescriptorClassNamePOD(const Descriptor* descriptor, + io::Printer& printer) const; + + void GenerateDescriptorMethodPOD(const Descriptor* descriptor, + io::Printer& printer) const; + + void GenerateEnumModule(const EnumDescriptor* enum_descriptor, + OutputDirectory* outdir) const; + + void GenerateMessageXSFieldAccessors(const FieldDescriptor* field, + io::Printer& printer, const TProtoStringType& classname) const; - - void GenerateMessageXSCommonMethods(const Descriptor* descriptor, - io::Printer& printer, + + void GenerateMessageXSCommonMethods(const Descriptor* descriptor, + io::Printer& printer, const TProtoStringType& classname) const; - - void GenerateFileXSTypedefs(const FileDescriptor* file, - io::Printer& printer, - std::set<const Descriptor*>& seen) const; - - void GenerateMessageXSTypedefs(const Descriptor* descriptor, - io::Printer& printer, - std::set<const Descriptor*>& seen) const; - - void GenerateMessageStatics(const Descriptor* descriptor, - io::Printer& printer) const; - - void GenerateMessageXSPackage(const Descriptor* descriptor, - io::Printer& printer) const; - - void GenerateTypemapInput(const Descriptor* descriptor, - io::Printer& printer, + + void GenerateFileXSTypedefs(const FileDescriptor* file, + io::Printer& printer, + std::set<const Descriptor*>& seen) const; + + void GenerateMessageXSTypedefs(const Descriptor* descriptor, + io::Printer& printer, + std::set<const Descriptor*>& seen) const; + + void GenerateMessageStatics(const Descriptor* descriptor, + io::Printer& printer) const; + + void GenerateMessageXSPackage(const Descriptor* descriptor, + io::Printer& printer) const; + + void GenerateTypemapInput(const Descriptor* descriptor, + io::Printer& printer, const TProtoStringType& svname) const; - + TProtoStringType MessageModuleName(const Descriptor* descriptor) const; - + TProtoStringType MessageClassName(const Descriptor* descriptor) const; - + TProtoStringType EnumClassName(const EnumDescriptor* descriptor) const; - + TProtoStringType PackageName(const TProtoStringType& name, const TProtoStringType& package) const; - - void PerlSVGetHelper(io::Printer& printer, + + void PerlSVGetHelper(io::Printer& printer, const std::map<TProtoStringType, TProtoStringType>& vars, - FieldDescriptor::CppType fieldtype, - int depth) const; - - void PODPrintEnumValue(const EnumValueDescriptor *value, - io::Printer& printer) const; - + FieldDescriptor::CppType fieldtype, + int depth) const; + + void PODPrintEnumValue(const EnumValueDescriptor *value, + io::Printer& printer) const; + TProtoStringType PODFieldTypeString(const FieldDescriptor* field) const; - - void StartFieldToHashref(const FieldDescriptor * field, - io::Printer& printer, + + void StartFieldToHashref(const FieldDescriptor * field, + io::Printer& printer, std::map<TProtoStringType, TProtoStringType>& vars, - int depth) const; - - void FieldToHashrefHelper(io::Printer& printer, + int depth) const; + + void FieldToHashrefHelper(io::Printer& printer, std::map<TProtoStringType, TProtoStringType>& vars, - const FieldDescriptor* field) const; - - void EndFieldToHashref(const FieldDescriptor * field, - io::Printer& printer, + const FieldDescriptor* field) const; + + void EndFieldToHashref(const FieldDescriptor * field, + io::Printer& printer, std::map<TProtoStringType, TProtoStringType>& vars, - int depth) const; - - void MessageToHashref(const Descriptor * descriptor, - io::Printer& printer, + int depth) const; + + void MessageToHashref(const Descriptor * descriptor, + io::Printer& printer, std::map<TProtoStringType, TProtoStringType>& vars, - int depth) const; - - void FieldFromHashrefHelper(io::Printer& printer, + int depth) const; + + void FieldFromHashrefHelper(io::Printer& printer, std::map<TProtoStringType, TProtoStringType>& vars, - const FieldDescriptor * field) const; - - void MessageFromHashref(const Descriptor * descriptor, - io::Printer& printer, + const FieldDescriptor * field) const; + + void MessageFromHashref(const Descriptor * descriptor, + io::Printer& printer, std::map<TProtoStringType, TProtoStringType>& vars, - int depth) const; - - private: - // --perlxs-package option (if given) - TProtoStringType perlxs_package_; -}; - -} // namespace perlxs -} // namespace compiler -} // namespace protobuf -} // namespace google -#endif // GOOGLE_PROTOBUF_COMPILER_PERLXS_GENERATOR_H__ + int depth) const; + + private: + // --perlxs-package option (if given) + TProtoStringType perlxs_package_; +}; + +} // namespace perlxs +} // namespace compiler +} // namespace protobuf +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_PERLXS_GENERATOR_H__ diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_helpers.cc b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_helpers.cc index 3c26e5c7c4..a1e5b5d340 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_helpers.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_helpers.cc @@ -1,35 +1,35 @@ -#include <sstream> -#include <vector> +#include <sstream> +#include <vector> #include <google/protobuf/compiler/perlxs/perlxs_helpers.h> -#include "google/protobuf/descriptor.pb.h" +#include "google/protobuf/descriptor.pb.h" #include <google/protobuf/io/printer.h> - -namespace google { -namespace protobuf { - + +namespace google { +namespace protobuf { + extern TProtoStringType StringReplace(const TProtoStringType& s, const TProtoStringType& oldsub, const TProtoStringType& newsub, bool replace_all); - -namespace compiler { -namespace perlxs { - -void + +namespace compiler { +namespace perlxs { + +void SetupDepthVars(std::map<TProtoStringType, TProtoStringType>& vars, int depth) -{ - std::ostringstream ost_pdepth; - std::ostringstream ost_depth; - std::ostringstream ost_ndepth; - - ost_pdepth << depth; - ost_depth << depth + 1; - ost_ndepth << depth + 2; - - vars["pdepth"] = ost_pdepth.str(); - vars["depth"] = ost_depth.str(); - vars["ndepth"] = ost_ndepth.str(); -} - -} // namespace perlxs -} // namespace compiler -} // namespace protobuf -} // namespace google +{ + std::ostringstream ost_pdepth; + std::ostringstream ost_depth; + std::ostringstream ost_ndepth; + + ost_pdepth << depth; + ost_depth << depth + 1; + ost_ndepth << depth + 2; + + vars["pdepth"] = ost_pdepth.str(); + vars["depth"] = ost_depth.str(); + vars["ndepth"] = ost_ndepth.str(); +} + +} // namespace perlxs +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_helpers.h b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_helpers.h index 3f34c59fdc..5454877f5a 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_helpers.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_helpers.h @@ -1,19 +1,19 @@ -#ifndef GOOGLE_PROTOBUF_COMPILER_PERLXS_HELPERS_H__ -#define GOOGLE_PROTOBUF_COMPILER_PERLXS_HELPERS_H__ - -#include <map> +#ifndef GOOGLE_PROTOBUF_COMPILER_PERLXS_HELPERS_H__ +#define GOOGLE_PROTOBUF_COMPILER_PERLXS_HELPERS_H__ + +#include <map> #include <google/protobuf/stubs/common.h> - -namespace google { -namespace protobuf { -namespace compiler { -namespace perlxs { - + +namespace google { +namespace protobuf { +namespace compiler { +namespace perlxs { + void SetupDepthVars(std::map<TProtoStringType, TProtoStringType>& vars, int depth); - -} // namespace perlxs -} // namespace compiler -} // namespace protobuf -} // namespace google - -#endif // GOOGLE_PROTOBUF_COMPILER_PERLXS_HELPERS_H__ + +} // namespace perlxs +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_PERLXS_HELPERS_H__ diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc index 6f364e610e..d05aef210a 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc @@ -96,7 +96,7 @@ class GeneratorResponseContext : public GeneratorContext { return new io::StringOutputStream(file->mutable_content()); } - void ListParsedFiles(std::vector<const FileDescriptor*>* output) { + void ListParsedFiles(std::vector<const FileDescriptor*>* output) { *output = parsed_files_; } @@ -107,7 +107,7 @@ class GeneratorResponseContext : public GeneratorContext { private: Version compiler_version_; CodeGeneratorResponse* response_; - const std::vector<const FileDescriptor*>& parsed_files_; + const std::vector<const FileDescriptor*>& parsed_files_; }; bool GenerateCode(const CodeGeneratorRequest& request, @@ -122,7 +122,7 @@ bool GenerateCode(const CodeGeneratorRequest& request, } } - std::vector<const FileDescriptor*> parsed_files; + std::vector<const FileDescriptor*> parsed_files; for (int i = 0; i < request.file_to_generate_size(); i++) { parsed_files.push_back(pool.FindFileByName(request.file_to_generate(i))); if (parsed_files.back() == NULL) { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.h b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.h index f406f9b7aa..6da6c31dad 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.pb.h @@ -445,14 +445,14 @@ class PROTOC_EXPORT CodeGeneratorRequest final : int _internal_file_to_generate_size() const; public: void clear_file_to_generate(); - const TProtoStringType& file_to_generate(int index) const; - TProtoStringType* mutable_file_to_generate(int index); - void set_file_to_generate(int index, const TProtoStringType& value); + const TProtoStringType& file_to_generate(int index) const; + TProtoStringType* mutable_file_to_generate(int index); + void set_file_to_generate(int index, const TProtoStringType& value); void set_file_to_generate(int index, TProtoStringType&& value); void set_file_to_generate(int index, const char* value); void set_file_to_generate(int index, const char* value, size_t size); - TProtoStringType* add_file_to_generate(); - void add_file_to_generate(const TProtoStringType& value); + TProtoStringType* add_file_to_generate(); + void add_file_to_generate(const TProtoStringType& value); void add_file_to_generate(TProtoStringType&& value); void add_file_to_generate(const char* value); void add_file_to_generate(const char* value, size_t size); @@ -487,12 +487,12 @@ class PROTOC_EXPORT CodeGeneratorRequest final : bool _internal_has_parameter() const; public: void clear_parameter(); - const TProtoStringType& parameter() const; + const TProtoStringType& parameter() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_parameter(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_parameter(); + TProtoStringType* mutable_parameter(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_parameter(); - void set_allocated_parameter(TProtoStringType* parameter); + void set_allocated_parameter(TProtoStringType* parameter); private: const TProtoStringType& _internal_parameter() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_parameter(const TProtoStringType& value); @@ -667,12 +667,12 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : bool _internal_has_name() const; public: void clear_name(); - const TProtoStringType& name() const; + const TProtoStringType& name() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_name(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_name(); + TProtoStringType* mutable_name(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_name(); - void set_allocated_name(TProtoStringType* name); + void set_allocated_name(TProtoStringType* name); private: const TProtoStringType& _internal_name() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const TProtoStringType& value); @@ -685,12 +685,12 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : bool _internal_has_insertion_point() const; public: void clear_insertion_point(); - const TProtoStringType& insertion_point() const; + const TProtoStringType& insertion_point() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_insertion_point(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_insertion_point(); + TProtoStringType* mutable_insertion_point(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_insertion_point(); - void set_allocated_insertion_point(TProtoStringType* insertion_point); + void set_allocated_insertion_point(TProtoStringType* insertion_point); private: const TProtoStringType& _internal_insertion_point() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_insertion_point(const TProtoStringType& value); @@ -703,12 +703,12 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : bool _internal_has_content() const; public: void clear_content(); - const TProtoStringType& content() const; + const TProtoStringType& content() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_content(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_content(); + TProtoStringType* mutable_content(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_content(); - void set_allocated_content(TProtoStringType* content); + void set_allocated_content(TProtoStringType* content); private: const TProtoStringType& _internal_content() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_content(const TProtoStringType& value); @@ -932,12 +932,12 @@ class PROTOC_EXPORT CodeGeneratorResponse final : bool _internal_has_error() const; public: void clear_error(); - const TProtoStringType& error() const; + const TProtoStringType& error() const; template <typename ArgT0 = const TProtoStringType&, typename... ArgT> void set_error(ArgT0&& arg0, ArgT... args); - TProtoStringType* mutable_error(); + TProtoStringType* mutable_error(); PROTOBUF_MUST_USE_RESULT TProtoStringType* release_error(); - void set_allocated_error(TProtoStringType* error); + void set_allocated_error(TProtoStringType* error); private: const TProtoStringType& _internal_error() const; inline PROTOBUF_ALWAYS_INLINE void _internal_set_error(const TProtoStringType& value); @@ -1146,15 +1146,15 @@ inline TProtoStringType* CodeGeneratorRequest::add_file_to_generate() { inline const TProtoStringType& CodeGeneratorRequest::_internal_file_to_generate(int index) const { return file_to_generate_.Get(index); } -inline const TProtoStringType& CodeGeneratorRequest::file_to_generate(int index) const { +inline const TProtoStringType& CodeGeneratorRequest::file_to_generate(int index) const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) return _internal_file_to_generate(index); } -inline TProtoStringType* CodeGeneratorRequest::mutable_file_to_generate(int index) { +inline TProtoStringType* CodeGeneratorRequest::mutable_file_to_generate(int index) { // @@protoc_insertion_point(field_mutable:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) return file_to_generate_.Mutable(index); } -inline void CodeGeneratorRequest::set_file_to_generate(int index, const TProtoStringType& value) { +inline void CodeGeneratorRequest::set_file_to_generate(int index, const TProtoStringType& value) { file_to_generate_.Mutable(index)->assign(value); // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) } @@ -1175,7 +1175,7 @@ inline void CodeGeneratorRequest::set_file_to_generate(int index, const char* va inline TProtoStringType* CodeGeneratorRequest::_internal_add_file_to_generate() { return file_to_generate_.Add(); } -inline void CodeGeneratorRequest::add_file_to_generate(const TProtoStringType& value) { +inline void CodeGeneratorRequest::add_file_to_generate(const TProtoStringType& value) { file_to_generate_.Add()->assign(value); // @@protoc_insertion_point(field_add:google.protobuf.compiler.CodeGeneratorRequest.file_to_generate) } @@ -1215,7 +1215,7 @@ inline void CodeGeneratorRequest::clear_parameter() { parameter_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& CodeGeneratorRequest::parameter() const { +inline const TProtoStringType& CodeGeneratorRequest::parameter() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorRequest.parameter) return _internal_parameter(); } @@ -1242,7 +1242,7 @@ inline TProtoStringType* CodeGeneratorRequest::_internal_mutable_parameter() { _has_bits_[0] |= 0x00000001u; return parameter_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* CodeGeneratorRequest::release_parameter() { +inline TProtoStringType* CodeGeneratorRequest::release_parameter() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.parameter) if (!_internal_has_parameter()) { return nullptr; @@ -1250,7 +1250,7 @@ inline TProtoStringType* CodeGeneratorRequest::release_parameter() { _has_bits_[0] &= ~0x00000001u; return parameter_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void CodeGeneratorRequest::set_allocated_parameter(TProtoStringType* parameter) { +inline void CodeGeneratorRequest::set_allocated_parameter(TProtoStringType* parameter) { if (parameter != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -1404,7 +1404,7 @@ inline void CodeGeneratorResponse_File::clear_name() { name_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& CodeGeneratorResponse_File::name() const { +inline const TProtoStringType& CodeGeneratorResponse_File::name() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.name) return _internal_name(); } @@ -1431,7 +1431,7 @@ inline TProtoStringType* CodeGeneratorResponse_File::_internal_mutable_name() { _has_bits_[0] |= 0x00000001u; return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* CodeGeneratorResponse_File::release_name() { +inline TProtoStringType* CodeGeneratorResponse_File::release_name() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.name) if (!_internal_has_name()) { return nullptr; @@ -1439,7 +1439,7 @@ inline TProtoStringType* CodeGeneratorResponse_File::release_name() { _has_bits_[0] &= ~0x00000001u; return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void CodeGeneratorResponse_File::set_allocated_name(TProtoStringType* name) { +inline void CodeGeneratorResponse_File::set_allocated_name(TProtoStringType* name) { if (name != nullptr) { _has_bits_[0] |= 0x00000001u; } else { @@ -1462,7 +1462,7 @@ inline void CodeGeneratorResponse_File::clear_insertion_point() { insertion_point_.ClearToEmpty(); _has_bits_[0] &= ~0x00000002u; } -inline const TProtoStringType& CodeGeneratorResponse_File::insertion_point() const { +inline const TProtoStringType& CodeGeneratorResponse_File::insertion_point() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) return _internal_insertion_point(); } @@ -1489,7 +1489,7 @@ inline TProtoStringType* CodeGeneratorResponse_File::_internal_mutable_insertion _has_bits_[0] |= 0x00000002u; return insertion_point_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* CodeGeneratorResponse_File::release_insertion_point() { +inline TProtoStringType* CodeGeneratorResponse_File::release_insertion_point() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point) if (!_internal_has_insertion_point()) { return nullptr; @@ -1497,7 +1497,7 @@ inline TProtoStringType* CodeGeneratorResponse_File::release_insertion_point() { _has_bits_[0] &= ~0x00000002u; return insertion_point_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void CodeGeneratorResponse_File::set_allocated_insertion_point(TProtoStringType* insertion_point) { +inline void CodeGeneratorResponse_File::set_allocated_insertion_point(TProtoStringType* insertion_point) { if (insertion_point != nullptr) { _has_bits_[0] |= 0x00000002u; } else { @@ -1520,7 +1520,7 @@ inline void CodeGeneratorResponse_File::clear_content() { content_.ClearToEmpty(); _has_bits_[0] &= ~0x00000004u; } -inline const TProtoStringType& CodeGeneratorResponse_File::content() const { +inline const TProtoStringType& CodeGeneratorResponse_File::content() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.File.content) return _internal_content(); } @@ -1547,7 +1547,7 @@ inline TProtoStringType* CodeGeneratorResponse_File::_internal_mutable_content() _has_bits_[0] |= 0x00000004u; return content_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* CodeGeneratorResponse_File::release_content() { +inline TProtoStringType* CodeGeneratorResponse_File::release_content() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.content) if (!_internal_has_content()) { return nullptr; @@ -1555,7 +1555,7 @@ inline TProtoStringType* CodeGeneratorResponse_File::release_content() { _has_bits_[0] &= ~0x00000004u; return content_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void CodeGeneratorResponse_File::set_allocated_content(TProtoStringType* content) { +inline void CodeGeneratorResponse_File::set_allocated_content(TProtoStringType* content) { if (content != nullptr) { _has_bits_[0] |= 0x00000004u; } else { @@ -1670,7 +1670,7 @@ inline void CodeGeneratorResponse::clear_error() { error_.ClearToEmpty(); _has_bits_[0] &= ~0x00000001u; } -inline const TProtoStringType& CodeGeneratorResponse::error() const { +inline const TProtoStringType& CodeGeneratorResponse::error() const { // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.error) return _internal_error(); } @@ -1697,7 +1697,7 @@ inline TProtoStringType* CodeGeneratorResponse::_internal_mutable_error() { _has_bits_[0] |= 0x00000001u; return error_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); } -inline TProtoStringType* CodeGeneratorResponse::release_error() { +inline TProtoStringType* CodeGeneratorResponse::release_error() { // @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.error) if (!_internal_has_error()) { return nullptr; @@ -1705,7 +1705,7 @@ inline TProtoStringType* CodeGeneratorResponse::release_error() { _has_bits_[0] &= ~0x00000001u; return error_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); } -inline void CodeGeneratorResponse::set_allocated_error(TProtoStringType* error) { +inline void CodeGeneratorResponse::set_allocated_error(TProtoStringType* error) { if (error != nullptr) { _has_bits_[0] |= 0x00000001u; } else { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc index e4691f0258..471cc46ef6 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc @@ -228,11 +228,11 @@ TProtoStringType StringifyDefaultValue(const FieldDescriptor& field) { return StrCat(field.default_value_uint64()); case FieldDescriptor::CPPTYPE_DOUBLE: { double value = field.default_value_double(); - if (value == std::numeric_limits<double>::infinity()) { + if (value == std::numeric_limits<double>::infinity()) { // Python pre-2.6 on Windows does not parse "inf" correctly. However, // a numeric literal that is too big for a double will become infinity. return "1e10000"; - } else if (value == -std::numeric_limits<double>::infinity()) { + } else if (value == -std::numeric_limits<double>::infinity()) { // See above. return "-1e10000"; } else if (value != value) { @@ -244,11 +244,11 @@ TProtoStringType StringifyDefaultValue(const FieldDescriptor& field) { } case FieldDescriptor::CPPTYPE_FLOAT: { float value = field.default_value_float(); - if (value == std::numeric_limits<float>::infinity()) { + if (value == std::numeric_limits<float>::infinity()) { // Python pre-2.6 on Windows does not parse "inf" correctly. However, // a numeric literal that is too big for a double will become infinity. return "1e10000"; - } else if (value == -std::numeric_limits<float>::infinity()) { + } else if (value == -std::numeric_limits<float>::infinity()) { // See above. return "-1e10000"; } else if (value != value) { diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/zip_writer.h b/contrib/libs/protoc/src/google/protobuf/compiler/zip_writer.h index 4684f81cad..a1ce179d89 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/zip_writer.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/zip_writer.h @@ -57,7 +57,7 @@ class ZipWriter { }; io::ZeroCopyOutputStream* raw_output_; - std::vector<FileInfo> files_; + std::vector<FileInfo> files_; }; } // namespace compiler diff --git a/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc b/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc index 6c0bee4925..8b41ca47dd 100644 --- a/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc +++ b/contrib/python/protobuf/py2/google/protobuf/pyext/message.cc @@ -2056,7 +2056,7 @@ static PyObject* WhichOneof(CMessage* self, PyObject* arg) { static PyObject* GetExtensionDict(CMessage* self, void *closure); static PyObject* ListFields(CMessage* self) { - std::vector<const FieldDescriptor*> fields; + std::vector<const FieldDescriptor*> fields; self->message->GetReflection()->ListFields(*self->message, &fields); // Normally, the list will be exactly the size of the fields. diff --git a/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc b/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc index 6c0bee4925..8b41ca47dd 100644 --- a/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc +++ b/contrib/python/protobuf/py3/google/protobuf/pyext/message.cc @@ -2056,7 +2056,7 @@ static PyObject* WhichOneof(CMessage* self, PyObject* arg) { static PyObject* GetExtensionDict(CMessage* self, void *closure); static PyObject* ListFields(CMessage* self) { - std::vector<const FieldDescriptor*> fields; + std::vector<const FieldDescriptor*> fields; self->message->GetReflection()->ListFields(*self->message, &fields); // Normally, the list will be exactly the size of the fields. diff --git a/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp b/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp index 076f92b203..cd96aa0565 100644 --- a/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp +++ b/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp @@ -18,7 +18,7 @@ namespace NPlugins { using namespace google::protobuf::compiler; using namespace google::protobuf::compiler::cpp; - typedef std::map<TProtoStringType, TProtoStringType> TVariables; + typedef std::map<TProtoStringType, TProtoStringType> TVariables; bool GenerateYaStyle(const FileDescriptor* fileDescriptor) { const auto& extension = fileDescriptor->FindExtensionByName("GenerateYaStyle"); |