aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler/generator_helpers.h
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2016-02-26 11:10:33 -0800
committerGravatar murgatroid99 <mlumish@google.com>2016-02-26 11:10:33 -0800
commitd2ee81fcd4b1e9dd6f7dbfefc796de7dd20d0b5e (patch)
treeb49c48f8f9be9118c1114d50523c5105c819b72f /src/compiler/generator_helpers.h
parentc15cd723ebabbab4825480032b56a2ddd9a8b76b (diff)
Created a Node grpc plugin
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");