![]() |
Provides a basic "extended POSIX" regular expression match engine. More...
#include <RegexpChecker.h>
Public Member Functions | |
RegexpChecker (StringDictionary &pDefinitionsRef) | |
Creates the match engine, receiving a string dictionary whose key is the name of every possible extended POSIX regular expression, and the value is the regular expression by itself. | |
bool | match (const char *pType, string pDataStr) |
Indicates if the given string. | |
string & | key (const char *pSample) |
When the given value match the regular expression, returns the corresponding key. | |
![]() | |
string & | lastErrorRef () |
Returns a reference to the last stored error message. | |
ErrorCode | lastCode () |
Returns the last stored code. | |
bool | valid () |
Permits to know if the object has a valid internal state. | |
string & | typeRef () |
Permits to know the type of this particular object. | |
Static Public Attributes | |
static string | NOTFOUND = "NOT FOUND" |
Additional Inherited Members | |
![]() | |
HSEPObject (const char *pType) | |
Constructor, providing the base for the state controlling instance. | |
virtual | ~HSEPObject () |
void | setLastError (string &pErrorMsgRef) |
Assigns an error message text to the last executed operation. | |
void | setLastError (const string &pErrorMsgRef) |
Assigns an error message text to the last executed operation. | |
void | setLastError (const char *pErrorMsg) |
Assigns an error message text to the last executed operation. | |
void | setValid () |
Defines that the object has a valid state. | |
void | setInvalid () |
Defines that the object has an invalid state. | |
void | setLastCode (const ErrorCode pErrorCode) |
Defines the internal result code for the object. | |
Provides a basic "extended POSIX" regular expression match engine.
Definition at line 39 of file RegexpChecker.h.
HSEP::RegexpChecker::RegexpChecker | ( | StringDictionary & | pDefinitionsRef | ) |
Creates the match engine, receiving a string dictionary whose key is the name of every possible extended POSIX regular expression, and the value is the regular expression by itself.
A possible way to "feed" the RegexpChecker is loading the string dictionary from a file using a FileTool instance.
pDefinitionsRef | reference to the regexp definitions. |
Definition at line 28 of file RegexpChecker.cpp.
References HSEP::Dictionary< T >::forEach(), HSEP::Dictionary< T >::put(), and HSEP::HSEPObject::valid().
string & HSEP::RegexpChecker::key | ( | const char * | pSample | ) |
When the given value match the regular expression, returns the corresponding key.
When the regex set has a DEFAULT as value, and no corresponding match exist, returns that DEFAULT instead of TypeChecker::NOTFOUND; if no DEFAULT is found, returns the TypeChecker::NOTFOUND value.
pSample |
Definition at line 57 of file RegexpChecker.cpp.
References HSEP::Dictionary< T >::forEach(), HSEP::Regexp::match(), NOTFOUND, and HSEP::Regexp::text().
bool HSEP::RegexpChecker::match | ( | const char * | pType, |
string | pDataStr | ||
) |
Indicates if the given string.
pType | |
pDataStr |
Definition at line 47 of file RegexpChecker.cpp.
References HSEP::Dictionary< T >::has(), HSEP::Regexp::match(), and HSEP::Dictionary< T >::ref().
|
static |
Definition at line 45 of file RegexpChecker.h.
Referenced by key().