aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/grpc/src/compiler
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/grpc/src/compiler
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/grpc/src/compiler')
-rw-r--r--contrib/libs/grpc/src/compiler/README.md2
-rw-r--r--contrib/libs/grpc/src/compiler/config.h34
-rw-r--r--contrib/libs/grpc/src/compiler/cpp_generator.cc1214
-rw-r--r--contrib/libs/grpc/src/compiler/cpp_generator.h62
-rw-r--r--contrib/libs/grpc/src/compiler/cpp_generator_helpers.h24
-rw-r--r--contrib/libs/grpc/src/compiler/cpp_plugin.cc22
-rw-r--r--contrib/libs/grpc/src/compiler/csharp_generator.cc188
-rw-r--r--contrib/libs/grpc/src/compiler/csharp_generator.h20
-rw-r--r--contrib/libs/grpc/src/compiler/csharp_generator_helpers.h22
-rw-r--r--contrib/libs/grpc/src/compiler/generator_helpers.h32
-rw-r--r--contrib/libs/grpc/src/compiler/grpc_plugin_support/ya.make2
-rw-r--r--contrib/libs/grpc/src/compiler/node_generator.cc76
-rw-r--r--contrib/libs/grpc/src/compiler/node_generator.h32
-rw-r--r--contrib/libs/grpc/src/compiler/node_generator_helpers.h20
-rw-r--r--contrib/libs/grpc/src/compiler/objective_c_generator.cc158
-rw-r--r--contrib/libs/grpc/src/compiler/objective_c_generator.h36
-rw-r--r--contrib/libs/grpc/src/compiler/objective_c_generator_helpers.h64
-rw-r--r--contrib/libs/grpc/src/compiler/php_generator.cc108
-rw-r--r--contrib/libs/grpc/src/compiler/php_generator_helpers.h76
-rw-r--r--contrib/libs/grpc/src/compiler/protobuf_plugin.h316
-rw-r--r--contrib/libs/grpc/src/compiler/python_generator.cc476
-rw-r--r--contrib/libs/grpc/src/compiler/python_generator.h26
-rw-r--r--contrib/libs/grpc/src/compiler/python_generator_helpers.h222
-rw-r--r--contrib/libs/grpc/src/compiler/python_plugin.cc22
-rw-r--r--contrib/libs/grpc/src/compiler/python_private_generator.h152
-rw-r--r--contrib/libs/grpc/src/compiler/ruby_generator.cc52
-rw-r--r--contrib/libs/grpc/src/compiler/ruby_generator.h20
-rw-r--r--contrib/libs/grpc/src/compiler/ruby_generator_helpers-inl.h24
-rw-r--r--contrib/libs/grpc/src/compiler/ruby_generator_map-inl.h20
-rw-r--r--contrib/libs/grpc/src/compiler/ruby_generator_string-inl.h44
-rw-r--r--contrib/libs/grpc/src/compiler/schema_interface.h176
31 files changed, 1871 insertions, 1871 deletions
diff --git a/contrib/libs/grpc/src/compiler/README.md b/contrib/libs/grpc/src/compiler/README.md
index bceace0c16..d5684af7ff 100644
--- a/contrib/libs/grpc/src/compiler/README.md
+++ b/contrib/libs/grpc/src/compiler/README.md
@@ -1,4 +1,4 @@
-# Overview
+# Overview
This directory contains source code for gRPC protocol buffer compiler (*protoc*) plugins. Along with `protoc`,
these plugins are used to generate gRPC client and server stubs from `.proto` files.
diff --git a/contrib/libs/grpc/src/compiler/config.h b/contrib/libs/grpc/src/compiler/config.h
index 26f6b06df7..95213b0f04 100644
--- a/contrib/libs/grpc/src/compiler/config.h
+++ b/contrib/libs/grpc/src/compiler/config.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -57,11 +57,11 @@ typedef GRPC_CUSTOM_STRINGOUTPUTSTREAM StringOutputStream;
} // namespace protobuf
} // namespace grpc
-namespace grpc_cpp_generator {
-
-static const char* const kCppGeneratorMessageHeaderExt = ".pb.h";
-static const char* const kCppGeneratorServiceHeaderExt = ".grpc.pb.h";
-
-} // namespace grpc_cpp_generator
-
+namespace grpc_cpp_generator {
+
+static const char* const kCppGeneratorMessageHeaderExt = ".pb.h";
+static const char* const kCppGeneratorServiceHeaderExt = ".grpc.pb.h";
+
+} // namespace grpc_cpp_generator
+
#endif // SRC_COMPILER_CONFIG_H
diff --git a/contrib/libs/grpc/src/compiler/cpp_generator.cc b/contrib/libs/grpc/src/compiler/cpp_generator.cc
index 340b307bf7..5759177474 100644
--- a/contrib/libs/grpc/src/compiler/cpp_generator.cc
+++ b/contrib/libs/grpc/src/compiler/cpp_generator.cc
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -34,14 +34,14 @@ TString as_string(T x) {
return out.str();
}
-inline bool ClientOnlyStreaming(const grpc_generator::Method* method) {
- return method->ClientStreaming() && !method->ServerStreaming();
-}
-
-inline bool ServerOnlyStreaming(const grpc_generator::Method* method) {
- return !method->ClientStreaming() && method->ServerStreaming();
-}
-
+inline bool ClientOnlyStreaming(const grpc_generator::Method* method) {
+ return method->ClientStreaming() && !method->ServerStreaming();
+}
+
+inline bool ServerOnlyStreaming(const grpc_generator::Method* method) {
+ return !method->ClientStreaming() && method->ServerStreaming();
+}
+
TString FilenameIdentifier(const TString& filename) {
TString result;
for (unsigned i = 0; i < filename.size(); i++) {
@@ -60,11 +60,11 @@ TString FilenameIdentifier(const TString& filename) {
} // namespace
template <class T, size_t N>
-T* array_end(T (&array)[N]) {
+T* array_end(T (&array)[N]) {
return array + N;
}
-void PrintIncludes(grpc_generator::Printer* printer,
+void PrintIncludes(grpc_generator::Printer* printer,
const std::vector<TString>& headers,
bool use_system_headers, const TString& search_path) {
std::map<TString, TString> vars;
@@ -72,9 +72,9 @@ void PrintIncludes(grpc_generator::Printer* printer,
vars["l"] = use_system_headers ? '<' : '"';
vars["r"] = use_system_headers ? '>' : '"';
- if (!search_path.empty()) {
- vars["l"] += search_path;
- if (search_path[search_path.size() - 1] != '/') {
+ if (!search_path.empty()) {
+ vars["l"] += search_path;
+ if (search_path[search_path.size() - 1] != '/') {
vars["l"] += '/';
}
}
@@ -100,14 +100,14 @@ TString GetHeaderPrologue(grpc_generator::File* file,
? kCppGeneratorMessageHeaderExt
: params.message_header_extension;
- printer->Print(vars, "// Generated by the gRPC C++ plugin.\n");
+ printer->Print(vars, "// Generated by the gRPC C++ plugin.\n");
printer->Print(vars,
"// If you make any local change, they will be lost.\n");
printer->Print(vars, "// source: $filename$\n");
TString leading_comments = file->GetLeadingComments("//");
if (!leading_comments.empty()) {
printer->Print(vars, "// Original file comments:\n");
- printer->PrintRaw(leading_comments.c_str());
+ printer->PrintRaw(leading_comments.c_str());
}
printer->Print(vars, "#ifndef GRPC_$filename_identifier$__INCLUDED\n");
printer->Print(vars, "#define GRPC_$filename_identifier$__INCLUDED\n");
@@ -117,7 +117,7 @@ TString GetHeaderPrologue(grpc_generator::File* file,
printer->Print(vars, "#endif\n");
printer->Print(vars, "\n");
printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
- printer->Print(vars, file->additional_headers().c_str());
+ printer->Print(vars, file->additional_headers().c_str());
printer->Print(vars, "\n");
}
return output;
@@ -138,37 +138,37 @@ TString GetHeaderIncludes(grpc_generator::File* file,
auto printer = file->CreatePrinter(&output);
std::map<TString, TString> vars;
- if (!params.additional_header_includes.empty()) {
- PrintIncludes(printer.get(), params.additional_header_includes, false,
- "");
- }
+ if (!params.additional_header_includes.empty()) {
+ PrintIncludes(printer.get(), params.additional_header_includes, false,
+ "");
+ }
// TODO(vjpai): Remove port_platform.h from header list when callback API is
// fully de-experimentalized since we will no longer be using
// macros from it.
- static const char* headers_strs[] = {
+ static const char* headers_strs[] = {
"functional",
"grpc/impl/codegen/port_platform.h",
"grpcpp/impl/codegen/async_generic_service.h",
- "grpcpp/impl/codegen/async_stream.h",
- "grpcpp/impl/codegen/async_unary_call.h",
+ "grpcpp/impl/codegen/async_stream.h",
+ "grpcpp/impl/codegen/async_unary_call.h",
"grpcpp/impl/codegen/client_callback.h",
"grpcpp/impl/codegen/client_context.h",
"grpcpp/impl/codegen/completion_queue.h",
"grpcpp/impl/codegen/message_allocator.h",
"grpcpp/impl/codegen/method_handler.h",
- "grpcpp/impl/codegen/proto_utils.h",
- "grpcpp/impl/codegen/rpc_method.h",
+ "grpcpp/impl/codegen/proto_utils.h",
+ "grpcpp/impl/codegen/rpc_method.h",
"grpcpp/impl/codegen/server_callback.h",
"grpcpp/impl/codegen/server_callback_handlers.h",
"grpcpp/impl/codegen/server_context.h",
- "grpcpp/impl/codegen/service_type.h",
- "grpcpp/impl/codegen/status.h",
- "grpcpp/impl/codegen/stub_options.h",
+ "grpcpp/impl/codegen/service_type.h",
+ "grpcpp/impl/codegen/status.h",
+ "grpcpp/impl/codegen/stub_options.h",
"grpcpp/impl/codegen/sync_stream.h",
};
std::vector<TString> headers(headers_strs, array_end(headers_strs));
- PrintIncludes(printer.get(), headers, params.use_system_headers,
- params.grpc_search_path);
+ PrintIncludes(printer.get(), headers, params.use_system_headers,
+ params.grpc_search_path);
printer->Print(vars, "\n");
vars["message_header_ext"] = params.message_header_extension.empty()
@@ -205,38 +205,38 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
(*vars)["Request"] = method->input_type_name();
(*vars)["Response"] = method->output_type_name();
- struct {
+ struct {
TString prefix;
TString method_params; // extra arguments to method
TString raw_args; // extra arguments to raw version of method
- } async_prefixes[] = {{"Async", ", void* tag", ", tag"},
- {"PrepareAsync", "", ""}};
-
+ } async_prefixes[] = {{"Async", ", void* tag", ", tag"},
+ {"PrepareAsync", "", ""}};
+
if (is_public) {
if (method->NoStreaming()) {
printer->Print(
*vars,
"virtual ::grpc::Status $Method$(::grpc::ClientContext* context, "
"const $Request$& request, $Response$* response) = 0;\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- printer->Print(
- *vars,
- "std::unique_ptr< "
- "::grpc::ClientAsyncResponseReaderInterface< $Response$>> "
- "$AsyncPrefix$$Method$(::grpc::ClientContext* context, "
- "const $Request$& request, "
- "::grpc::CompletionQueue* cq) {\n");
- printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< "
- "::grpc::ClientAsyncResponseReaderInterface< $Response$>>("
- "$AsyncPrefix$$Method$Raw(context, request, cq));\n");
- printer->Outdent();
- printer->Print("}\n");
- }
- } else if (ClientOnlyStreaming(method)) {
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ printer->Print(
+ *vars,
+ "std::unique_ptr< "
+ "::grpc::ClientAsyncResponseReaderInterface< $Response$>> "
+ "$AsyncPrefix$$Method$(::grpc::ClientContext* context, "
+ "const $Request$& request, "
+ "::grpc::CompletionQueue* cq) {\n");
+ printer->Indent();
+ printer->Print(
+ *vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientAsyncResponseReaderInterface< $Response$>>("
+ "$AsyncPrefix$$Method$Raw(context, request, cq));\n");
+ printer->Outdent();
+ printer->Print("}\n");
+ }
+ } else if (ClientOnlyStreaming(method)) {
printer->Print(
*vars,
"std::unique_ptr< ::grpc::ClientWriterInterface< $Request$>>"
@@ -249,27 +249,27 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
"($Method$Raw(context, response));\n");
printer->Outdent();
printer->Print("}\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
- printer->Print(
- *vars,
- "std::unique_ptr< ::grpc::ClientAsyncWriterInterface< $Request$>>"
- " $AsyncPrefix$$Method$(::grpc::ClientContext* context, "
- "$Response$* "
- "response, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
- printer->Indent();
- printer->Print(*vars,
- "return std::unique_ptr< "
- "::grpc::ClientAsyncWriterInterface< $Request$>>("
- "$AsyncPrefix$$Method$Raw(context, response, "
- "cq$AsyncRawArgs$));\n");
- printer->Outdent();
- printer->Print("}\n");
- }
- } else if (ServerOnlyStreaming(method)) {
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientAsyncWriterInterface< $Request$>>"
+ " $AsyncPrefix$$Method$(::grpc::ClientContext* context, "
+ "$Response$* "
+ "response, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
+ printer->Indent();
+ printer->Print(*vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientAsyncWriterInterface< $Request$>>("
+ "$AsyncPrefix$$Method$Raw(context, response, "
+ "cq$AsyncRawArgs$));\n");
+ printer->Outdent();
+ printer->Print("}\n");
+ }
+ } else if (ServerOnlyStreaming(method)) {
printer->Print(
*vars,
"std::unique_ptr< ::grpc::ClientReaderInterface< $Response$>>"
@@ -283,24 +283,24 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
printer->Outdent();
printer->Print("}\n");
for (auto& async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
- printer->Print(
- *vars,
- "std::unique_ptr< ::grpc::ClientAsyncReaderInterface< $Response$>> "
- "$AsyncPrefix$$Method$("
- "::grpc::ClientContext* context, const $Request$& request, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
- printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< "
- "::grpc::ClientAsyncReaderInterface< $Response$>>("
- "$AsyncPrefix$$Method$Raw(context, request, cq$AsyncRawArgs$));\n");
- printer->Outdent();
- printer->Print("}\n");
- }
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientAsyncReaderInterface< $Response$>> "
+ "$AsyncPrefix$$Method$("
+ "::grpc::ClientContext* context, const $Request$& request, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
+ printer->Indent();
+ printer->Print(
+ *vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientAsyncReaderInterface< $Response$>>("
+ "$AsyncPrefix$$Method$Raw(context, request, cq$AsyncRawArgs$));\n");
+ printer->Outdent();
+ printer->Print("}\n");
+ }
} else if (method->BidiStreaming()) {
printer->Print(*vars,
"std::unique_ptr< ::grpc::ClientReaderWriterInterface< "
@@ -314,125 +314,125 @@ void PrintHeaderClientMethodInterfaces(grpc_generator::Printer* printer,
"$Method$Raw(context));\n");
printer->Outdent();
printer->Print("}\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
- printer->Print(
- *vars,
- "std::unique_ptr< "
- "::grpc::ClientAsyncReaderWriterInterface< $Request$, $Response$>> "
- "$AsyncPrefix$$Method$(::grpc::ClientContext* context, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
- printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< "
- "::grpc::ClientAsyncReaderWriterInterface< $Request$, $Response$>>("
- "$AsyncPrefix$$Method$Raw(context, cq$AsyncRawArgs$));\n");
- printer->Outdent();
- printer->Print("}\n");
- }
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
+ printer->Print(
+ *vars,
+ "std::unique_ptr< "
+ "::grpc::ClientAsyncReaderWriterInterface< $Request$, $Response$>> "
+ "$AsyncPrefix$$Method$(::grpc::ClientContext* context, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
+ printer->Indent();
+ printer->Print(
+ *vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientAsyncReaderWriterInterface< $Request$, $Response$>>("
+ "$AsyncPrefix$$Method$Raw(context, cq$AsyncRawArgs$));\n");
+ printer->Outdent();
+ printer->Print("}\n");
+ }
}
} else {
if (method->NoStreaming()) {
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- printer->Print(
- *vars,
- "virtual ::grpc::ClientAsyncResponseReaderInterface< $Response$>* "
- "$AsyncPrefix$$Method$Raw(::grpc::ClientContext* context, "
- "const $Request$& request, "
- "::grpc::CompletionQueue* cq) = 0;\n");
- }
- } else if (ClientOnlyStreaming(method)) {
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ printer->Print(
+ *vars,
+ "virtual ::grpc::ClientAsyncResponseReaderInterface< $Response$>* "
+ "$AsyncPrefix$$Method$Raw(::grpc::ClientContext* context, "
+ "const $Request$& request, "
+ "::grpc::CompletionQueue* cq) = 0;\n");
+ }
+ } else if (ClientOnlyStreaming(method)) {
printer->Print(
*vars,
"virtual ::grpc::ClientWriterInterface< $Request$>*"
" $Method$Raw("
"::grpc::ClientContext* context, $Response$* response) = 0;\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- printer->Print(
- *vars,
- "virtual ::grpc::ClientAsyncWriterInterface< $Request$>*"
- " $AsyncPrefix$$Method$Raw(::grpc::ClientContext* context, "
- "$Response$* response, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) = 0;\n");
- }
- } else if (ServerOnlyStreaming(method)) {
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ printer->Print(
+ *vars,
+ "virtual ::grpc::ClientAsyncWriterInterface< $Request$>*"
+ " $AsyncPrefix$$Method$Raw(::grpc::ClientContext* context, "
+ "$Response$* response, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) = 0;\n");
+ }
+ } else if (ServerOnlyStreaming(method)) {
printer->Print(
*vars,
- "virtual ::grpc::ClientReaderInterface< $Response$>* "
- "$Method$Raw("
+ "virtual ::grpc::ClientReaderInterface< $Response$>* "
+ "$Method$Raw("
"::grpc::ClientContext* context, const $Request$& request) = 0;\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- printer->Print(
- *vars,
- "virtual ::grpc::ClientAsyncReaderInterface< $Response$>* "
- "$AsyncPrefix$$Method$Raw("
- "::grpc::ClientContext* context, const $Request$& request, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) = 0;\n");
- }
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ printer->Print(
+ *vars,
+ "virtual ::grpc::ClientAsyncReaderInterface< $Response$>* "
+ "$AsyncPrefix$$Method$Raw("
+ "::grpc::ClientContext* context, const $Request$& request, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) = 0;\n");
+ }
} else if (method->BidiStreaming()) {
printer->Print(*vars,
"virtual ::grpc::ClientReaderWriterInterface< $Request$, "
"$Response$>* "
"$Method$Raw(::grpc::ClientContext* context) = 0;\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- printer->Print(
- *vars,
- "virtual ::grpc::ClientAsyncReaderWriterInterface< "
- "$Request$, $Response$>* "
- "$AsyncPrefix$$Method$Raw(::grpc::ClientContext* context, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) = 0;\n");
- }
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ printer->Print(
+ *vars,
+ "virtual ::grpc::ClientAsyncReaderWriterInterface< "
+ "$Request$, $Response$>* "
+ "$AsyncPrefix$$Method$Raw(::grpc::ClientContext* context, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) = 0;\n");
+ }
}
}
}
-void PrintHeaderClientMethod(grpc_generator::Printer* printer,
- const grpc_generator::Method* method,
+void PrintHeaderClientMethod(grpc_generator::Printer* printer,
+ const grpc_generator::Method* method,
std::map<TString, TString>* vars,
bool is_public) {
(*vars)["Method"] = method->name();
(*vars)["Request"] = method->input_type_name();
(*vars)["Response"] = method->output_type_name();
- struct {
+ struct {
TString prefix;
TString method_params; // extra arguments to method
TString raw_args; // extra arguments to raw version of method
- } async_prefixes[] = {{"Async", ", void* tag", ", tag"},
- {"PrepareAsync", "", ""}};
-
+ } async_prefixes[] = {{"Async", ", void* tag", ", tag"},
+ {"PrepareAsync", "", ""}};
+
if (is_public) {
if (method->NoStreaming()) {
printer->Print(
*vars,
"::grpc::Status $Method$(::grpc::ClientContext* context, "
"const $Request$& request, $Response$* response) override;\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- printer->Print(
- *vars,
- "std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> "
- "$AsyncPrefix$$Method$(::grpc::ClientContext* context, "
- "const $Request$& request, "
- "::grpc::CompletionQueue* cq) {\n");
- printer->Indent();
- printer->Print(*vars,
- "return std::unique_ptr< "
- "::grpc::ClientAsyncResponseReader< $Response$>>("
- "$AsyncPrefix$$Method$Raw(context, request, cq));\n");
- printer->Outdent();
- printer->Print("}\n");
- }
- } else if (ClientOnlyStreaming(method)) {
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> "
+ "$AsyncPrefix$$Method$(::grpc::ClientContext* context, "
+ "const $Request$& request, "
+ "::grpc::CompletionQueue* cq) {\n");
+ printer->Indent();
+ printer->Print(*vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientAsyncResponseReader< $Response$>>("
+ "$AsyncPrefix$$Method$Raw(context, request, cq));\n");
+ printer->Outdent();
+ printer->Print("}\n");
+ }
+ } else if (ClientOnlyStreaming(method)) {
printer->Print(
*vars,
"std::unique_ptr< ::grpc::ClientWriter< $Request$>>"
@@ -444,25 +444,25 @@ void PrintHeaderClientMethod(grpc_generator::Printer* printer,
"($Method$Raw(context, response));\n");
printer->Outdent();
printer->Print("}\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
- printer->Print(*vars,
- "std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>>"
- " $AsyncPrefix$$Method$(::grpc::ClientContext* context, "
- "$Response$* response, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
- printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>>("
- "$AsyncPrefix$$Method$Raw(context, response, "
- "cq$AsyncRawArgs$));\n");
- printer->Outdent();
- printer->Print("}\n");
- }
- } else if (ServerOnlyStreaming(method)) {
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
+ printer->Print(*vars,
+ "std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>>"
+ " $AsyncPrefix$$Method$(::grpc::ClientContext* context, "
+ "$Response$* response, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
+ printer->Indent();
+ printer->Print(
+ *vars,
+ "return std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>>("
+ "$AsyncPrefix$$Method$Raw(context, response, "
+ "cq$AsyncRawArgs$));\n");
+ printer->Outdent();
+ printer->Print("}\n");
+ }
+ } else if (ServerOnlyStreaming(method)) {
printer->Print(
*vars,
"std::unique_ptr< ::grpc::ClientReader< $Response$>>"
@@ -475,24 +475,24 @@ void PrintHeaderClientMethod(grpc_generator::Printer* printer,
"($Method$Raw(context, request));\n");
printer->Outdent();
printer->Print("}\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
- printer->Print(
- *vars,
- "std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> "
- "$AsyncPrefix$$Method$("
- "::grpc::ClientContext* context, const $Request$& request, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
- printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>>("
- "$AsyncPrefix$$Method$Raw(context, request, cq$AsyncRawArgs$));\n");
- printer->Outdent();
- printer->Print("}\n");
- }
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
+ printer->Print(
+ *vars,
+ "std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> "
+ "$AsyncPrefix$$Method$("
+ "::grpc::ClientContext* context, const $Request$& request, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
+ printer->Indent();
+ printer->Print(
+ *vars,
+ "return std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>>("
+ "$AsyncPrefix$$Method$Raw(context, request, cq$AsyncRawArgs$));\n");
+ printer->Outdent();
+ printer->Print("}\n");
+ }
} else if (method->BidiStreaming()) {
printer->Print(
*vars,
@@ -505,80 +505,80 @@ void PrintHeaderClientMethod(grpc_generator::Printer* printer,
"$Method$Raw(context));\n");
printer->Outdent();
printer->Print("}\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
- printer->Print(*vars,
- "std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
- "$Request$, $Response$>> "
- "$AsyncPrefix$$Method$(::grpc::ClientContext* context, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
- printer->Indent();
- printer->Print(
- *vars,
- "return std::unique_ptr< "
- "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>>("
- "$AsyncPrefix$$Method$Raw(context, cq$AsyncRawArgs$));\n");
- printer->Outdent();
- printer->Print("}\n");
- }
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
+ printer->Print(*vars,
+ "std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
+ "$Request$, $Response$>> "
+ "$AsyncPrefix$$Method$(::grpc::ClientContext* context, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
+ printer->Indent();
+ printer->Print(
+ *vars,
+ "return std::unique_ptr< "
+ "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>>("
+ "$AsyncPrefix$$Method$Raw(context, cq$AsyncRawArgs$));\n");
+ printer->Outdent();
+ printer->Print("}\n");
+ }
}
} else {
if (method->NoStreaming()) {
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- printer->Print(
- *vars,
- "::grpc::ClientAsyncResponseReader< $Response$>* "
- "$AsyncPrefix$$Method$Raw(::grpc::ClientContext* context, "
- "const $Request$& request, "
- "::grpc::CompletionQueue* cq) override;\n");
- }
- } else if (ClientOnlyStreaming(method)) {
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ printer->Print(
+ *vars,
+ "::grpc::ClientAsyncResponseReader< $Response$>* "
+ "$AsyncPrefix$$Method$Raw(::grpc::ClientContext* context, "
+ "const $Request$& request, "
+ "::grpc::CompletionQueue* cq) override;\n");
+ }
+ } else if (ClientOnlyStreaming(method)) {
printer->Print(*vars,
"::grpc::ClientWriter< $Request$>* $Method$Raw("
"::grpc::ClientContext* context, $Response$* response) "
"override;\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
- printer->Print(
- *vars,
- "::grpc::ClientAsyncWriter< $Request$>* $AsyncPrefix$$Method$Raw("
- "::grpc::ClientContext* context, $Response$* response, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) override;\n");
- }
- } else if (ServerOnlyStreaming(method)) {
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
+ printer->Print(
+ *vars,
+ "::grpc::ClientAsyncWriter< $Request$>* $AsyncPrefix$$Method$Raw("
+ "::grpc::ClientContext* context, $Response$* response, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) override;\n");
+ }
+ } else if (ServerOnlyStreaming(method)) {
printer->Print(*vars,
"::grpc::ClientReader< $Response$>* $Method$Raw("
"::grpc::ClientContext* context, const $Request$& request)"
" override;\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
- printer->Print(
- *vars,
- "::grpc::ClientAsyncReader< $Response$>* $AsyncPrefix$$Method$Raw("
- "::grpc::ClientContext* context, const $Request$& request, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) override;\n");
- }
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
+ printer->Print(
+ *vars,
+ "::grpc::ClientAsyncReader< $Response$>* $AsyncPrefix$$Method$Raw("
+ "::grpc::ClientContext* context, const $Request$& request, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) override;\n");
+ }
} else if (method->BidiStreaming()) {
printer->Print(*vars,
"::grpc::ClientReaderWriter< $Request$, $Response$>* "
"$Method$Raw(::grpc::ClientContext* context) override;\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
- printer->Print(
- *vars,
- "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* "
- "$AsyncPrefix$$Method$Raw(::grpc::ClientContext* context, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) override;\n");
- }
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["AsyncRawArgs"] = async_prefix.raw_args;
+ printer->Print(
+ *vars,
+ "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* "
+ "$AsyncPrefix$$Method$Raw(::grpc::ClientContext* context, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) override;\n");
+ }
}
}
}
@@ -780,33 +780,33 @@ void PrintHeaderClientMethodCallbackEnd(
"return &async_stub_; }\n");
}
-void PrintHeaderClientMethodData(grpc_generator::Printer* printer,
- const grpc_generator::Method* method,
+void PrintHeaderClientMethodData(grpc_generator::Printer* printer,
+ const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
(*vars)["Method"] = method->name();
- printer->Print(*vars,
- "const ::grpc::internal::RpcMethod rpcmethod_$Method$_;\n");
+ printer->Print(*vars,
+ "const ::grpc::internal::RpcMethod rpcmethod_$Method$_;\n");
}
-void PrintHeaderServerMethodSync(grpc_generator::Printer* printer,
- const grpc_generator::Method* method,
+void PrintHeaderServerMethodSync(grpc_generator::Printer* printer,
+ const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] = method->input_type_name();
(*vars)["Response"] = method->output_type_name();
- printer->Print(method->GetLeadingComments("//").c_str());
+ printer->Print(method->GetLeadingComments("//").c_str());
if (method->NoStreaming()) {
printer->Print(*vars,
"virtual ::grpc::Status $Method$("
"::grpc::ServerContext* context, const $Request$* request, "
"$Response$* response);\n");
- } else if (ClientOnlyStreaming(method)) {
+ } else if (ClientOnlyStreaming(method)) {
printer->Print(*vars,
"virtual ::grpc::Status $Method$("
"::grpc::ServerContext* context, "
"::grpc::ServerReader< $Request$>* reader, "
"$Response$* response);\n");
- } else if (ServerOnlyStreaming(method)) {
+ } else if (ServerOnlyStreaming(method)) {
printer->Print(*vars,
"virtual ::grpc::Status $Method$("
"::grpc::ServerContext* context, const $Request$* request, "
@@ -819,7 +819,7 @@ void PrintHeaderServerMethodSync(grpc_generator::Printer* printer,
"::grpc::ServerReaderWriter< $Response$, $Request$>* stream);"
"\n");
}
- printer->Print(method->GetTrailingComments("//").c_str());
+ printer->Print(method->GetTrailingComments("//").c_str());
}
// Helper generator. Disables the sync API for Request and Response, then adds
@@ -849,7 +849,7 @@ void PrintHeaderServerAsyncMethodsHelper(
" ::grpc::Service::RequestAsyncUnary($Idx$, context, "
"request, response, new_call_cq, notification_cq, tag);\n");
printer->Print("}\n");
- } else if (ClientOnlyStreaming(method)) {
+ } else if (ClientOnlyStreaming(method)) {
printer->Print(
*vars,
"// disable synchronous version of this method\n"
@@ -871,7 +871,7 @@ void PrintHeaderServerAsyncMethodsHelper(
" ::grpc::Service::RequestAsyncClientStreaming($Idx$, "
"context, reader, new_call_cq, notification_cq, tag);\n");
printer->Print("}\n");
- } else if (ServerOnlyStreaming(method)) {
+ } else if (ServerOnlyStreaming(method)) {
printer->Print(
*vars,
"// disable synchronous version of this method\n"
@@ -1301,7 +1301,7 @@ void PrintHeaderServerMethodRawCallback(
}
void PrintHeaderServerMethodStreamedUnary(
- grpc_generator::Printer* printer, const grpc_generator::Method* method,
+ grpc_generator::Printer* printer, const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] = method->input_type_name();
@@ -1355,12 +1355,12 @@ void PrintHeaderServerMethodStreamedUnary(
}
void PrintHeaderServerMethodSplitStreaming(
- grpc_generator::Printer* printer, const grpc_generator::Method* method,
+ grpc_generator::Printer* printer, const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] = method->input_type_name();
(*vars)["Response"] = method->output_type_name();
- if (ServerOnlyStreaming(method)) {
+ if (ServerOnlyStreaming(method)) {
printer->Print(*vars, "template <class BaseClass>\n");
printer->Print(*vars,
"class WithSplitStreamingMethod_$Method$ : "
@@ -1442,7 +1442,7 @@ void PrintHeaderServerMethodGeneric(grpc_generator::Printer* printer,
" abort();\n"
" return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
"}\n");
- } else if (ClientOnlyStreaming(method)) {
+ } else if (ClientOnlyStreaming(method)) {
printer->Print(
*vars,
"// disable synchronous version of this method\n"
@@ -1453,7 +1453,7 @@ void PrintHeaderServerMethodGeneric(grpc_generator::Printer* printer,
" abort();\n"
" return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
"}\n");
- } else if (ServerOnlyStreaming(method)) {
+ } else if (ServerOnlyStreaming(method)) {
printer->Print(
*vars,
"// disable synchronous version of this method\n"
@@ -1511,23 +1511,23 @@ void PrintHeaderServerMethodRaw(grpc_generator::Printer* printer,
printer->Print(*vars, "};\n");
}
-void PrintHeaderService(grpc_generator::Printer* printer,
- const grpc_generator::Service* service,
+void PrintHeaderService(grpc_generator::Printer* printer,
+ const grpc_generator::Service* service,
std::map<TString, TString>* vars) {
(*vars)["Service"] = service->name();
- printer->Print(service->GetLeadingComments("//").c_str());
+ printer->Print(service->GetLeadingComments("//").c_str());
printer->Print(*vars,
"class $Service$ final {\n"
" public:\n");
printer->Indent();
- // Service metadata
- printer->Print(*vars,
- "static constexpr char const* service_full_name() {\n"
- " return \"$Package$$Service$\";\n"
- "}\n");
-
+ // Service metadata
+ printer->Print(*vars,
+ "static constexpr char const* service_full_name() {\n"
+ " return \"$Package$$Service$\";\n"
+ "}\n");
+
// Client side
printer->Print(
"class StubInterface {\n"
@@ -1535,10 +1535,10 @@ void PrintHeaderService(grpc_generator::Printer* printer,
printer->Indent();
printer->Print("virtual ~StubInterface() {}\n");
for (int i = 0; i < service->method_count(); ++i) {
- printer->Print(service->method(i)->GetLeadingComments("//").c_str());
+ printer->Print(service->method(i)->GetLeadingComments("//").c_str());
PrintHeaderClientMethodInterfaces(printer, service->method(i).get(), vars,
true);
- printer->Print(service->method(i)->GetTrailingComments("//").c_str());
+ printer->Print(service->method(i)->GetTrailingComments("//").c_str());
}
PrintHeaderClientMethodCallbackInterfacesStart(printer, vars);
for (int i = 0; i < service->method_count(); ++i) {
@@ -1562,8 +1562,8 @@ void PrintHeaderService(grpc_generator::Printer* printer,
" {\n public:\n");
printer->Indent();
printer->Print(
- "Stub(const std::shared_ptr< ::grpc::ChannelInterface>& "
- "channel);\n");
+ "Stub(const std::shared_ptr< ::grpc::ChannelInterface>& "
+ "channel);\n");
for (int i = 0; i < service->method_count(); ++i) {
PrintHeaderClientMethod(printer, service->method(i).get(), vars, true);
}
@@ -1705,15 +1705,15 @@ void PrintHeaderService(grpc_generator::Printer* printer,
printer->Print("typedef ");
for (int i = 0; i < service->method_count(); ++i) {
(*vars)["method_name"] = service->method(i)->name();
- auto method = service->method(i);
- if (ServerOnlyStreaming(method.get())) {
+ auto method = service->method(i);
+ if (ServerOnlyStreaming(method.get())) {
printer->Print(*vars, "WithSplitStreamingMethod_$method_name$<");
}
}
printer->Print("Service");
for (int i = 0; i < service->method_count(); ++i) {
- auto method = service->method(i);
- if (ServerOnlyStreaming(method.get())) {
+ auto method = service->method(i);
+ if (ServerOnlyStreaming(method.get())) {
printer->Print(" >");
}
}
@@ -1723,8 +1723,8 @@ void PrintHeaderService(grpc_generator::Printer* printer,
printer->Print("typedef ");
for (int i = 0; i < service->method_count(); ++i) {
(*vars)["method_name"] = service->method(i)->name();
- auto method = service->method(i);
- if (ServerOnlyStreaming(method.get())) {
+ auto method = service->method(i);
+ if (ServerOnlyStreaming(method.get())) {
printer->Print(*vars, "WithSplitStreamingMethod_$method_name$<");
}
if (service->method(i)->NoStreaming()) {
@@ -1733,9 +1733,9 @@ void PrintHeaderService(grpc_generator::Printer* printer,
}
printer->Print("Service");
for (int i = 0; i < service->method_count(); ++i) {
- auto method = service->method(i);
+ auto method = service->method(i);
if (service->method(i)->NoStreaming() ||
- ServerOnlyStreaming(method.get())) {
+ ServerOnlyStreaming(method.get())) {
printer->Print(" >");
}
}
@@ -1743,7 +1743,7 @@ void PrintHeaderService(grpc_generator::Printer* printer,
printer->Outdent();
printer->Print("};\n");
- printer->Print(service->GetTrailingComments("//").c_str());
+ printer->Print(service->GetTrailingComments("//").c_str());
}
TString GetHeaderServices(grpc_generator::File* file,
@@ -1801,7 +1801,7 @@ TString GetHeaderEpilogue(grpc_generator::File* file,
printer->Print(vars, "\n");
printer->Print(vars, "#endif // GRPC_$filename_identifier$__INCLUDED\n");
- printer->Print(file->GetTrailingComments("//").c_str());
+ printer->Print(file->GetTrailingComments("//").c_str());
}
return output;
}
@@ -1819,9 +1819,9 @@ TString GetSourcePrologue(grpc_generator::File* file,
vars["message_header_ext"] = params.message_header_extension.empty()
? kCppGeneratorMessageHeaderExt
: params.message_header_extension;
- vars["service_header_ext"] = kCppGeneratorServiceHeaderExt;
+ vars["service_header_ext"] = kCppGeneratorServiceHeaderExt;
- printer->Print(vars, "// Generated by the gRPC C++ plugin.\n");
+ printer->Print(vars, "// Generated by the gRPC C++ plugin.\n");
printer->Print(vars,
"// If you make any local change, they will be lost.\n");
printer->Print(vars, "// source: $filename$\n\n");
@@ -1840,24 +1840,24 @@ TString GetSourceIncludes(grpc_generator::File* file,
// Scope the output stream so it closes and finalizes output to the string.
auto printer = file->CreatePrinter(&output);
std::map<TString, TString> vars;
- static const char* headers_strs[] = {
+ static const char* headers_strs[] = {
"functional",
- "grpcpp/impl/codegen/async_stream.h",
- "grpcpp/impl/codegen/async_unary_call.h",
- "grpcpp/impl/codegen/channel_interface.h",
- "grpcpp/impl/codegen/client_unary_call.h",
+ "grpcpp/impl/codegen/async_stream.h",
+ "grpcpp/impl/codegen/async_unary_call.h",
+ "grpcpp/impl/codegen/channel_interface.h",
+ "grpcpp/impl/codegen/client_unary_call.h",
"grpcpp/impl/codegen/client_callback.h",
"grpcpp/impl/codegen/message_allocator.h",
"grpcpp/impl/codegen/method_handler.h",
- "grpcpp/impl/codegen/rpc_service_method.h",
+ "grpcpp/impl/codegen/rpc_service_method.h",
"grpcpp/impl/codegen/server_callback.h",
"grpcpp/impl/codegen/server_callback_handlers.h",
"grpcpp/impl/codegen/server_context.h",
- "grpcpp/impl/codegen/service_type.h",
- "grpcpp/impl/codegen/sync_stream.h"};
+ "grpcpp/impl/codegen/service_type.h",
+ "grpcpp/impl/codegen/sync_stream.h"};
std::vector<TString> headers(headers_strs, array_end(headers_strs));
- PrintIncludes(printer.get(), headers, params.use_system_headers,
- params.grpc_search_path);
+ PrintIncludes(printer.get(), headers, params.use_system_headers,
+ params.grpc_search_path);
if (!file->package().empty()) {
std::vector<TString> parts = file->package_parts();
@@ -1873,28 +1873,28 @@ TString GetSourceIncludes(grpc_generator::File* file,
return output;
}
-void PrintSourceClientMethod(grpc_generator::Printer* printer,
- const grpc_generator::Method* method,
+void PrintSourceClientMethod(grpc_generator::Printer* printer,
+ const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] = method->input_type_name();
(*vars)["Response"] = method->output_type_name();
- struct {
+ struct {
TString prefix;
TString start; // bool literal expressed as string
TString method_params; // extra arguments to method
TString create_args; // extra arguments to creator
- } async_prefixes[] = {{"Async", "true", ", void* tag", ", tag"},
- {"PrepareAsync", "false", "", ", nullptr"}};
+ } async_prefixes[] = {{"Async", "true", ", void* tag", ", tag"},
+ {"PrepareAsync", "false", "", ", nullptr"}};
if (method->NoStreaming()) {
printer->Print(*vars,
"::grpc::Status $ns$$Service$::Stub::$Method$("
"::grpc::ClientContext* context, "
"const $Request$& request, $Response$* response) {\n");
printer->Print(*vars,
- " return ::grpc::internal::BlockingUnaryCall"
- "(channel_.get(), rpcmethod_$Method$_, "
- "context, request, response);\n}\n\n");
+ " return ::grpc::internal::BlockingUnaryCall"
+ "(channel_.get(), rpcmethod_$Method$_, "
+ "context, request, response);\n}\n\n");
printer->Print(*vars,
"void $ns$$Service$::Stub::experimental_async::$Method$("
@@ -1941,7 +1941,7 @@ void PrintSourceClientMethod(grpc_generator::Printer* printer,
" result->StartCall();\n"
" return result;\n"
"}\n\n");
- } else if (ClientOnlyStreaming(method)) {
+ } else if (ClientOnlyStreaming(method)) {
printer->Print(*vars,
"::grpc::ClientWriter< $Request$>* "
"$ns$$Service$::Stub::$Method$Raw("
@@ -1968,27 +1968,27 @@ void PrintSourceClientMethod(grpc_generator::Printer* printer,
"context, response, reactor);\n"
"}\n\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncStart"] = async_prefix.start;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["AsyncCreateArgs"] = async_prefix.create_args;
- printer->Print(*vars,
- "::grpc::ClientAsyncWriter< $Request$>* "
- "$ns$$Service$::Stub::$AsyncPrefix$$Method$Raw("
- "::grpc::ClientContext* context, $Response$* response, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
- printer->Print(
- *vars,
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncStart"] = async_prefix.start;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["AsyncCreateArgs"] = async_prefix.create_args;
+ printer->Print(*vars,
+ "::grpc::ClientAsyncWriter< $Request$>* "
+ "$ns$$Service$::Stub::$AsyncPrefix$$Method$Raw("
+ "::grpc::ClientContext* context, $Response$* response, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
+ printer->Print(
+ *vars,
" return ::grpc::internal::ClientAsyncWriterFactory< $Request$>"
- "::Create(channel_.get(), cq, "
- "rpcmethod_$Method$_, "
- "context, response, $AsyncStart$$AsyncCreateArgs$);\n"
- "}\n\n");
- }
- } else if (ServerOnlyStreaming(method)) {
- printer->Print(
- *vars,
+ "::Create(channel_.get(), cq, "
+ "rpcmethod_$Method$_, "
+ "context, response, $AsyncStart$$AsyncCreateArgs$);\n"
+ "}\n\n");
+ }
+ } else if (ServerOnlyStreaming(method)) {
+ printer->Print(
+ *vars,
"::grpc::ClientReader< $Response$>* "
"$ns$$Service$::Stub::$Method$Raw("
"::grpc::ClientContext* context, const $Request$& request) {\n");
@@ -2014,17 +2014,17 @@ void PrintSourceClientMethod(grpc_generator::Printer* printer,
"context, request, reactor);\n"
"}\n\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncStart"] = async_prefix.start;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["AsyncCreateArgs"] = async_prefix.create_args;
- printer->Print(
- *vars,
- "::grpc::ClientAsyncReader< $Response$>* "
- "$ns$$Service$::Stub::$AsyncPrefix$$Method$Raw("
- "::grpc::ClientContext* context, const $Request$& request, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncStart"] = async_prefix.start;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["AsyncCreateArgs"] = async_prefix.create_args;
+ printer->Print(
+ *vars,
+ "::grpc::ClientAsyncReader< $Response$>* "
+ "$ns$$Service$::Stub::$AsyncPrefix$$Method$Raw("
+ "::grpc::ClientContext* context, const $Request$& request, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
printer->Print(*vars,
" return ::grpc::internal::ClientAsyncReaderFactory< "
"$Response$>"
@@ -2032,7 +2032,7 @@ void PrintSourceClientMethod(grpc_generator::Printer* printer,
"rpcmethod_$Method$_, "
"context, request, $AsyncStart$$AsyncCreateArgs$);\n"
"}\n\n");
- }
+ }
} else if (method->BidiStreaming()) {
printer->Print(
*vars,
@@ -2040,7 +2040,7 @@ void PrintSourceClientMethod(grpc_generator::Printer* printer,
"$ns$$Service$::Stub::$Method$Raw(::grpc::ClientContext* context) {\n");
printer->Print(*vars,
" return ::grpc::internal::ClientReaderWriterFactory< "
- "$Request$, $Response$>::Create("
+ "$Request$, $Response$>::Create("
"channel_.get(), "
"rpcmethod_$Method$_, "
"context);\n"
@@ -2060,30 +2060,30 @@ void PrintSourceClientMethod(grpc_generator::Printer* printer,
"context, reactor);\n"
"}\n\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncStart"] = async_prefix.start;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["AsyncCreateArgs"] = async_prefix.create_args;
- printer->Print(*vars,
- "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* "
- "$ns$$Service$::Stub::$AsyncPrefix$$Method$Raw(::grpc::"
- "ClientContext* context, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
- printer->Print(*vars,
- " return "
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncStart"] = async_prefix.start;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["AsyncCreateArgs"] = async_prefix.create_args;
+ printer->Print(*vars,
+ "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* "
+ "$ns$$Service$::Stub::$AsyncPrefix$$Method$Raw(::grpc::"
+ "ClientContext* context, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$) {\n");
+ printer->Print(*vars,
+ " return "
"::grpc::internal::ClientAsyncReaderWriterFactory< "
- "$Request$, $Response$>::Create("
- "channel_.get(), cq, "
- "rpcmethod_$Method$_, "
- "context, $AsyncStart$$AsyncCreateArgs$);\n"
- "}\n\n");
- }
+ "$Request$, $Response$>::Create("
+ "channel_.get(), cq, "
+ "rpcmethod_$Method$_, "
+ "context, $AsyncStart$$AsyncCreateArgs$);\n"
+ "}\n\n");
+ }
}
}
-void PrintSourceServerMethod(grpc_generator::Printer* printer,
- const grpc_generator::Method* method,
+void PrintSourceServerMethod(grpc_generator::Printer* printer,
+ const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] = method->input_type_name();
@@ -2100,7 +2100,7 @@ void PrintSourceServerMethod(grpc_generator::Printer* printer,
" return ::grpc::Status("
"::grpc::StatusCode::UNIMPLEMENTED, \"\");\n");
printer->Print("}\n\n");
- } else if (ClientOnlyStreaming(method)) {
+ } else if (ClientOnlyStreaming(method)) {
printer->Print(*vars,
"::grpc::Status $ns$$Service$::Service::$Method$("
"::grpc::ServerContext* context, "
@@ -2113,7 +2113,7 @@ void PrintSourceServerMethod(grpc_generator::Printer* printer,
" return ::grpc::Status("
"::grpc::StatusCode::UNIMPLEMENTED, \"\");\n");
printer->Print("}\n\n");
- } else if (ServerOnlyStreaming(method)) {
+ } else if (ServerOnlyStreaming(method)) {
printer->Print(*vars,
"::grpc::Status $ns$$Service$::Service::$Method$("
"::grpc::ServerContext* context, "
@@ -2141,8 +2141,8 @@ void PrintSourceServerMethod(grpc_generator::Printer* printer,
}
}
-void PrintSourceService(grpc_generator::Printer* printer,
- const grpc_generator::Service* service,
+void PrintSourceService(grpc_generator::Printer* printer,
+ const grpc_generator::Service* service,
std::map<TString, TString>* vars) {
(*vars)["Service"] = service->name();
@@ -2159,8 +2159,8 @@ void PrintSourceService(grpc_generator::Printer* printer,
printer->Print(*vars,
"std::unique_ptr< $ns$$Service$::Stub> $ns$$Service$::NewStub("
"const std::shared_ptr< ::grpc::ChannelInterface>& channel, "
- "const ::grpc::StubOptions& options) {\n"
- " (void)options;\n"
+ "const ::grpc::StubOptions& options) {\n"
+ " (void)options;\n"
" std::unique_ptr< $ns$$Service$::Stub> stub(new "
"$ns$$Service$::Stub(channel));\n"
" return stub;\n"
@@ -2179,9 +2179,9 @@ void PrintSourceService(grpc_generator::Printer* printer,
// NOTE: There is no reason to consider streamed-unary as a separate
// category here since this part is setting up the client-side stub
// and this appears as a NORMAL_RPC from the client-side.
- } else if (ClientOnlyStreaming(method.get())) {
+ } else if (ClientOnlyStreaming(method.get())) {
(*vars)["StreamingType"] = "CLIENT_STREAMING";
- } else if (ServerOnlyStreaming(method.get())) {
+ } else if (ServerOnlyStreaming(method.get())) {
(*vars)["StreamingType"] = "SERVER_STREAMING";
} else {
(*vars)["StreamingType"] = "BIDI_STREAMING";
@@ -2189,7 +2189,7 @@ void PrintSourceService(grpc_generator::Printer* printer,
printer->Print(*vars,
", rpcmethod_$Method$_("
"$prefix$$Service$_method_names[$Idx$], "
- "::grpc::internal::RpcMethod::$StreamingType$, "
+ "::grpc::internal::RpcMethod::$StreamingType$, "
"channel"
")\n");
}
@@ -2212,10 +2212,10 @@ void PrintSourceService(grpc_generator::Printer* printer,
if (method->NoStreaming()) {
printer->Print(
*vars,
- "AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
+ "AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
" $prefix$$Service$_method_names[$Idx$],\n"
- " ::grpc::internal::RpcMethod::NORMAL_RPC,\n"
- " new ::grpc::internal::RpcMethodHandler< $ns$$Service$::Service, "
+ " ::grpc::internal::RpcMethod::NORMAL_RPC,\n"
+ " new ::grpc::internal::RpcMethodHandler< $ns$$Service$::Service, "
"$Request$, "
"$Response$>(\n"
" []($ns$$Service$::Service* service,\n"
@@ -2224,13 +2224,13 @@ void PrintSourceService(grpc_generator::Printer* printer,
" $Response$* resp) {\n"
" return service->$Method$(ctx, req, resp);\n"
" }, this)));\n");
- } else if (ClientOnlyStreaming(method.get())) {
+ } else if (ClientOnlyStreaming(method.get())) {
printer->Print(
*vars,
- "AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
+ "AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
" $prefix$$Service$_method_names[$Idx$],\n"
- " ::grpc::internal::RpcMethod::CLIENT_STREAMING,\n"
- " new ::grpc::internal::ClientStreamingHandler< "
+ " ::grpc::internal::RpcMethod::CLIENT_STREAMING,\n"
+ " new ::grpc::internal::ClientStreamingHandler< "
"$ns$$Service$::Service, $Request$, $Response$>(\n"
" []($ns$$Service$::Service* service,\n"
" ::grpc::ServerContext* ctx,\n"
@@ -2238,13 +2238,13 @@ void PrintSourceService(grpc_generator::Printer* printer,
" $Response$* resp) {\n"
" return service->$Method$(ctx, reader, resp);\n"
" }, this)));\n");
- } else if (ServerOnlyStreaming(method.get())) {
+ } else if (ServerOnlyStreaming(method.get())) {
printer->Print(
*vars,
- "AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
+ "AddMethod(new ::grpc::internal::RpcServiceMethod(\n"
" $prefix$$Service$_method_names[$Idx$],\n"
- " ::grpc::internal::RpcMethod::SERVER_STREAMING,\n"
- " new ::grpc::internal::ServerStreamingHandler< "
+ " ::grpc::internal::RpcMethod::SERVER_STREAMING,\n"
+ " new ::grpc::internal::ServerStreamingHandler< "
"$ns$$Service$::Service, $Request$, $Response$>(\n"
" []($ns$$Service$::Service* service,\n"
" ::grpc::ServerContext* ctx,\n"
@@ -2325,29 +2325,29 @@ TString GetSourceEpilogue(grpc_generator::File* file,
return temp;
}
-// TODO(mmukhi): Make sure we need parameters or not.
+// TODO(mmukhi): Make sure we need parameters or not.
TString GetMockPrologue(grpc_generator::File* file,
const Parameters& params) {
TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
- auto printer = file->CreatePrinter(&output);
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+ auto printer = file->CreatePrinter(&output);
std::map<TString, TString> vars;
-
- vars["filename"] = file->filename();
- vars["filename_base"] = file->filename_without_ext();
+
+ vars["filename"] = file->filename();
+ vars["filename_base"] = file->filename_without_ext();
vars["message_header_ext"] = params.message_header_extension.empty()
? kCppGeneratorMessageHeaderExt
: params.message_header_extension;
- vars["service_header_ext"] = kCppGeneratorServiceHeaderExt;
-
- printer->Print(vars, "// Generated by the gRPC C++ plugin.\n");
- printer->Print(vars,
- "// If you make any local change, they will be lost.\n");
- printer->Print(vars, "// source: $filename$\n\n");
-
- printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
- printer->Print(vars, "#include \"$filename_base$$service_header_ext$\"\n");
+ vars["service_header_ext"] = kCppGeneratorServiceHeaderExt;
+
+ printer->Print(vars, "// Generated by the gRPC C++ plugin.\n");
+ printer->Print(vars,
+ "// If you make any local change, they will be lost.\n");
+ printer->Print(vars, "// source: $filename$\n\n");
+
+ printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
+ printer->Print(vars, "#include \"$filename_base$$service_header_ext$\"\n");
if (params.include_import_headers) {
const std::vector<TString> import_names = file->GetImportNames();
for (const auto& import_name : import_names) {
@@ -2356,202 +2356,202 @@ TString GetMockPrologue(grpc_generator::File* file,
}
printer->PrintRaw("\n");
}
- printer->Print(vars, file->additional_headers().c_str());
- printer->Print(vars, "\n");
- }
- return output;
-}
-
-// TODO(mmukhi): Add client-stream and completion-queue headers.
+ printer->Print(vars, file->additional_headers().c_str());
+ printer->Print(vars, "\n");
+ }
+ return output;
+}
+
+// TODO(mmukhi): Add client-stream and completion-queue headers.
TString GetMockIncludes(grpc_generator::File* file,
const Parameters& params) {
TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
- auto printer = file->CreatePrinter(&output);
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+ auto printer = file->CreatePrinter(&output);
std::map<TString, TString> vars;
-
- static const char* headers_strs[] = {
- "grpcpp/impl/codegen/async_stream.h",
- "grpcpp/impl/codegen/sync_stream.h",
- };
+
+ static const char* headers_strs[] = {
+ "grpcpp/impl/codegen/async_stream.h",
+ "grpcpp/impl/codegen/sync_stream.h",
+ };
std::vector<TString> headers(headers_strs, array_end(headers_strs));
- PrintIncludes(printer.get(), headers, params.use_system_headers,
- params.grpc_search_path);
-
+ PrintIncludes(printer.get(), headers, params.use_system_headers,
+ params.grpc_search_path);
+
std::vector<TString> gmock_header;
- if (params.gmock_search_path.empty()) {
- gmock_header.push_back("gmock/gmock.h");
- PrintIncludes(printer.get(), gmock_header, params.use_system_headers,
- params.grpc_search_path);
- } else {
- gmock_header.push_back("gmock.h");
- // We use local includes when a gmock_search_path is given
- PrintIncludes(printer.get(), gmock_header, false,
- params.gmock_search_path);
- }
-
- if (!file->package().empty()) {
+ if (params.gmock_search_path.empty()) {
+ gmock_header.push_back("gmock/gmock.h");
+ PrintIncludes(printer.get(), gmock_header, params.use_system_headers,
+ params.grpc_search_path);
+ } else {
+ gmock_header.push_back("gmock.h");
+ // We use local includes when a gmock_search_path is given
+ PrintIncludes(printer.get(), gmock_header, false,
+ params.gmock_search_path);
+ }
+
+ if (!file->package().empty()) {
std::vector<TString> parts = file->package_parts();
-
- for (auto part = parts.begin(); part != parts.end(); part++) {
- vars["part"] = *part;
- printer->Print(vars, "namespace $part$ {\n");
- }
- }
-
- printer->Print(vars, "\n");
- }
- return output;
-}
-
-void PrintMockClientMethods(grpc_generator::Printer* printer,
- const grpc_generator::Method* method,
+
+ for (auto part = parts.begin(); part != parts.end(); part++) {
+ vars["part"] = *part;
+ printer->Print(vars, "namespace $part$ {\n");
+ }
+ }
+
+ printer->Print(vars, "\n");
+ }
+ return output;
+}
+
+void PrintMockClientMethods(grpc_generator::Printer* printer,
+ const grpc_generator::Method* method,
std::map<TString, TString>* vars) {
- (*vars)["Method"] = method->name();
- (*vars)["Request"] = method->input_type_name();
- (*vars)["Response"] = method->output_type_name();
-
- struct {
+ (*vars)["Method"] = method->name();
+ (*vars)["Request"] = method->input_type_name();
+ (*vars)["Response"] = method->output_type_name();
+
+ struct {
TString prefix;
TString method_params; // extra arguments to method
- int extra_method_param_count;
- } async_prefixes[] = {{"Async", ", void* tag", 1}, {"PrepareAsync", "", 0}};
-
- if (method->NoStreaming()) {
- printer->Print(
- *vars,
- "MOCK_METHOD3($Method$, ::grpc::Status(::grpc::ClientContext* context, "
- "const $Request$& request, $Response$* response));\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- printer->Print(
- *vars,
- "MOCK_METHOD3($AsyncPrefix$$Method$Raw, "
- "::grpc::ClientAsyncResponseReaderInterface< $Response$>*"
- "(::grpc::ClientContext* context, const $Request$& request, "
- "::grpc::CompletionQueue* cq));\n");
- }
- } else if (ClientOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "MOCK_METHOD2($Method$Raw, "
- "::grpc::ClientWriterInterface< $Request$>*"
- "(::grpc::ClientContext* context, $Response$* response));\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["MockArgs"] =
+ int extra_method_param_count;
+ } async_prefixes[] = {{"Async", ", void* tag", 1}, {"PrepareAsync", "", 0}};
+
+ if (method->NoStreaming()) {
+ printer->Print(
+ *vars,
+ "MOCK_METHOD3($Method$, ::grpc::Status(::grpc::ClientContext* context, "
+ "const $Request$& request, $Response$* response));\n");
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ printer->Print(
+ *vars,
+ "MOCK_METHOD3($AsyncPrefix$$Method$Raw, "
+ "::grpc::ClientAsyncResponseReaderInterface< $Response$>*"
+ "(::grpc::ClientContext* context, const $Request$& request, "
+ "::grpc::CompletionQueue* cq));\n");
+ }
+ } else if (ClientOnlyStreaming(method)) {
+ printer->Print(
+ *vars,
+ "MOCK_METHOD2($Method$Raw, "
+ "::grpc::ClientWriterInterface< $Request$>*"
+ "(::grpc::ClientContext* context, $Response$* response));\n");
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["MockArgs"] =
ToString(3 + async_prefix.extra_method_param_count);
- printer->Print(*vars,
- "MOCK_METHOD$MockArgs$($AsyncPrefix$$Method$Raw, "
- "::grpc::ClientAsyncWriterInterface< $Request$>*"
- "(::grpc::ClientContext* context, $Response$* response, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$));\n");
- }
- } else if (ServerOnlyStreaming(method)) {
- printer->Print(
- *vars,
- "MOCK_METHOD2($Method$Raw, "
- "::grpc::ClientReaderInterface< $Response$>*"
- "(::grpc::ClientContext* context, const $Request$& request));\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["MockArgs"] =
+ printer->Print(*vars,
+ "MOCK_METHOD$MockArgs$($AsyncPrefix$$Method$Raw, "
+ "::grpc::ClientAsyncWriterInterface< $Request$>*"
+ "(::grpc::ClientContext* context, $Response$* response, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$));\n");
+ }
+ } else if (ServerOnlyStreaming(method)) {
+ printer->Print(
+ *vars,
+ "MOCK_METHOD2($Method$Raw, "
+ "::grpc::ClientReaderInterface< $Response$>*"
+ "(::grpc::ClientContext* context, const $Request$& request));\n");
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["MockArgs"] =
ToString(3 + async_prefix.extra_method_param_count);
- printer->Print(
- *vars,
- "MOCK_METHOD$MockArgs$($AsyncPrefix$$Method$Raw, "
- "::grpc::ClientAsyncReaderInterface< $Response$>*"
- "(::grpc::ClientContext* context, const $Request$& request, "
- "::grpc::CompletionQueue* cq$AsyncMethodParams$));\n");
- }
- } else if (method->BidiStreaming()) {
- printer->Print(
- *vars,
- "MOCK_METHOD1($Method$Raw, "
- "::grpc::ClientReaderWriterInterface< $Request$, $Response$>*"
- "(::grpc::ClientContext* context));\n");
- for (auto async_prefix : async_prefixes) {
- (*vars)["AsyncPrefix"] = async_prefix.prefix;
- (*vars)["AsyncMethodParams"] = async_prefix.method_params;
- (*vars)["MockArgs"] =
+ printer->Print(
+ *vars,
+ "MOCK_METHOD$MockArgs$($AsyncPrefix$$Method$Raw, "
+ "::grpc::ClientAsyncReaderInterface< $Response$>*"
+ "(::grpc::ClientContext* context, const $Request$& request, "
+ "::grpc::CompletionQueue* cq$AsyncMethodParams$));\n");
+ }
+ } else if (method->BidiStreaming()) {
+ printer->Print(
+ *vars,
+ "MOCK_METHOD1($Method$Raw, "
+ "::grpc::ClientReaderWriterInterface< $Request$, $Response$>*"
+ "(::grpc::ClientContext* context));\n");
+ for (auto async_prefix : async_prefixes) {
+ (*vars)["AsyncPrefix"] = async_prefix.prefix;
+ (*vars)["AsyncMethodParams"] = async_prefix.method_params;
+ (*vars)["MockArgs"] =
ToString(2 + async_prefix.extra_method_param_count);
- printer->Print(
- *vars,
- "MOCK_METHOD$MockArgs$($AsyncPrefix$$Method$Raw, "
+ printer->Print(
+ *vars,
+ "MOCK_METHOD$MockArgs$($AsyncPrefix$$Method$Raw, "
"::grpc::ClientAsyncReaderWriterInterface<$Request$, "
"$Response$>*"
- "(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq"
- "$AsyncMethodParams$));\n");
- }
- }
-}
-
-void PrintMockService(grpc_generator::Printer* printer,
- const grpc_generator::Service* service,
+ "(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq"
+ "$AsyncMethodParams$));\n");
+ }
+ }
+}
+
+void PrintMockService(grpc_generator::Printer* printer,
+ const grpc_generator::Service* service,
std::map<TString, TString>* vars) {
- (*vars)["Service"] = service->name();
-
- printer->Print(*vars,
- "class Mock$Service$Stub : public $Service$::StubInterface {\n"
- " public:\n");
- printer->Indent();
- for (int i = 0; i < service->method_count(); ++i) {
- PrintMockClientMethods(printer, service->method(i).get(), vars);
- }
- printer->Outdent();
- printer->Print("};\n");
-}
-
+ (*vars)["Service"] = service->name();
+
+ printer->Print(*vars,
+ "class Mock$Service$Stub : public $Service$::StubInterface {\n"
+ " public:\n");
+ printer->Indent();
+ for (int i = 0; i < service->method_count(); ++i) {
+ PrintMockClientMethods(printer, service->method(i).get(), vars);
+ }
+ printer->Outdent();
+ printer->Print("};\n");
+}
+
TString GetMockServices(grpc_generator::File* file,
const Parameters& params) {
TString output;
- {
- // Scope the output stream so it closes and finalizes output to the string.
- auto printer = file->CreatePrinter(&output);
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+ auto printer = file->CreatePrinter(&output);
std::map<TString, TString> vars;
- // Package string is empty or ends with a dot. It is used to fully qualify
- // method names.
- vars["Package"] = file->package();
- if (!file->package().empty()) {
- vars["Package"].append(".");
- }
-
- if (!params.services_namespace.empty()) {
- vars["services_namespace"] = params.services_namespace;
- printer->Print(vars, "\nnamespace $services_namespace$ {\n\n");
- }
-
- for (int i = 0; i < file->service_count(); i++) {
- PrintMockService(printer.get(), file->service(i).get(), &vars);
- printer->Print("\n");
- }
-
- if (!params.services_namespace.empty()) {
- printer->Print(vars, "} // namespace $services_namespace$\n\n");
- }
- }
- return output;
-}
-
+ // Package string is empty or ends with a dot. It is used to fully qualify
+ // method names.
+ vars["Package"] = file->package();
+ if (!file->package().empty()) {
+ vars["Package"].append(".");
+ }
+
+ if (!params.services_namespace.empty()) {
+ vars["services_namespace"] = params.services_namespace;
+ printer->Print(vars, "\nnamespace $services_namespace$ {\n\n");
+ }
+
+ for (int i = 0; i < file->service_count(); i++) {
+ PrintMockService(printer.get(), file->service(i).get(), &vars);
+ printer->Print("\n");
+ }
+
+ if (!params.services_namespace.empty()) {
+ printer->Print(vars, "} // namespace $services_namespace$\n\n");
+ }
+ }
+ return output;
+}
+
TString GetMockEpilogue(grpc_generator::File* file,
const Parameters& /*params*/) {
TString temp;
-
- if (!file->package().empty()) {
+
+ if (!file->package().empty()) {
std::vector<TString> parts = file->package_parts();
-
- for (auto part = parts.begin(); part != parts.end(); part++) {
- temp.append("} // namespace ");
- temp.append(*part);
- temp.append("\n");
- }
- temp.append("\n");
- }
-
- return temp;
-}
-
+
+ for (auto part = parts.begin(); part != parts.end(); part++) {
+ temp.append("} // namespace ");
+ temp.append(*part);
+ temp.append("\n");
+ }
+ temp.append("\n");
+ }
+
+ return temp;
+}
+
} // namespace grpc_cpp_generator
diff --git a/contrib/libs/grpc/src/compiler/cpp_generator.h b/contrib/libs/grpc/src/compiler/cpp_generator.h
index 331a932bf9..606b850a87 100644
--- a/contrib/libs/grpc/src/compiler/cpp_generator.h
+++ b/contrib/libs/grpc/src/compiler/cpp_generator.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -28,7 +28,7 @@
#include <vector>
#include "src/compiler/config.h"
-#include "src/compiler/schema_interface.h"
+#include "src/compiler/schema_interface.h"
#ifdef GRPC_CUSTOM_STRING
#warning GRPC_CUSTOM_STRING is no longer supported. Please use TString.
@@ -53,11 +53,11 @@ struct Parameters {
bool use_system_headers;
// Prefix to any grpc include
TString grpc_search_path;
- // Generate Google Mock code to facilitate unit testing.
- bool generate_mock_code;
- // Google Mock search path, when non-empty, local includes will be used.
+ // Generate Google Mock code to facilitate unit testing.
+ bool generate_mock_code;
+ // Google Mock search path, when non-empty, local includes will be used.
TString gmock_search_path;
- // *EXPERIMENTAL* Additional include files in grpc.pb.h
+ // *EXPERIMENTAL* Additional include files in grpc.pb.h
std::vector<TString> additional_header_includes;
// By default, use "pb.h"
TString message_header_extension;
@@ -65,67 +65,67 @@ struct Parameters {
bool include_import_headers;
};
-// Return the prologue of the generated header file.
+// Return the prologue of the generated header file.
TString GetHeaderPrologue(grpc_generator::File* file,
const Parameters& params);
-// Return the includes needed for generated header file.
+// Return the includes needed for generated header file.
TString GetHeaderIncludes(grpc_generator::File* file,
const Parameters& params);
-// Return the includes needed for generated source file.
+// Return the includes needed for generated source file.
TString GetSourceIncludes(grpc_generator::File* file,
const Parameters& params);
-// Return the epilogue of the generated header file.
+// Return the epilogue of the generated header file.
TString GetHeaderEpilogue(grpc_generator::File* file,
const Parameters& params);
-// Return the prologue of the generated source file.
+// Return the prologue of the generated source file.
TString GetSourcePrologue(grpc_generator::File* file,
const Parameters& params);
-// Return the services for generated header file.
+// Return the services for generated header file.
TString GetHeaderServices(grpc_generator::File* file,
const Parameters& params);
-// Return the services for generated source file.
+// Return the services for generated source file.
TString GetSourceServices(grpc_generator::File* file,
const Parameters& params);
-// Return the epilogue of the generated source file.
+// Return the epilogue of the generated source file.
TString GetSourceEpilogue(grpc_generator::File* file,
const Parameters& params);
-// Return the prologue of the generated mock file.
+// Return the prologue of the generated mock file.
TString GetMockPrologue(grpc_generator::File* file,
const Parameters& params);
-// Return the includes needed for generated mock file.
+// Return the includes needed for generated mock file.
TString GetMockIncludes(grpc_generator::File* file,
const Parameters& params);
-// Return the services for generated mock file.
+// Return the services for generated mock file.
TString GetMockServices(grpc_generator::File* file,
const Parameters& params);
-// Return the epilogue of generated mock file.
+// Return the epilogue of generated mock file.
TString GetMockEpilogue(grpc_generator::File* file,
const Parameters& params);
-// Return the prologue of the generated mock file.
+// Return the prologue of the generated mock file.
TString GetMockPrologue(grpc_generator::File* file,
const Parameters& params);
-// Return the includes needed for generated mock file.
+// Return the includes needed for generated mock file.
TString GetMockIncludes(grpc_generator::File* file,
const Parameters& params);
-// Return the services for generated mock file.
+// Return the services for generated mock file.
TString GetMockServices(grpc_generator::File* file,
const Parameters& params);
-// Return the epilogue of generated mock file.
+// Return the epilogue of generated mock file.
TString GetMockEpilogue(grpc_generator::File* file,
const Parameters& params);
diff --git a/contrib/libs/grpc/src/compiler/cpp_generator_helpers.h b/contrib/libs/grpc/src/compiler/cpp_generator_helpers.h
index 9605e4dd74..2e34d53a65 100644
--- a/contrib/libs/grpc/src/compiler/cpp_generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/cpp_generator_helpers.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -20,7 +20,7 @@
#define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H
#include <map>
-
+
#include "src/compiler/config.h"
#include "src/compiler/generator_helpers.h"
@@ -38,7 +38,7 @@ inline TString ClassName(const grpc::protobuf::Descriptor* descriptor,
bool qualified) {
// Find "outer", the descriptor of the top-level message in which
// "descriptor" is embedded.
- const grpc::protobuf::Descriptor* outer = descriptor;
+ const grpc::protobuf::Descriptor* outer = descriptor;
while (outer->containing_type() != NULL) outer = outer->containing_type();
const TString& outer_name = outer->full_name();
diff --git a/contrib/libs/grpc/src/compiler/cpp_plugin.cc b/contrib/libs/grpc/src/compiler/cpp_plugin.cc
index 15a2bcaf24..2de2745445 100644
--- a/contrib/libs/grpc/src/compiler/cpp_plugin.cc
+++ b/contrib/libs/grpc/src/compiler/cpp_plugin.cc
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -20,7 +20,7 @@
//
#include "src/compiler/cpp_plugin.h"
-int main(int argc, char* argv[]) {
+int main(int argc, char* argv[]) {
CppGrpcGenerator generator;
return grpc::protobuf::compiler::PluginMain(argc, argv, &generator);
}
diff --git a/contrib/libs/grpc/src/compiler/csharp_generator.cc b/contrib/libs/grpc/src/compiler/csharp_generator.cc
index cfc757a00c..3b7107c4c4 100644
--- a/contrib/libs/grpc/src/compiler/csharp_generator.cc
+++ b/contrib/libs/grpc/src/compiler/csharp_generator.cc
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -25,19 +25,19 @@
#include "src/compiler/csharp_generator.h"
#include "src/compiler/csharp_generator_helpers.h"
-using google::protobuf::compiler::csharp::GetClassName;
+using google::protobuf::compiler::csharp::GetClassName;
using google::protobuf::compiler::csharp::GetFileNamespace;
using google::protobuf::compiler::csharp::GetReflectionClassName;
-using grpc::protobuf::Descriptor;
+using grpc::protobuf::Descriptor;
using grpc::protobuf::FileDescriptor;
-using grpc::protobuf::MethodDescriptor;
+using grpc::protobuf::MethodDescriptor;
using grpc::protobuf::ServiceDescriptor;
using grpc::protobuf::io::Printer;
using grpc::protobuf::io::StringOutputStream;
using grpc_generator::GetMethodType;
using grpc_generator::MethodType;
-using grpc_generator::METHODTYPE_BIDI_STREAMING;
-using grpc_generator::METHODTYPE_CLIENT_STREAMING;
+using grpc_generator::METHODTYPE_BIDI_STREAMING;
+using grpc_generator::METHODTYPE_CLIENT_STREAMING;
using grpc_generator::METHODTYPE_NO_STREAMING;
using grpc_generator::METHODTYPE_SERVER_STREAMING;
using grpc_generator::StringReplace;
@@ -52,7 +52,7 @@ namespace {
// Currently, we cannot easily reuse the functionality as
// google/protobuf/compiler/csharp/csharp_doc_comment.h is not a public header.
// TODO(jtattermusch): reuse the functionality from google/protobuf.
-bool GenerateDocCommentBodyImpl(grpc::protobuf::io::Printer* printer,
+bool GenerateDocCommentBodyImpl(grpc::protobuf::io::Printer* printer,
grpc::protobuf::SourceLocation location) {
TString comments = location.leading_comments.empty()
? location.trailing_comments
@@ -99,8 +99,8 @@ bool GenerateDocCommentBodyImpl(grpc::protobuf::io::Printer* printer,
}
template <typename DescriptorType>
-bool GenerateDocCommentBody(grpc::protobuf::io::Printer* printer,
- const DescriptorType* descriptor) {
+bool GenerateDocCommentBody(grpc::protobuf::io::Printer* printer,
+ const DescriptorType* descriptor) {
grpc::protobuf::SourceLocation location;
if (!descriptor->GetSourceLocation(&location)) {
return false;
@@ -108,8 +108,8 @@ bool GenerateDocCommentBody(grpc::protobuf::io::Printer* printer,
return GenerateDocCommentBodyImpl(printer, location);
}
-void GenerateDocCommentServerMethod(grpc::protobuf::io::Printer* printer,
- const MethodDescriptor* method) {
+void GenerateDocCommentServerMethod(grpc::protobuf::io::Printer* printer,
+ const MethodDescriptor* method) {
if (GenerateDocCommentBody(printer, method)) {
if (method->client_streaming()) {
printer->Print(
@@ -140,8 +140,8 @@ void GenerateDocCommentServerMethod(grpc::protobuf::io::Printer* printer,
}
}
-void GenerateDocCommentClientMethod(grpc::protobuf::io::Printer* printer,
- const MethodDescriptor* method,
+void GenerateDocCommentClientMethod(grpc::protobuf::io::Printer* printer,
+ const MethodDescriptor* method,
bool is_sync, bool use_call_options) {
if (GenerateDocCommentBody(printer, method)) {
if (!method->client_streaming()) {
@@ -187,13 +187,13 @@ TString GetServerClassName(const ServiceDescriptor* service) {
TString GetCSharpMethodType(MethodType method_type) {
switch (method_type) {
case METHODTYPE_NO_STREAMING:
- return "grpc::MethodType.Unary";
+ return "grpc::MethodType.Unary";
case METHODTYPE_CLIENT_STREAMING:
- return "grpc::MethodType.ClientStreaming";
+ return "grpc::MethodType.ClientStreaming";
case METHODTYPE_SERVER_STREAMING:
- return "grpc::MethodType.ServerStreaming";
+ return "grpc::MethodType.ServerStreaming";
case METHODTYPE_BIDI_STREAMING:
- return "grpc::MethodType.DuplexStreaming";
+ return "grpc::MethodType.DuplexStreaming";
}
GOOGLE_LOG(FATAL) << "Can't get here.";
return "";
@@ -243,19 +243,19 @@ TString GetAccessLevel(bool internal_access) {
TString GetMethodReturnTypeClient(const MethodDescriptor* method) {
switch (GetMethodType(method)) {
case METHODTYPE_NO_STREAMING:
- return "grpc::AsyncUnaryCall<" + GetClassName(method->output_type()) +
- ">";
+ return "grpc::AsyncUnaryCall<" + GetClassName(method->output_type()) +
+ ">";
case METHODTYPE_CLIENT_STREAMING:
- return "grpc::AsyncClientStreamingCall<" +
- GetClassName(method->input_type()) + ", " +
- GetClassName(method->output_type()) + ">";
+ return "grpc::AsyncClientStreamingCall<" +
+ GetClassName(method->input_type()) + ", " +
+ GetClassName(method->output_type()) + ">";
case METHODTYPE_SERVER_STREAMING:
- return "grpc::AsyncServerStreamingCall<" +
- GetClassName(method->output_type()) + ">";
+ return "grpc::AsyncServerStreamingCall<" +
+ GetClassName(method->output_type()) + ">";
case METHODTYPE_BIDI_STREAMING:
- return "grpc::AsyncDuplexStreamingCall<" +
- GetClassName(method->input_type()) + ", " +
- GetClassName(method->output_type()) + ">";
+ return "grpc::AsyncDuplexStreamingCall<" +
+ GetClassName(method->input_type()) + ", " +
+ GetClassName(method->output_type()) + ">";
}
GOOGLE_LOG(FATAL) << "Can't get here.";
return "";
@@ -268,7 +268,7 @@ TString GetMethodRequestParamServer(const MethodDescriptor* method) {
return GetClassName(method->input_type()) + " request";
case METHODTYPE_CLIENT_STREAMING:
case METHODTYPE_BIDI_STREAMING:
- return "grpc::IAsyncStreamReader<" + GetClassName(method->input_type()) +
+ return "grpc::IAsyncStreamReader<" + GetClassName(method->input_type()) +
"> requestStream";
}
GOOGLE_LOG(FATAL) << "Can't get here.";
@@ -296,21 +296,21 @@ TString GetMethodResponseStreamMaybe(const MethodDescriptor* method) {
return "";
case METHODTYPE_SERVER_STREAMING:
case METHODTYPE_BIDI_STREAMING:
- return ", grpc::IServerStreamWriter<" +
- GetClassName(method->output_type()) + "> responseStream";
+ return ", grpc::IServerStreamWriter<" +
+ GetClassName(method->output_type()) + "> responseStream";
}
GOOGLE_LOG(FATAL) << "Can't get here.";
return "";
}
// Gets vector of all messages used as input or output types.
-std::vector<const Descriptor*> GetUsedMessages(
- const ServiceDescriptor* service) {
- std::set<const Descriptor*> descriptor_set;
- std::vector<const Descriptor*>
+std::vector<const Descriptor*> GetUsedMessages(
+ const ServiceDescriptor* service) {
+ std::set<const Descriptor*> descriptor_set;
+ std::vector<const Descriptor*>
result; // vector is to maintain stable ordering
for (int i = 0; i < service->method_count(); i++) {
- const MethodDescriptor* method = service->method(i);
+ const MethodDescriptor* method = service->method(i);
if (descriptor_set.find(method->input_type()) == descriptor_set.end()) {
descriptor_set.insert(method->input_type());
result.push_back(method->input_type());
@@ -323,8 +323,8 @@ std::vector<const Descriptor*> GetUsedMessages(
return result;
}
-void GenerateMarshallerFields(Printer* out, const ServiceDescriptor* service) {
- std::vector<const Descriptor*> used_messages = GetUsedMessages(service);
+void GenerateMarshallerFields(Printer* out, const ServiceDescriptor* service) {
+ std::vector<const Descriptor*> used_messages = GetUsedMessages(service);
if (used_messages.size() != 0) {
// Generate static helper methods for serialization/deserialization
out->Print(
@@ -390,9 +390,9 @@ void GenerateMarshallerFields(Printer* out, const ServiceDescriptor* service) {
}
for (size_t i = 0; i < used_messages.size(); i++) {
- const Descriptor* message = used_messages[i];
+ const Descriptor* message = used_messages[i];
out->Print(
- "static readonly grpc::Marshaller<$type$> $fieldname$ = "
+ "static readonly grpc::Marshaller<$type$> $fieldname$ = "
"grpc::Marshallers.Create(__Helper_SerializeMessage, "
"context => __Helper_DeserializeMessage(context, $type$.Parser));\n",
"fieldname", GetMarshallerFieldName(message), "type",
@@ -401,10 +401,10 @@ void GenerateMarshallerFields(Printer* out, const ServiceDescriptor* service) {
out->Print("\n");
}
-void GenerateStaticMethodField(Printer* out, const MethodDescriptor* method) {
+void GenerateStaticMethodField(Printer* out, const MethodDescriptor* method) {
out->Print(
- "static readonly grpc::Method<$request$, $response$> $fieldname$ = new "
- "grpc::Method<$request$, $response$>(\n",
+ "static readonly grpc::Method<$request$, $response$> $fieldname$ = new "
+ "grpc::Method<$request$, $response$>(\n",
"fieldname", GetMethodFieldName(method), "request",
GetClassName(method->input_type()), "response",
GetClassName(method->output_type()));
@@ -424,8 +424,8 @@ void GenerateStaticMethodField(Printer* out, const MethodDescriptor* method) {
out->Outdent();
}
-void GenerateServiceDescriptorProperty(Printer* out,
- const ServiceDescriptor* service) {
+void GenerateServiceDescriptorProperty(Printer* out,
+ const ServiceDescriptor* service) {
std::ostringstream index;
index << service->index();
out->Print("/// <summary>Service descriptor</summary>\n");
@@ -440,7 +440,7 @@ void GenerateServiceDescriptorProperty(Printer* out,
out->Print("\n");
}
-void GenerateServerClass(Printer* out, const ServiceDescriptor* service) {
+void GenerateServerClass(Printer* out, const ServiceDescriptor* service) {
out->Print(
"/// <summary>Base class for server-side implementations of "
"$servicename$</summary>\n",
@@ -454,12 +454,12 @@ void GenerateServerClass(Printer* out, const ServiceDescriptor* service) {
out->Print("{\n");
out->Indent();
for (int i = 0; i < service->method_count(); i++) {
- const MethodDescriptor* method = service->method(i);
+ const MethodDescriptor* method = service->method(i);
GenerateDocCommentServerMethod(out, method);
out->Print(
"public virtual $returntype$ "
"$methodname$($request$$response_stream_maybe$, "
- "grpc::ServerCallContext context)\n",
+ "grpc::ServerCallContext context)\n",
"methodname", method->name(), "returntype",
GetMethodReturnTypeServer(method), "request",
GetMethodRequestParamServer(method), "response_stream_maybe",
@@ -467,8 +467,8 @@ void GenerateServerClass(Printer* out, const ServiceDescriptor* service) {
out->Print("{\n");
out->Indent();
out->Print(
- "throw new grpc::RpcException("
- "new grpc::Status(grpc::StatusCode.Unimplemented, \"\"));\n");
+ "throw new grpc::RpcException("
+ "new grpc::Status(grpc::StatusCode.Unimplemented, \"\"));\n");
out->Outdent();
out->Print("}\n\n");
}
@@ -477,10 +477,10 @@ void GenerateServerClass(Printer* out, const ServiceDescriptor* service) {
out->Print("\n");
}
-void GenerateClientStub(Printer* out, const ServiceDescriptor* service) {
+void GenerateClientStub(Printer* out, const ServiceDescriptor* service) {
out->Print("/// <summary>Client for $servicename$</summary>\n", "servicename",
GetServiceClassName(service));
- out->Print("public partial class $name$ : grpc::ClientBase<$name$>\n", "name",
+ out->Print("public partial class $name$ : grpc::ClientBase<$name$>\n", "name",
GetClientClassName(service));
out->Print("{\n");
out->Indent();
@@ -501,9 +501,9 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service) {
"/// <param name=\"callInvoker\">The callInvoker to use to make remote "
"calls.</param>\n",
"servicename", GetServiceClassName(service));
- out->Print(
- "public $name$(grpc::CallInvoker callInvoker) : base(callInvoker)\n",
- "name", GetClientClassName(service));
+ out->Print(
+ "public $name$(grpc::CallInvoker callInvoker) : base(callInvoker)\n",
+ "name", GetClientClassName(service));
out->Print("{\n");
out->Print("}\n");
out->Print(
@@ -525,27 +525,27 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service) {
out->Print("}\n\n");
for (int i = 0; i < service->method_count(); i++) {
- const MethodDescriptor* method = service->method(i);
+ const MethodDescriptor* method = service->method(i);
MethodType method_type = GetMethodType(method);
if (method_type == METHODTYPE_NO_STREAMING) {
// unary calls have an extra synchronous stub method
GenerateDocCommentClientMethod(out, method, true, false);
out->Print(
- "public virtual $response$ $methodname$($request$ request, "
- "grpc::Metadata "
- "headers = null, global::System.DateTime? deadline = null, "
- "global::System.Threading.CancellationToken "
- "cancellationToken = "
- "default(global::System.Threading.CancellationToken))\n",
+ "public virtual $response$ $methodname$($request$ request, "
+ "grpc::Metadata "
+ "headers = null, global::System.DateTime? deadline = null, "
+ "global::System.Threading.CancellationToken "
+ "cancellationToken = "
+ "default(global::System.Threading.CancellationToken))\n",
"methodname", method->name(), "request",
GetClassName(method->input_type()), "response",
GetClassName(method->output_type()));
out->Print("{\n");
out->Indent();
out->Print(
- "return $methodname$(request, new grpc::CallOptions(headers, "
- "deadline, "
+ "return $methodname$(request, new grpc::CallOptions(headers, "
+ "deadline, "
"cancellationToken));\n",
"methodname", method->name());
out->Outdent();
@@ -555,7 +555,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service) {
GenerateDocCommentClientMethod(out, method, true, true);
out->Print(
"public virtual $response$ $methodname$($request$ request, "
- "grpc::CallOptions options)\n",
+ "grpc::CallOptions options)\n",
"methodname", method->name(), "request",
GetClassName(method->input_type()), "response",
GetClassName(method->output_type()));
@@ -575,12 +575,12 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service) {
}
GenerateDocCommentClientMethod(out, method, false, false);
out->Print(
- "public virtual $returntype$ "
- "$methodname$($request_maybe$grpc::Metadata "
- "headers = null, global::System.DateTime? deadline = null, "
- "global::System.Threading.CancellationToken "
- "cancellationToken = "
- "default(global::System.Threading.CancellationToken))\n",
+ "public virtual $returntype$ "
+ "$methodname$($request_maybe$grpc::Metadata "
+ "headers = null, global::System.DateTime? deadline = null, "
+ "global::System.Threading.CancellationToken "
+ "cancellationToken = "
+ "default(global::System.Threading.CancellationToken))\n",
"methodname", method_name, "request_maybe",
GetMethodRequestParamMaybe(method), "returntype",
GetMethodReturnTypeClient(method));
@@ -588,8 +588,8 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service) {
out->Indent();
out->Print(
- "return $methodname$($request_maybe$new grpc::CallOptions(headers, "
- "deadline, "
+ "return $methodname$($request_maybe$new grpc::CallOptions(headers, "
+ "deadline, "
"cancellationToken));\n",
"methodname", method_name, "request_maybe",
GetMethodRequestParamMaybe(method, true));
@@ -599,8 +599,8 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service) {
// overload taking CallOptions as a param
GenerateDocCommentClientMethod(out, method, false, true);
out->Print(
- "public virtual $returntype$ "
- "$methodname$($request_maybe$grpc::CallOptions "
+ "public virtual $returntype$ "
+ "$methodname$($request_maybe$grpc::CallOptions "
"options)\n",
"methodname", method_name, "request_maybe",
GetMethodRequestParamMaybe(method), "returntype",
@@ -659,7 +659,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service) {
out->Print("\n");
}
-void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor* service) {
+void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor* service) {
out->Print(
"/// <summary>Creates service definition that can be registered with a "
"server</summary>\n");
@@ -667,7 +667,7 @@ void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor* service) {
"/// <param name=\"serviceImpl\">An object implementing the server-side"
" handling logic.</param>\n");
out->Print(
- "public static grpc::ServerServiceDefinition BindService($implclass$ "
+ "public static grpc::ServerServiceDefinition BindService($implclass$ "
"serviceImpl)\n",
"implclass", GetServerClassName(service));
out->Print("{\n");
@@ -677,7 +677,7 @@ void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor* service) {
out->Indent();
out->Indent();
for (int i = 0; i < service->method_count(); i++) {
- const MethodDescriptor* method = service->method(i);
+ const MethodDescriptor* method = service->method(i);
out->Print("\n.AddMethod($methodfield$, serviceImpl.$methodname$)",
"methodfield", GetMethodFieldName(method), "methodname",
method->name());
@@ -732,7 +732,7 @@ void GenerateBindServiceWithBinderMethod(Printer* out,
out->Print("\n");
}
-void GenerateService(Printer* out, const ServiceDescriptor* service,
+void GenerateService(Printer* out, const ServiceDescriptor* service,
bool generate_client, bool generate_server,
bool internal_access) {
GenerateDocCommentBody(out, service);
@@ -785,24 +785,24 @@ TString GetServices(const FileDescriptor* file, bool generate_client,
}
// Write out a file header.
- out.Print("// <auto-generated>\n");
- out.Print(
- "// Generated by the protocol buffer compiler. DO NOT EDIT!\n");
- out.Print("// source: $filename$\n", "filename", file->name());
- out.Print("// </auto-generated>\n");
+ out.Print("// <auto-generated>\n");
+ out.Print(
+ "// Generated by the protocol buffer compiler. DO NOT EDIT!\n");
+ out.Print("// source: $filename$\n", "filename", file->name());
+ out.Print("// </auto-generated>\n");
// use C++ style as there are no file-level XML comments in .NET
TString leading_comments = GetCsharpComments(file, true);
if (!leading_comments.empty()) {
out.Print("// Original file comments:\n");
- out.PrintRaw(leading_comments.c_str());
+ out.PrintRaw(leading_comments.c_str());
}
out.Print("#pragma warning disable 0414, 1591\n");
out.Print("#region Designer generated code\n");
out.Print("\n");
- out.Print("using grpc = global::Grpc.Core;\n");
+ out.Print("using grpc = global::Grpc.Core;\n");
out.Print("\n");
TString file_namespace = GetFileNamespace(file);
diff --git a/contrib/libs/grpc/src/compiler/csharp_generator.h b/contrib/libs/grpc/src/compiler/csharp_generator.h
index 82bdbf5e95..c13da4657f 100644
--- a/contrib/libs/grpc/src/compiler/csharp_generator.h
+++ b/contrib/libs/grpc/src/compiler/csharp_generator.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
diff --git a/contrib/libs/grpc/src/compiler/csharp_generator_helpers.h b/contrib/libs/grpc/src/compiler/csharp_generator_helpers.h
index 12b143f1bd..a8af7f3ccd 100644
--- a/contrib/libs/grpc/src/compiler/csharp_generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/csharp_generator_helpers.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -24,7 +24,7 @@
namespace grpc_csharp_generator {
-inline bool ServicesFilename(const grpc::protobuf::FileDescriptor* file,
+inline bool ServicesFilename(const grpc::protobuf::FileDescriptor* file,
TString* file_name_or_error) {
*file_name_or_error =
grpc_generator::FileNameInUpperCamel(file, false) + "Grpc.cs";
diff --git a/contrib/libs/grpc/src/compiler/generator_helpers.h b/contrib/libs/grpc/src/compiler/generator_helpers.h
index c8b748b900..265713a16b 100644
--- a/contrib/libs/grpc/src/compiler/generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/generator_helpers.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -129,7 +129,7 @@ inline TString LowerUnderscoreToUpperCamel(TString str) {
}
inline TString FileNameInUpperCamel(
- const grpc::protobuf::FileDescriptor* file, bool include_package_path) {
+ const grpc::protobuf::FileDescriptor* file, bool include_package_path) {
std::vector<TString> tokens = tokenize(StripProto(file->name()), "/");
TString result = "";
if (include_package_path) {
@@ -142,7 +142,7 @@ inline TString FileNameInUpperCamel(
}
inline TString FileNameInUpperCamel(
- const grpc::protobuf::FileDescriptor* file) {
+ const grpc::protobuf::FileDescriptor* file) {
return FileNameInUpperCamel(file, true);
}
@@ -154,7 +154,7 @@ enum MethodType {
};
inline MethodType GetMethodType(
- const grpc::protobuf::MethodDescriptor* method) {
+ const grpc::protobuf::MethodDescriptor* method) {
if (method->client_streaming()) {
if (method->server_streaming()) {
return METHODTYPE_BIDI_STREAMING;
@@ -172,7 +172,7 @@ inline MethodType GetMethodType(
template <typename TStringType>
inline void Split(const TStringType& s, char /*delim*/,
- std::vector<TStringType>* append_to) {
+ std::vector<TStringType>* append_to) {
std::istringstream iss(s);
TStringType piece;
while (std::getline(iss, piece)) {
@@ -198,7 +198,7 @@ enum CommentType {
// Get all the raw comments and append each line without newline to out.
template <typename DescriptorType>
-inline void GetComment(const DescriptorType* desc, CommentType type,
+inline void GetComment(const DescriptorType* desc, CommentType type,
std::vector<TString>* out) {
grpc::protobuf::SourceLocation location;
if (!desc->GetSourceLocation(&location)) {
@@ -225,7 +225,7 @@ inline void GetComment(const DescriptorType* desc, CommentType type,
// For file level leading and detached leading comments, we return comments
// above syntax line. Return nothing for trailing comments.
template <>
-inline void GetComment(const grpc::protobuf::FileDescriptor* desc,
+inline void GetComment(const grpc::protobuf::FileDescriptor* desc,
CommentType type, std::vector<TString>* out) {
if (type == COMMENTTYPE_TRAILING) {
return;
diff --git a/contrib/libs/grpc/src/compiler/grpc_plugin_support/ya.make b/contrib/libs/grpc/src/compiler/grpc_plugin_support/ya.make
index 41d358a7ad..068ae1ead6 100644
--- a/contrib/libs/grpc/src/compiler/grpc_plugin_support/ya.make
+++ b/contrib/libs/grpc/src/compiler/grpc_plugin_support/ya.make
@@ -5,7 +5,7 @@ LIBRARY()
WITHOUT_LICENSE_TEXTS()
OWNER(g:cpp-contrib)
-
+
LICENSE(Apache-2.0)
PEERDIR(
diff --git a/contrib/libs/grpc/src/compiler/node_generator.cc b/contrib/libs/grpc/src/compiler/node_generator.cc
index 06c1980675..89e4871a66 100644
--- a/contrib/libs/grpc/src/compiler/node_generator.cc
+++ b/contrib/libs/grpc/src/compiler/node_generator.cc
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * Copyright 2016 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -20,12 +20,12 @@
#include "src/compiler/config.h"
#include "src/compiler/generator_helpers.h"
-#include "src/compiler/node_generator.h"
+#include "src/compiler/node_generator.h"
#include "src/compiler/node_generator_helpers.h"
-using grpc::protobuf::Descriptor;
+using grpc::protobuf::Descriptor;
using grpc::protobuf::FileDescriptor;
-using grpc::protobuf::MethodDescriptor;
+using grpc::protobuf::MethodDescriptor;
using grpc::protobuf::ServiceDescriptor;
using grpc::protobuf::io::Printer;
using grpc::protobuf::io::StringOutputStream;
@@ -48,7 +48,7 @@ TString ModuleAlias(const TString filename) {
TString basename = grpc_generator::StripProto(filename);
basename = grpc_generator::StringReplace(basename, "-", "$");
basename = grpc_generator::StringReplace(basename, "/", "_");
- basename = grpc_generator::StringReplace(basename, ".", "_");
+ basename = grpc_generator::StringReplace(basename, ".", "_");
return basename + "_pb";
}
@@ -94,12 +94,12 @@ map<TString, const Descriptor*> GetAllMessages(const FileDescriptor* file) {
map<TString, const Descriptor*> message_types;
for (int service_num = 0; service_num < file->service_count();
service_num++) {
- const ServiceDescriptor* service = file->service(service_num);
+ const ServiceDescriptor* service = file->service(service_num);
for (int method_num = 0; method_num < service->method_count();
method_num++) {
- const MethodDescriptor* method = service->method(method_num);
- const Descriptor* input_type = method->input_type();
- const Descriptor* output_type = method->output_type();
+ const MethodDescriptor* method = service->method(method_num);
+ const Descriptor* input_type = method->input_type();
+ const Descriptor* output_type = method->output_type();
message_types[input_type->full_name()] = input_type;
message_types[output_type->full_name()] = output_type;
}
@@ -119,8 +119,8 @@ TString NodeObjectPath(const Descriptor* descriptor) {
}
// Prints out the message serializer and deserializer functions
-void PrintMessageTransformer(const Descriptor* descriptor, Printer* out,
- const Parameters& params) {
+void PrintMessageTransformer(const Descriptor* descriptor, Printer* out,
+ const Parameters& params) {
map<TString, TString> template_vars;
TString full_name = descriptor->full_name();
template_vars["identifier_name"] = MessageIdentifierName(full_name);
@@ -135,12 +135,12 @@ void PrintMessageTransformer(const Descriptor* descriptor, Printer* out,
"throw new Error('Expected argument of type $name$');\n");
out->Outdent();
out->Print("}\n");
- if (params.minimum_node_version > 5) {
- // Node version is > 5, we should use Buffer.from
- out->Print("return Buffer.from(arg.serializeBinary());\n");
- } else {
- out->Print("return new Buffer(arg.serializeBinary());\n");
- }
+ if (params.minimum_node_version > 5) {
+ // Node version is > 5, we should use Buffer.from
+ out->Print("return Buffer.from(arg.serializeBinary());\n");
+ } else {
+ out->Print("return new Buffer(arg.serializeBinary());\n");
+ }
out->Outdent();
out->Print("}\n\n");
@@ -155,9 +155,9 @@ void PrintMessageTransformer(const Descriptor* descriptor, Printer* out,
out->Print("}\n\n");
}
-void PrintMethod(const MethodDescriptor* method, Printer* out) {
- const Descriptor* input_type = method->input_type();
- const Descriptor* output_type = method->output_type();
+void PrintMethod(const MethodDescriptor* method, Printer* out) {
+ const Descriptor* input_type = method->input_type();
+ const Descriptor* output_type = method->output_type();
map<TString, TString> vars;
vars["service_name"] = method->service()->full_name();
vars["name"] = method->name();
@@ -183,7 +183,7 @@ void PrintMethod(const MethodDescriptor* method, Printer* out) {
}
// Prints out the service descriptor object
-void PrintService(const ServiceDescriptor* service, Printer* out) {
+void PrintService(const ServiceDescriptor* service, Printer* out) {
map<TString, TString> template_vars;
out->Print(GetNodeComments(service, true).c_str());
template_vars["name"] = service->name();
@@ -206,7 +206,7 @@ void PrintService(const ServiceDescriptor* service, Printer* out) {
out->Print(GetNodeComments(service, false).c_str());
}
-void PrintImports(const FileDescriptor* file, Printer* out) {
+void PrintImports(const FileDescriptor* file, Printer* out) {
out->Print("var grpc = require('grpc');\n");
if (file->message_type_count() > 0) {
TString file_path =
@@ -225,22 +225,22 @@ void PrintImports(const FileDescriptor* file, Printer* out) {
out->Print("\n");
}
-void PrintTransformers(const FileDescriptor* file, Printer* out,
- const Parameters& params) {
+void PrintTransformers(const FileDescriptor* file, Printer* out,
+ const Parameters& params) {
map<TString, const Descriptor*> messages = GetAllMessages(file);
for (std::map<TString, const Descriptor*>::iterator it = messages.begin();
it != messages.end(); it++) {
- PrintMessageTransformer(it->second, out, params);
+ PrintMessageTransformer(it->second, out, params);
}
out->Print("\n");
}
-void PrintServices(const FileDescriptor* file, Printer* out) {
+void PrintServices(const FileDescriptor* file, Printer* out) {
for (int i = 0; i < file->service_count(); i++) {
PrintService(file->service(i), out);
}
}
-} // namespace
+} // namespace
TString GenerateFile(const FileDescriptor* file, const Parameters& params) {
TString output;
@@ -256,14 +256,14 @@ TString GenerateFile(const FileDescriptor* file, const Parameters& params) {
TString leading_comments = GetNodeComments(file, true);
if (!leading_comments.empty()) {
out.Print("// Original file comments:\n");
- out.PrintRaw(leading_comments.c_str());
+ out.PrintRaw(leading_comments.c_str());
}
out.Print("'use strict';\n");
PrintImports(file, &out);
- PrintTransformers(file, &out, params);
+ PrintTransformers(file, &out, params);
PrintServices(file, &out);
diff --git a/contrib/libs/grpc/src/compiler/node_generator.h b/contrib/libs/grpc/src/compiler/node_generator.h
index 70297d7aef..959df436ea 100644
--- a/contrib/libs/grpc/src/compiler/node_generator.h
+++ b/contrib/libs/grpc/src/compiler/node_generator.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * Copyright 2016 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -23,15 +23,15 @@
namespace grpc_node_generator {
-// Contains all the parameters that are parsed from the command line.
-struct Parameters {
- // Sets the earliest version of nodejs that needs to be supported.
- int minimum_node_version;
-};
+// Contains all the parameters that are parsed from the command line.
+struct Parameters {
+ // Sets the earliest version of nodejs that needs to be supported.
+ int minimum_node_version;
+};
TString GenerateFile(const grpc::protobuf::FileDescriptor* file,
const Parameters& params);
-
+
} // namespace grpc_node_generator
#endif // GRPC_INTERNAL_COMPILER_NODE_GENERATOR_H
diff --git a/contrib/libs/grpc/src/compiler/node_generator_helpers.h b/contrib/libs/grpc/src/compiler/node_generator_helpers.h
index a294e26161..ccf57ec8a6 100644
--- a/contrib/libs/grpc/src/compiler/node_generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/node_generator_helpers.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * Copyright 2016 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
diff --git a/contrib/libs/grpc/src/compiler/objective_c_generator.cc b/contrib/libs/grpc/src/compiler/objective_c_generator.cc
index 158e4c3aa2..07826b6a8d 100644
--- a/contrib/libs/grpc/src/compiler/objective_c_generator.cc
+++ b/contrib/libs/grpc/src/compiler/objective_c_generator.cc
@@ -1,23 +1,23 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
#include <map>
-#include <set>
+#include <set>
#include <sstream>
#include "src/compiler/config.h"
@@ -27,12 +27,12 @@
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
using ::google::protobuf::compiler::objectivec::ClassName;
-using ::grpc::protobuf::FileDescriptor;
+using ::grpc::protobuf::FileDescriptor;
using ::grpc::protobuf::MethodDescriptor;
using ::grpc::protobuf::ServiceDescriptor;
-using ::grpc::protobuf::io::Printer;
+using ::grpc::protobuf::io::Printer;
using ::std::map;
-using ::std::set;
+using ::std::set;
namespace grpc_objective_c_generator {
namespace {
@@ -66,7 +66,7 @@ static void PrintAllComments(const DescriptorType* desc, Printer* printer,
printer->Print(" * ");
size_t start_pos = it->find_first_not_of(' ');
if (start_pos != TString::npos) {
- printer->PrintRaw(it->c_str() + start_pos);
+ printer->PrintRaw(it->c_str() + start_pos);
}
printer->Print("\n");
}
@@ -80,7 +80,7 @@ static void PrintAllComments(const DescriptorType* desc, Printer* printer,
printer->Print(" */\n");
}
-void PrintMethodSignature(Printer* printer, const MethodDescriptor* method,
+void PrintMethodSignature(Printer* printer, const MethodDescriptor* method,
const map< ::TString, ::TString>& vars) {
// Print comment
PrintAllComments(method, printer, true);
@@ -105,7 +105,7 @@ void PrintMethodSignature(Printer* printer, const MethodDescriptor* method,
}
}
-void PrintSimpleSignature(Printer* printer, const MethodDescriptor* method,
+void PrintSimpleSignature(Printer* printer, const MethodDescriptor* method,
map< ::TString, ::TString> vars) {
vars["method_name"] =
grpc_generator::LowercaseFirstLetter(vars["method_name"]);
@@ -113,7 +113,7 @@ void PrintSimpleSignature(Printer* printer, const MethodDescriptor* method,
PrintMethodSignature(printer, method, vars);
}
-void PrintAdvancedSignature(Printer* printer, const MethodDescriptor* method,
+void PrintAdvancedSignature(Printer* printer, const MethodDescriptor* method,
map< ::TString, ::TString> vars) {
vars["method_name"] = "RPCTo" + vars["method_name"];
vars["return_type"] = "GRPCProtoCall *";
@@ -144,7 +144,7 @@ void PrintV2Signature(Printer* printer, const MethodDescriptor* method,
}
inline map< ::TString, ::TString> GetMethodVars(
- const MethodDescriptor* method) {
+ const MethodDescriptor* method) {
map< ::TString, ::TString> res;
res["method_name"] = method->name();
res["request_type"] = method->input_type()->name();
@@ -154,7 +154,7 @@ inline map< ::TString, ::TString> GetMethodVars(
return res;
}
-void PrintMethodDeclarations(Printer* printer, const MethodDescriptor* method) {
+void PrintMethodDeclarations(Printer* printer, const MethodDescriptor* method) {
map< ::TString, ::TString> vars = GetMethodVars(method);
PrintProtoRpcDeclarationAsPragma(printer, method, vars);
@@ -175,7 +175,7 @@ void PrintV2MethodDeclarations(Printer* printer,
printer->Print(";\n\n");
}
-void PrintSimpleImplementation(Printer* printer, const MethodDescriptor* method,
+void PrintSimpleImplementation(Printer* printer, const MethodDescriptor* method,
map< ::TString, ::TString> vars) {
printer->Print("{\n");
printer->Print(vars, " [[self RPCTo$method_name$With");
@@ -192,8 +192,8 @@ void PrintSimpleImplementation(Printer* printer, const MethodDescriptor* method,
printer->Print("}\n");
}
-void PrintAdvancedImplementation(Printer* printer,
- const MethodDescriptor* method,
+void PrintAdvancedImplementation(Printer* printer,
+ const MethodDescriptor* method,
map< ::TString, ::TString> vars) {
printer->Print("{\n");
printer->Print(vars, " return [self RPCToMethod:@\"$method_name$\"\n");
@@ -236,7 +236,7 @@ void PrintV2Implementation(Printer* printer, const MethodDescriptor* method,
}
}
-void PrintMethodImplementations(Printer* printer,
+void PrintMethodImplementations(Printer* printer,
const MethodDescriptor* method,
const Parameters& generator_params) {
map< ::TString, ::TString> vars = GetMethodVars(method);
@@ -262,20 +262,20 @@ void PrintMethodImplementations(Printer* printer,
::TString GetAllMessageClasses(const FileDescriptor* file) {
::TString output;
set< ::TString> classes;
- for (int i = 0; i < file->service_count(); i++) {
- const auto service = file->service(i);
- for (int i = 0; i < service->method_count(); i++) {
- const auto method = service->method(i);
- classes.insert(ClassName(method->input_type()));
- classes.insert(ClassName(method->output_type()));
- }
- }
- for (auto one_class : classes) {
- output += "@class " + one_class + ";\n";
- }
-
- return output;
-}
+ for (int i = 0; i < file->service_count(); i++) {
+ const auto service = file->service(i);
+ for (int i = 0; i < service->method_count(); i++) {
+ const auto method = service->method(i);
+ classes.insert(ClassName(method->input_type()));
+ classes.insert(ClassName(method->output_type()));
+ }
+ }
+ for (auto one_class : classes) {
+ output += "@class " + one_class + ";\n";
+ }
+
+ return output;
+}
::TString GetProtocol(const ServiceDescriptor* service,
const Parameters& generator_params) {
@@ -283,13 +283,13 @@ void PrintMethodImplementations(Printer* printer,
if (generator_params.no_v1_compatibility) return output;
- // Scope the output stream so it closes and finalizes output to the string.
- grpc::protobuf::io::StringOutputStream output_stream(&output);
- Printer printer(&output_stream, '$');
+ // Scope the output stream so it closes and finalizes output to the string.
+ grpc::protobuf::io::StringOutputStream output_stream(&output);
+ Printer printer(&output_stream, '$');
map< ::TString, ::TString> vars = {
- {"service_class", ServiceClassName(service)}};
-
+ {"service_class", ServiceClassName(service)}};
+
printer.Print(vars,
"/**\n"
" * The methods in this protocol belong to a set of old APIs "
@@ -298,11 +298,11 @@ void PrintMethodImplementations(Printer* printer,
"the v2 protocol is recommended.\n"
" */\n");
printer.Print(vars, "@protocol $service_class$ <NSObject>\n\n");
- for (int i = 0; i < service->method_count(); i++) {
- PrintMethodDeclarations(&printer, service->method(i));
+ for (int i = 0; i < service->method_count(); i++) {
+ PrintMethodDeclarations(&printer, service->method(i));
}
- printer.Print("@end\n\n");
-
+ printer.Print("@end\n\n");
+
return output;
}
@@ -328,31 +328,31 @@ void PrintMethodImplementations(Printer* printer,
::TString GetInterface(const ServiceDescriptor* service,
const Parameters& generator_params) {
::TString output;
-
- // Scope the output stream so it closes and finalizes output to the string.
- grpc::protobuf::io::StringOutputStream output_stream(&output);
- Printer printer(&output_stream, '$');
-
+
+ // Scope the output stream so it closes and finalizes output to the string.
+ grpc::protobuf::io::StringOutputStream output_stream(&output);
+ Printer printer(&output_stream, '$');
+
map< ::TString, ::TString> vars = {
- {"service_class", ServiceClassName(service)}};
-
- printer.Print(vars,
- "/**\n"
- " * Basic service implementation, over gRPC, that only does\n"
- " * marshalling and parsing.\n"
- " */\n");
- printer.Print(vars,
- "@interface $service_class$ :"
+ {"service_class", ServiceClassName(service)}};
+
+ printer.Print(vars,
+ "/**\n"
+ " * Basic service implementation, over gRPC, that only does\n"
+ " * marshalling and parsing.\n"
+ " */\n");
+ printer.Print(vars,
+ "@interface $service_class$ :"
" GRPCProtoService<$service_class$2");
if (!generator_params.no_v1_compatibility) {
printer.Print(vars, ", $service_class$");
}
printer.Print(">\n");
- printer.Print(
+ printer.Print(
"- (instancetype)initWithHost:(NSString *)host "
"callOptions:(GRPCCallOptions "
"*_Nullable)callOptions"
- " NS_DESIGNATED_INITIALIZER;\n");
+ " NS_DESIGNATED_INITIALIZER;\n");
printer.Print(
"+ (instancetype)serviceWithHost:(NSString *)host "
"callOptions:(GRPCCallOptions *_Nullable)callOptions;\n");
@@ -363,11 +363,11 @@ void PrintMethodImplementations(Printer* printer,
printer.Print("- (instancetype)initWithHost:(NSString *)host;\n");
printer.Print("+ (instancetype)serviceWithHost:(NSString *)host;\n");
}
- printer.Print("@end\n");
-
- return output;
-}
-
+ printer.Print("@end\n");
+
+ return output;
+}
+
::TString GetSource(const ServiceDescriptor* service,
const Parameters& generator_params) {
::TString output;
@@ -381,12 +381,12 @@ void PrintMethodImplementations(Printer* printer,
{"service_class", ServiceClassName(service)},
{"package", service->file()->package()}};
- printer.Print(vars,
- "@implementation $service_class$\n\n"
+ printer.Print(vars,
+ "@implementation $service_class$\n\n"
"#pragma clang diagnostic push\n"
"#pragma clang diagnostic ignored "
"\"-Wobjc-designated-initializers\"\n\n"
- "// Designated initializer\n"
+ "// Designated initializer\n"
"- (instancetype)initWithHost:(NSString *)host "
"callOptions:(GRPCCallOptions *_Nullable)callOptions {\n"
" return [super initWithHost:host\n"
@@ -415,12 +415,12 @@ void PrintMethodImplementations(Printer* printer,
"}\n\n");
}
printer.Print(
- "- (instancetype)initWithHost:(NSString *)host\n"
- " packageName:(NSString *)packageName\n"
+ "- (instancetype)initWithHost:(NSString *)host\n"
+ " packageName:(NSString *)packageName\n"
" serviceName:(NSString *)serviceName\n"
" callOptions:(GRPCCallOptions *)callOptions {\n"
" return [self initWithHost:host callOptions:callOptions];\n"
- "}\n\n");
+ "}\n\n");
printer.Print("#pragma mark - Class Methods\n\n");
if (!generator_params.no_v1_compatibility) {
@@ -429,14 +429,14 @@ void PrintMethodImplementations(Printer* printer,
" return [[self alloc] initWithHost:host];\n"
"}\n\n");
}
- printer.Print(
+ printer.Print(
"+ (instancetype)serviceWithHost:(NSString *)host "
"callOptions:(GRPCCallOptions *_Nullable)callOptions {\n"
" return [[self alloc] initWithHost:host callOptions:callOptions];\n"
- "}\n\n");
-
- printer.Print("#pragma mark - Method Implementations\n\n");
-
+ "}\n\n");
+
+ printer.Print("#pragma mark - Method Implementations\n\n");
+
for (int i = 0; i < service->method_count(); i++) {
PrintMethodImplementations(&printer, service->method(i),
generator_params);
diff --git a/contrib/libs/grpc/src/compiler/objective_c_generator.h b/contrib/libs/grpc/src/compiler/objective_c_generator.h
index ce0d0eeb3f..9770f65436 100644
--- a/contrib/libs/grpc/src/compiler/objective_c_generator.h
+++ b/contrib/libs/grpc/src/compiler/objective_c_generator.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -28,28 +28,28 @@ struct Parameters {
bool no_v1_compatibility;
};
-using ::grpc::protobuf::FileDescriptor;
+using ::grpc::protobuf::FileDescriptor;
using ::grpc::protobuf::ServiceDescriptor;
using ::TString;
-// Returns forward declaration of classes in the generated header file.
-string GetAllMessageClasses(const FileDescriptor* file);
+// Returns forward declaration of classes in the generated header file.
+string GetAllMessageClasses(const FileDescriptor* file);
-// Returns the content to be included defining the @protocol segment at the
+// Returns the content to be included defining the @protocol segment at the
// insertion point of the generated implementation file. This interface is
// legacy and for backwards compatibility.
string GetProtocol(const ServiceDescriptor* service,
const Parameters& generator_params);
-
+
// Returns the content to be included defining the @protocol segment at the
// insertion point of the generated implementation file.
string GetV2Protocol(const ServiceDescriptor* service);
-// Returns the content to be included defining the @interface segment at the
-// insertion point of the generated implementation file.
+// Returns the content to be included defining the @interface segment at the
+// insertion point of the generated implementation file.
string GetInterface(const ServiceDescriptor* service,
const Parameters& generator_params);
-
+
// Returns the content to be included in the "global_scope" insertion point of
// the generated implementation file.
string GetSource(const ServiceDescriptor* service,
diff --git a/contrib/libs/grpc/src/compiler/objective_c_generator_helpers.h b/contrib/libs/grpc/src/compiler/objective_c_generator_helpers.h
index 54c15a2164..ae296741ce 100644
--- a/contrib/libs/grpc/src/compiler/objective_c_generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/objective_c_generator_helpers.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -24,27 +24,27 @@
#include "src/compiler/generator_helpers.h"
#include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
-
+
namespace grpc_objective_c_generator {
using ::grpc::protobuf::FileDescriptor;
using ::grpc::protobuf::ServiceDescriptor;
using ::TString;
-inline string MessageHeaderName(const FileDescriptor* file) {
- return google::protobuf::compiler::objectivec::FilePath(file) + ".pbobjc.h";
+inline string MessageHeaderName(const FileDescriptor* file) {
+ return google::protobuf::compiler::objectivec::FilePath(file) + ".pbobjc.h";
}
-inline string ServiceClassName(const ServiceDescriptor* service) {
- const FileDescriptor* file = service->file();
+inline string ServiceClassName(const ServiceDescriptor* service) {
+ const FileDescriptor* file = service->file();
string prefix = file->options().objc_class_prefix();
return prefix + service->name();
}
-
+
inline ::TString LocalImport(const ::TString& import) {
return ::TString("#import \"" + import + "\"\n");
}
-
+
inline ::TString FrameworkImport(const ::TString& import,
const ::TString& framework) {
// Flattens the directory structure: grab the file name only
@@ -57,38 +57,38 @@ inline ::TString FrameworkImport(const ::TString& import,
inline ::TString SystemImport(const ::TString& import) {
return ::TString("#import <" + import + ">\n");
-}
-
+}
+
inline ::TString PreprocConditional(::TString symbol, bool invert) {
- return invert ? "!defined(" + symbol + ") || !" + symbol
- : "defined(" + symbol + ") && " + symbol;
-}
-
+ return invert ? "!defined(" + symbol + ") || !" + symbol
+ : "defined(" + symbol + ") && " + symbol;
+}
+
inline ::TString PreprocIf(const ::TString& symbol,
const ::TString& if_true) {
return ::TString("#if " + PreprocConditional(symbol, false) + "\n" +
if_true + "#endif\n");
-}
-
+}
+
inline ::TString PreprocIfNot(const ::TString& symbol,
const ::TString& if_true) {
return ::TString("#if " + PreprocConditional(symbol, true) + "\n" +
if_true + "#endif\n");
-}
-
+}
+
inline ::TString PreprocIfElse(const ::TString& symbol,
const ::TString& if_true,
const ::TString& if_false) {
return ::TString("#if " + PreprocConditional(symbol, false) + "\n" +
if_true + "#else\n" + if_false + "#endif\n");
-}
-
+}
+
inline ::TString PreprocIfNotElse(const ::TString& symbol,
const ::TString& if_true,
const ::TString& if_false) {
return ::TString("#if " + PreprocConditional(symbol, true) + "\n" +
if_true + "#else\n" + if_false + "#endif\n");
-}
-
-} // namespace grpc_objective_c_generator
+}
+
+} // namespace grpc_objective_c_generator
#endif // GRPC_INTERNAL_COMPILER_OBJECTIVE_C_GENERATOR_HELPERS_H
diff --git a/contrib/libs/grpc/src/compiler/php_generator.cc b/contrib/libs/grpc/src/compiler/php_generator.cc
index da18f9ccb8..b35d3f2a02 100644
--- a/contrib/libs/grpc/src/compiler/php_generator.cc
+++ b/contrib/libs/grpc/src/compiler/php_generator.cc
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * Copyright 2016 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -23,10 +23,10 @@
#include "src/compiler/generator_helpers.h"
#include "src/compiler/php_generator_helpers.h"
-using google::protobuf::compiler::php::GeneratedClassName;
-using grpc::protobuf::Descriptor;
+using google::protobuf::compiler::php::GeneratedClassName;
+using grpc::protobuf::Descriptor;
using grpc::protobuf::FileDescriptor;
-using grpc::protobuf::MethodDescriptor;
+using grpc::protobuf::MethodDescriptor;
using grpc::protobuf::ServiceDescriptor;
using grpc::protobuf::io::Printer;
using grpc::protobuf::io::StringOutputStream;
@@ -46,34 +46,34 @@ TString ConvertToPhpNamespace(const TString& name) {
}
TString PackageName(const FileDescriptor* file) {
- if (file->options().has_php_namespace()) {
- return file->options().php_namespace();
- } else {
- return ConvertToPhpNamespace(file->package());
- }
-}
-
+ if (file->options().has_php_namespace()) {
+ return file->options().php_namespace();
+ } else {
+ return ConvertToPhpNamespace(file->package());
+ }
+}
+
TString MessageIdentifierName(const TString& name,
const FileDescriptor* file) {
std::vector<TString> tokens = grpc_generator::tokenize(name, ".");
- std::ostringstream oss;
- if (PackageName(file) != "") {
- oss << PackageName(file) << "\\";
- }
- oss << grpc_generator::CapitalizeFirstLetter(tokens[tokens.size() - 1]);
- return oss.str();
-}
-
-void PrintMethod(const MethodDescriptor* method, Printer* out) {
- const Descriptor* input_type = method->input_type();
- const Descriptor* output_type = method->output_type();
+ std::ostringstream oss;
+ if (PackageName(file) != "") {
+ oss << PackageName(file) << "\\";
+ }
+ oss << grpc_generator::CapitalizeFirstLetter(tokens[tokens.size() - 1]);
+ return oss.str();
+}
+
+void PrintMethod(const MethodDescriptor* method, Printer* out) {
+ const Descriptor* input_type = method->input_type();
+ const Descriptor* output_type = method->output_type();
map<TString, TString> vars;
vars["service_name"] = method->service()->full_name();
vars["name"] = method->name();
- vars["input_type_id"] =
- MessageIdentifierName(GeneratedClassName(input_type), input_type->file());
- vars["output_type_id"] = MessageIdentifierName(
- GeneratedClassName(output_type), output_type->file());
+ vars["input_type_id"] =
+ MessageIdentifierName(GeneratedClassName(input_type), input_type->file());
+ vars["output_type_id"] = MessageIdentifierName(
+ GeneratedClassName(output_type), output_type->file());
out->Print("/**\n");
out->Print(GetPHPComments(method, " *").c_str());
@@ -90,7 +90,7 @@ void PrintMethod(const MethodDescriptor* method, Printer* out) {
"public function $name$($$metadata = [], "
"$$options = []) {\n");
out->Indent();
- out->Indent();
+ out->Indent();
if (method->server_streaming()) {
out->Print("return $$this->_bidiRequest(");
} else {
@@ -114,7 +114,7 @@ void PrintMethod(const MethodDescriptor* method, Printer* out) {
"public function $name$(\\$input_type_id$ $$argument,\n"
" $$metadata = [], $$options = []) {\n");
out->Indent();
- out->Indent();
+ out->Indent();
if (method->server_streaming()) {
out->Print("return $$this->_serverStreamRequest(");
} else {
@@ -127,33 +127,33 @@ void PrintMethod(const MethodDescriptor* method, Printer* out) {
"$$metadata, $$options);\n");
}
out->Outdent();
- out->Outdent();
+ out->Outdent();
out->Print("}\n\n");
}
// Prints out the service descriptor object
-void PrintService(const ServiceDescriptor* service,
+void PrintService(const ServiceDescriptor* service,
const TString& class_suffix, Printer* out) {
map<TString, TString> vars;
- out->Print("/**\n");
- out->Print(GetPHPComments(service, " *").c_str());
- out->Print(" */\n");
- vars["name"] = GetPHPServiceClassname(service, class_suffix);
- out->Print(vars, "class $name$ extends \\Grpc\\BaseStub {\n\n");
+ out->Print("/**\n");
+ out->Print(GetPHPComments(service, " *").c_str());
+ out->Print(" */\n");
+ vars["name"] = GetPHPServiceClassname(service, class_suffix);
+ out->Print(vars, "class $name$ extends \\Grpc\\BaseStub {\n\n");
+ out->Indent();
out->Indent();
- out->Indent();
out->Print(
"/**\n * @param string $$hostname hostname\n"
" * @param array $$opts channel options\n"
- " * @param \\Grpc\\Channel $$channel (optional) re-use channel "
+ " * @param \\Grpc\\Channel $$channel (optional) re-use channel "
"object\n */\n"
"public function __construct($$hostname, $$opts, "
"$$channel = null) {\n");
out->Indent();
- out->Indent();
+ out->Indent();
out->Print("parent::__construct($$hostname, $$opts, $$channel);\n");
out->Outdent();
- out->Outdent();
+ out->Outdent();
out->Print("}\n\n");
for (int i = 0; i < service->method_count(); i++) {
TString method_name =
@@ -164,7 +164,7 @@ void PrintService(const ServiceDescriptor* service,
out->Outdent();
out->Print("}\n");
}
-} // namespace
+} // namespace
TString GenerateFile(const FileDescriptor* file,
const ServiceDescriptor* service,
@@ -180,15 +180,15 @@ TString GenerateFile(const FileDescriptor* file,
TString leading_comments = GetPHPComments(file, "//");
if (!leading_comments.empty()) {
out.Print("// Original file comments:\n");
- out.PrintRaw(leading_comments.c_str());
+ out.PrintRaw(leading_comments.c_str());
}
map<TString, TString> vars;
TString php_namespace = PackageName(file);
- vars["package"] = php_namespace;
- out.Print(vars, "namespace $package$;\n\n");
-
- PrintService(service, class_suffix, &out);
+ vars["package"] = php_namespace;
+ out.Print(vars, "namespace $package$;\n\n");
+
+ PrintService(service, class_suffix, &out);
}
return output;
}
diff --git a/contrib/libs/grpc/src/compiler/php_generator_helpers.h b/contrib/libs/grpc/src/compiler/php_generator_helpers.h
index 569261d6bd..70a31eaf75 100644
--- a/contrib/libs/grpc/src/compiler/php_generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/php_generator_helpers.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2016 gRPC authors.
+ * Copyright 2016 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -27,48 +27,48 @@
namespace grpc_php_generator {
inline TString GetPHPServiceClassname(
- const grpc::protobuf::ServiceDescriptor* service,
+ const grpc::protobuf::ServiceDescriptor* service,
const TString& class_suffix) {
- return service->name() + (class_suffix == "" ? "Client" : class_suffix);
+ return service->name() + (class_suffix == "" ? "Client" : class_suffix);
}
-// ReplaceAll replaces all instances of search with replace in s.
+// ReplaceAll replaces all instances of search with replace in s.
inline TString ReplaceAll(TString s, const TString& search,
const TString& replace) {
- size_t pos = 0;
+ size_t pos = 0;
while ((pos = s.find(search, pos)) != TString::npos) {
- s.replace(pos, search.length(), replace);
- pos += replace.length();
- }
- return s;
-}
-
+ s.replace(pos, search.length(), replace);
+ pos += replace.length();
+ }
+ return s;
+}
+
inline TString GetPHPServiceFilename(
- const grpc::protobuf::FileDescriptor* file,
- const grpc::protobuf::ServiceDescriptor* service,
+ const grpc::protobuf::FileDescriptor* file,
+ const grpc::protobuf::ServiceDescriptor* service,
const TString& class_suffix) {
- std::ostringstream oss;
- if (file->options().has_php_namespace()) {
- oss << ReplaceAll(file->options().php_namespace(), "\\", "/");
- } else {
+ std::ostringstream oss;
+ if (file->options().has_php_namespace()) {
+ oss << ReplaceAll(file->options().php_namespace(), "\\", "/");
+ } else {
std::vector<TString> tokens =
- grpc_generator::tokenize(file->package(), ".");
- for (unsigned int i = 0; i < tokens.size(); i++) {
- oss << (i == 0 ? "" : "/")
- << grpc_generator::CapitalizeFirstLetter(tokens[i]);
- }
- }
- return oss.str() + "/" + GetPHPServiceClassname(service, class_suffix) +
- ".php";
-}
-
+ grpc_generator::tokenize(file->package(), ".");
+ for (unsigned int i = 0; i < tokens.size(); i++) {
+ oss << (i == 0 ? "" : "/")
+ << grpc_generator::CapitalizeFirstLetter(tokens[i]);
+ }
+ }
+ return oss.str() + "/" + GetPHPServiceClassname(service, class_suffix) +
+ ".php";
+}
+
// Get leading or trailing comments in a string. Comment lines start with "// ".
// Leading detached comments are put in front of leading comments.
template <typename DescriptorType>
inline TString GetPHPComments(const DescriptorType* desc,
TString prefix) {
- return ReplaceAll(grpc_generator::GetPrefixedComments(desc, true, prefix),
- "*/", "&#42;/");
+ return ReplaceAll(grpc_generator::GetPrefixedComments(desc, true, prefix),
+ "*/", "&#42;/");
}
} // namespace grpc_php_generator
diff --git a/contrib/libs/grpc/src/compiler/protobuf_plugin.h b/contrib/libs/grpc/src/compiler/protobuf_plugin.h
index 2c0b4c4134..ef844ea055 100644
--- a/contrib/libs/grpc/src/compiler/protobuf_plugin.h
+++ b/contrib/libs/grpc/src/compiler/protobuf_plugin.h
@@ -1,195 +1,195 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_PROTOBUF_PLUGIN_H
-#define GRPC_INTERNAL_COMPILER_PROTOBUF_PLUGIN_H
-
-#include "src/compiler/config.h"
-#include "src/compiler/cpp_generator_helpers.h"
-#include "src/compiler/python_generator_helpers.h"
-#include "src/compiler/python_private_generator.h"
-#include "src/compiler/schema_interface.h"
-
-#include <vector>
-
-// Get leading or trailing comments in a string.
-template <typename DescriptorType>
+/*
+ *
+ * Copyright 2015 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_PROTOBUF_PLUGIN_H
+#define GRPC_INTERNAL_COMPILER_PROTOBUF_PLUGIN_H
+
+#include "src/compiler/config.h"
+#include "src/compiler/cpp_generator_helpers.h"
+#include "src/compiler/python_generator_helpers.h"
+#include "src/compiler/python_private_generator.h"
+#include "src/compiler/schema_interface.h"
+
+#include <vector>
+
+// Get leading or trailing comments in a string.
+template <typename DescriptorType>
inline TString GetCommentsHelper(const DescriptorType* desc, bool leading,
const TString& prefix) {
- return grpc_generator::GetPrefixedComments(desc, leading, prefix);
-}
-
-class ProtoBufMethod : public grpc_generator::Method {
- public:
- ProtoBufMethod(const grpc::protobuf::MethodDescriptor* method)
- : method_(method) {}
-
+ return grpc_generator::GetPrefixedComments(desc, leading, prefix);
+}
+
+class ProtoBufMethod : public grpc_generator::Method {
+ public:
+ ProtoBufMethod(const grpc::protobuf::MethodDescriptor* method)
+ : method_(method) {}
+
TString name() const { return method_->name(); }
-
+
TString input_type_name() const {
- return grpc_cpp_generator::ClassName(method_->input_type(), true);
- }
+ return grpc_cpp_generator::ClassName(method_->input_type(), true);
+ }
TString output_type_name() const {
- return grpc_cpp_generator::ClassName(method_->output_type(), true);
- }
-
+ return grpc_cpp_generator::ClassName(method_->output_type(), true);
+ }
+
TString get_input_type_name() const {
- return method_->input_type()->file()->name();
- }
+ return method_->input_type()->file()->name();
+ }
TString get_output_type_name() const {
- return method_->output_type()->file()->name();
- }
-
+ return method_->output_type()->file()->name();
+ }
+
// TODO(https://github.com/grpc/grpc/issues/18800): Clean this up.
bool get_module_and_message_path_input(
TString* str, TString generator_file_name,
bool generate_in_pb2_grpc, TString import_prefix,
const std::vector<TString>& prefixes_to_filter) const final {
- return grpc_python_generator::GetModuleAndMessagePath(
- method_->input_type(), str, generator_file_name, generate_in_pb2_grpc,
+ return grpc_python_generator::GetModuleAndMessagePath(
+ method_->input_type(), str, generator_file_name, generate_in_pb2_grpc,
import_prefix, prefixes_to_filter);
- }
-
+ }
+
bool get_module_and_message_path_output(
TString* str, TString generator_file_name,
bool generate_in_pb2_grpc, TString import_prefix,
const std::vector<TString>& prefixes_to_filter) const final {
- return grpc_python_generator::GetModuleAndMessagePath(
- method_->output_type(), str, generator_file_name, generate_in_pb2_grpc,
+ return grpc_python_generator::GetModuleAndMessagePath(
+ method_->output_type(), str, generator_file_name, generate_in_pb2_grpc,
import_prefix, prefixes_to_filter);
- }
-
- bool NoStreaming() const {
- return !method_->client_streaming() && !method_->server_streaming();
- }
-
- bool ClientStreaming() const { return method_->client_streaming(); }
-
- bool ServerStreaming() const { return method_->server_streaming(); }
-
- bool BidiStreaming() const {
- return method_->client_streaming() && method_->server_streaming();
- }
-
+ }
+
+ bool NoStreaming() const {
+ return !method_->client_streaming() && !method_->server_streaming();
+ }
+
+ bool ClientStreaming() const { return method_->client_streaming(); }
+
+ bool ServerStreaming() const { return method_->server_streaming(); }
+
+ bool BidiStreaming() const {
+ return method_->client_streaming() && method_->server_streaming();
+ }
+
TString GetLeadingComments(const TString prefix) const {
- return GetCommentsHelper(method_, true, prefix);
- }
-
+ return GetCommentsHelper(method_, true, prefix);
+ }
+
TString GetTrailingComments(const TString prefix) const {
- return GetCommentsHelper(method_, false, prefix);
- }
-
+ return GetCommentsHelper(method_, false, prefix);
+ }
+
vector<TString> GetAllComments() const {
- return grpc_python_generator::get_all_comments(method_);
- }
-
- private:
- const grpc::protobuf::MethodDescriptor* method_;
-};
-
-class ProtoBufService : public grpc_generator::Service {
- public:
- ProtoBufService(const grpc::protobuf::ServiceDescriptor* service)
- : service_(service) {}
-
+ return grpc_python_generator::get_all_comments(method_);
+ }
+
+ private:
+ const grpc::protobuf::MethodDescriptor* method_;
+};
+
+class ProtoBufService : public grpc_generator::Service {
+ public:
+ ProtoBufService(const grpc::protobuf::ServiceDescriptor* service)
+ : service_(service) {}
+
TString name() const { return service_->name(); }
-
+
int method_count() const { return service_->method_count(); }
- std::unique_ptr<const grpc_generator::Method> method(int i) const {
- return std::unique_ptr<const grpc_generator::Method>(
- new ProtoBufMethod(service_->method(i)));
+ std::unique_ptr<const grpc_generator::Method> method(int i) const {
+ return std::unique_ptr<const grpc_generator::Method>(
+ new ProtoBufMethod(service_->method(i)));
}
-
+
TString GetLeadingComments(const TString prefix) const {
- return GetCommentsHelper(service_, true, prefix);
- }
-
+ return GetCommentsHelper(service_, true, prefix);
+ }
+
TString GetTrailingComments(const TString prefix) const {
- return GetCommentsHelper(service_, false, prefix);
- }
-
+ return GetCommentsHelper(service_, false, prefix);
+ }
+
vector<TString> GetAllComments() const {
- return grpc_python_generator::get_all_comments(service_);
- }
-
- private:
- const grpc::protobuf::ServiceDescriptor* service_;
-};
-
-class ProtoBufPrinter : public grpc_generator::Printer {
- public:
+ return grpc_python_generator::get_all_comments(service_);
+ }
+
+ private:
+ const grpc::protobuf::ServiceDescriptor* service_;
+};
+
+class ProtoBufPrinter : public grpc_generator::Printer {
+ public:
ProtoBufPrinter(TString* str)
- : output_stream_(str), printer_(&output_stream_, '$') {}
-
+ : output_stream_(str), printer_(&output_stream_, '$') {}
+
void Print(const std::map<TString, TString>& vars,
- const char* string_template) {
- printer_.Print(vars, string_template);
- }
-
- void Print(const char* string) { printer_.Print(string); }
- void PrintRaw(const char* string) { printer_.PrintRaw(string); }
- void Indent() { printer_.Indent(); }
- void Outdent() { printer_.Outdent(); }
-
- private:
- grpc::protobuf::io::StringOutputStream output_stream_;
- grpc::protobuf::io::Printer printer_;
-};
-
-class ProtoBufFile : public grpc_generator::File {
- public:
- ProtoBufFile(const grpc::protobuf::FileDescriptor* file) : file_(file) {}
-
+ const char* string_template) {
+ printer_.Print(vars, string_template);
+ }
+
+ void Print(const char* string) { printer_.Print(string); }
+ void PrintRaw(const char* string) { printer_.PrintRaw(string); }
+ void Indent() { printer_.Indent(); }
+ void Outdent() { printer_.Outdent(); }
+
+ private:
+ grpc::protobuf::io::StringOutputStream output_stream_;
+ grpc::protobuf::io::Printer printer_;
+};
+
+class ProtoBufFile : public grpc_generator::File {
+ public:
+ ProtoBufFile(const grpc::protobuf::FileDescriptor* file) : file_(file) {}
+
TString filename() const { return file_->name(); }
TString filename_without_ext() const {
- return grpc_generator::StripProto(filename());
- }
-
+ return grpc_generator::StripProto(filename());
+ }
+
TString package() const { return file_->package(); }
std::vector<TString> package_parts() const {
- return grpc_generator::tokenize(package(), ".");
- }
-
+ return grpc_generator::tokenize(package(), ".");
+ }
+
TString additional_headers() const { return ""; }
-
+
int service_count() const { return file_->service_count(); }
- std::unique_ptr<const grpc_generator::Service> service(int i) const {
- return std::unique_ptr<const grpc_generator::Service>(
- new ProtoBufService(file_->service(i)));
- }
-
- std::unique_ptr<grpc_generator::Printer> CreatePrinter(
+ std::unique_ptr<const grpc_generator::Service> service(int i) const {
+ return std::unique_ptr<const grpc_generator::Service>(
+ new ProtoBufService(file_->service(i)));
+ }
+
+ std::unique_ptr<grpc_generator::Printer> CreatePrinter(
TString* str) const {
- return std::unique_ptr<grpc_generator::Printer>(new ProtoBufPrinter(str));
- }
-
+ return std::unique_ptr<grpc_generator::Printer>(new ProtoBufPrinter(str));
+ }
+
TString GetLeadingComments(const TString prefix) const {
- return GetCommentsHelper(file_, true, prefix);
- }
-
+ return GetCommentsHelper(file_, true, prefix);
+ }
+
TString GetTrailingComments(const TString prefix) const {
- return GetCommentsHelper(file_, false, prefix);
- }
-
+ return GetCommentsHelper(file_, false, prefix);
+ }
+
vector<TString> GetAllComments() const {
- return grpc_python_generator::get_all_comments(file_);
- }
-
+ return grpc_python_generator::get_all_comments(file_);
+ }
+
vector<TString> GetImportNames() const {
vector<TString> proto_names;
for (int i = 0; i < file_->dependency_count(); ++i) {
@@ -199,8 +199,8 @@ class ProtoBufFile : public grpc_generator::File {
return proto_names;
}
- private:
- const grpc::protobuf::FileDescriptor* file_;
-};
-
-#endif // GRPC_INTERNAL_COMPILER_PROTOBUF_PLUGIN_H
+ private:
+ const grpc::protobuf::FileDescriptor* file_;
+};
+
+#endif // GRPC_INTERNAL_COMPILER_PROTOBUF_PLUGIN_H
diff --git a/contrib/libs/grpc/src/compiler/python_generator.cc b/contrib/libs/grpc/src/compiler/python_generator.cc
index 149f3a1e78..d083d19f0b 100644
--- a/contrib/libs/grpc/src/compiler/python_generator.cc
+++ b/contrib/libs/grpc/src/compiler/python_generator.cc
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -32,10 +32,10 @@
#include "src/compiler/config.h"
#include "src/compiler/generator_helpers.h"
-#include "src/compiler/protobuf_plugin.h"
+#include "src/compiler/protobuf_plugin.h"
#include "src/compiler/python_generator.h"
-#include "src/compiler/python_generator_helpers.h"
-#include "src/compiler/python_private_generator.h"
+#include "src/compiler/python_generator_helpers.h"
+#include "src/compiler/python_private_generator.h"
using grpc::protobuf::FileDescriptor;
using grpc::protobuf::compiler::GeneratorContext;
@@ -45,14 +45,14 @@ using std::make_pair;
using std::map;
using std::pair;
using std::replace;
-using std::set;
+using std::set;
using std::tuple;
using std::vector;
namespace grpc_python_generator {
TString generator_file_name;
-
+
namespace {
typedef map<TString, TString> StringMap;
@@ -69,7 +69,7 @@ typedef set<StringPair> StringPairSet;
// }
class IndentScope {
public:
- explicit IndentScope(grpc_generator::Printer* printer) : printer_(printer) {
+ explicit IndentScope(grpc_generator::Printer* printer) : printer_(printer) {
// NOTE(rbellevi): Two-space tabs are hard-coded in the protocol compiler.
// Doubling our indents and outdents guarantees compliance with PEP8.
printer_->Indent();
@@ -82,22 +82,22 @@ class IndentScope {
}
private:
- grpc_generator::Printer* printer_;
+ grpc_generator::Printer* printer_;
};
PrivateGenerator::PrivateGenerator(const GeneratorConfiguration& config,
- const grpc_generator::File* file)
+ const grpc_generator::File* file)
: config(config), file(file) {}
-void PrivateGenerator::PrintAllComments(StringVector comments,
- grpc_generator::Printer* out) {
+void PrivateGenerator::PrintAllComments(StringVector comments,
+ grpc_generator::Printer* out) {
if (comments.empty()) {
- // Python requires code structures like class and def to have
- // a body, even if it is just "pass" or a docstring. We need
- // to ensure not to generate empty bodies. We could do something
- // smarter and more sophisticated, but at the moment, if there is
- // no docstring to print, we simply emit "pass" to ensure validity
- // of the generated code.
+ // Python requires code structures like class and def to have
+ // a body, even if it is just "pass" or a docstring. We need
+ // to ensure not to generate empty bodies. We could do something
+ // smarter and more sophisticated, but at the moment, if there is
+ // no docstring to print, we simply emit "pass" to ensure validity
+ // of the generated code.
out->Print(
"\"\"\"Missing associated documentation comment in .proto "
"file.\"\"\"\n");
@@ -108,19 +108,19 @@ void PrivateGenerator::PrintAllComments(StringVector comments,
++it) {
size_t start_pos = it->find_first_not_of(' ');
if (start_pos != TString::npos) {
- out->PrintRaw(it->c_str() + start_pos);
+ out->PrintRaw(it->c_str() + start_pos);
}
out->Print("\n");
}
out->Print("\"\"\"\n");
}
-bool PrivateGenerator::PrintBetaServicer(const grpc_generator::Service* service,
- grpc_generator::Printer* out) {
- StringMap service_dict;
- service_dict["Service"] = service->name();
+bool PrivateGenerator::PrintBetaServicer(const grpc_generator::Service* service,
+ grpc_generator::Printer* out) {
+ StringMap service_dict;
+ service_dict["Service"] = service->name();
out->Print("\n\n");
- out->Print(service_dict, "class Beta$Service$Servicer(object):\n");
+ out->Print(service_dict, "class Beta$Service$Servicer(object):\n");
{
IndentScope raii_class_indent(out);
out->Print(
@@ -130,20 +130,20 @@ bool PrivateGenerator::PrintBetaServicer(const grpc_generator::Service* service,
"generated\n"
"only to ease transition from grpcio<0.15.0 to "
"grpcio>=0.15.0.\"\"\"\n");
- StringVector service_comments = service->GetAllComments();
- PrintAllComments(service_comments, out);
+ StringVector service_comments = service->GetAllComments();
+ PrintAllComments(service_comments, out);
for (int i = 0; i < service->method_count(); ++i) {
- auto method = service->method(i);
+ auto method = service->method(i);
TString arg_name =
- method->ClientStreaming() ? "request_iterator" : "request";
- StringMap method_dict;
- method_dict["Method"] = method->name();
- method_dict["ArgName"] = arg_name;
- out->Print(method_dict, "def $Method$(self, $ArgName$, context):\n");
+ method->ClientStreaming() ? "request_iterator" : "request";
+ StringMap method_dict;
+ method_dict["Method"] = method->name();
+ method_dict["ArgName"] = arg_name;
+ out->Print(method_dict, "def $Method$(self, $ArgName$, context):\n");
{
IndentScope raii_method_indent(out);
- StringVector method_comments = method->GetAllComments();
- PrintAllComments(method_comments, out);
+ StringVector method_comments = method->GetAllComments();
+ PrintAllComments(method_comments, out);
out->Print("context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)\n");
}
}
@@ -151,12 +151,12 @@ bool PrivateGenerator::PrintBetaServicer(const grpc_generator::Service* service,
return true;
}
-bool PrivateGenerator::PrintBetaStub(const grpc_generator::Service* service,
- grpc_generator::Printer* out) {
- StringMap service_dict;
- service_dict["Service"] = service->name();
+bool PrivateGenerator::PrintBetaStub(const grpc_generator::Service* service,
+ grpc_generator::Printer* out) {
+ StringMap service_dict;
+ service_dict["Service"] = service->name();
out->Print("\n\n");
- out->Print(service_dict, "class Beta$Service$Stub(object):\n");
+ out->Print(service_dict, "class Beta$Service$Stub(object):\n");
{
IndentScope raii_class_indent(out);
out->Print(
@@ -166,12 +166,12 @@ bool PrivateGenerator::PrintBetaStub(const grpc_generator::Service* service,
"generated\n"
"only to ease transition from grpcio<0.15.0 to "
"grpcio>=0.15.0.\"\"\"\n");
- StringVector service_comments = service->GetAllComments();
- PrintAllComments(service_comments, out);
+ StringVector service_comments = service->GetAllComments();
+ PrintAllComments(service_comments, out);
for (int i = 0; i < service->method_count(); ++i) {
- auto method = service->method(i);
+ auto method = service->method(i);
TString arg_name =
- method->ClientStreaming() ? "request_iterator" : "request";
+ method->ClientStreaming() ? "request_iterator" : "request";
StringMap method_dict;
method_dict["Method"] = method->name();
method_dict["ArgName"] = arg_name;
@@ -180,11 +180,11 @@ bool PrivateGenerator::PrintBetaStub(const grpc_generator::Service* service,
"with_call=False, protocol_options=None):\n");
{
IndentScope raii_method_indent(out);
- StringVector method_comments = method->GetAllComments();
- PrintAllComments(method_comments, out);
+ StringVector method_comments = method->GetAllComments();
+ PrintAllComments(method_comments, out);
out->Print("raise NotImplementedError()\n");
}
- if (!method->ServerStreaming()) {
+ if (!method->ServerStreaming()) {
out->Print(method_dict, "$Method$.future = None\n");
}
}
@@ -194,13 +194,13 @@ bool PrivateGenerator::PrintBetaStub(const grpc_generator::Service* service,
bool PrivateGenerator::PrintBetaServerFactory(
const TString& package_qualified_service_name,
- const grpc_generator::Service* service, grpc_generator::Printer* out) {
- StringMap service_dict;
- service_dict["Service"] = service->name();
+ const grpc_generator::Service* service, grpc_generator::Printer* out) {
+ StringMap service_dict;
+ service_dict["Service"] = service->name();
out->Print("\n\n");
- out->Print(service_dict,
- "def beta_create_$Service$_server(servicer, pool=None, "
- "pool_size=None, default_timeout=None, maximum_timeout=None):\n");
+ out->Print(service_dict,
+ "def beta_create_$Service$_server(servicer, pool=None, "
+ "pool_size=None, default_timeout=None, maximum_timeout=None):\n");
{
IndentScope raii_create_server_indent(out);
out->Print(
@@ -213,21 +213,21 @@ bool PrivateGenerator::PrintBetaServerFactory(
StringMap input_message_modules_and_classes;
StringMap output_message_modules_and_classes;
for (int i = 0; i < service->method_count(); ++i) {
- auto method = service->method(i);
+ auto method = service->method(i);
const TString method_implementation_constructor =
TString(method->ClientStreaming() ? "stream_" : "unary_") +
TString(method->ServerStreaming() ? "stream_" : "unary_") +
"inline";
TString input_message_module_and_class;
- if (!method->get_module_and_message_path_input(
- &input_message_module_and_class, generator_file_name,
+ if (!method->get_module_and_message_path_input(
+ &input_message_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
return false;
}
TString output_message_module_and_class;
- if (!method->get_module_and_message_path_output(
- &output_message_module_and_class, generator_file_name,
+ if (!method->get_module_and_message_path_output(
+ &output_message_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
return false;
@@ -239,21 +239,21 @@ bool PrivateGenerator::PrintBetaServerFactory(
output_message_modules_and_classes.insert(
make_pair(method->name(), output_message_module_and_class));
}
- StringMap method_dict;
- method_dict["PackageQualifiedServiceName"] = package_qualified_service_name;
+ StringMap method_dict;
+ method_dict["PackageQualifiedServiceName"] = package_qualified_service_name;
out->Print("request_deserializers = {\n");
for (StringMap::iterator name_and_input_module_class_pair =
input_message_modules_and_classes.begin();
name_and_input_module_class_pair !=
input_message_modules_and_classes.end();
name_and_input_module_class_pair++) {
- method_dict["MethodName"] = name_and_input_module_class_pair->first;
- method_dict["InputTypeModuleAndClass"] =
- name_and_input_module_class_pair->second;
+ method_dict["MethodName"] = name_and_input_module_class_pair->first;
+ method_dict["InputTypeModuleAndClass"] =
+ name_and_input_module_class_pair->second;
IndentScope raii_indent(out);
- out->Print(method_dict,
- "(\'$PackageQualifiedServiceName$\', \'$MethodName$\'): "
- "$InputTypeModuleAndClass$.FromString,\n");
+ out->Print(method_dict,
+ "(\'$PackageQualifiedServiceName$\', \'$MethodName$\'): "
+ "$InputTypeModuleAndClass$.FromString,\n");
}
out->Print("}\n");
out->Print("response_serializers = {\n");
@@ -262,13 +262,13 @@ bool PrivateGenerator::PrintBetaServerFactory(
name_and_output_module_class_pair !=
output_message_modules_and_classes.end();
name_and_output_module_class_pair++) {
- method_dict["MethodName"] = name_and_output_module_class_pair->first;
- method_dict["OutputTypeModuleAndClass"] =
- name_and_output_module_class_pair->second;
+ method_dict["MethodName"] = name_and_output_module_class_pair->first;
+ method_dict["OutputTypeModuleAndClass"] =
+ name_and_output_module_class_pair->second;
IndentScope raii_indent(out);
- out->Print(method_dict,
- "(\'$PackageQualifiedServiceName$\', \'$MethodName$\'): "
- "$OutputTypeModuleAndClass$.SerializeToString,\n");
+ out->Print(method_dict,
+ "(\'$PackageQualifiedServiceName$\', \'$MethodName$\'): "
+ "$OutputTypeModuleAndClass$.SerializeToString,\n");
}
out->Print("}\n");
out->Print("method_implementations = {\n");
@@ -277,14 +277,14 @@ bool PrivateGenerator::PrintBetaServerFactory(
name_and_implementation_constructor !=
method_implementation_constructors.end();
name_and_implementation_constructor++) {
- method_dict["Method"] = name_and_implementation_constructor->first;
- method_dict["Constructor"] = name_and_implementation_constructor->second;
+ method_dict["Method"] = name_and_implementation_constructor->first;
+ method_dict["Constructor"] = name_and_implementation_constructor->second;
IndentScope raii_descriptions_indent(out);
const TString method_name =
name_and_implementation_constructor->first;
- out->Print(method_dict,
- "(\'$PackageQualifiedServiceName$\', \'$Method$\'): "
- "face_utilities.$Constructor$(servicer.$Method$),\n");
+ out->Print(method_dict,
+ "(\'$PackageQualifiedServiceName$\', \'$Method$\'): "
+ "face_utilities.$Constructor$(servicer.$Method$),\n");
}
out->Print("}\n");
out->Print(
@@ -303,7 +303,7 @@ bool PrivateGenerator::PrintBetaServerFactory(
bool PrivateGenerator::PrintBetaStubFactory(
const TString& package_qualified_service_name,
- const grpc_generator::Service* service, grpc_generator::Printer* out) {
+ const grpc_generator::Service* service, grpc_generator::Printer* out) {
StringMap dict;
dict["Service"] = service->name();
out->Print("\n\n");
@@ -322,20 +322,20 @@ bool PrivateGenerator::PrintBetaStubFactory(
StringMap input_message_modules_and_classes;
StringMap output_message_modules_and_classes;
for (int i = 0; i < service->method_count(); ++i) {
- auto method = service->method(i);
+ auto method = service->method(i);
const TString method_cardinality =
TString(method->ClientStreaming() ? "STREAM" : "UNARY") + "_" +
TString(method->ServerStreaming() ? "STREAM" : "UNARY");
TString input_message_module_and_class;
- if (!method->get_module_and_message_path_input(
- &input_message_module_and_class, generator_file_name,
+ if (!method->get_module_and_message_path_input(
+ &input_message_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
return false;
}
TString output_message_module_and_class;
- if (!method->get_module_and_message_path_output(
- &output_message_module_and_class, generator_file_name,
+ if (!method->get_module_and_message_path_output(
+ &output_message_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
return false;
@@ -347,21 +347,21 @@ bool PrivateGenerator::PrintBetaStubFactory(
output_message_modules_and_classes.insert(
make_pair(method->name(), output_message_module_and_class));
}
- StringMap method_dict;
- method_dict["PackageQualifiedServiceName"] = package_qualified_service_name;
+ StringMap method_dict;
+ method_dict["PackageQualifiedServiceName"] = package_qualified_service_name;
out->Print("request_serializers = {\n");
for (StringMap::iterator name_and_input_module_class_pair =
input_message_modules_and_classes.begin();
name_and_input_module_class_pair !=
input_message_modules_and_classes.end();
name_and_input_module_class_pair++) {
- method_dict["MethodName"] = name_and_input_module_class_pair->first;
- method_dict["InputTypeModuleAndClass"] =
- name_and_input_module_class_pair->second;
+ method_dict["MethodName"] = name_and_input_module_class_pair->first;
+ method_dict["InputTypeModuleAndClass"] =
+ name_and_input_module_class_pair->second;
IndentScope raii_indent(out);
- out->Print(method_dict,
- "(\'$PackageQualifiedServiceName$\', \'$MethodName$\'): "
- "$InputTypeModuleAndClass$.SerializeToString,\n");
+ out->Print(method_dict,
+ "(\'$PackageQualifiedServiceName$\', \'$MethodName$\'): "
+ "$InputTypeModuleAndClass$.SerializeToString,\n");
}
out->Print("}\n");
out->Print("response_deserializers = {\n");
@@ -370,13 +370,13 @@ bool PrivateGenerator::PrintBetaStubFactory(
name_and_output_module_class_pair !=
output_message_modules_and_classes.end();
name_and_output_module_class_pair++) {
- method_dict["MethodName"] = name_and_output_module_class_pair->first;
- method_dict["OutputTypeModuleAndClass"] =
- name_and_output_module_class_pair->second;
+ method_dict["MethodName"] = name_and_output_module_class_pair->first;
+ method_dict["OutputTypeModuleAndClass"] =
+ name_and_output_module_class_pair->second;
IndentScope raii_indent(out);
- out->Print(method_dict,
- "(\'$PackageQualifiedServiceName$\', \'$MethodName$\'): "
- "$OutputTypeModuleAndClass$.FromString,\n");
+ out->Print(method_dict,
+ "(\'$PackageQualifiedServiceName$\', \'$MethodName$\'): "
+ "$OutputTypeModuleAndClass$.FromString,\n");
}
out->Print("}\n");
out->Print("cardinalities = {\n");
@@ -384,11 +384,11 @@ bool PrivateGenerator::PrintBetaStubFactory(
method_cardinalities.begin();
name_and_cardinality != method_cardinalities.end();
name_and_cardinality++) {
- method_dict["Method"] = name_and_cardinality->first;
- method_dict["Cardinality"] = name_and_cardinality->second;
+ method_dict["Method"] = name_and_cardinality->first;
+ method_dict["Cardinality"] = name_and_cardinality->second;
IndentScope raii_descriptions_indent(out);
- out->Print(method_dict,
- "\'$Method$\': cardinality.Cardinality.$Cardinality$,\n");
+ out->Print(method_dict,
+ "\'$Method$\': cardinality.Cardinality.$Cardinality$,\n");
}
out->Print("}\n");
out->Print(
@@ -397,25 +397,25 @@ bool PrivateGenerator::PrintBetaStubFactory(
"request_serializers=request_serializers, "
"response_deserializers=response_deserializers, "
"thread_pool=pool, thread_pool_size=pool_size)\n");
- out->Print(method_dict,
- "return beta_implementations.dynamic_stub(channel, "
- "\'$PackageQualifiedServiceName$\', "
- "cardinalities, options=stub_options)\n");
+ out->Print(method_dict,
+ "return beta_implementations.dynamic_stub(channel, "
+ "\'$PackageQualifiedServiceName$\', "
+ "cardinalities, options=stub_options)\n");
}
return true;
}
bool PrivateGenerator::PrintStub(
const TString& package_qualified_service_name,
- const grpc_generator::Service* service, grpc_generator::Printer* out) {
- StringMap dict;
- dict["Service"] = service->name();
+ const grpc_generator::Service* service, grpc_generator::Printer* out) {
+ StringMap dict;
+ dict["Service"] = service->name();
out->Print("\n\n");
- out->Print(dict, "class $Service$Stub(object):\n");
+ out->Print(dict, "class $Service$Stub(object):\n");
{
IndentScope raii_class_indent(out);
- StringVector service_comments = service->GetAllComments();
- PrintAllComments(service_comments, out);
+ StringVector service_comments = service->GetAllComments();
+ PrintAllComments(service_comments, out);
out->Print("\n");
out->Print("def __init__(self, channel):\n");
{
@@ -429,43 +429,43 @@ bool PrivateGenerator::PrintStub(
}
out->Print("\"\"\"\n");
for (int i = 0; i < service->method_count(); ++i) {
- auto method = service->method(i);
+ auto method = service->method(i);
TString multi_callable_constructor =
TString(method->ClientStreaming() ? "stream" : "unary") + "_" +
TString(method->ServerStreaming() ? "stream" : "unary");
TString request_module_and_class;
- if (!method->get_module_and_message_path_input(
- &request_module_and_class, generator_file_name,
+ if (!method->get_module_and_message_path_input(
+ &request_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
return false;
}
TString response_module_and_class;
- if (!method->get_module_and_message_path_output(
- &response_module_and_class, generator_file_name,
+ if (!method->get_module_and_message_path_output(
+ &response_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
return false;
}
- StringMap method_dict;
- method_dict["Method"] = method->name();
- method_dict["MultiCallableConstructor"] = multi_callable_constructor;
- out->Print(method_dict,
- "self.$Method$ = channel.$MultiCallableConstructor$(\n");
+ StringMap method_dict;
+ method_dict["Method"] = method->name();
+ method_dict["MultiCallableConstructor"] = multi_callable_constructor;
+ out->Print(method_dict,
+ "self.$Method$ = channel.$MultiCallableConstructor$(\n");
{
- method_dict["PackageQualifiedService"] =
- package_qualified_service_name;
- method_dict["RequestModuleAndClass"] = request_module_and_class;
- method_dict["ResponseModuleAndClass"] = response_module_and_class;
+ method_dict["PackageQualifiedService"] =
+ package_qualified_service_name;
+ method_dict["RequestModuleAndClass"] = request_module_and_class;
+ method_dict["ResponseModuleAndClass"] = response_module_and_class;
IndentScope raii_first_attribute_indent(out);
IndentScope raii_second_attribute_indent(out);
- out->Print(method_dict, "'/$PackageQualifiedService$/$Method$',\n");
- out->Print(method_dict,
- "request_serializer=$RequestModuleAndClass$."
- "SerializeToString,\n");
+ out->Print(method_dict, "'/$PackageQualifiedService$/$Method$',\n");
+ out->Print(method_dict,
+ "request_serializer=$RequestModuleAndClass$."
+ "SerializeToString,\n");
out->Print(
- method_dict,
- "response_deserializer=$ResponseModuleAndClass$.FromString,\n");
+ method_dict,
+ "response_deserializer=$ResponseModuleAndClass$.FromString,\n");
out->Print(")\n");
}
}
@@ -474,29 +474,29 @@ bool PrivateGenerator::PrintStub(
return true;
}
-bool PrivateGenerator::PrintServicer(const grpc_generator::Service* service,
- grpc_generator::Printer* out) {
- StringMap service_dict;
- service_dict["Service"] = service->name();
+bool PrivateGenerator::PrintServicer(const grpc_generator::Service* service,
+ grpc_generator::Printer* out) {
+ StringMap service_dict;
+ service_dict["Service"] = service->name();
out->Print("\n\n");
- out->Print(service_dict, "class $Service$Servicer(object):\n");
+ out->Print(service_dict, "class $Service$Servicer(object):\n");
{
IndentScope raii_class_indent(out);
- StringVector service_comments = service->GetAllComments();
- PrintAllComments(service_comments, out);
+ StringVector service_comments = service->GetAllComments();
+ PrintAllComments(service_comments, out);
for (int i = 0; i < service->method_count(); ++i) {
- auto method = service->method(i);
+ auto method = service->method(i);
TString arg_name =
- method->ClientStreaming() ? "request_iterator" : "request";
- StringMap method_dict;
- method_dict["Method"] = method->name();
- method_dict["ArgName"] = arg_name;
+ method->ClientStreaming() ? "request_iterator" : "request";
+ StringMap method_dict;
+ method_dict["Method"] = method->name();
+ method_dict["ArgName"] = arg_name;
out->Print("\n");
- out->Print(method_dict, "def $Method$(self, $ArgName$, context):\n");
+ out->Print(method_dict, "def $Method$(self, $ArgName$, context):\n");
{
IndentScope raii_method_indent(out);
- StringVector method_comments = method->GetAllComments();
- PrintAllComments(method_comments, out);
+ StringVector method_comments = method->GetAllComments();
+ PrintAllComments(method_comments, out);
out->Print("context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n");
out->Print("context.set_details('Method not implemented!')\n");
out->Print("raise NotImplementedError('Method not implemented!')\n");
@@ -508,12 +508,12 @@ bool PrivateGenerator::PrintServicer(const grpc_generator::Service* service,
bool PrivateGenerator::PrintAddServicerToServer(
const TString& package_qualified_service_name,
- const grpc_generator::Service* service, grpc_generator::Printer* out) {
- StringMap service_dict;
- service_dict["Service"] = service->name();
+ const grpc_generator::Service* service, grpc_generator::Printer* out) {
+ StringMap service_dict;
+ service_dict["Service"] = service->name();
out->Print("\n\n");
- out->Print(service_dict,
- "def add_$Service$Servicer_to_server(servicer, server):\n");
+ out->Print(service_dict,
+ "def add_$Service$Servicer_to_server(servicer, server):\n");
{
IndentScope raii_class_indent(out);
out->Print("rpc_method_handlers = {\n");
@@ -521,56 +521,56 @@ bool PrivateGenerator::PrintAddServicerToServer(
IndentScope raii_dict_first_indent(out);
IndentScope raii_dict_second_indent(out);
for (int i = 0; i < service->method_count(); ++i) {
- auto method = service->method(i);
+ auto method = service->method(i);
TString method_handler_constructor =
TString(method->ClientStreaming() ? "stream" : "unary") + "_" +
TString(method->ServerStreaming() ? "stream" : "unary") +
"_rpc_method_handler";
TString request_module_and_class;
- if (!method->get_module_and_message_path_input(
- &request_module_and_class, generator_file_name,
+ if (!method->get_module_and_message_path_input(
+ &request_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
return false;
}
TString response_module_and_class;
- if (!method->get_module_and_message_path_output(
- &response_module_and_class, generator_file_name,
+ if (!method->get_module_and_message_path_output(
+ &response_module_and_class, generator_file_name,
generate_in_pb2_grpc, config.import_prefix,
config.prefixes_to_filter)) {
return false;
}
- StringMap method_dict;
- method_dict["Method"] = method->name();
- method_dict["MethodHandlerConstructor"] = method_handler_constructor;
- method_dict["RequestModuleAndClass"] = request_module_and_class;
- method_dict["ResponseModuleAndClass"] = response_module_and_class;
- out->Print(method_dict,
- "'$Method$': grpc.$MethodHandlerConstructor$(\n");
+ StringMap method_dict;
+ method_dict["Method"] = method->name();
+ method_dict["MethodHandlerConstructor"] = method_handler_constructor;
+ method_dict["RequestModuleAndClass"] = request_module_and_class;
+ method_dict["ResponseModuleAndClass"] = response_module_and_class;
+ out->Print(method_dict,
+ "'$Method$': grpc.$MethodHandlerConstructor$(\n");
{
IndentScope raii_call_first_indent(out);
IndentScope raii_call_second_indent(out);
- out->Print(method_dict, "servicer.$Method$,\n");
+ out->Print(method_dict, "servicer.$Method$,\n");
out->Print(
- method_dict,
- "request_deserializer=$RequestModuleAndClass$.FromString,\n");
+ method_dict,
+ "request_deserializer=$RequestModuleAndClass$.FromString,\n");
out->Print(
- method_dict,
+ method_dict,
"response_serializer=$ResponseModuleAndClass$.SerializeToString,"
- "\n");
+ "\n");
}
out->Print("),\n");
}
}
- StringMap method_dict;
- method_dict["PackageQualifiedServiceName"] = package_qualified_service_name;
+ StringMap method_dict;
+ method_dict["PackageQualifiedServiceName"] = package_qualified_service_name;
out->Print("}\n");
out->Print("generic_handler = grpc.method_handlers_generic_handler(\n");
{
IndentScope raii_call_first_indent(out);
IndentScope raii_call_second_indent(out);
- out->Print(method_dict,
- "'$PackageQualifiedServiceName$', rpc_method_handlers)\n");
+ out->Print(method_dict,
+ "'$PackageQualifiedServiceName$', rpc_method_handlers)\n");
}
out->Print("server.add_generic_rpc_handlers((generic_handler,))\n");
}
@@ -665,31 +665,31 @@ bool PrivateGenerator::PrintServiceClass(
return true;
}
-bool PrivateGenerator::PrintBetaPreamble(grpc_generator::Printer* out) {
- StringMap var;
- var["Package"] = config.beta_package_root;
- out->Print(var,
- "from $Package$ import implementations as beta_implementations\n");
- out->Print(var, "from $Package$ import interfaces as beta_interfaces\n");
+bool PrivateGenerator::PrintBetaPreamble(grpc_generator::Printer* out) {
+ StringMap var;
+ var["Package"] = config.beta_package_root;
+ out->Print(var,
+ "from $Package$ import implementations as beta_implementations\n");
+ out->Print(var, "from $Package$ import interfaces as beta_interfaces\n");
out->Print("from grpc.framework.common import cardinality\n");
out->Print(
"from grpc.framework.interfaces.face import utilities as "
"face_utilities\n");
- return true;
-}
-
-bool PrivateGenerator::PrintPreamble(grpc_generator::Printer* out) {
- StringMap var;
- var["Package"] = config.grpc_package_root;
- out->Print(var, "import $Package$\n");
+ return true;
+}
+
+bool PrivateGenerator::PrintPreamble(grpc_generator::Printer* out) {
+ StringMap var;
+ var["Package"] = config.grpc_package_root;
+ out->Print(var, "import $Package$\n");
if (generate_in_pb2_grpc) {
out->Print("\n");
StringPairSet imports_set;
for (int i = 0; i < file->service_count(); ++i) {
- auto service = file->service(i);
+ auto service = file->service(i);
for (int j = 0; j < service->method_count(); ++j) {
- auto method = service.get()->method(j);
-
+ auto method = service.get()->method(j);
+
TString input_type_file_name = method->get_input_type_name();
TString input_module_name =
ModuleName(input_type_file_name, config.import_prefix,
@@ -697,9 +697,9 @@ bool PrivateGenerator::PrintPreamble(grpc_generator::Printer* out) {
TString input_module_alias =
ModuleAlias(input_type_file_name, config.import_prefix,
config.prefixes_to_filter);
- imports_set.insert(
- std::make_tuple(input_module_name, input_module_alias));
-
+ imports_set.insert(
+ std::make_tuple(input_module_name, input_module_alias));
+
TString output_type_file_name = method->get_output_type_name();
TString output_module_name =
ModuleName(output_type_file_name, config.import_prefix,
@@ -707,40 +707,40 @@ bool PrivateGenerator::PrintPreamble(grpc_generator::Printer* out) {
TString output_module_alias =
ModuleAlias(output_type_file_name, config.import_prefix,
config.prefixes_to_filter);
- imports_set.insert(
- std::make_tuple(output_module_name, output_module_alias));
+ imports_set.insert(
+ std::make_tuple(output_module_name, output_module_alias));
}
}
-
+
for (StringPairSet::iterator it = imports_set.begin();
it != imports_set.end(); ++it) {
- auto module_name = std::get<0>(*it);
- var["ModuleAlias"] = std::get<1>(*it);
- const size_t last_dot_pos = module_name.rfind('.');
+ auto module_name = std::get<0>(*it);
+ var["ModuleAlias"] = std::get<1>(*it);
+ const size_t last_dot_pos = module_name.rfind('.');
if (last_dot_pos == TString::npos) {
- var["ImportStatement"] = "import " + module_name;
- } else {
- var["ImportStatement"] = "from " + module_name.substr(0, last_dot_pos) +
- " import " +
- module_name.substr(last_dot_pos + 1);
- }
- out->Print(var, "$ImportStatement$ as $ModuleAlias$\n");
+ var["ImportStatement"] = "import " + module_name;
+ } else {
+ var["ImportStatement"] = "from " + module_name.substr(0, last_dot_pos) +
+ " import " +
+ module_name.substr(last_dot_pos + 1);
+ }
+ out->Print(var, "$ImportStatement$ as $ModuleAlias$\n");
}
}
return true;
}
-bool PrivateGenerator::PrintGAServices(grpc_generator::Printer* out) {
+bool PrivateGenerator::PrintGAServices(grpc_generator::Printer* out) {
TString package = file->package();
if (!package.empty()) {
package = package.append(".");
}
for (int i = 0; i < file->service_count(); ++i) {
- auto service = file->service(i);
+ auto service = file->service(i);
TString package_qualified_service_name = package + service->name();
- if (!(PrintStub(package_qualified_service_name, service.get(), out) &&
- PrintServicer(service.get(), out) &&
- PrintAddServicerToServer(package_qualified_service_name,
+ if (!(PrintStub(package_qualified_service_name, service.get(), out) &&
+ PrintServicer(service.get(), out) &&
+ PrintAddServicerToServer(package_qualified_service_name,
service.get(), out) &&
PrintServiceClass(package_qualified_service_name, service.get(),
out))) {
@@ -750,20 +750,20 @@ bool PrivateGenerator::PrintGAServices(grpc_generator::Printer* out) {
return true;
}
-bool PrivateGenerator::PrintBetaServices(grpc_generator::Printer* out) {
+bool PrivateGenerator::PrintBetaServices(grpc_generator::Printer* out) {
TString package = file->package();
if (!package.empty()) {
package = package.append(".");
}
for (int i = 0; i < file->service_count(); ++i) {
- auto service = file->service(i);
+ auto service = file->service(i);
TString package_qualified_service_name = package + service->name();
- if (!(PrintBetaServicer(service.get(), out) &&
- PrintBetaStub(service.get(), out) &&
- PrintBetaServerFactory(package_qualified_service_name, service.get(),
- out) &&
- PrintBetaStubFactory(package_qualified_service_name, service.get(),
- out))) {
+ if (!(PrintBetaServicer(service.get(), out) &&
+ PrintBetaStub(service.get(), out) &&
+ PrintBetaServerFactory(package_qualified_service_name, service.get(),
+ out) &&
+ PrintBetaStubFactory(package_qualified_service_name, service.get(),
+ out))) {
return false;
}
}
@@ -774,42 +774,42 @@ pair<bool, TString> PrivateGenerator::GetGrpcServices() {
TString output;
{
// Scope the output stream so it closes and finalizes output to the string.
- auto out = file->CreatePrinter(&output);
+ auto out = file->CreatePrinter(&output);
if (generate_in_pb2_grpc) {
out->Print(
"# Generated by the gRPC Python protocol compiler plugin. "
"DO NOT EDIT!\n\"\"\""
"Client and server classes corresponding to protobuf-defined "
"services.\"\"\"\n");
- if (!PrintPreamble(out.get())) {
+ if (!PrintPreamble(out.get())) {
return make_pair(false, "");
}
- if (!PrintGAServices(out.get())) {
+ if (!PrintGAServices(out.get())) {
return make_pair(false, "");
}
} else {
out->Print("try:\n");
{
- IndentScope raii_dict_try_indent(out.get());
+ IndentScope raii_dict_try_indent(out.get());
out->Print(
"# THESE ELEMENTS WILL BE DEPRECATED.\n"
"# Please use the generated *_pb2_grpc.py files instead.\n");
- if (!PrintPreamble(out.get())) {
+ if (!PrintPreamble(out.get())) {
return make_pair(false, "");
}
- if (!PrintBetaPreamble(out.get())) {
+ if (!PrintBetaPreamble(out.get())) {
return make_pair(false, "");
}
- if (!PrintGAServices(out.get())) {
+ if (!PrintGAServices(out.get())) {
return make_pair(false, "");
}
- if (!PrintBetaServices(out.get())) {
+ if (!PrintBetaServices(out.get())) {
return make_pair(false, "");
}
}
out->Print("except ImportError:\n");
{
- IndentScope raii_dict_except_indent(out.get());
+ IndentScope raii_dict_except_indent(out.get());
out->Print("pass");
}
}
@@ -820,9 +820,9 @@ pair<bool, TString> PrivateGenerator::GetGrpcServices() {
} // namespace
GeneratorConfiguration::GeneratorConfiguration()
- : grpc_package_root("grpc"),
- beta_package_root("grpc.beta"),
- import_prefix("") {}
+ : grpc_package_root("grpc"),
+ beta_package_root("grpc.beta"),
+ import_prefix("") {}
PythonGrpcGenerator::PythonGrpcGenerator(const GeneratorConfiguration& config)
: config_(config) {}
@@ -900,9 +900,9 @@ bool PythonGrpcGenerator::Generate(const FileDescriptor* file,
*error = "Invalid proto file name. Proto file must end with .proto";
return false;
}
- generator_file_name = file->name();
+ generator_file_name = file->name();
- ProtoBufFile pbfile(file);
+ ProtoBufFile pbfile(file);
TString grpc_version;
GeneratorConfiguration extended_config(config_);
bool success = ParseParameters(parameter, &grpc_version,
diff --git a/contrib/libs/grpc/src/compiler/python_generator.h b/contrib/libs/grpc/src/compiler/python_generator.h
index 045e26c06b..bcde0a5e35 100644
--- a/contrib/libs/grpc/src/compiler/python_generator.h
+++ b/contrib/libs/grpc/src/compiler/python_generator.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -23,7 +23,7 @@
#include <vector>
#include "src/compiler/config.h"
-#include "src/compiler/schema_interface.h"
+#include "src/compiler/schema_interface.h"
namespace grpc_python_generator {
@@ -32,9 +32,9 @@ namespace grpc_python_generator {
struct GeneratorConfiguration {
GeneratorConfiguration();
TString grpc_package_root;
- // TODO(https://github.com/grpc/grpc/issues/8622): Drop this.
+ // TODO(https://github.com/grpc/grpc/issues/8622): Drop this.
TString beta_package_root;
- // TODO(https://github.com/google/protobuf/issues/888): Drop this.
+ // TODO(https://github.com/google/protobuf/issues/888): Drop this.
TString import_prefix;
std::vector<TString> prefixes_to_filter;
};
diff --git a/contrib/libs/grpc/src/compiler/python_generator_helpers.h b/contrib/libs/grpc/src/compiler/python_generator_helpers.h
index c453ca0f67..78e7efd7e0 100644
--- a/contrib/libs/grpc/src/compiler/python_generator_helpers.h
+++ b/contrib/libs/grpc/src/compiler/python_generator_helpers.h
@@ -1,54 +1,54 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_HELPERS_H
-#define GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_HELPERS_H
-
-#include <cstring>
-#include <fstream>
-#include <iostream>
-#include <vector>
-
-#include "src/compiler/config.h"
-#include "src/compiler/generator_helpers.h"
-#include "src/compiler/python_generator.h"
-#include "src/compiler/python_private_generator.h"
-
-using grpc::protobuf::Descriptor;
-using grpc::protobuf::FileDescriptor;
-using grpc::protobuf::MethodDescriptor;
-using grpc::protobuf::ServiceDescriptor;
-using grpc::protobuf::compiler::GeneratorContext;
-using grpc::protobuf::io::CodedOutputStream;
-using grpc::protobuf::io::Printer;
-using grpc::protobuf::io::StringOutputStream;
-using grpc::protobuf::io::ZeroCopyOutputStream;
-using grpc_generator::StringReplace;
-using grpc_generator::StripProto;
-using std::vector;
-
-namespace grpc_python_generator {
-
-namespace {
-
-typedef vector<const Descriptor*> DescriptorVector;
+/*
+ *
+ * Copyright 2015 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_HELPERS_H
+#define GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_HELPERS_H
+
+#include <cstring>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+#include "src/compiler/config.h"
+#include "src/compiler/generator_helpers.h"
+#include "src/compiler/python_generator.h"
+#include "src/compiler/python_private_generator.h"
+
+using grpc::protobuf::Descriptor;
+using grpc::protobuf::FileDescriptor;
+using grpc::protobuf::MethodDescriptor;
+using grpc::protobuf::ServiceDescriptor;
+using grpc::protobuf::compiler::GeneratorContext;
+using grpc::protobuf::io::CodedOutputStream;
+using grpc::protobuf::io::Printer;
+using grpc::protobuf::io::StringOutputStream;
+using grpc::protobuf::io::ZeroCopyOutputStream;
+using grpc_generator::StringReplace;
+using grpc_generator::StripProto;
+using std::vector;
+
+namespace grpc_python_generator {
+
+namespace {
+
+typedef vector<const Descriptor*> DescriptorVector;
typedef vector<TString> StringVector;
-
+
static TString StripModulePrefixes(
const TString& raw_module_name,
const std::vector<TString>& prefixes_to_filter) {
@@ -61,81 +61,81 @@ static TString StripModulePrefixes(
return raw_module_name;
}
-// TODO(https://github.com/google/protobuf/issues/888):
-// Export `ModuleName` from protobuf's
-// `src/google/protobuf/compiler/python/python_generator.cc` file.
+// TODO(https://github.com/google/protobuf/issues/888):
+// Export `ModuleName` from protobuf's
+// `src/google/protobuf/compiler/python/python_generator.cc` file.
TString ModuleName(const TString& filename,
const TString& import_prefix,
const std::vector<TString>& prefixes_to_filter) {
TString basename = StripProto(filename);
- basename = StringReplace(basename, "-", "_");
- basename = StringReplace(basename, "/", ".");
+ basename = StringReplace(basename, "-", "_");
+ basename = StringReplace(basename, "/", ".");
return StripModulePrefixes(import_prefix + basename + "_pb2",
prefixes_to_filter);
-}
-
-// TODO(https://github.com/google/protobuf/issues/888):
-// Export `ModuleAlias` from protobuf's
-// `src/google/protobuf/compiler/python/python_generator.cc` file.
+}
+
+// TODO(https://github.com/google/protobuf/issues/888):
+// Export `ModuleAlias` from protobuf's
+// `src/google/protobuf/compiler/python/python_generator.cc` file.
TString ModuleAlias(const TString& filename,
const TString& import_prefix,
const std::vector<TString>& prefixes_to_filter) {
TString module_name =
ModuleName(filename, import_prefix, prefixes_to_filter);
- // We can't have dots in the module name, so we replace each with _dot_.
- // But that could lead to a collision between a.b and a_dot_b, so we also
- // duplicate each underscore.
- module_name = StringReplace(module_name, "_", "__");
- module_name = StringReplace(module_name, ".", "_dot_");
- return module_name;
-}
-
+ // We can't have dots in the module name, so we replace each with _dot_.
+ // But that could lead to a collision between a.b and a_dot_b, so we also
+ // duplicate each underscore.
+ module_name = StringReplace(module_name, "_", "__");
+ module_name = StringReplace(module_name, ".", "_dot_");
+ return module_name;
+}
+
bool GetModuleAndMessagePath(
const Descriptor* type, TString* out, TString generator_file_name,
bool generate_in_pb2_grpc, TString& import_prefix,
const std::vector<TString>& prefixes_to_filter) {
- const Descriptor* path_elem_type = type;
- DescriptorVector message_path;
- do {
- message_path.push_back(path_elem_type);
- path_elem_type = path_elem_type->containing_type();
- } while (path_elem_type); // implicit nullptr comparison; don't be explicit
+ const Descriptor* path_elem_type = type;
+ DescriptorVector message_path;
+ do {
+ message_path.push_back(path_elem_type);
+ path_elem_type = path_elem_type->containing_type();
+ } while (path_elem_type); // implicit nullptr comparison; don't be explicit
TString file_name = type->file()->name();
- static const int proto_suffix_length = strlen(".proto");
- if (!(file_name.size() > static_cast<size_t>(proto_suffix_length) &&
- file_name.find_last_of(".proto") == file_name.size() - 1)) {
- return false;
- }
-
+ static const int proto_suffix_length = strlen(".proto");
+ if (!(file_name.size() > static_cast<size_t>(proto_suffix_length) &&
+ file_name.find_last_of(".proto") == file_name.size() - 1)) {
+ return false;
+ }
+
TString module;
- if (generator_file_name != file_name || generate_in_pb2_grpc) {
+ if (generator_file_name != file_name || generate_in_pb2_grpc) {
module = ModuleAlias(file_name, import_prefix, prefixes_to_filter) + ".";
- } else {
- module = "";
- }
+ } else {
+ module = "";
+ }
TString message_type;
- for (DescriptorVector::reverse_iterator path_iter = message_path.rbegin();
- path_iter != message_path.rend(); ++path_iter) {
- message_type += (*path_iter)->name() + ".";
- }
- // no pop_back prior to C++11
- message_type.resize(message_type.size() - 1);
- *out = module + message_type;
- return true;
-}
-
-template <typename DescriptorType>
-StringVector get_all_comments(const DescriptorType* descriptor) {
- StringVector comments;
- grpc_generator::GetComment(
- descriptor, grpc_generator::COMMENTTYPE_LEADING_DETACHED, &comments);
- grpc_generator::GetComment(descriptor, grpc_generator::COMMENTTYPE_LEADING,
- &comments);
- grpc_generator::GetComment(descriptor, grpc_generator::COMMENTTYPE_TRAILING,
- &comments);
- return comments;
-}
-
+ for (DescriptorVector::reverse_iterator path_iter = message_path.rbegin();
+ path_iter != message_path.rend(); ++path_iter) {
+ message_type += (*path_iter)->name() + ".";
+ }
+ // no pop_back prior to C++11
+ message_type.resize(message_type.size() - 1);
+ *out = module + message_type;
+ return true;
+}
+
+template <typename DescriptorType>
+StringVector get_all_comments(const DescriptorType* descriptor) {
+ StringVector comments;
+ grpc_generator::GetComment(
+ descriptor, grpc_generator::COMMENTTYPE_LEADING_DETACHED, &comments);
+ grpc_generator::GetComment(descriptor, grpc_generator::COMMENTTYPE_LEADING,
+ &comments);
+ grpc_generator::GetComment(descriptor, grpc_generator::COMMENTTYPE_TRAILING,
+ &comments);
+ return comments;
+}
+
inline void Split(const TString& s, char delim,
std::vector<TString>* append_to) {
auto current = s.begin();
@@ -146,8 +146,8 @@ inline void Split(const TString& s, char delim,
}
}
-} // namespace
-
-} // namespace grpc_python_generator
-
-#endif // GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_HELPERS_H
+} // namespace
+
+} // namespace grpc_python_generator
+
+#endif // GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_HELPERS_H
diff --git a/contrib/libs/grpc/src/compiler/python_plugin.cc b/contrib/libs/grpc/src/compiler/python_plugin.cc
index 75e1b769a5..81eb1d4fc2 100644
--- a/contrib/libs/grpc/src/compiler/python_plugin.cc
+++ b/contrib/libs/grpc/src/compiler/python_plugin.cc
@@ -1,25 +1,25 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
// Generates a Python gRPC service interface out of Protobuf IDL.
#include "src/compiler/config.h"
-#include "src/compiler/protobuf_plugin.h"
+#include "src/compiler/protobuf_plugin.h"
#include "src/compiler/python_generator.h"
int main(int argc, char* argv[]) {
diff --git a/contrib/libs/grpc/src/compiler/python_private_generator.h b/contrib/libs/grpc/src/compiler/python_private_generator.h
index 85c84ab6bd..3039a38e12 100644
--- a/contrib/libs/grpc/src/compiler/python_private_generator.h
+++ b/contrib/libs/grpc/src/compiler/python_private_generator.h
@@ -1,87 +1,87 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_PYTHON_PRIVATE_GENERATOR_H
-#define GRPC_INTERNAL_COMPILER_PYTHON_PRIVATE_GENERATOR_H
-
-#include <iostream>
-#include <vector>
-
-#include "src/compiler/python_generator.h"
-#include "src/compiler/schema_interface.h"
-
-namespace grpc_python_generator {
-
-namespace {
-
-// Tucks all generator state in an anonymous namespace away from
-// PythonGrpcGenerator and the header file, mostly to encourage future changes
-// to not require updates to the grpcio-tools C++ code part. Assumes that it is
-// only ever used from a single thread.
-struct PrivateGenerator {
- const GeneratorConfiguration& config;
- const grpc_generator::File* file;
-
- bool generate_in_pb2_grpc;
-
- PrivateGenerator(const GeneratorConfiguration& config,
- const grpc_generator::File* file);
-
+/*
+ *
+ * Copyright 2015 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_PYTHON_PRIVATE_GENERATOR_H
+#define GRPC_INTERNAL_COMPILER_PYTHON_PRIVATE_GENERATOR_H
+
+#include <iostream>
+#include <vector>
+
+#include "src/compiler/python_generator.h"
+#include "src/compiler/schema_interface.h"
+
+namespace grpc_python_generator {
+
+namespace {
+
+// Tucks all generator state in an anonymous namespace away from
+// PythonGrpcGenerator and the header file, mostly to encourage future changes
+// to not require updates to the grpcio-tools C++ code part. Assumes that it is
+// only ever used from a single thread.
+struct PrivateGenerator {
+ const GeneratorConfiguration& config;
+ const grpc_generator::File* file;
+
+ bool generate_in_pb2_grpc;
+
+ PrivateGenerator(const GeneratorConfiguration& config,
+ const grpc_generator::File* file);
+
std::pair<bool, TString> GetGrpcServices();
-
- private:
- bool PrintPreamble(grpc_generator::Printer* out);
- bool PrintBetaPreamble(grpc_generator::Printer* out);
- bool PrintGAServices(grpc_generator::Printer* out);
- bool PrintBetaServices(grpc_generator::Printer* out);
-
- bool PrintAddServicerToServer(
+
+ private:
+ bool PrintPreamble(grpc_generator::Printer* out);
+ bool PrintBetaPreamble(grpc_generator::Printer* out);
+ bool PrintGAServices(grpc_generator::Printer* out);
+ bool PrintBetaServices(grpc_generator::Printer* out);
+
+ bool PrintAddServicerToServer(
const TString& package_qualified_service_name,
- const grpc_generator::Service* service, grpc_generator::Printer* out);
- bool PrintServicer(const grpc_generator::Service* service,
- grpc_generator::Printer* out);
+ const grpc_generator::Service* service, grpc_generator::Printer* out);
+ bool PrintServicer(const grpc_generator::Service* service,
+ grpc_generator::Printer* out);
bool PrintStub(const TString& package_qualified_service_name,
- const grpc_generator::Service* service,
- grpc_generator::Printer* out);
-
+ const grpc_generator::Service* service,
+ grpc_generator::Printer* out);
+
bool PrintServiceClass(const TString& package_qualified_service_name,
const grpc_generator::Service* service,
grpc_generator::Printer* out);
- bool PrintBetaServicer(const grpc_generator::Service* service,
- grpc_generator::Printer* out);
+ bool PrintBetaServicer(const grpc_generator::Service* service,
+ grpc_generator::Printer* out);
bool PrintBetaServerFactory(const TString& package_qualified_service_name,
const grpc_generator::Service* service,
grpc_generator::Printer* out);
- bool PrintBetaStub(const grpc_generator::Service* service,
- grpc_generator::Printer* out);
+ bool PrintBetaStub(const grpc_generator::Service* service,
+ grpc_generator::Printer* out);
bool PrintBetaStubFactory(const TString& package_qualified_service_name,
- const grpc_generator::Service* service,
- grpc_generator::Printer* out);
-
- // Get all comments (leading, leading_detached, trailing) and print them as a
- // docstring. Any leading space of a line will be removed, but the line
- // wrapping will not be changed.
+ const grpc_generator::Service* service,
+ grpc_generator::Printer* out);
+
+ // Get all comments (leading, leading_detached, trailing) and print them as a
+ // docstring. Any leading space of a line will be removed, but the line
+ // wrapping will not be changed.
void PrintAllComments(std::vector<TString> comments,
- grpc_generator::Printer* out);
-};
-
-} // namespace
-
-} // namespace grpc_python_generator
-
-#endif // GRPC_INTERNAL_COMPILER_PYTHON_PRIVATE_GENERATOR_H
+ grpc_generator::Printer* out);
+};
+
+} // namespace
+
+} // namespace grpc_python_generator
+
+#endif // GRPC_INTERNAL_COMPILER_PYTHON_PRIVATE_GENERATOR_H
diff --git a/contrib/libs/grpc/src/compiler/ruby_generator.cc b/contrib/libs/grpc/src/compiler/ruby_generator.cc
index 770a7d55dd..c82e78fd64 100644
--- a/contrib/libs/grpc/src/compiler/ruby_generator.cc
+++ b/contrib/libs/grpc/src/compiler/ruby_generator.cc
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -27,7 +27,7 @@
#include "src/compiler/ruby_generator_string-inl.h"
using grpc::protobuf::FileDescriptor;
-using grpc::protobuf::MethodDescriptor;
+using grpc::protobuf::MethodDescriptor;
using grpc::protobuf::ServiceDescriptor;
using grpc::protobuf::io::Printer;
using grpc::protobuf::io::StringOutputStream;
@@ -48,11 +48,11 @@ void PrintMethod(const MethodDescriptor* method, Printer* out) {
output_type = "stream(" + output_type + ")";
}
std::map<TString, TString> method_vars = ListToDict({
- "mth.name",
- method->name(),
- "input.type",
- input_type,
- "output.type",
+ "mth.name",
+ method->name(),
+ "input.type",
+ input_type,
+ "output.type",
output_type,
});
out->Print(GetRubyComments(method, true).c_str());
@@ -68,8 +68,8 @@ void PrintService(const ServiceDescriptor* service, Printer* out) {
// Begin the service module
std::map<TString, TString> module_vars = ListToDict({
- "module.name",
- Modularize(service->name()),
+ "module.name",
+ Modularize(service->name()),
});
out->Print(module_vars, "module $module.name$\n");
out->Indent();
@@ -160,9 +160,9 @@ TString GetServices(const FileDescriptor* file) {
// Write out a file header.
std::map<TString, TString> header_comment_vars = ListToDict({
- "file.name",
- file->name(),
- "file.package",
+ "file.name",
+ file->name(),
+ "file.package",
package_name,
});
out.Print("# Generated by the protocol buffer compiler. DO NOT EDIT!\n");
@@ -172,7 +172,7 @@ TString GetServices(const FileDescriptor* file) {
TString leading_comments = GetRubyComments(file, true);
if (!leading_comments.empty()) {
out.Print("# Original file comments:\n");
- out.PrintRaw(leading_comments.c_str());
+ out.PrintRaw(leading_comments.c_str());
}
out.Print("\n");
@@ -181,8 +181,8 @@ TString GetServices(const FileDescriptor* file) {
// that defines the messages used by the service. This is generated by the
// main ruby plugin.
std::map<TString, TString> dep_vars = ListToDict({
- "dep.name",
- MessagesRequireName(file),
+ "dep.name",
+ MessagesRequireName(file),
});
out.Print(dep_vars, "require '$dep.name$'\n");
@@ -191,8 +191,8 @@ TString GetServices(const FileDescriptor* file) {
std::vector<TString> modules = Split(package_name, '.');
for (size_t i = 0; i < modules.size(); ++i) {
std::map<TString, TString> module_vars = ListToDict({
- "module.name",
- PackageToModule(modules[i]),
+ "module.name",
+ PackageToModule(modules[i]),
});
out.Print(module_vars, "module $module.name$\n");
out.Indent();
diff --git a/contrib/libs/grpc/src/compiler/ruby_generator.h b/contrib/libs/grpc/src/compiler/ruby_generator.h
index b10d265166..325dc02294 100644
--- a/contrib/libs/grpc/src/compiler/ruby_generator.h
+++ b/contrib/libs/grpc/src/compiler/ruby_generator.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
diff --git a/contrib/libs/grpc/src/compiler/ruby_generator_helpers-inl.h b/contrib/libs/grpc/src/compiler/ruby_generator_helpers-inl.h
index c9949f74df..9a10976619 100644
--- a/contrib/libs/grpc/src/compiler/ruby_generator_helpers-inl.h
+++ b/contrib/libs/grpc/src/compiler/ruby_generator_helpers-inl.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -25,7 +25,7 @@
namespace grpc_ruby_generator {
-inline bool ServicesFilename(const grpc::protobuf::FileDescriptor* file,
+inline bool ServicesFilename(const grpc::protobuf::FileDescriptor* file,
TString* file_name_or_error) {
// Get output file name.
static const unsigned proto_suffix_length = 6; // length of ".proto"
@@ -42,7 +42,7 @@ inline bool ServicesFilename(const grpc::protobuf::FileDescriptor* file,
}
inline TString MessagesRequireName(
- const grpc::protobuf::FileDescriptor* file) {
+ const grpc::protobuf::FileDescriptor* file) {
return Replace(file->name(), ".proto", "_pb");
}
diff --git a/contrib/libs/grpc/src/compiler/ruby_generator_map-inl.h b/contrib/libs/grpc/src/compiler/ruby_generator_map-inl.h
index fb7e334567..4c75780b1a 100644
--- a/contrib/libs/grpc/src/compiler/ruby_generator_map-inl.h
+++ b/contrib/libs/grpc/src/compiler/ruby_generator_map-inl.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
diff --git a/contrib/libs/grpc/src/compiler/ruby_generator_string-inl.h b/contrib/libs/grpc/src/compiler/ruby_generator_string-inl.h
index 4f7cf54da9..956539f392 100644
--- a/contrib/libs/grpc/src/compiler/ruby_generator_string-inl.h
+++ b/contrib/libs/grpc/src/compiler/ruby_generator_string-inl.h
@@ -1,18 +1,18 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2015 gRPC authors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
*/
@@ -81,23 +81,23 @@ inline bool ReplacePrefix(TString* s, const TString& from,
return true;
}
-// Modularize converts a string into a ruby module compatible name
+// Modularize converts a string into a ruby module compatible name
inline TString Modularize(TString s) {
if (s.empty()) {
return s;
}
TString new_string = "";
- bool was_last_underscore = false;
- new_string.append(1, ::toupper(s[0]));
+ bool was_last_underscore = false;
+ new_string.append(1, ::toupper(s[0]));
for (TString::size_type i = 1; i < s.size(); ++i) {
- if (was_last_underscore && s[i] != '_') {
- new_string.append(1, ::toupper(s[i]));
- } else if (s[i] != '_') {
- new_string.append(1, s[i]);
- }
- was_last_underscore = s[i] == '_';
- }
- return new_string;
+ if (was_last_underscore && s[i] != '_') {
+ new_string.append(1, ::toupper(s[i]));
+ } else if (s[i] != '_') {
+ new_string.append(1, s[i]);
+ }
+ was_last_underscore = s[i] == '_';
+ }
+ return new_string;
}
// RubyPackage gets the ruby package in either proto or ruby_package format
@@ -135,7 +135,7 @@ inline TString RubyTypeOf(const grpc::protobuf::Descriptor* descriptor) {
res += "::"; // switch '.' to the ruby module delim
}
if (i < prefixes_and_type.size() - 1) {
- res += Modularize(prefixes_and_type[i]); // capitalize pkgs
+ res += Modularize(prefixes_and_type[i]); // capitalize pkgs
} else {
res += prefixes_and_type[i];
}
diff --git a/contrib/libs/grpc/src/compiler/schema_interface.h b/contrib/libs/grpc/src/compiler/schema_interface.h
index edadeff5d9..60b9d337e8 100644
--- a/contrib/libs/grpc/src/compiler/schema_interface.h
+++ b/contrib/libs/grpc/src/compiler/schema_interface.h
@@ -1,118 +1,118 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H
-#define GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H
-
-#include "src/compiler/config.h"
-
-#include <memory>
+/*
+ *
+ * Copyright 2015 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H
+#define GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H
+
+#include "src/compiler/config.h"
+
+#include <memory>
#include <util/generic/string.h>
-#include <vector>
-
+#include <vector>
+
#ifdef GRPC_CUSTOM_STRING
#warning GRPC_CUSTOM_STRING is no longer supported. Please use TString.
-#endif
-
-namespace grpc {
-
+#endif
+
+namespace grpc {
+
// Using grpc::string and grpc::to_string is discouraged in favor of
// TString and ToString. This is only for legacy code using
// them explictly.
typedef TString string; // deprecated
-
-} // namespace grpc
-
-namespace grpc_generator {
-
-// A common interface for objects having comments in the source.
-// Return formatted comments to be inserted in generated code.
-struct CommentHolder {
- virtual ~CommentHolder() {}
+
+} // namespace grpc
+
+namespace grpc_generator {
+
+// A common interface for objects having comments in the source.
+// Return formatted comments to be inserted in generated code.
+struct CommentHolder {
+ virtual ~CommentHolder() {}
virtual TString GetLeadingComments(const TString prefix) const = 0;
virtual TString GetTrailingComments(const TString prefix) const = 0;
virtual std::vector<TString> GetAllComments() const = 0;
-};
-
-// An abstract interface representing a method.
-struct Method : public CommentHolder {
- virtual ~Method() {}
-
+};
+
+// An abstract interface representing a method.
+struct Method : public CommentHolder {
+ virtual ~Method() {}
+
virtual TString name() const = 0;
-
+
virtual TString input_type_name() const = 0;
virtual TString output_type_name() const = 0;
-
- virtual bool get_module_and_message_path_input(
+
+ virtual bool get_module_and_message_path_input(
TString* str, TString generator_file_name,
bool generate_in_pb2_grpc, TString import_prefix,
const std::vector<TString>& prefixes_to_filter) const = 0;
- virtual bool get_module_and_message_path_output(
+ virtual bool get_module_and_message_path_output(
TString* str, TString generator_file_name,
bool generate_in_pb2_grpc, TString import_prefix,
const std::vector<TString>& prefixes_to_filter) const = 0;
-
+
virtual TString get_input_type_name() const = 0;
virtual TString get_output_type_name() const = 0;
- virtual bool NoStreaming() const = 0;
- virtual bool ClientStreaming() const = 0;
- virtual bool ServerStreaming() const = 0;
- virtual bool BidiStreaming() const = 0;
-};
-
-// An abstract interface representing a service.
-struct Service : public CommentHolder {
- virtual ~Service() {}
-
+ virtual bool NoStreaming() const = 0;
+ virtual bool ClientStreaming() const = 0;
+ virtual bool ServerStreaming() const = 0;
+ virtual bool BidiStreaming() const = 0;
+};
+
+// An abstract interface representing a service.
+struct Service : public CommentHolder {
+ virtual ~Service() {}
+
virtual TString name() const = 0;
-
- virtual int method_count() const = 0;
- virtual std::unique_ptr<const Method> method(int i) const = 0;
-};
-
-struct Printer {
- virtual ~Printer() {}
-
+
+ virtual int method_count() const = 0;
+ virtual std::unique_ptr<const Method> method(int i) const = 0;
+};
+
+struct Printer {
+ virtual ~Printer() {}
+
virtual void Print(const std::map<TString, TString>& vars,
- const char* template_string) = 0;
- virtual void Print(const char* string) = 0;
- virtual void PrintRaw(const char* string) = 0;
- virtual void Indent() = 0;
- virtual void Outdent() = 0;
-};
-
-// An interface that allows the source generated to be output using various
-// libraries/idls/serializers.
-struct File : public CommentHolder {
- virtual ~File() {}
-
+ const char* template_string) = 0;
+ virtual void Print(const char* string) = 0;
+ virtual void PrintRaw(const char* string) = 0;
+ virtual void Indent() = 0;
+ virtual void Outdent() = 0;
+};
+
+// An interface that allows the source generated to be output using various
+// libraries/idls/serializers.
+struct File : public CommentHolder {
+ virtual ~File() {}
+
virtual TString filename() const = 0;
virtual TString filename_without_ext() const = 0;
virtual TString package() const = 0;
virtual std::vector<TString> package_parts() const = 0;
virtual TString additional_headers() const = 0;
virtual std::vector<TString> GetImportNames() const { return {}; }
-
- virtual int service_count() const = 0;
- virtual std::unique_ptr<const Service> service(int i) const = 0;
-
+
+ virtual int service_count() const = 0;
+ virtual std::unique_ptr<const Service> service(int i) const = 0;
+
virtual std::unique_ptr<Printer> CreatePrinter(TString* str) const = 0;
-};
-} // namespace grpc_generator
-
-#endif // GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H
+};
+} // namespace grpc_generator
+
+#endif // GRPC_INTERNAL_COMPILER_SCHEMA_INTERFACE_H