1 #include <string> 2 #include <vector> 3 4 namespace android { 5 namespace stream_proto { 6 7 using namespace std; 8 9 // Indent 10 const string INDENT = " "; 11 12 /** 13 * Capitalizes the string, removes underscores and makes the next letter 14 * capitalized, and makes the letter following numbers capitalized. 15 */ 16 string to_camel_case(const string& str); 17 18 /** 19 * Capitalize and insert underscores for CamelCase. 20 */ 21 string make_constant_name(const string& str); 22 23 /** 24 * Returns the part of a file name that isn't a path and isn't a type suffix. 25 */ 26 string file_base_name(const string& str); 27 28 /** 29 * Replaces all occurances of 'replace' with 'with'. 30 */ 31 string replace_string(const string& str, const char replace, const char with); 32 33 /** 34 * Splits a string to parts by delimiter. 35 */ 36 vector<string> split(const string& str, const char delimiter); 37 38 /** 39 * Returns the rest of str if it has prefix, otherwise return all. 40 */ 41 string stripPrefix(const string& str, const string& prefix); 42 43 } // namespace stream_proto 44 } // namespace android 45 46