|
| | StringMapper (const std::string &format="", const std::string &validChars="[a-zA-Z0-9_]+", bool formatting=true) |
| | Default constructor.
|
| |
|
| StringMapper (const RegExp ®exp, bool formatting=true) |
| | Initialize with the given RegExp // REMOVE!
|
| |
|
| StringMapper (const StringMapper &mapper) |
| | Copy constructor copies the parsed string and the regExp.
|
| |
|
StringMapper & | setValidChars (const std::string &chars) |
| |
| StringMapper & | enableFormatting (bool formatting) |
| | Enable variable formatting, followed by pipe '|'.
|
| |
| StringMapper & | parse (const std::string &s, bool convertEscaped=false) |
| | Converts a std::string containing variables like in "Hello, ${NAME}!" to a list of StringLet's.
|
| |
|
bool | isLiteral () const |
| | Return true, if all the elements are literal.
|
| |
| std::ostream & | toStream (std::ostream &ostr) const |
| | Output a concatenated chain of stringlets: literals as such and variables surrounded with "${" and "}".
|
| |
| template<class T > |
| std::ostream & | toStream (std::ostream &ostr, const std::map< std::string, T > &variables, int replace=0, const VariableFormatter< T > &formatter=VariableFormatter< T >()) const |
| | Expands the variables in the last.
|
| |
| template<class T > |
| std::string | toStr (const std::map< std::string, T > &m, int replaceChar=-1, const VariableFormatter< T > &formatter=VariableFormatter< T >()) const |
| | Expands the variables in the last parsed std::string to a std::string.
|
| |
| template<class T > |
| void | expand (const std::map< std::string, T > &m, const VariableFormatter< T > &formatter=VariableFormatter< T >(), bool clear=false) |
| | Expands the variables in StringMapper, turning expanded variables to constants.
|
| |
|
template<class T > |
| std::ostream & | debug (std::ostream &ostr, const std::map< std::string, T > &m) const |
| | Dumps the list of StringLet's.
|
| |
A tool for expanding variables embedded in a std::string to literals.
The input variables are provided as a map, which is allowed to change dynamically. The input std::string, issued with parse(), contains the variables as "$key" or "${key}", a format familiar in Unix shell.