![]() |
|
General-purpose key matcher: tests string equality, or regExp, if defined as such. More...
#include <StringMatcher.h>


Public Member Functions | |
| StringMatcher (const std::string &s="") | |
| StringMatcher (const char *s) | |
| StringMatcher (const StringMatcher &matcher) | |
| bool | empty () const |
| void | set (const std::string &s) |
| Assign a string – which may be a literal or a regular expression. | |
| StringMatcher & | operator= (const std::string &s) |
| StringMatcher & | operator= (const StringMatcher &s) |
| bool | operator== (const std::string &s) const |
| bool | operator== (const char *s) const |
| bool | operator== (const StringMatcher &m) const |
| bool | test (const std::string &s) const |
| Test with direct string matching or regExp, if defined. | |
| const std::string & | getType () const |
Public Attributes | |
| const std::string & | value |
| A visible reference to the current string / regExp. | |
Static Public Attributes | |
| static const std::string | regExpSpecialChars = "^.?*[]()$" |
Protected Attributes | |
| bool | isRegExp |
| Checks if the key conforms to ODIM convention: DBZH, VRAD, etc. (capital letters, underscores) | |
Protected Attributes inherited from RegExp | |
| regex_t | regExpBinary |
| std::string | regExpString |
| result_t | writableResult |
| const std::vector< std::string > & | result |
| Public interface for the result. | |
| int | flags |
Additional Inherited Members | |
Protected Types inherited from RegExp | |
| typedef std::vector< std::string > | result_t |
| Native result type, also for external result object. | |
Protected Member Functions inherited from RegExp | |
| RegExp (const std::string &str="", int flags=REG_EXTENDED) | |
| Constructor. | |
| RegExp (const RegExp &r) | |
| Copy constructor. | |
| virtual | ~RegExp () |
| Destructor. | |
| RegExp & | operator= (const std::string &str) |
| RegExp & | operator= (const RegExp &r) |
| bool | setExpression (const std::string &str, int flags=REG_EXTENDED) |
| void | clear () |
| bool | isSet () const |
| void | reset () |
| bool | empty () const |
| Returns true, if expression is empty. | |
| void | setFlags (int flags) |
| bool | test (const std::string &str) const |
| Tests if the regular expression accepts the given std::string. | |
| template<class T > | |
| int | execute (const std::string &str, T &result) const |
| Apply regexp matching in a string. Returns 0 on success, REG_NOMATCH on failure. | |
| int | execute (const std::string &str) const |
| Variant using internal vector. | |
| void | replace (const std::string &src, const std::string &replacement, std::string &dst) const |
| Replaces std::string segment matching search regexp to the given std::string. | |
| void | replace (const std::string &src, const std::string &replacement, std::ostream &sstr) const |
| const std::string & | toStr () const |
Static Protected Member Functions inherited from RegExp | |
| static void | replace (const std::string &src, const std::string ®exp, const std::string &replacement, std::string &dst) |
| Replaces std::string segment matching search to the given std::string. | |
General-purpose key matcher: tests string equality, or regExp, if defined as such.
The internal value can be a literal string or a regular expression.
Empty string is a valid key - it accepts only an empty string. If you want to accept any string, use set(".*").
When setting the value, it is recognized as a literal if it contains no special characters.
|
protected |
Checks if the key conforms to ODIM convention: DBZH, VRAD, etc. (capital letters, underscores)
This is used for example by PaletteOp
static bool validateKey(const std::string & key);
1.9.8