aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler
diff options
context:
space:
mode:
authorGravatar Mahak Mukhi <mmukhi@google.com>2017-04-13 13:28:16 -0700
committerGravatar Mahak Mukhi <mmukhi@google.com>2017-04-13 13:28:16 -0700
commit529e4c53854e89f22f66defd766a95ca0a96b0b6 (patch)
tree6a40240fb3a54a9aea0be6a35235c27f722ac76c /src/compiler
parent81b5d26b9363443324182b57dee4fe996291bafe (diff)
update according to new changes in cpp code
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/cpp_generator.cc32
-rw-r--r--src/compiler/cpp_generator.h24
2 files changed, 32 insertions, 24 deletions
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index 400627ecca..c13577ce52 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -1408,7 +1408,7 @@ grpc::string GetSourceEpilogue(grpc_generator::File *file,
}
// TODO(mmukhi): Make sure we need parameters or not.
-grpc::string GetMockPrologue(File *file, const Parameters & ) {
+grpc::string GetMockPrologue(grpc_generator::File *file, const Parameters & /*params*/ ) {
grpc::string output;
{
// Scope the output stream so it closes and finalizes output to the string.
@@ -1417,8 +1417,8 @@ grpc::string GetMockPrologue(File *file, const Parameters & ) {
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();
+ vars["message_header_ext"] = message_header_ext();
+ vars["service_header_ext"] = service_header_ext();
printer->Print(vars, "// Generated by the gRPC C++ plugin.\n");
printer->Print(vars,
@@ -1434,7 +1434,7 @@ grpc::string GetMockPrologue(File *file, const Parameters & ) {
}
// TODO(mmukhi): Add client-stream and completion-queue headers.
-grpc::string GetMockIncludes(File *file, const Parameters &params) {
+grpc::string GetMockIncludes(grpc_generator::File *file, const Parameters &params) {
grpc::string output;
{
// Scope the output stream so it closes and finalizes output to the string.
@@ -1463,9 +1463,9 @@ grpc::string GetMockIncludes(File *file, const Parameters &params) {
return output;
}
-void PrintMockClientMethods(
- Printer *printer, const Method *method,
- std::map<grpc::string, grpc::string> *vars) {
+void PrintMockClientMethods(grpc_generator::Printer *printer,
+ const grpc_generator::Method *method,
+ std::map<grpc::string, grpc::string> *vars) {
(*vars)["Method"] = method->name();
(*vars)["Request"] = method->input_type_name();
(*vars)["Response"] = method->output_type_name();
@@ -1481,7 +1481,7 @@ void PrintMockClientMethods(
"::grpc::ClientAsyncResponseReaderInterface< $Response$>*"
"(::grpc::ClientContext* context, const $Request$& request, "
"::grpc::CompletionQueue* cq));\n");
- } else if (method->ClientOnlyStreaming()) {
+ } else if (ClientOnlyStreaming(method)) {
printer->Print(
*vars,
"MOCK_METHOD2($Method$Raw, "
@@ -1493,7 +1493,7 @@ void PrintMockClientMethods(
"::grpc::ClientAsyncWriterInterface< $Request$>*"
"(::grpc::ClientContext* context, $Response$* response, "
"::grpc::CompletionQueue* cq, void* tag));\n");
- } else if (method->ServerOnlyStreaming()) {
+ } else if (ServerOnlyStreaming(method)) {
printer->Print(
*vars,
"MOCK_METHOD2($Method$Raw, "
@@ -1520,12 +1520,12 @@ void PrintMockClientMethods(
}
}
-void PrintMockService(Printer *printer,
- const Service *service,
+void PrintMockService(grpc_generator::Printer *printer,
+ const grpc_generator::Service *service,
std::map<grpc::string, grpc::string> *vars) {
(*vars)["Service"] = service->name();
- printer->Print(service->GetLeadingComments().c_str());
+ printer->Print(service->GetLeadingComments("//").c_str());
printer->Print(*vars,
"class Mock$Service$Stub : public $Service$::StubInterface {\n"
" public:\n");
@@ -1534,16 +1534,16 @@ void PrintMockService(Printer *printer,
"Mock$Service$Stub(){}\n"
"~Mock$Service$Stub(){}\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());
PrintMockClientMethods(printer, service->method(i).get(), vars);
- printer->Print(service->method(i)->GetTrailingComments().c_str());
+ printer->Print(service->method(i)->GetTrailingComments("//").c_str());
}
printer->Outdent();
printer->Print("};\n");
}
-grpc::string GetMockServices(File *file,
+grpc::string GetMockServices(grpc_generator::File *file,
const Parameters &params) {
grpc::string output;
{
@@ -1574,7 +1574,7 @@ grpc::string GetMockServices(File *file,
return output;
}
-grpc::string GetMockEpilogue(File *file, const Parameters &) {
+grpc::string GetMockEpilogue(grpc_generator::File *file, const Parameters & /*params*/) {
grpc::string temp;
if (!file->package().empty()) {
diff --git a/src/compiler/cpp_generator.h b/src/compiler/cpp_generator.h
index c59310f053..cd672d120d 100644
--- a/src/compiler/cpp_generator.h
+++ b/src/compiler/cpp_generator.h
@@ -100,28 +100,36 @@ grpc::string GetSourceEpilogue(grpc_generator::File *file,
const Parameters &params);
// Return the prologue of the generated mock file.
-grpc::string GetMockPrologue(File *file, const Parameters &params);
+grpc::string GetMockPrologue(grpc_generator::File *file,
+ const Parameters &params);
// Return the includes needed for generated mock file.
-grpc::string GetMockIncludes(File *file, const Parameters &params);
+grpc::string GetMockIncludes(grpc_generator::File *file,
+ const Parameters &params);
// Return the services for generated mock file.
-grpc::string GetMockServices(File* file, const Parameters &params);
+grpc::string GetMockServices(grpc_generator::File* file,
+ const Parameters &params);
// Return the epilogue of generated mock file.
-grpc::string GetMockEpilogue(File* file, const Parameters &params);
+grpc::string GetMockEpilogue(grpc_generator::File* file,
+ const Parameters &params);
// Return the prologue of the generated mock file.
-grpc::string GetMockPrologue(File *file, const Parameters &params);
+grpc::string GetMockPrologue(grpc_generator::File *file,
+ const Parameters &params);
// Return the includes needed for generated mock file.
-grpc::string GetMockIncludes(File *file, const Parameters &params);
+grpc::string GetMockIncludes(grpc_generator::File *file,
+ const Parameters &params);
// Return the services for generated mock file.
-grpc::string GetMockServices(File* file, const Parameters &params);
+grpc::string GetMockServices(grpc_generator::File* file,
+ const Parameters &params);
// Return the epilogue of generated mock file.
-grpc::string GetMockEpilogue(File* file, const Parameters &params);
+grpc::string GetMockEpilogue(grpc_generator::File* file,
+ const Parameters &params);
} // namespace grpc_cpp_generator