diff options
author | heretic <heretic@yandex-team.ru> | 2022-02-10 16:45:43 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:43 +0300 |
commit | 397cbe258b9e064f49c4ca575279f02f39fef76e (patch) | |
tree | a0b0eb3cca6a14e4e8ea715393637672fa651284 /contrib/libs/grpc/src/compiler/ruby_generator.cc | |
parent | 43f5a35593ebc9f6bcea619bb170394ea7ae468e (diff) | |
download | ydb-397cbe258b9e064f49c4ca575279f02f39fef76e.tar.gz |
Restoring authorship annotation for <heretic@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/grpc/src/compiler/ruby_generator.cc')
-rw-r--r-- | contrib/libs/grpc/src/compiler/ruby_generator.cc | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/contrib/libs/grpc/src/compiler/ruby_generator.cc b/contrib/libs/grpc/src/compiler/ruby_generator.cc index c82e78fd640..eeb82612a4e 100644 --- a/contrib/libs/grpc/src/compiler/ruby_generator.cc +++ b/contrib/libs/grpc/src/compiler/ruby_generator.cc @@ -38,16 +38,16 @@ namespace grpc_ruby_generator { namespace { // Prints out the method using the ruby gRPC DSL. -void PrintMethod(const MethodDescriptor* method, Printer* out) { - TString input_type = RubyTypeOf(method->input_type()); +void PrintMethod(const MethodDescriptor* method, Printer* out) { + TString input_type = RubyTypeOf(method->input_type()); if (method->client_streaming()) { input_type = "stream(" + input_type + ")"; } - TString output_type = RubyTypeOf(method->output_type()); + TString output_type = RubyTypeOf(method->output_type()); if (method->server_streaming()) { output_type = "stream(" + output_type + ")"; } - std::map<TString, TString> method_vars = ListToDict({ + std::map<TString, TString> method_vars = ListToDict({ "mth.name", method->name(), "input.type", @@ -61,13 +61,13 @@ void PrintMethod(const MethodDescriptor* method, Printer* out) { } // Prints out the service using the ruby gRPC DSL. -void PrintService(const ServiceDescriptor* service, Printer* out) { +void PrintService(const ServiceDescriptor* service, Printer* out) { if (service->method_count() == 0) { return; } // Begin the service module - std::map<TString, TString> module_vars = ListToDict({ + std::map<TString, TString> module_vars = ListToDict({ "module.name", Modularize(service->name()), }); @@ -84,12 +84,12 @@ void PrintService(const ServiceDescriptor* service, Printer* out) { out->Print("\n"); out->Print("self.marshal_class_method = :encode\n"); out->Print("self.unmarshal_class_method = :decode\n"); - std::map<TString, TString> pkg_vars = + std::map<TString, TString> pkg_vars = ListToDict({"service_full_name", service->full_name()}); out->Print(pkg_vars, "self.service_name = '$service_full_name$'\n"); out->Print("\n"); for (int i = 0; i < service->method_count(); ++i) { - PrintMethod(service->method(i), out); + PrintMethod(service->method(i), out); } out->Outdent(); @@ -120,12 +120,12 @@ char ToUpper(char ch) { return IsLower(ch) ? (ch - 'a' + 'A') : ch; } // names must be PascalCased. // // foo_bar_baz -> FooBarBaz -TString PackageToModule(const TString& name) { +TString PackageToModule(const TString& name) { bool next_upper = true; - TString result; + TString result; result.reserve(name.size()); - for (TString::size_type i = 0; i < name.size(); i++) { + for (TString::size_type i = 0; i < name.size(); i++) { if (name[i] == '_') { next_upper = true; } else { @@ -142,8 +142,8 @@ TString PackageToModule(const TString& name) { } // end copying of protoc generator for ruby code -TString GetServices(const FileDescriptor* file) { - TString output; +TString GetServices(const FileDescriptor* file) { + TString output; { // Scope the output stream so it closes and finalizes output to the string. @@ -156,10 +156,10 @@ TString GetServices(const FileDescriptor* file) { return output; } - TString package_name = RubyPackage(file); + TString package_name = RubyPackage(file); // Write out a file header. - std::map<TString, TString> header_comment_vars = ListToDict({ + std::map<TString, TString> header_comment_vars = ListToDict({ "file.name", file->name(), "file.package", @@ -169,7 +169,7 @@ TString GetServices(const FileDescriptor* file) { out.Print(header_comment_vars, "# Source: $file.name$ for package '$file.package$'\n"); - TString leading_comments = GetRubyComments(file, true); + TString leading_comments = GetRubyComments(file, true); if (!leading_comments.empty()) { out.Print("# Original file comments:\n"); out.PrintRaw(leading_comments.c_str()); @@ -180,7 +180,7 @@ TString GetServices(const FileDescriptor* file) { // Write out require statemment to import the separately generated file // that defines the messages used by the service. This is generated by the // main ruby plugin. - std::map<TString, TString> dep_vars = ListToDict({ + std::map<TString, TString> dep_vars = ListToDict({ "dep.name", MessagesRequireName(file), }); @@ -188,9 +188,9 @@ TString GetServices(const FileDescriptor* file) { // Write out services within the modules out.Print("\n"); - std::vector<TString> modules = Split(package_name, '.'); + std::vector<TString> modules = Split(package_name, '.'); for (size_t i = 0; i < modules.size(); ++i) { - std::map<TString, TString> module_vars = ListToDict({ + std::map<TString, TString> module_vars = ListToDict({ "module.name", PackageToModule(modules[i]), }); @@ -199,7 +199,7 @@ TString GetServices(const FileDescriptor* file) { } for (int i = 0; i < file->service_count(); ++i) { auto service = file->service(i); - PrintService(service, &out); + PrintService(service, &out); } for (size_t i = 0; i < modules.size(); ++i) { out.Outdent(); |