|
|
|
@ -92,8 +92,8 @@ bool HasBidiStreaming(const google::protobuf::FileDescriptor* file) { |
|
|
|
|
} |
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
string GetHeaderIncludes(const google::protobuf::FileDescriptor* file) { |
|
|
|
|
string temp = |
|
|
|
|
std::string GetHeaderIncludes(const google::protobuf::FileDescriptor* file) { |
|
|
|
|
std::string temp = |
|
|
|
|
"#include \"grpc++/impl/internal_stub.h\"\n" |
|
|
|
|
"#include \"grpc++/status.h\"\n" |
|
|
|
|
"\n" |
|
|
|
@ -121,7 +121,7 @@ string GetHeaderIncludes(const google::protobuf::FileDescriptor* file) { |
|
|
|
|
return temp; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
string GetSourceIncludes() { |
|
|
|
|
std::string GetSourceIncludes() { |
|
|
|
|
return "#include \"grpc++/channel_interface.h\"\n" |
|
|
|
|
"#include \"grpc++/impl/rpc_method.h\"\n" |
|
|
|
|
"#include \"grpc++/impl/rpc_service_method.h\"\n" |
|
|
|
@ -130,7 +130,7 @@ string GetSourceIncludes() { |
|
|
|
|
|
|
|
|
|
void PrintHeaderClientMethod(google::protobuf::io::Printer* printer, |
|
|
|
|
const google::protobuf::MethodDescriptor* method, |
|
|
|
|
map<string, string>* vars) { |
|
|
|
|
std::map<std::string, std::string>* vars) { |
|
|
|
|
(*vars)["Method"] = method->name(); |
|
|
|
|
(*vars)["Request"] = |
|
|
|
|
grpc_cpp_generator::ClassName(method->input_type(), true); |
|
|
|
@ -159,7 +159,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer* printer, |
|
|
|
|
|
|
|
|
|
void PrintHeaderServerMethod(google::protobuf::io::Printer* printer, |
|
|
|
|
const google::protobuf::MethodDescriptor* method, |
|
|
|
|
map<string, string>* vars) { |
|
|
|
|
std::map<std::string, std::string>* vars) { |
|
|
|
|
(*vars)["Method"] = method->name(); |
|
|
|
|
(*vars)["Request"] = |
|
|
|
|
grpc_cpp_generator::ClassName(method->input_type(), true); |
|
|
|
@ -193,7 +193,7 @@ void PrintHeaderServerMethod(google::protobuf::io::Printer* printer, |
|
|
|
|
|
|
|
|
|
void PrintHeaderService(google::protobuf::io::Printer* printer, |
|
|
|
|
const google::protobuf::ServiceDescriptor* service, |
|
|
|
|
map<string, string>* vars) { |
|
|
|
|
std::map<std::string, std::string>* vars) { |
|
|
|
|
(*vars)["Service"] = service->name(); |
|
|
|
|
|
|
|
|
|
printer->Print(*vars, |
|
|
|
@ -238,11 +238,11 @@ void PrintHeaderService(google::protobuf::io::Printer* printer, |
|
|
|
|
printer->Print("};\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
string GetHeaderServices(const google::protobuf::FileDescriptor* file) { |
|
|
|
|
string output; |
|
|
|
|
std::string GetHeaderServices(const google::protobuf::FileDescriptor* file) { |
|
|
|
|
std::string output; |
|
|
|
|
google::protobuf::io::StringOutputStream output_stream(&output); |
|
|
|
|
google::protobuf::io::Printer printer(&output_stream, '$'); |
|
|
|
|
map<string, string> vars; |
|
|
|
|
std::map<std::string, std::string> vars; |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < file->service_count(); ++i) { |
|
|
|
|
PrintHeaderService(&printer, file->service(i), &vars); |
|
|
|
@ -253,7 +253,7 @@ string GetHeaderServices(const google::protobuf::FileDescriptor* file) { |
|
|
|
|
|
|
|
|
|
void PrintSourceClientMethod(google::protobuf::io::Printer* printer, |
|
|
|
|
const google::protobuf::MethodDescriptor* method, |
|
|
|
|
map<string, string>* vars) { |
|
|
|
|
std::map<std::string, std::string>* vars) { |
|
|
|
|
(*vars)["Method"] = method->name(); |
|
|
|
|
(*vars)["Request"] = |
|
|
|
|
grpc_cpp_generator::ClassName(method->input_type(), true); |
|
|
|
@ -311,7 +311,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer* printer, |
|
|
|
|
|
|
|
|
|
void PrintSourceServerMethod(google::protobuf::io::Printer* printer, |
|
|
|
|
const google::protobuf::MethodDescriptor* method, |
|
|
|
|
map<string, string>* vars) { |
|
|
|
|
std::map<std::string, std::string>* vars) { |
|
|
|
|
(*vars)["Method"] = method->name(); |
|
|
|
|
(*vars)["Request"] = |
|
|
|
|
grpc_cpp_generator::ClassName(method->input_type(), true); |
|
|
|
@ -361,7 +361,7 @@ void PrintSourceServerMethod(google::protobuf::io::Printer* printer, |
|
|
|
|
|
|
|
|
|
void PrintSourceService(google::protobuf::io::Printer* printer, |
|
|
|
|
const google::protobuf::ServiceDescriptor* service, |
|
|
|
|
map<string, string>* vars) { |
|
|
|
|
std::map<std::string, std::string>* vars) { |
|
|
|
|
(*vars)["Service"] = service->name(); |
|
|
|
|
printer->Print( |
|
|
|
|
*vars, |
|
|
|
@ -455,11 +455,11 @@ void PrintSourceService(google::protobuf::io::Printer* printer, |
|
|
|
|
printer->Print("}\n\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
string GetSourceServices(const google::protobuf::FileDescriptor* file) { |
|
|
|
|
string output; |
|
|
|
|
std::string GetSourceServices(const google::protobuf::FileDescriptor* file) { |
|
|
|
|
std::string output; |
|
|
|
|
google::protobuf::io::StringOutputStream output_stream(&output); |
|
|
|
|
google::protobuf::io::Printer printer(&output_stream, '$'); |
|
|
|
|
map<string, string> vars; |
|
|
|
|
std::map<std::string, std::string> vars; |
|
|
|
|
// Package string is empty or ends with a dot. It is used to fully qualify
|
|
|
|
|
// method names.
|
|
|
|
|
vars["Package"] = file->package(); |
|
|
|
|