aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler/generator_helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/generator_helpers.h')
-rw-r--r--src/compiler/generator_helpers.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler/generator_helpers.h b/src/compiler/generator_helpers.h
index e1bb66a875..3ed0500efc 100644
--- a/src/compiler/generator_helpers.h
+++ b/src/compiler/generator_helpers.h
@@ -52,6 +52,16 @@ inline bool StripSuffix(grpc::string *filename, const grpc::string &suffix) {
return false;
}
+inline bool StripPrefix(grpc::string *name, const grpc::string &prefix) {
+ if (name->length() >= prefix.length()) {
+ if (name->substr(0, prefix.size()) == prefix) {
+ *name = name->substr(prefix.size());
+ return true;
+ }
+ }
+ return false;
+}
+
inline grpc::string StripProto(grpc::string filename) {
if (!StripSuffix(&filename, ".protodevel")) {
StripSuffix(&filename, ".proto");