aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler/generator_helpers.h
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nnoble@google.com>2015-03-12 17:22:33 -0700
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-03-13 02:03:01 +0100
commitd446eb86fae18df3c473c96676da5bcf4f69178c (patch)
treebd1d84ca73d0694e2eaad96583e67b7a5de3ab01 /src/compiler/generator_helpers.h
parente758ed16aa0fe3ec085f45a4c1ad642b8ddd50fc (diff)
Adding initial support for alternative protobuf libraries.
Diffstat (limited to 'src/compiler/generator_helpers.h')
-rw-r--r--src/compiler/generator_helpers.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/compiler/generator_helpers.h b/src/compiler/generator_helpers.h
index 2035820f0d..1e6727dd4c 100644
--- a/src/compiler/generator_helpers.h
+++ b/src/compiler/generator_helpers.h
@@ -35,14 +35,15 @@
#define GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H
#include <map>
-#include <string>
+
+#include "src/compiler/config.h"
namespace grpc_generator {
-inline bool StripSuffix(std::string *filename, const std::string &suffix) {
+inline bool StripSuffix(grpc::string *filename, const grpc::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) {
+ if (filename->compare(suffix_pos, grpc::string::npos, suffix) == 0) {
filename->resize(filename->size() - suffix.size());
return true;
}
@@ -51,20 +52,20 @@ inline bool StripSuffix(std::string *filename, const std::string &suffix) {
return false;
}
-inline std::string StripProto(std::string filename) {
+inline grpc::string StripProto(grpc::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) {
+inline grpc::string StringReplace(grpc::string str, const grpc::string &from,
+ const grpc::string &to) {
size_t pos = 0;
for (;;) {
pos = str.find(from, pos);
- if (pos == std::string::npos) {
+ if (pos == grpc::string::npos) {
break;
}
str.replace(pos, from.length(), to);