aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler/cpp_generator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/cpp_generator.cc')
-rw-r--r--src/compiler/cpp_generator.cc21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index b133699306..9319c41934 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -86,7 +86,7 @@ void PrintIncludes(Printer *printer, const std::vector<grpc::string>& headers, c
}
}
-grpc::string GetHeaderPrologue(File *file, const Parameters &params) {
+grpc::string GetHeaderPrologue(File *file, const Parameters & /*params*/) {
grpc::string output;
{
// Scope the output stream so it closes and finalizes output to the string.
@@ -96,6 +96,7 @@ grpc::string GetHeaderPrologue(File *file, const Parameters &params) {
vars["filename"] = file->filename();
vars["filename_identifier"] = FilenameIdentifier(file->filename());
vars["filename_base"] = file->filename_without_ext();
+ vars["message_header_ext"] = file->message_header_ext();
printer->Print(vars, "// Generated by the gRPC protobuf plugin.\n");
printer->Print(vars,
@@ -104,7 +105,7 @@ grpc::string GetHeaderPrologue(File *file, const Parameters &params) {
printer->Print(vars, "#ifndef GRPC_$filename_identifier$__INCLUDED\n");
printer->Print(vars, "#define GRPC_$filename_identifier$__INCLUDED\n");
printer->Print(vars, "\n");
- printer->Print(vars, "#include \"$filename_base$.pb.h\"\n");
+ printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
printer->Print(vars, "\n");
}
return output;
@@ -794,8 +795,7 @@ grpc::string GetHeaderServices(File *file,
return output;
}
-grpc::string GetHeaderEpilogue(File *file,
- const Parameters &params) {
+grpc::string GetHeaderEpilogue(File *file, const Parameters & /*params*/) {
grpc::string output;
{
// Scope the output stream so it closes and finalizes output to the string.
@@ -821,8 +821,7 @@ grpc::string GetHeaderEpilogue(File *file,
return output;
}
-grpc::string GetSourcePrologue(File *file,
- const Parameters &params) {
+grpc::string GetSourcePrologue(File *file, const Parameters & /*params*/) {
grpc::string output;
{
// Scope the output stream so it closes and finalizes output to the string.
@@ -831,13 +830,16 @@ grpc::string GetSourcePrologue(File *file,
vars["filename"] = file->filename();
vars["filename_base"] = file->filename_without_ext();
+ vars["message_header_ext"] = file->message_header_ext();
+ vars["service_header_ext"] = file->service_header_ext();
printer->Print(vars, "// Generated by the gRPC protobuf 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$.pb.h\"\n");
- printer->Print(vars, "#include \"$filename_base$.grpc.pb.h\"\n");
+ printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
+ printer->Print(vars, "#include \"$filename_base$$service_header_ext$\"\n");
+ printer->Print(vars, file->additional_headers().c_str());
printer->Print(vars, "\n");
}
return output;
@@ -1180,8 +1182,7 @@ grpc::string GetSourceServices(File *file,
return output;
}
-grpc::string GetSourceEpilogue(File *file,
- const Parameters &params) {
+grpc::string GetSourceEpilogue(File *file, const Parameters & /*params*/) {
grpc::string temp;
if (!file->package().empty()) {