From 93fa09812464d5100b23a75dd52906c0ca61efec Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 27 Feb 2015 21:50:58 +0100 Subject: Removing private protobuf header inclusion. --- src/compiler/python_generator.cc | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src/compiler/python_generator.cc') diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index ae4d65df4c..b8d4aa509b 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -40,20 +40,19 @@ #include #include +#include "src/compiler/generator_helpers.h" #include "src/compiler/python_generator.h" #include #include #include #include -#include +using grpc_generator::StringReplace; +using grpc_generator::StripProto; using google::protobuf::Descriptor; using google::protobuf::FileDescriptor; -using google::protobuf::HasSuffixString; using google::protobuf::MethodDescriptor; using google::protobuf::ServiceDescriptor; -using google::protobuf::StripString; -using google::protobuf::StripSuffixString; using google::protobuf::io::Printer; using google::protobuf::io::StringOutputStream; using std::initializer_list; @@ -197,18 +196,12 @@ bool PrintStub(const ServiceDescriptor* service, return true; } -// TODO(protobuf team): See TODO for `ModuleName`. -string StripProto(const string& filename) { - const char* suffix = HasSuffixString(filename, ".protodevel") - ? ".protodevel" : ".proto"; - return StripSuffixString(filename, suffix); -} // TODO(protobuf team): Export `ModuleName` from protobuf's // `src/google/protobuf/compiler/python/python_generator.cc` file. string ModuleName(const string& filename) { string basename = StripProto(filename); - StripString(&basename, "-", '_'); - StripString(&basename, "/", '.'); + basename = StringReplace(basename, "-", "_"); + basename = StringReplace(basename, "/", "."); return basename + "_pb2"; } -- cgit v1.2.3