Merge pull request #10950 from jeady/service_name_metadata

Add static method to generated code to return fully qualified protobuf service name
pull/10999/head
Yang Gao 8 years ago committed by GitHub
commit f31a80eac3
  1. 6
      src/compiler/cpp_generator.cc
  2. 6
      test/cpp/codegen/compiler_test_golden

@ -804,6 +804,12 @@ void PrintHeaderService(grpc_generator::Printer *printer,
" public:\n");
printer->Indent();
// Service metadata
printer->Print(*vars,
"static constexpr char const* service_full_name() {\n"
" return \"$Package$$Service$\";\n"
"}\n");
// Client side
printer->Print(
"class StubInterface {\n"

@ -69,6 +69,9 @@ namespace testing {
// ServiceA leading comment 1
class ServiceA final {
public:
static constexpr char const* service_full_name() {
return "grpc.testing.ServiceA";
}
class StubInterface {
public:
virtual ~StubInterface() {}
@ -373,6 +376,9 @@ class ServiceA final {
// ServiceB leading comment 1
class ServiceB final {
public:
static constexpr char const* service_full_name() {
return "grpc.testing.ServiceB";
}
class StubInterface {
public:
virtual ~StubInterface() {}

Loading…
Cancel
Save