Joe Onorato | 6c9547d | 2016-09-07 18:43:49 -0700 | [diff] [blame] | 1 | #include <string> |
Yi Jin | 0473f88b | 2017-10-09 11:21:40 -0700 | [diff] [blame] | 2 | #include <vector> |
Joe Onorato | 6c9547d | 2016-09-07 18:43:49 -0700 | [diff] [blame] | 3 | |
| 4 | namespace android { |
Yi Jin | 0473f88b | 2017-10-09 11:21:40 -0700 | [diff] [blame] | 5 | namespace stream_proto { |
Joe Onorato | 6c9547d | 2016-09-07 18:43:49 -0700 | [diff] [blame] | 6 | |
| 7 | using namespace std; |
| 8 | |
Yi Jin | f9ed04b | 2017-10-20 16:17:58 -0700 | [diff] [blame] | 9 | // Indent |
| 10 | const string INDENT = " "; |
| 11 | |
Joe Onorato | 6c9547d | 2016-09-07 18:43:49 -0700 | [diff] [blame] | 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 | /** |
Yi Jin | e2f7f79 | 2017-11-01 17:08:27 -0700 | [diff] [blame] | 29 | * Replaces all occurances of 'replace' with 'with'. |
Joe Onorato | 6c9547d | 2016-09-07 18:43:49 -0700 | [diff] [blame] | 30 | */ |
| 31 | string replace_string(const string& str, const char replace, const char with); |
| 32 | |
Yi Jin | 0473f88b | 2017-10-09 11:21:40 -0700 | [diff] [blame] | 33 | /** |
Yi Jin | e2f7f79 | 2017-11-01 17:08:27 -0700 | [diff] [blame] | 34 | * Splits a string to parts by delimiter. |
Yi Jin | 0473f88b | 2017-10-09 11:21:40 -0700 | [diff] [blame] | 35 | */ |
| 36 | vector<string> split(const string& str, const char delimiter); |
Joe Onorato | 6c9547d | 2016-09-07 18:43:49 -0700 | [diff] [blame] | 37 | |
Yi Jin | e2f7f79 | 2017-11-01 17:08:27 -0700 | [diff] [blame] | 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 | |
Yi Jin | 0473f88b | 2017-10-09 11:21:40 -0700 | [diff] [blame] | 43 | } // namespace stream_proto |
Joe Onorato | 6c9547d | 2016-09-07 18:43:49 -0700 | [diff] [blame] | 44 | } // namespace android |
| 45 | |