diff options
Diffstat (limited to 'src/compiler/ruby_generator_string-inl.h')
-rw-r--r-- | src/compiler/ruby_generator_string-inl.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/compiler/ruby_generator_string-inl.h b/src/compiler/ruby_generator_string-inl.h index a253f78d49..d24a61b9f5 100644 --- a/src/compiler/ruby_generator_string-inl.h +++ b/src/compiler/ruby_generator_string-inl.h @@ -45,8 +45,8 @@ using std::transform; namespace grpc_ruby_generator { // Split splits a string using char into elems. -inline std::vector<std::string>& Split(const std::string& s, char delim, - std::vector<std::string>* elems) { +inline std::vector<std::string> &Split(const std::string &s, char delim, + std::vector<std::string> *elems) { std::stringstream ss(s); std::string item; while (getline(ss, item, delim)) { @@ -56,15 +56,15 @@ inline std::vector<std::string>& Split(const std::string& s, char delim, } // Split splits a string using char, returning the result in a vector. -inline std::vector<std::string> Split(const std::string& s, char delim) { +inline std::vector<std::string> Split(const std::string &s, char delim) { std::vector<std::string> elems; Split(s, delim, &elems); return elems; } // Replace replaces from with to in s. -inline std::string Replace(std::string s, const std::string& from, - const std::string& to) { +inline std::string Replace(std::string s, const std::string &from, + const std::string &to) { size_t start_pos = s.find(from); if (start_pos == std::string::npos) { return s; @@ -74,8 +74,8 @@ inline std::string Replace(std::string s, const std::string& from, } // ReplaceAll replaces all instances of search with replace in s. -inline std::string ReplaceAll(std::string s, const std::string& search, - const std::string& replace) { +inline std::string ReplaceAll(std::string s, const std::string &search, + const std::string &replace) { size_t pos = 0; while ((pos = s.find(search, pos)) != std::string::npos) { s.replace(pos, search.length(), replace); @@ -85,8 +85,8 @@ inline std::string ReplaceAll(std::string s, const std::string& search, } // ReplacePrefix replaces from with to in s if search is a prefix of s. -inline bool ReplacePrefix(std::string* s, const std::string& from, - const std::string& to) { +inline bool ReplacePrefix(std::string *s, const std::string &from, + const std::string &to) { size_t start_pos = s->find(from); if (start_pos == std::string::npos || start_pos != 0) { return false; @@ -105,8 +105,8 @@ inline std::string CapitalizeFirst(std::string s) { } // RubyTypeOf updates a proto type to the required ruby equivalent. -inline std::string RubyTypeOf(const std::string& a_type, - const std::string& package) { +inline std::string RubyTypeOf(const std::string &a_type, + const std::string &package) { std::string res(a_type); ReplacePrefix(&res, package, ""); // remove the leading package if present ReplacePrefix(&res, ".", ""); // remove the leading . (no package) |