Inherits YGP::IRegularExpression.
Public Member Functions | |
RegularExpression (const char *pRegExp) throw (std::invalid_argument) | |
virtual | ~RegularExpression () |
virtual int | checkIntegrity () const throw (std::invalid_argument) |
RegularExpression & | operator= (const char *pRegExp) throw (std::invalid_argument) |
Protected Member Functions | |
virtual bool | compare (const char *pAktRegExp, const char *pCompare) |
This is just a little intruduction into the supported constructs; see regex(7) or the GNU regexp manual for a better description.
regex.h
do (at least in glibc 2.2.4), which might differ from what you expect from the reading (or how - e.g. - emacs behaves). But I have no idea what the *real* standard is and for testing it was the easiest to follow an existing implementation!
If the class is compiled with ENHANCED_REGEXP
defined the following constructs are also supported (Warning: Those things are not regulary tested):
pExpression-parameter
is stored as is (and not copied); so take care it is valid during the life-time of the object.
YGP::RegularExpression::RegularExpression | ( | const char * | pRegExp | ) | throw (std::invalid_argument) |
Constructor, specifies the regular expression to match.
pRegExp | Pointer to character array holding regular expression |
std::invalid_argument | In case of an invalid regexp a describing text |
YGP::RegularExpression::~RegularExpression | ( | ) | [virtual] |
Destructor.
int YGP::RegularExpression::checkIntegrity | ( | ) | const throw (std::invalid_argument) [virtual] |
Checks the syntax of the regular expression.
If everything is OK, 0 is returned; 1 if there is no regular expression at all. In case of any other error an exception is thrown.
std::invalid_argument | In case of an invalid regexp a describing text |
pFileRegExp
is a valid regexp Reimplemented from YGP::IRegularExpression.
bool YGP::RegularExpression::compare | ( | const char * | pActRegExp, | |
const char * | pCompare | |||
) | [protected, virtual] |
Checks if the passed text matches the passed regular expression.
Both passed parameters must not be NULL-pointers and the regular expression must be in a valid syntax (this can be checked with the checkIntegrity()-method).
pActRegExp | Pointer to character array holding regular expression | |
pCompare | Pointer to character array holding value to compare |
pAktRegExp
, pCompare
must be ASCIIZ-strings, not NULL Implements YGP::IRegularExpression.
RegularExpression & YGP::RegularExpression::operator= | ( | const char * | pRegExp | ) | throw (std::invalid_argument) |
Assignmentoperator; specifies the regular expression to match.
pRegExp | Pointer to character array holding regular expression |
std::invalid_argument | In case of an invalid regexp a describing text |
Reimplemented from YGP::IRegularExpression.