CrystalSpace

Public API Reference

csRegExpMatcher Class Reference

Matcher for regular expressions. More...

#include <csutil/regexp.h>

List of all members.

Public Member Functions

 csRegExpMatcher (const csRegExpMatcher &other)
 Copy constructor.
 csRegExpMatcher (const char *pattern, bool extendedRE=false)
 Create a new RE matcher.
csRegExpMatchError Match (const char *string, csArray< csRegExpMatch > &matches, int flags=0)
 Match a string against the pattern.
csRegExpMatchError Match (const char *string, int flags=0)
 Match a string against the pattern.
csRegExpMatcheroperator= (const csRegExpMatcher &other)
 Assignment operator.
 ~csRegExpMatcher ()
 Destructor.


Detailed Description

Matcher for regular expressions.

Note:
Implementation note: if the platform supports it, this class wraps the runtime libraries POSIX.2 regular expression interface; otherwise, it uses a built-in implementation of POSIX.2 regular expression (borrowed from glibc.) Both of them utiltize "compilation" of pattern for faster repeated matching of the same pattern. Although compilation is transparent, you should be aware that calls to Match() with different flags than previous calls cause a recompilation of the pattern. Thus, to improve performance, same flags should be used for subsequent calls to Match().

Definition at line 153 of file regexp.h.


Constructor & Destructor Documentation

csRegExpMatcher::csRegExpMatcher ( const char *  pattern,
bool  extendedRE = false 
)

Create a new RE matcher.

Parameters:
pattern Pattern to match against.
extendedRE Treat the pattern as an extended regular expression, rather than as a basic regular expression.

csRegExpMatcher::csRegExpMatcher ( const csRegExpMatcher other  ) 

Copy constructor.

csRegExpMatcher::~csRegExpMatcher (  ) 

Destructor.


Member Function Documentation

csRegExpMatchError csRegExpMatcher::Match ( const char *  string,
csArray< csRegExpMatch > &  matches,
int  flags = 0 
)

Match a string against the pattern.

Parameters:
string String against which to attempt match.
matches Array receiving the locations of individual (sub)expression matches.
flags One or more of csRegExpMatchFlags. Flags are combined using the bitwise-or | operator.
Returns:
csrxNoError in case of success, else an error code.
Note:
Also check the "Implementation note" in the csRegExpMatcher description.

csRegExpMatchError csRegExpMatcher::Match ( const char *  string,
int  flags = 0 
)

Match a string against the pattern.

Parameters:
string String against which to attempt match.
flags One or more of csRegExpMatchFlags. Flags are combined using the bitwise-or | operator.
Returns:
csrxNoError in case of success, else an error code.
Note:
Also check the "Implementation note" in the csRegExpMatcher description.

Referenced by CS::DocumentHelper::NodeAttributeRegexpTest::operator()().

csRegExpMatcher& csRegExpMatcher::operator= ( const csRegExpMatcher other  ) 

Assignment operator.


The documentation for this class was generated from the following file:
Generated for Crystal Space 1.0.2 by doxygen 1.4.7