| 287 | } |
| 288 | |
| 289 | string ToCamelCase(const string& str) { |
| 290 | string result; |
| 291 | const char joiner = '_'; |
| 292 | size_t i = 0; |
| 293 | bool cap = true; |
| 294 | while (i < str.size()) { |
| 295 | const char c = str[i++]; |
| 296 | if (c == joiner) { |
| 297 | cap = true; |
| 298 | } else if (cap) { |
| 299 | result += toupper(c); |
| 300 | cap = false; |
| 301 | } else { |
| 302 | result += c; |
| 303 | } |
| 304 | } |
| 305 | return result; |
| 306 | } |
| 307 | |
| 308 | // Returns a <string, bool> pair. The string is the C++ type name to be used for |
| 309 | // attr_type when defining an object of that type. The bool is a flag to |
no test coverage detected