|
|
|
@ -60,9 +60,34 @@ void PrintProtoRpcDeclarationAsPragma(Printer *printer, |
|
|
|
|
" returns ($server_stream$$response_type$)\n\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename DescriptorType> |
|
|
|
|
static void PrintAllComments(const DescriptorType* desc, Printer* printer) { |
|
|
|
|
std::vector<grpc::string> comments; |
|
|
|
|
grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_LEADING_DETACHED, |
|
|
|
|
&comments); |
|
|
|
|
grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_LEADING, |
|
|
|
|
&comments); |
|
|
|
|
grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_TRAILING, |
|
|
|
|
&comments); |
|
|
|
|
if (comments.empty()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
printer->Print("/**\n"); |
|
|
|
|
for (auto it = comments.begin(); it != comments.end(); ++it) { |
|
|
|
|
printer->Print(" * "); |
|
|
|
|
size_t start_pos = it->find_first_not_of(' '); |
|
|
|
|
if (start_pos != grpc::string::npos) { |
|
|
|
|
printer->Print(it->c_str() + start_pos); |
|
|
|
|
} |
|
|
|
|
printer->Print("\n"); |
|
|
|
|
} |
|
|
|
|
printer->Print(" */\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void PrintMethodSignature(Printer *printer, const MethodDescriptor *method, |
|
|
|
|
const map< ::grpc::string, ::grpc::string> &vars) { |
|
|
|
|
// TODO(jcanizales): Print method comments.
|
|
|
|
|
// Print comment
|
|
|
|
|
PrintAllComments(method, printer); |
|
|
|
|
|
|
|
|
|
printer->Print(vars, "- ($return_type$)$method_name$With"); |
|
|
|
|
if (method->client_streaming()) { |
|
|
|
@ -195,8 +220,10 @@ void PrintMethodImplementations(Printer *printer, |
|
|
|
|
printer.Print("@end\n\n"); |
|
|
|
|
|
|
|
|
|
printer.Print( |
|
|
|
|
"// Basic service implementation, over gRPC, that only does" |
|
|
|
|
" marshalling and parsing.\n"); |
|
|
|
|
"/**\n" |
|
|
|
|
" * Basic service implementation, over gRPC, that only does\n" |
|
|
|
|
" * marshalling and parsing.\n" |
|
|
|
|
" */\n"); |
|
|
|
|
printer.Print(vars, |
|
|
|
|
"@interface $service_class$ :" |
|
|
|
|
" GRPCProtoService<$service_class$>\n"); |
|
|
|
|