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>

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. More...
 
bool match (const std::string &str)
 Match against a string. More...
 
void comperror (ErrorStream &err) const
 To be called on errors. More...
 
bool error () const
 Check whether there was an error. More...
 

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 Tue Jan 19 2016.