Puma Reference Manual Puma::RegComp Class Reference



Puma::RegComp Class Reference

Instances of this class encapsulate a regular expression and the match mechanism. More...

#include <Puma/RegComp.h>

List of all members.

Public Member Functions

 RegComp (const std::string &expr)
 RegComp (const RegComp &rc)
RegCompoperator= (const RegComp &rc)
bool compile (const string &expr)
 Compile the regular expression.
bool match (const std::string &str)
 Match against a string.
void comperror (ErrorStream &err) const
 To be called on errors.
bool error () const
 Check whether there was an error.

Detailed Description

Instances of this class encapsulate a regular expression and the match mechanism.

The implementation compiles the expression when a string is matched for the first time. In case of an error, a message can be printed on an ErrorStream object.


Constructor & Destructor Documentation

Puma::RegComp::RegComp ( const std::string &  expr)
Puma::RegComp::RegComp ( const RegComp rc)

Member Function Documentation

void Puma::RegComp::comperror ( ErrorStream err) const

To be called on errors.

Parameters:
errErrorStream on which the error message should be printed.
bool Puma::RegComp::compile ( const string &  expr)

Compile the regular expression.

Parameters:
exprThe regular expression string, which should be compiled
Returns:
'false' in case of an error. Use comperror to get the message.
bool Puma::RegComp::error ( ) const
inline

Check whether there was an error.

Returns:
true in case of an error; use comperror to print it.
bool Puma::RegComp::match ( const std::string &  str)

Match against a string.

Parameters:
strString to be matched.
Returns:
'true' if the regular expression matches the string.
RegComp& Puma::RegComp::operator= ( const RegComp rc)



Puma Reference Manual. Created on Sat Jun 30 2012.