OMNeT++ Simulation Library
5.6.1
|
#include <cmatchexpression.h>
Decides whether an object matches an expression.
Objects must implement, or be wrapped into an instance of, cMatchExpression::Matchable to be used with this class. Fields of the object will be queried via methods of Matchable.
By default, a pattern must match the "default field" of the object, which will usually be its name. Other fields can be matched with the fieldname(pattern) syntax. These elements can be combined with the AND, OR, NOT operators, accepted in both lowercase and uppercase. AND has higher precedence than OR, but parentheses can be used to change the evaluation order.
Patterns are those accepted by cPatternMatcher, that is, "*", "?", character ranges as "{a-z}", numeric ranges as "{0..999}", or bracketed numeric ranges as "[0..999]" (e.g. "*[90..100] matching "foo[95]") are accepted.
Pattern examples:
Classes | |
class | Matchable |
Objects to be matched must implement this interface. More... | |
Public Member Functions | |
cMatchExpression () | |
cMatchExpression (const char *pattern, bool dottedpath, bool fullstring, bool casesensitive) | |
~cMatchExpression () | |
void | setPattern (const char *pattern, bool dottedpath, bool fullstring, bool casesensitive) |
bool | matches (const Matchable *object) |
cMatchExpression | ( | ) |
Constructor
cMatchExpression | ( | const char * | pattern, |
bool | dottedpath, | ||
bool | fullstring, | ||
bool | casesensitive | ||
) |
Constructor, accepts the same args as setPattern().
~cMatchExpression | ( | ) |
Destructor
void setPattern | ( | const char * | pattern, |
bool | dottedpath, | ||
bool | fullstring, | ||
bool | casesensitive | ||
) |
Sets the pattern to be used by subsequent calls to matches(). See the general class description for the meaning of the rest of the arguments. Throws cException if the pattern is bogus.
bool matches | ( | const Matchable * | object | ) |
Returns true if the line matches the pattern with the given settings. See setPattern().