PUMA Library Reference Manual
|
#include <Puma/RegComp.h>
Regular expression matching.
This class compiles the expression when a string is matched for the first time. In case of an error, an error message can be printed on an error stream.
Public Member Functions | |
RegComp (const std::string &expr) | |
Constructor. | |
RegComp (const RegComp ©) | |
Copy-constructor. | |
RegComp & | operator= (const RegComp ©) |
Assign a regular expression. | |
bool | compile (const std::string &expr) |
Compile the regular expression. | |
bool | match (const std::string &str) |
Match against a string. | |
void | comperror (ErrorStream &err) const |
Print a regular expression compilation error message on the given error stream. | |
bool | error () const |
Check whether there was an error compiling the regular expression. | |
Puma::RegComp::RegComp | ( | const std::string & | expr | ) |
Constructor.
expr | The regular expression. |
Puma::RegComp::RegComp | ( | const RegComp & | copy | ) |
Copy-constructor.
copy | The regular expression to copy. |
void Puma::RegComp::comperror | ( | ErrorStream & | err | ) | const |
Print a regular expression compilation error message on the given error stream.
To be called when compile() fails.
err | Error stream on which to print the error message. |
bool Puma::RegComp::compile | ( | const std::string & | expr | ) |
Compile the regular expression.
expr | The regular expression. |
|
inline |
Check whether there was an error compiling the regular expression.
bool Puma::RegComp::match | ( | const std::string & | str | ) |
Match against a string.
str | String to be matched. |