OMNeT++ Simulation Library  6.0.3
cMatchExpression Class Reference

#include <cmatchexpression.h>

Description

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.

Matches various fields of an object. 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, and 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.

Field names and patterns that do not contain whitespace, a left or right parenthesis or the "=~" sequence can be written without quotation marks. When a field name or pattern is enclosed in quotation marks, it is interpreted similar to a string constant in C/C++ regarding the use of backslashes, i.e. "\t" becomes a tab, "\\" a single backslash, etc.

Inheritance diagram for cMatchExpression:
noncopyable

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 (cMatchExpression &&other)
 
 ~cMatchExpression ()
 
void setPattern (const char *pattern, bool dottedpath, bool fullstring, bool casesensitive)
 
bool matches (const Matchable *object) const
 

Constructor & Destructor Documentation

◆ cMatchExpression() [1/3]

Constructor

◆ cMatchExpression() [2/3]

cMatchExpression ( const char *  pattern,
bool  dottedpath,
bool  fullstring,
bool  casesensitive 
)

Constructor, accepts the same args as setPattern().

◆ cMatchExpression() [3/3]

cMatchExpression ( cMatchExpression &&  other)
inline

Move constructor

◆ ~cMatchExpression()

Destructor

Member Function Documentation

◆ setPattern()

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.

◆ matches()

bool matches ( const Matchable object) const

Returns true if the line matches the pattern with the given settings. See setPattern().


The documentation for this class was generated from the following file: