diff options
author | Nicolas Noble <nnoble@google.com> | 2015-03-12 17:22:33 -0700 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-03-13 02:03:01 +0100 |
commit | d446eb86fae18df3c473c96676da5bcf4f69178c (patch) | |
tree | bd1d84ca73d0694e2eaad96583e67b7a5de3ab01 /src/compiler/cpp_generator_helpers.h | |
parent | e758ed16aa0fe3ec085f45a4c1ad642b8ddd50fc (diff) |
Adding initial support for alternative protobuf libraries.
Diffstat (limited to 'src/compiler/cpp_generator_helpers.h')
-rw-r--r-- | src/compiler/cpp_generator_helpers.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/compiler/cpp_generator_helpers.h b/src/compiler/cpp_generator_helpers.h index 16abbde8d4..be68cbe695 100644 --- a/src/compiler/cpp_generator_helpers.h +++ b/src/compiler/cpp_generator_helpers.h @@ -35,30 +35,28 @@ #define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H #include <map> -#include <string> -#include <google/protobuf/descriptor.h> -#include <google/protobuf/descriptor.pb.h> +#include "src/compiler/config.h" #include "src/compiler/generator_helpers.h" namespace grpc_cpp_generator { -inline std::string DotsToColons(const std::string &name) { +inline grpc::string DotsToColons(const grpc::string &name) { return grpc_generator::StringReplace(name, ".", "::"); } -inline std::string DotsToUnderscores(const std::string &name) { +inline grpc::string DotsToUnderscores(const grpc::string &name) { return grpc_generator::StringReplace(name, ".", "_"); } -inline std::string ClassName(const google::protobuf::Descriptor *descriptor, - bool qualified) { +inline grpc::string ClassName(const grpc::protobuf::Descriptor *descriptor, + bool qualified) { // Find "outer", the descriptor of the top-level message in which // "descriptor" is embedded. - const google::protobuf::Descriptor *outer = descriptor; + const grpc::protobuf::Descriptor *outer = descriptor; while (outer->containing_type() != NULL) outer = outer->containing_type(); - const std::string &outer_name = outer->full_name(); - std::string inner_name = descriptor->full_name().substr(outer_name.size()); + const grpc::string &outer_name = outer->full_name(); + grpc::string inner_name = descriptor->full_name().substr(outer_name.size()); if (qualified) { return "::" + DotsToColons(outer_name) + DotsToUnderscores(inner_name); |