diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-02-27 21:50:58 +0100 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-02-27 21:50:58 +0100 |
commit | 93fa09812464d5100b23a75dd52906c0ca61efec (patch) | |
tree | 344944de9f75826e0da219f802e549a12cc06a8b /src/compiler/cpp_generator_helpers.h | |
parent | 1c94bf98066fe696b4b58ea6941353f2d9b13d08 (diff) |
Removing private protobuf header inclusion.
Diffstat (limited to 'src/compiler/cpp_generator_helpers.h')
-rw-r--r-- | src/compiler/cpp_generator_helpers.h | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/src/compiler/cpp_generator_helpers.h b/src/compiler/cpp_generator_helpers.h index e3c76e0291..632ff3c8cf 100644 --- a/src/compiler/cpp_generator_helpers.h +++ b/src/compiler/cpp_generator_helpers.h @@ -38,50 +38,16 @@ #include <string> #include <google/protobuf/descriptor.h> #include <google/protobuf/descriptor.pb.h> +#include "src/compiler/generator_helpers.h" namespace grpc_cpp_generator { -inline bool StripSuffix(std::string *filename, const std::string &suffix) { - if (filename->length() >= suffix.length()) { - size_t suffix_pos = filename->length() - suffix.length(); - if (filename->compare(suffix_pos, std::string::npos, suffix) == 0) { - filename->resize(filename->size() - suffix.size()); - return true; - } - } - - return false; -} - -inline std::string StripProto(std::string filename) { - if (!StripSuffix(&filename, ".protodevel")) { - StripSuffix(&filename, ".proto"); - } - return filename; -} - -inline std::string StringReplace(std::string str, const std::string &from, - const std::string &to) { - size_t pos = 0; - - for (;;) { - pos = str.find(from, pos); - if (pos == std::string::npos) { - break; - } - str.replace(pos, from.length(), to); - pos += to.length(); - } - - return str; -} - inline std::string DotsToColons(const std::string &name) { - return StringReplace(name, ".", "::"); + return grpc_generator::StringReplace(name, ".", "::"); } inline std::string DotsToUnderscores(const std::string &name) { - return StringReplace(name, ".", "_"); + return grpc_generator::StringReplace(name, ".", "_"); } inline std::string ClassName(const google::protobuf::Descriptor *descriptor, |