OMNeT++ Simulation Library  5.6.1
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.

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:

  • "" matches nothing
  • "node*"
  • "node* or host*"
  • "node* or host* or className(StandardHost*)"
  • "packet-* and className(PPPFrame)"
  • "className(TCPSegment) and not kind({0..2}) and SYN or data-*"
  • "className(TCPSegment) or byteLength({4096..})

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)
 

Constructor & Destructor Documentation

◆ cMatchExpression() [1/2]

Constructor

◆ cMatchExpression() [2/2]

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

Constructor, accepts the same args as setPattern().

◆ ~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)

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: