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 def92edec6..fb429784bb 100644 --- a/src/compiler/ruby_generator_string-inl.h +++ b/src/compiler/ruby_generator_string-inl.h @@ -31,8 +31,8 @@ using std::transform; namespace grpc_ruby_generator { // Split splits a string using char into elems. -inline std::vector<grpc::string> &Split(const grpc::string &s, char delim, - std::vector<grpc::string> *elems) { +inline std::vector<grpc::string>& Split(const grpc::string& s, char delim, + std::vector<grpc::string>* elems) { std::stringstream ss(s); grpc::string item; while (getline(ss, item, delim)) { @@ -42,15 +42,15 @@ inline std::vector<grpc::string> &Split(const grpc::string &s, char delim, } // Split splits a string using char, returning the result in a vector. -inline std::vector<grpc::string> Split(const grpc::string &s, char delim) { +inline std::vector<grpc::string> Split(const grpc::string& s, char delim) { std::vector<grpc::string> elems; Split(s, delim, &elems); return elems; } // Replace replaces from with to in s. -inline grpc::string Replace(grpc::string s, const grpc::string &from, - const grpc::string &to) { +inline grpc::string Replace(grpc::string s, const grpc::string& from, + const grpc::string& to) { size_t start_pos = s.find(from); if (start_pos == grpc::string::npos) { return s; @@ -60,8 +60,8 @@ inline grpc::string Replace(grpc::string s, const grpc::string &from, } // ReplaceAll replaces all instances of search with replace in s. -inline grpc::string ReplaceAll(grpc::string s, const grpc::string &search, - const grpc::string &replace) { +inline grpc::string ReplaceAll(grpc::string s, const grpc::string& search, + const grpc::string& replace) { size_t pos = 0; while ((pos = s.find(search, pos)) != grpc::string::npos) { s.replace(pos, search.length(), replace); @@ -71,8 +71,8 @@ inline grpc::string ReplaceAll(grpc::string s, const grpc::string &search, } // ReplacePrefix replaces from with to in s if search is a prefix of s. -inline bool ReplacePrefix(grpc::string *s, const grpc::string &from, - const grpc::string &to) { +inline bool ReplacePrefix(grpc::string* s, const grpc::string& from, + const grpc::string& to) { size_t start_pos = s->find(from); if (start_pos == grpc::string::npos || start_pos != 0) { return false; @@ -91,8 +91,8 @@ inline grpc::string CapitalizeFirst(grpc::string s) { } // RubyTypeOf updates a proto type to the required ruby equivalent. -inline grpc::string RubyTypeOf(const grpc::string &a_type, - const grpc::string &package) { +inline grpc::string RubyTypeOf(const grpc::string& a_type, + const grpc::string& package) { grpc::string res(a_type); ReplacePrefix(&res, package, ""); // remove the leading package if present ReplacePrefix(&res, ".", ""); // remove the leading . (no package) |