diff options
| author | thegeorg <[email protected]> | 2022-02-10 16:45:12 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:12 +0300 | 
| commit | 49116032d905455a7b1c994e4a696afc885c1e71 (patch) | |
| tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/tools/protoc/plugins | |
| parent | 4e839db24a3bbc9f1c610c43d6faaaa99824dcca (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/protoc/plugins')
5 files changed, 189 insertions, 189 deletions
diff --git a/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp b/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp index a6a3f16ab3c..cd96aa05657 100644 --- a/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp +++ b/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp @@ -1,11 +1,11 @@ -#include <google/protobuf/compiler/code_generator.h>  -#include <google/protobuf/compiler/cpp/cpp_helpers.h>  -#include <google/protobuf/descriptor.h>  -#include <google/protobuf/descriptor.pb.h>  -#include <google/protobuf/io/printer.h>  -#include <google/protobuf/io/zero_copy_stream.h>  -#include <google/protobuf/stubs/common.h>  -#include <google/protobuf/stubs/strutil.h>  +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/cpp/cpp_helpers.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/io/printer.h> +#include <google/protobuf/io/zero_copy_stream.h> +#include <google/protobuf/stubs/common.h> +#include <google/protobuf/stubs/strutil.h>  #include "cpp_styleguide.h"  #include <util/stream/output.h> @@ -41,12 +41,12 @@ namespace NPlugins {      }      TProtoStringType HeaderFileName(const FileDescriptor* file) { -        TProtoStringType basename = compiler::StripProto(file->name());  +        TProtoStringType basename = compiler::StripProto(file->name());          return basename.append(".pb.h");      }      TProtoStringType SourceFileName(const FileDescriptor* file) { -        TProtoStringType basename = compiler::StripProto(file->name());  +        TProtoStringType basename = compiler::StripProto(file->name());          return basename.append(".pb.cc");      } @@ -105,15 +105,15 @@ namespace NPlugins {              }              void GenerateAccessorDeclarations(io::Printer* printer) { -                Variables_["type"] = QualifiedClassName(Field_->message_type());  +                Variables_["type"] = QualifiedClassName(Field_->message_type());                  printer->Print(Variables_, -                    "inline const $type$& Get$rname$() const { return $name$(); }\n"  -                    "inline $type$* Mutable$rname$() { return mutable_$name$(); }\n");  +                    "inline const $type$& Get$rname$() const { return $name$(); }\n" +                    "inline $type$* Mutable$rname$() { return mutable_$name$(); }\n");                  if (Variables_.end() != Variables_.find("RName"))                      printer->Print(Variables_, -                        "inline const $type$& Get$RName$() const { return $name$(); }\n"  -                        "inline $type$* Mutable$RName$() { return mutable_$name$(); }\n");  +                        "inline const $type$& Get$RName$() const { return $name$(); }\n" +                        "inline $type$* Mutable$RName$() { return mutable_$name$(); }\n");              }              void GenerateJSONPrinting(io::Printer* printer) override { @@ -132,7 +132,7 @@ namespace NPlugins {                  switch (Val_->cpp_type()) {                      case FieldDescriptor::CPPTYPE_MESSAGE: -                        Variables_["val_cpp"] = QualifiedClassName(Val_->message_type());  +                        Variables_["val_cpp"] = QualifiedClassName(Val_->message_type());                          break;                      case FieldDescriptor::CPPTYPE_ENUM:                          Variables_["val_cpp"] = ClassName(Val_->enum_type(), true); @@ -144,12 +144,12 @@ namespace NPlugins {              void GenerateAccessorDeclarations(io::Printer* printer) {                  printer->Print(Variables_, -                    "inline const ::google::protobuf::Map<$key_cpp$, $val_cpp$>& Get$rname$() const { return $name$(); }\n"  -                    "inline ::google::protobuf::Map<$key_cpp$, $val_cpp$>* Mutable$rname$() { return mutable_$name$(); }\n");  +                    "inline const ::google::protobuf::Map<$key_cpp$, $val_cpp$>& Get$rname$() const { return $name$(); }\n" +                    "inline ::google::protobuf::Map<$key_cpp$, $val_cpp$>* Mutable$rname$() { return mutable_$name$(); }\n");                  if (Variables_.end() != Variables_.find("RName"))                      printer->Print(Variables_, -                        "inline const ::google::protobuf::Map<$key_cpp$, $val_cpp$>& Get$RName$() const { return $name$(); }\n"  -                        "inline ::google::protobuf::Map<$key_cpp$, $val_cpp$>* Mutable$RName$() { return mutable_$name$(); }\n");  +                        "inline const ::google::protobuf::Map<$key_cpp$, $val_cpp$>& Get$RName$() const { return $name$(); }\n" +                        "inline ::google::protobuf::Map<$key_cpp$, $val_cpp$>* Mutable$RName$() { return mutable_$name$(); }\n");              }              void GenerateKeyValuePrinting(io::Printer* printer, const char* scopeName, bool isKey) { @@ -205,28 +205,28 @@ namespace NPlugins {              }              void GenerateAccessorDeclarations(io::Printer* printer) { -                Variables_["type"] = QualifiedClassName(Field_->message_type());  +                Variables_["type"] = QualifiedClassName(Field_->message_type());                  printer->Print(Variables_, -                    "inline const $type$& Get$rname$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(int(_index)); }\n"  -                    "inline $type$* Mutable$rname$(size_t _index) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return mutable_$name$(int(_index)); }\n"  -                    "inline $type$* Add$rname$() { return add_$name$(); }\n"  -                    "inline const $type$& get_idx_$name$(int _index) const { return $name$(_index); }\n"  -                    "inline const ::google::protobuf::RepeatedPtrField< $type$ >&\n"  +                    "inline const $type$& Get$rname$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(int(_index)); }\n" +                    "inline $type$* Mutable$rname$(size_t _index) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return mutable_$name$(int(_index)); }\n" +                    "inline $type$* Add$rname$() { return add_$name$(); }\n" +                    "inline const $type$& get_idx_$name$(int _index) const { return $name$(_index); }\n" +                    "inline const ::google::protobuf::RepeatedPtrField< $type$ >&\n"                      "    get_arr_$name$() const { return $name$(); }\n" -                    "inline const ::google::protobuf::RepeatedPtrField< $type$ >&\n"  +                    "inline const ::google::protobuf::RepeatedPtrField< $type$ >&\n"                      "    Get$rname$() const { return $name$(); }\n" -                    "inline ::google::protobuf::RepeatedPtrField< $type$ >*\n"  +                    "inline ::google::protobuf::RepeatedPtrField< $type$ >*\n"                      "    Mutable$rname$() { return mutable_$name$(); }\n");                  if (Variables_.end() != Variables_.find("RName"))                      printer->Print(Variables_, -                        "inline const $type$& Get$RName$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(int(_index)); }\n"  -                        "inline $type$* Mutable$RName$(size_t _index) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return mutable_$name$(int(_index)); }\n"  -                        "inline $type$* Add$RName$() { return add_$name$(); }\n"  -                        "inline const ::google::protobuf::RepeatedPtrField< $type$ >&\n"  +                        "inline const $type$& Get$RName$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(int(_index)); }\n" +                        "inline $type$* Mutable$RName$(size_t _index) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return mutable_$name$(int(_index)); }\n" +                        "inline $type$* Add$RName$() { return add_$name$(); }\n" +                        "inline const ::google::protobuf::RepeatedPtrField< $type$ >&\n"                          "    Get$RName$() const { return $name$(); }\n" -                        "inline ::google::protobuf::RepeatedPtrField< $type$ >*\n"  +                        "inline ::google::protobuf::RepeatedPtrField< $type$ >*\n"                          "    Mutable$RName$() { return mutable_$name$(); }\n"                      );              } @@ -255,21 +255,21 @@ namespace NPlugins {                  }                  printer->Print(Variables_, -                    "inline const TProtoStringType& Get$rname$() const { return $name$(); }\n"  -                    "inline void Set$rname$(const TProtoStringType& value) { set_$name$(value); }\n"  -                    "inline void Set$rname$(TProtoStringType&& value) { set_$name$(std::move(value)); }\n"  -                    "inline void Set$rname$(const char* value) { set_$name$(value); }\n"  -                    "inline void Set$rname$(const $pointer_type$* value, size_t size) { set_$name$(value, size); }\n"  -                    "inline TProtoStringType* Mutable$rname$() { return mutable_$name$(); }\n");  +                    "inline const TProtoStringType& Get$rname$() const { return $name$(); }\n" +                    "inline void Set$rname$(const TProtoStringType& value) { set_$name$(value); }\n" +                    "inline void Set$rname$(TProtoStringType&& value) { set_$name$(std::move(value)); }\n" +                    "inline void Set$rname$(const char* value) { set_$name$(value); }\n" +                    "inline void Set$rname$(const $pointer_type$* value, size_t size) { set_$name$(value, size); }\n" +                    "inline TProtoStringType* Mutable$rname$() { return mutable_$name$(); }\n");                  if (Variables_.end() != Variables_.find("RName"))                      printer->Print(Variables_, -                        "inline const TProtoStringType& Get$RName$() const { return $name$(); }\n"  -                        "inline void Set$RName$(const TProtoStringType& value) { set_$name$(value); }\n"  -                        "inline void Set$RName$(TProtoStringType&& value) { set_$name$(std::move(value)); }\n"  -                        "inline void Set$RName$(const char* value) { set_$name$(value); }\n"  -                        "inline void Set$RName$(const $pointer_type$* value, size_t size) { set_$name$(value, size); }\n"  -                        "inline TProtoStringType* Mutable$RName$() { return mutable_$name$(); }\n"  +                        "inline const TProtoStringType& Get$RName$() const { return $name$(); }\n" +                        "inline void Set$RName$(const TProtoStringType& value) { set_$name$(value); }\n" +                        "inline void Set$RName$(TProtoStringType&& value) { set_$name$(std::move(value)); }\n" +                        "inline void Set$RName$(const char* value) { set_$name$(value); }\n" +                        "inline void Set$RName$(const $pointer_type$* value, size_t size) { set_$name$(value, size); }\n" +                        "inline TProtoStringType* Mutable$RName$() { return mutable_$name$(); }\n"                      );                  if (Field_->options().ctype() != FieldOptions::STRING) { @@ -304,41 +304,41 @@ namespace NPlugins {                  }                  printer->Print(Variables_, -                    "inline const TProtoStringType& Get$rname$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(_index); }\n"  -                    "inline TProtoStringType* Mutable$rname$(size_t _index) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return mutable_$name$(_index); }\n"  -                    "inline void Set$rname$(size_t _index, const TProtoStringType& value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n"  -                    "inline void Set$rname$(size_t _index, TProtoStringType&& value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, std::move(value)); }\n"  -                    "inline void Set$rname$(size_t _index, const char* value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n"  -                    "inline void Set$rname$(size_t _index, const $pointer_type$* value, size_t size) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value, size); }\n"  -                    "inline TProtoStringType* Add$rname$() { return add_$name$(); }\n"  -                    "inline void Add$rname$(const TProtoStringType& value) { add_$name$(value); }\n"  -                    "inline void Add$rname$(TProtoStringType&& value) { add_$name$(std::move(value)); }\n"  -                    "inline void Add$rname$(const char* value) { add_$name$(value); }\n"  -                    "inline void Add$rname$(const $pointer_type$* value, size_t size) { add_$name$(value, size); }\n"  -                    "inline const TProtoStringType& get_idx_$name$(int _index) const { return $name$(_index); }\n"  -                    "inline const ::google::protobuf::RepeatedPtrField<TProtoStringType>& get_arr_$name$() const"  +                    "inline const TProtoStringType& Get$rname$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(_index); }\n" +                    "inline TProtoStringType* Mutable$rname$(size_t _index) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return mutable_$name$(_index); }\n" +                    "inline void Set$rname$(size_t _index, const TProtoStringType& value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n" +                    "inline void Set$rname$(size_t _index, TProtoStringType&& value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, std::move(value)); }\n" +                    "inline void Set$rname$(size_t _index, const char* value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n" +                    "inline void Set$rname$(size_t _index, const $pointer_type$* value, size_t size) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value, size); }\n" +                    "inline TProtoStringType* Add$rname$() { return add_$name$(); }\n" +                    "inline void Add$rname$(const TProtoStringType& value) { add_$name$(value); }\n" +                    "inline void Add$rname$(TProtoStringType&& value) { add_$name$(std::move(value)); }\n" +                    "inline void Add$rname$(const char* value) { add_$name$(value); }\n" +                    "inline void Add$rname$(const $pointer_type$* value, size_t size) { add_$name$(value, size); }\n" +                    "inline const TProtoStringType& get_idx_$name$(int _index) const { return $name$(_index); }\n" +                    "inline const ::google::protobuf::RepeatedPtrField<TProtoStringType>& get_arr_$name$() const"                      "{ return $name$(); }\n" -                    "inline const ::google::protobuf::RepeatedPtrField<TProtoStringType>& Get$rname$() const"  +                    "inline const ::google::protobuf::RepeatedPtrField<TProtoStringType>& Get$rname$() const"                      "{ return $name$(); }\n" -                    "inline ::google::protobuf::RepeatedPtrField<TProtoStringType>* Mutable$rname$()"  +                    "inline ::google::protobuf::RepeatedPtrField<TProtoStringType>* Mutable$rname$()"                      "{ return mutable_$name$(); }\n");                  if (Variables_.end() != Variables_.find("RName"))                      printer->Print(Variables_, -                        "inline const TProtoStringType& Get$RName$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(_index); }\n"  -                        "inline TProtoStringType* Mutable$RName$(size_t _index) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return mutable_$name$(_index); }\n"  -                        "inline void Set$RName$(size_t _index, const TProtoStringType& value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n"  -                        "inline void Set$RName$(size_t _index, TProtoStringType&& value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, std::move(value)); }\n"  -                        "inline void Set$RName$(size_t _index, const char* value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n"  -                        "inline void Set$RName$(size_t _index, const $pointer_type$* value, size_t size) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value, size); }\n"  -                        "inline TProtoStringType* Add$RName$() { return add_$name$(); }\n"  -                        "inline void Add$RName$(const TProtoStringType& value) { add_$name$(value); }\n"  -                        "inline void Add$RName$(TProtoStringType&& value) { add_$name$(std::move(value)); }\n"  -                        "inline void Add$RName$(const char* value) { add_$name$(value); }\n"  -                        "inline void Add$RName$(const $pointer_type$* value, size_t size) { add_$name$(value, size); }\n"  -                        "inline const ::google::protobuf::RepeatedPtrField<TProtoStringType>& Get$RName$() const"  +                        "inline const TProtoStringType& Get$RName$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(_index); }\n" +                        "inline TProtoStringType* Mutable$RName$(size_t _index) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return mutable_$name$(_index); }\n" +                        "inline void Set$RName$(size_t _index, const TProtoStringType& value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n" +                        "inline void Set$RName$(size_t _index, TProtoStringType&& value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, std::move(value)); }\n" +                        "inline void Set$RName$(size_t _index, const char* value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n" +                        "inline void Set$RName$(size_t _index, const $pointer_type$* value, size_t size) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value, size); }\n" +                        "inline TProtoStringType* Add$RName$() { return add_$name$(); }\n" +                        "inline void Add$RName$(const TProtoStringType& value) { add_$name$(value); }\n" +                        "inline void Add$RName$(TProtoStringType&& value) { add_$name$(std::move(value)); }\n" +                        "inline void Add$RName$(const char* value) { add_$name$(value); }\n" +                        "inline void Add$RName$(const $pointer_type$* value, size_t size) { add_$name$(value, size); }\n" +                        "inline const ::google::protobuf::RepeatedPtrField<TProtoStringType>& Get$RName$() const"                          "{ return $name$(); }\n" -                        "inline ::google::protobuf::RepeatedPtrField<TProtoStringType>* Mutable$RName$()"  +                        "inline ::google::protobuf::RepeatedPtrField<TProtoStringType>* Mutable$RName$()"                          "{ return mutable_$name$(); }\n"                      ); @@ -368,13 +368,13 @@ namespace NPlugins {                  Variables_["type"] = ClassName(Field_->enum_type(), true);                  printer->Print(Variables_, -                    "inline $type$ Get$rname$() const { return $name$(); }\n"  -                    "inline void Set$rname$($type$ value) { set_$name$(value); }\n");  +                    "inline $type$ Get$rname$() const { return $name$(); }\n" +                    "inline void Set$rname$($type$ value) { set_$name$(value); }\n");                  if (Variables_.end() != Variables_.find("RName"))                      printer->Print(Variables_, -                        "inline $type$ Get$RName$() const { return $name$(); } \n"  -                        "inline void Set$RName$($type$ value) { set_$name$(value); }\n"  +                        "inline $type$ Get$RName$() const { return $name$(); } \n" +                        "inline void Set$RName$($type$ value) { set_$name$(value); }\n"                      );              } @@ -394,20 +394,20 @@ namespace NPlugins {                  Variables_["type"] = ClassName(Field_->enum_type(), true);                  printer->Print(Variables_, -                    "inline $type$ Get$rname$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(_index); }\n"  -                    "inline void Set$rname$(size_t _index, $type$ value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n"  -                    "inline void Add$rname$($type$ value) { add_$name$(value); }\n"  -                    "inline $type$ get_idx_$name$(int _index) const {return $name$(_index); }\n"  -                    "inline const ::google::protobuf::RepeatedField<int>& get_arr_$name$() const { return $name$(); }\n"  -                    "inline const ::google::protobuf::RepeatedField<int>& Get$rname$() const { return $name$(); }\n"  -                    "inline ::google::protobuf::RepeatedField<int>* Mutable$rname$() { return mutable_$name$(); }\n");  +                    "inline $type$ Get$rname$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(_index); }\n" +                    "inline void Set$rname$(size_t _index, $type$ value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n" +                    "inline void Add$rname$($type$ value) { add_$name$(value); }\n" +                    "inline $type$ get_idx_$name$(int _index) const {return $name$(_index); }\n" +                    "inline const ::google::protobuf::RepeatedField<int>& get_arr_$name$() const { return $name$(); }\n" +                    "inline const ::google::protobuf::RepeatedField<int>& Get$rname$() const { return $name$(); }\n" +                    "inline ::google::protobuf::RepeatedField<int>* Mutable$rname$() { return mutable_$name$(); }\n");                  if (Variables_.end() != Variables_.find("RName"))                      printer->Print(Variables_, -                        "inline $type$ Get$RName$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(_index); }\n"  -                        "inline void Set$RName$(size_t _index, $type$ value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n"  -                        "inline void Add$RName$($type$ value) { add_$name$(value); }\n"  -                        "inline const ::google::protobuf::RepeatedField<int>& Get$RName$() const { return $name$(); }\n"  -                        "inline ::google::protobuf::RepeatedField<int>* Mutable$RName$() { return mutable_$name$(); }\n"  +                        "inline $type$ Get$RName$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(_index); }\n" +                        "inline void Set$RName$(size_t _index, $type$ value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n" +                        "inline void Add$RName$($type$ value) { add_$name$(value); }\n" +                        "inline const ::google::protobuf::RepeatedField<int>& Get$RName$() const { return $name$(); }\n" +                        "inline ::google::protobuf::RepeatedField<int>* Mutable$RName$() { return mutable_$name$(); }\n"                      );              } @@ -427,12 +427,12 @@ namespace NPlugins {                  Variables_["type"] = PrimitiveTypeName(Field_->cpp_type());                  printer->Print(Variables_, -                    "inline $type$ Get$rname$() const { return $name$();}\n"  -                    "inline void Set$rname$($type$ value) { set_$name$(value); }\n");  +                    "inline $type$ Get$rname$() const { return $name$();}\n" +                    "inline void Set$rname$($type$ value) { set_$name$(value); }\n");                  if (Variables_.end() != Variables_.find("RName"))                      printer->Print(Variables_, -                        "inline $type$ Get$RName$() const { return $name$();}\n"  -                        "inline void Set$RName$($type$ value) { set_$name$(value); }\n"  +                        "inline $type$ Get$RName$() const { return $name$();}\n" +                        "inline void Set$RName$($type$ value) { set_$name$(value); }\n"                      );              } @@ -452,24 +452,24 @@ namespace NPlugins {                  Variables_["type"] = PrimitiveTypeName(Field_->cpp_type());                  printer->Print(Variables_, -                    "inline $type$ Get$rname$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(_index); }\n"  -                    "inline void Set$rname$(size_t _index, $type$ value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n"  -                    "inline void Add$rname$($type$ value) { add_$name$(value); }\n"  -                    "inline $type$ get_idx_$name$(int _index) const { return $name$(_index); }\n"  -                    "inline const ::google::protobuf::RepeatedField< $type$ >&\n"  +                    "inline $type$ Get$rname$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(_index); }\n" +                    "inline void Set$rname$(size_t _index, $type$ value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n" +                    "inline void Add$rname$($type$ value) { add_$name$(value); }\n" +                    "inline $type$ get_idx_$name$(int _index) const { return $name$(_index); }\n" +                    "inline const ::google::protobuf::RepeatedField< $type$ >&\n"                      "    get_arr_$name$() const { return $name$(); }\n" -                    "inline const ::google::protobuf::RepeatedField< $type$ >&\n"  +                    "inline const ::google::protobuf::RepeatedField< $type$ >&\n"                      "    Get$rname$() const { return $name$(); }\n" -                    "inline ::google::protobuf::RepeatedField< $type$ >*\n"  +                    "inline ::google::protobuf::RepeatedField< $type$ >*\n"                      "    Mutable$rname$() { return mutable_$name$(); }\n");                  if (Variables_.end() != Variables_.find("RName"))                      printer->Print(Variables_, -                        "inline $type$ Get$RName$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(_index); }\n"  -                        "inline void Set$RName$(size_t _index, $type$ value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n"  -                        "inline void Add$RName$($type$ value) { add_$name$(value); }\n"  -                        "inline const ::google::protobuf::RepeatedField< $type$ >&\n"  +                        "inline $type$ Get$RName$(size_t _index) const {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); return $name$(_index); }\n" +                        "inline void Set$RName$(size_t _index, $type$ value) {Y_ASSERT(_index < static_cast<size_t>(::Max<int>())); set_$name$(_index, value); }\n" +                        "inline void Add$RName$($type$ value) { add_$name$(value); }\n" +                        "inline const ::google::protobuf::RepeatedField< $type$ >&\n"                          "    Get$RName$() const { return $name$(); }\n" -                        "inline ::google::protobuf::RepeatedField< $type$ >*\n"  +                        "inline ::google::protobuf::RepeatedField< $type$ >*\n"                          "    Mutable$RName$() { return mutable_$name$(); }\n"                      );              } @@ -662,23 +662,23 @@ namespace NPlugins {              {                  for (int i = 0, idx = 0; i < descriptor->nested_type_count(); i++) {                      if (!IsAutogeneratedNestedType(descriptor->nested_type(i))) { -                        NestedGenerators_.emplace_back(descriptor->nested_type(i), OutputDirectory_);  +                        NestedGenerators_.emplace_back(descriptor->nested_type(i), OutputDirectory_);                      }                  } -                FieldGenerators_.reserve(descriptor->field_count());  +                FieldGenerators_.reserve(descriptor->field_count());                  for (int i = 0; i < descriptor->field_count(); i++) { -                    FieldGenerators_.emplace_back(MakeGenerator(descriptor->field(i)));  +                    FieldGenerators_.emplace_back(MakeGenerator(descriptor->field(i)));                  } -                ExtensionGenerators_.reserve(descriptor->extension_count());  +                ExtensionGenerators_.reserve(descriptor->extension_count());                  for (int i = 0; i < descriptor->extension_count(); i++) { -                    ExtensionGenerators_.emplace_back(descriptor->extension(i));  +                    ExtensionGenerators_.emplace_back(descriptor->extension(i));                  } -                OneofGenerators_.reserve(descriptor->real_oneof_decl_count());  -                for (int i = 0; i < descriptor->real_oneof_decl_count(); i++) {  -                    OneofGenerators_.emplace_back(descriptor->oneof_decl(i));  +                OneofGenerators_.reserve(descriptor->real_oneof_decl_count()); +                for (int i = 0; i < descriptor->real_oneof_decl_count(); i++) { +                    OneofGenerators_.emplace_back(descriptor->oneof_decl(i));                  }              } @@ -686,40 +686,40 @@ namespace NPlugins {                  GenerateSaveLoadImplementation();                  GenerateJSONImplementation(); -                for (auto& nestedGenerator: NestedGenerators_) {  -                    nestedGenerator.GenerateClassDefinitionExtension();  +                for (auto& nestedGenerator: NestedGenerators_) { +                    nestedGenerator.GenerateClassDefinitionExtension();                  }              }              void GenerateDebugOutputExtension() {                  GenerateDebugOutput(); -                for (auto& nestedGenerator: NestedGenerators_) {  -                    nestedGenerator.GenerateDebugOutputExtension();  +                for (auto& nestedGenerator: NestedGenerators_) { +                    nestedGenerator.GenerateDebugOutputExtension();                  }              }              void GenerateTypedefOutputExtension(bool nested) {                  GenerateTypedefOutput(nested); -                for (auto& nestedGenerator: NestedGenerators_) {  -                    nestedGenerator.GenerateTypedefOutputExtension(true);  +                for (auto& nestedGenerator: NestedGenerators_) { +                    nestedGenerator.GenerateTypedefOutputExtension(true);                  }              }              void GenerateClassExtension() {                  GenerateDebugStringImplementation(); -                for (auto& nestedGenerator: NestedGenerators_) {  -                    nestedGenerator.GenerateClassExtension();  +                for (auto& nestedGenerator: NestedGenerators_) { +                    nestedGenerator.GenerateClassExtension();                  }              }              void GenerateDeclarations() {                  GenerateFieldAccessorDeclarations(); -                for (auto& nestedGenerator: NestedGenerators_) {  -                    nestedGenerator.GenerateDeclarations();  +                for (auto& nestedGenerator: NestedGenerators_) { +                    nestedGenerator.GenerateDeclarations();                  }              } @@ -733,7 +733,7 @@ namespace NPlugins {              void GenerateFieldAccessorDeclarations() {                  TProtoStringType fileName = HeaderFileName(Descriptor_->file());                  TProtoStringType scope = "class_scope:" + Descriptor_->full_name(); -                std::unique_ptr<io::ZeroCopyOutputStream> output(  +                std::unique_ptr<io::ZeroCopyOutputStream> output(                      OutputDirectory_->OpenForInsert(fileName, scope));                  io::Printer printer(output.get(), '$'); @@ -747,44 +747,44 @@ namespace NPlugins {                      const bool hasRName = (vars.end() != vars.find("RName"));                      if (field->is_repeated()) {                          printer.Print(vars, -                            "inline size_t $rname$Size() const { return (size_t)$name$_size(); }\n");  +                            "inline size_t $rname$Size() const { return (size_t)$name$_size(); }\n");                          if (hasRName)                              printer.Print(vars, -                                "inline size_t $RName$Size() const { return (size_t)$name$_size(); }\n");  -                    } else if (field->has_presence()) {  +                                "inline size_t $RName$Size() const { return (size_t)$name$_size(); }\n"); +                    } else if (field->has_presence()) {                          printer.Print(vars, -                            "inline bool Has$rname$() const { return has_$name$(); }\n");  +                            "inline bool Has$rname$() const { return has_$name$(); }\n");                          if (hasRName)                              printer.Print(vars, -                                "inline bool Has$RName$() const { return has_$name$(); }\n");  +                                "inline bool Has$RName$() const { return has_$name$(); }\n");                      } -                    printer.Print(vars, "inline void Clear$rname$() { clear_$name$(); }\n");  +                    printer.Print(vars, "inline void Clear$rname$() { clear_$name$(); }\n");                      if (hasRName)                          printer.Print(vars, -                            "inline void Clear$RName$() { clear_$name$(); }\n");  +                            "inline void Clear$RName$() { clear_$name$(); }\n");                      // Generate type-specific accessor declarations.                      FieldGenerators_[i]->GenerateAccessorDeclarations(&printer);                      printer.Print("\n");                  } -                for (auto& extensionGenerator: ExtensionGenerators_) {  -                    extensionGenerator.GenerateDeclaration(&printer);  +                for (auto& extensionGenerator: ExtensionGenerators_) { +                    extensionGenerator.GenerateDeclaration(&printer);                  } -                for (auto& oneofGenerator: OneofGenerators_) {  -                    oneofGenerator.GenerateDeclarations(&printer);  +                for (auto& oneofGenerator: OneofGenerators_) { +                    oneofGenerator.GenerateDeclarations(&printer);                  }                  TVariables vars;                  vars["class"] = ClassName(Descriptor_, false);                  if (!IsLiteRuntimeMessage(Descriptor_)) {                      printer.Print("TProtoStringType ShortUtf8DebugString() const;\n"); -  -                    printer.Print("void PrintJSON(IOutputStream&) const override;\n");  -                    printer.Print(vars, "::google::protobuf::io::TAsJSON<$class$> AsJSON() const {\n");  -                    printer.Print(vars, "    return ::google::protobuf::io::TAsJSON<$class$>(*this);\n");  -                    printer.Print("}\n");  -  + +                    printer.Print("void PrintJSON(IOutputStream&) const override;\n"); +                    printer.Print(vars, "::google::protobuf::io::TAsJSON<$class$> AsJSON() const {\n"); +                    printer.Print(vars, "    return ::google::protobuf::io::TAsJSON<$class$>(*this);\n"); +                    printer.Print("}\n"); +                      printer.Print("void Save(IOutputStream* output) const;\n");                      printer.Print("void Load(IInputStream* input);\n");                  } @@ -794,7 +794,7 @@ namespace NPlugins {              void GenerateSaveLoadImplementation() {                  TProtoStringType fileName = SourceFileName(Descriptor_->file());                  TProtoStringType scope = "namespace_scope"; -                std::unique_ptr<io::ZeroCopyOutputStream> output(  +                std::unique_ptr<io::ZeroCopyOutputStream> output(                      OutputDirectory_->OpenForInsert(fileName, scope));                  io::Printer printer(output.get(), '$'); @@ -815,7 +815,7 @@ namespace NPlugins {              void GenerateDebugStringImplementation() {                  TProtoStringType fileName = SourceFileName(Descriptor_->file());                  TProtoStringType scope = "namespace_scope"; -                std::unique_ptr<io::ZeroCopyOutputStream> output(  +                std::unique_ptr<io::ZeroCopyOutputStream> output(                      OutputDirectory_->OpenForInsert(fileName, scope));                  io::Printer printer(output.get(), '$'); @@ -831,13 +831,13 @@ namespace NPlugins {              }              void GenerateJSONImplementation() { -                if (IsLiteRuntimeMessage(Descriptor_)) {  -                    return;  -                }  -  +                if (IsLiteRuntimeMessage(Descriptor_)) { +                    return; +                } +                  TProtoStringType fileName = SourceFileName(Descriptor_->file());                  TProtoStringType scope = "namespace_scope"; -                std::unique_ptr<io::ZeroCopyOutputStream> output(  +                std::unique_ptr<io::ZeroCopyOutputStream> output(                      OutputDirectory_->OpenForInsert(fileName, scope));                  io::Printer printer(output.get(), '$');                  printer.Print("// Yandex JSON extension\n"); @@ -859,7 +859,7 @@ namespace NPlugins {                      if (field->is_repeated()) {                          // map or repeated field in both proto3 and proto2 syntax                          printer.Print(vars, "if ($rname$Size() > 0) {\n"); -                    } else if (field->has_presence()) {  +                    } else if (field->has_presence()) {                          // any optional or required field in proto2 syntax                          // message-field or any oneof field in proto3 syntax                          printer.Print(vars, "if (Has$rname$()) {\n"); @@ -886,7 +886,7 @@ namespace NPlugins {              void GenerateDebugOutput() {                  TProtoStringType fileName = SourceFileName(Descriptor_->file());                  TProtoStringType scope = "global_scope"; -                std::unique_ptr<io::ZeroCopyOutputStream> output(  +                std::unique_ptr<io::ZeroCopyOutputStream> output(                      OutputDirectory_->OpenForInsert(fileName, scope));                  io::Printer printer(output.get(), '$');                  if (!IsLiteRuntimeMessage(Descriptor_)) { @@ -908,7 +908,7 @@ namespace NPlugins {                  TProtoStringType scope = nested ? "class_scope:" + Descriptor_->full_name().substr(0,                                                      Descriptor_->full_name().size() - Descriptor_->name().size() - 1)                                                  : "namespace_scope"; -                std::unique_ptr<io::ZeroCopyOutputStream> output(  +                std::unique_ptr<io::ZeroCopyOutputStream> output(                      OutputDirectory_->OpenForInsert(fileName, scope));                  io::Printer printer(output.get(), '$');                  TString name = Descriptor_->name(); @@ -926,12 +926,12 @@ namespace NPlugins {          private:              const Descriptor* Descriptor_; -            TProtoStringType Classname_;  +            TProtoStringType Classname_;              OutputDirectory* OutputDirectory_; -            std::vector<std::unique_ptr<TFieldExtGenerator>>  FieldGenerators_;  -            std::vector<TMessageExtGenerator> NestedGenerators_;  -            std::vector<TExtensionGenerator> ExtensionGenerators_;  -            std::vector<TOneofGenerator> OneofGenerators_;  +            std::vector<std::unique_ptr<TFieldExtGenerator>>  FieldGenerators_; +            std::vector<TMessageExtGenerator> NestedGenerators_; +            std::vector<TExtensionGenerator> ExtensionGenerators_; +            std::vector<TOneofGenerator> OneofGenerators_;      };      class TFileExtGenerator { @@ -940,26 +940,26 @@ namespace NPlugins {                  : File_(file)                  , OutputDirectory_(output_directory)              { -                MessageGenerators_.reserve(file->message_type_count());  -                for (size_t i = 0; i < file->message_type_count(); i++) {  -                    MessageGenerators_.emplace_back(file->message_type(i), OutputDirectory_);  +                MessageGenerators_.reserve(file->message_type_count()); +                for (size_t i = 0; i < file->message_type_count(); i++) { +                    MessageGenerators_.emplace_back(file->message_type(i), OutputDirectory_);                  }              }              void GenerateHeaderExtensions() {                  GenerateHeaderIncludeExtensions(); -                for (auto& messageGenerator: MessageGenerators_) {  -                    messageGenerator.GenerateTypedefOutputExtension(false);  -                    messageGenerator.GenerateDeclarations();  +                for (auto& messageGenerator: MessageGenerators_) { +                    messageGenerator.GenerateTypedefOutputExtension(false); +                    messageGenerator.GenerateDeclarations();                  }              }              void GenerateSourceExtensions() {                  GenerateSourceIncludeExtensions(); -                for (auto& messageGenerator: MessageGenerators_) {  -                    messageGenerator.GenerateDefinitions();  +                for (auto& messageGenerator: MessageGenerators_) { +                    messageGenerator.GenerateDefinitions();                  }              } @@ -967,7 +967,7 @@ namespace NPlugins {              void GenerateSourceIncludeExtensions() {                  TProtoStringType fileName = SourceFileName(File_);                  TProtoStringType scope = "includes"; -                std::unique_ptr<io::ZeroCopyOutputStream> output(  +                std::unique_ptr<io::ZeroCopyOutputStream> output(                      OutputDirectory_->OpenForInsert(fileName, scope));                  io::Printer printer(output.get(), '$');                  printer.Print("#include <google/protobuf/messagext.h>\n"); @@ -976,7 +976,7 @@ namespace NPlugins {              void GenerateHeaderIncludeExtensions() {                  TProtoStringType fileName = HeaderFileName(File_);                  TProtoStringType scope = "includes"; -                std::unique_ptr<io::ZeroCopyOutputStream> output(  +                std::unique_ptr<io::ZeroCopyOutputStream> output(                      OutputDirectory_->OpenForInsert(fileName, scope));                  io::Printer printer(output.get(), '$');                  printer.Print("#include <google/protobuf/json_util.h>\n"); @@ -986,7 +986,7 @@ namespace NPlugins {              const FileDescriptor* File_;              OutputDirectory* OutputDirectory_;              size_t MessageTypeCount_; -            std::vector<TMessageExtGenerator> MessageGenerators_;  +            std::vector<TMessageExtGenerator> MessageGenerators_;      };      bool TCppStyleGuideExtensionGenerator::Generate(const FileDescriptor* file, diff --git a/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.h b/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.h index c0dc1df119d..b428730edb3 100644 --- a/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.h +++ b/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.h @@ -1,20 +1,20 @@ -#include <google/protobuf/compiler/code_generator.h>  -#include <google/protobuf/compiler/plugin.h>  -#include <google/protobuf/stubs/common.h>  +#include <google/protobuf/compiler/code_generator.h> +#include <google/protobuf/compiler/plugin.h> +#include <google/protobuf/stubs/common.h> -namespace NProtobuf::NCompiler::NPlugins {  +namespace NProtobuf::NCompiler::NPlugins {  class TCppStyleGuideExtensionGenerator : public google::protobuf::compiler::CodeGenerator { -public:  -    bool Generate(const google::protobuf::FileDescriptor* file,  -        const TProtoStringType& parameter,  -        google::protobuf::compiler::OutputDirectory* output_directory,  -        TProtoStringType* error  -    ) const override;  +public: +    bool Generate(const google::protobuf::FileDescriptor* file, +        const TProtoStringType& parameter, +        google::protobuf::compiler::OutputDirectory* output_directory, +        TProtoStringType* error +    ) const override; -    uint64_t GetSupportedFeatures() const override {  -        return FEATURE_PROTO3_OPTIONAL;  -    }  +    uint64_t GetSupportedFeatures() const override { +        return FEATURE_PROTO3_OPTIONAL; +    }  }; -} // namespace NProtobuf::NCompiler::NPlugins  +} // namespace NProtobuf::NCompiler::NPlugins diff --git a/contrib/tools/protoc/plugins/cpp_styleguide/ya.make b/contrib/tools/protoc/plugins/cpp_styleguide/ya.make index 8ee9f2e57e0..5a5f17d49aa 100644 --- a/contrib/tools/protoc/plugins/cpp_styleguide/ya.make +++ b/contrib/tools/protoc/plugins/cpp_styleguide/ya.make @@ -7,7 +7,7 @@ ENDIF()  IF (NOT PREBUILT)      INCLUDE(${ARCADIA_ROOT}/contrib/tools/protoc/plugins/cpp_styleguide/bin/ya.make)  ENDIF() -  +  RECURSE(      bin  ) diff --git a/contrib/tools/protoc/plugins/grpc_java/ya.make b/contrib/tools/protoc/plugins/grpc_java/ya.make index 7df2c6e31cd..82b18378a03 100644 --- a/contrib/tools/protoc/plugins/grpc_java/ya.make +++ b/contrib/tools/protoc/plugins/grpc_java/ya.make @@ -10,7 +10,7 @@ ENDIF()  IF (NOT PREBUILT)      INCLUDE(${ARCADIA_ROOT}/contrib/tools/protoc/plugins/grpc_java/bin/ya.make)  ENDIF() -  +  RECURSE(      bin  ) diff --git a/contrib/tools/protoc/plugins/ya.make b/contrib/tools/protoc/plugins/ya.make index 7101688a542..44254ae1112 100644 --- a/contrib/tools/protoc/plugins/ya.make +++ b/contrib/tools/protoc/plugins/ya.make @@ -1,6 +1,6 @@ -RECURSE(  -    cpp_styleguide  -    grpc_cpp  -    grpc_java  -    grpc_python  -)  +RECURSE( +    cpp_styleguide +    grpc_cpp +    grpc_java +    grpc_python +)  | 
