void evaluate(StringBuffer& output) { StringBuffer variable; bool in_variable = false; for(const char* i = m_string.c_str(); *i != '\0'; ++i) { if(!in_variable) { switch(*i) { case '[': in_variable = true; break; default: output.push_back(*i); break; } } else { switch(*i) { case ']': in_variable = false; output.push_string(build_get_variable(variable.c_str())); variable.clear(); break; default: variable.push_back(*i); break; } } } }
std::size_t write(const char* buffer, std::size_t length) { for(const char* end = buffer + length; buffer != end; ++buffer) { if(*buffer == '_') { m_buffer.push_back('_'); } m_buffer.push_back(*buffer); } return length; }
void push_back(char c) // not escaped { m_buffer.push_back(c); }
EscapedMnemonic(std::size_t capacity) : m_buffer(capacity) { m_buffer.push_back('_'); }