Skip to content
Snippets Groups Projects
Commit 3b264510 authored by James Eady's avatar James Eady
Browse files

Add static method to generated code to return fully qualified protobuf service name.

parent 305dcf3d
No related branches found
No related tags found
No related merge requests found
...@@ -804,6 +804,13 @@ void PrintHeaderService(grpc_generator::Printer *printer, ...@@ -804,6 +804,13 @@ void PrintHeaderService(grpc_generator::Printer *printer,
" public:\n"); " public:\n");
printer->Indent(); printer->Indent();
// Service metadata
printer->Print(
*vars,
"static constexpr char const* service_full_name() {\n"
" return \"$Package$$Service$\";\n"
"}\n");
// Client side // Client side
printer->Print( printer->Print(
"class StubInterface {\n" "class StubInterface {\n"
......
...@@ -69,6 +69,9 @@ namespace testing { ...@@ -69,6 +69,9 @@ namespace testing {
// ServiceA leading comment 1 // ServiceA leading comment 1
class ServiceA final { class ServiceA final {
public: public:
static constexpr char const* service_full_name() {
return "grpc.testing.ServiceA";
}
class StubInterface { class StubInterface {
public: public:
virtual ~StubInterface() {} virtual ~StubInterface() {}
...@@ -373,6 +376,9 @@ class ServiceA final { ...@@ -373,6 +376,9 @@ class ServiceA final {
// ServiceB leading comment 1 // ServiceB leading comment 1
class ServiceB final { class ServiceB final {
public: public:
static constexpr char const* service_full_name() {
return "grpc.testing.ServiceB";
}
class StubInterface { class StubInterface {
public: public:
virtual ~StubInterface() {} virtual ~StubInterface() {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment