#include <ExtendedRegex.h>
Definition at line 26 of file ExtendedRegex.h.
Public Member Functions | |
ExtendedRegex () | |
ExtendedRegex (const String &pattern) | |
const char * | pattern (const char *pat=0) |
Returns of specifies the pattern to be used in future Regex::match calls. | |
void | useExtended (bool u=true) |
If called before assigning a pattern the regex compilation will add support for extended regular expressions. | |
void | ignoreCase (bool u=true) |
If called before assigning a pattern the regex compilation will will verify matches disregarding the matchable string case (so it wont matter if it is uppercase or lowercase). | |
bool | matches (const char *str) |
By using the compiled regex it attempts to check if the provided string matches the previously given pattern. | |
bool | matches (const String &str) |
By using the compiled regex it attempts to check if the provided string matches the previously given pattern. | |
virtual const char * | getClassName () |
Returns the name of the current class. | |
virtual std::string | toString () |
Static Public Member Functions | |
static bool | match (const String &pattern, const String &str, bool case_sensitive=true) |
Verifies that a given string matches a specified paramter. | |
static void | debugmsg (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__) |
Will print a debug message to the screen. | |
static void | debugmsgln (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__) |
Protected Member Functions | |
virtual void | compile () |
Compiles the provided pattern. | |
Protected Attributes | |
int | cflags |
Holds the regex compilation flags. | |
std::string | __cls_name |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const Object &s) |
xvr2::Text::ExtendedRegex::ExtendedRegex | ( | ) |
xvr2::Text::ExtendedRegex::ExtendedRegex | ( | const String & | pattern | ) |
virtual void xvr2::Text::ExtendedRegex::compile | ( | ) | [protected, virtual] |
Compiles the provided pattern.
This method will make use of the regcomp function call in order to have a regex usable structure. I for some reason the pattern object is null an appropiate exception will be thrown.
NullPointer | if the regex pattern has not been initialized yet | |
RegexException | if regex compilation or matching fails at library level. |
Reimplemented from xvr2::Text::Regex.
static bool xvr2::Text::ExtendedRegex::match | ( | const String & | pattern, | |
const String & | str, | |||
bool | case_sensitive = true | |||
) | [static] |
Verifies that a given string matches a specified paramter.
This method makes use of extended regular expressions to achieve its goals.
pattern | The regex to be used for verifying matches | |
str | The string to be matched against the pattern | |
case_sensitive | If true then the pattern matching will be case sensitive, if false, then it will be case insensitive. |
Reimplemented from xvr2::Text::Regex.
const char* xvr2::Text::Regex::pattern | ( | const char * | pat = 0 |
) | [inherited] |
Returns of specifies the pattern to be used in future Regex::match calls.
If the pattern is provided then it will be compiled automagically, compilation will make use of previous options like useExtended() and ignoreCase().
pat | Is the regular expression pattern to be used. |
Exception::NullPointer | If the regex pattern has not been initialized yet | |
Exception::Regex | If regex compilation fails |
void xvr2::Text::Regex::useExtended | ( | bool | u = true |
) | [inherited] |
If called before assigning a pattern the regex compilation will add support for extended regular expressions.
u | If true then pattern compilation will use extended regular exprenssions, otherwise common posix regular expressions will be used. |
void xvr2::Text::Regex::ignoreCase | ( | bool | u = true |
) | [inherited] |
If called before assigning a pattern the regex compilation will will verify matches disregarding the matchable string case (so it wont matter if it is uppercase or lowercase).
u | If true then pattern compilation will ignore case, otherwise the matching algorithms will be case sensitive. |
bool xvr2::Text::Regex::matches | ( | const char * | str | ) | [inherited] |
By using the compiled regex it attempts to check if the provided string matches the previously given pattern.
str | The string o test for matches against the given pattern |
bool xvr2::Text::Regex::matches | ( | const String & | str | ) | [inherited] |
By using the compiled regex it attempts to check if the provided string matches the previously given pattern.
str | The string o test for matches against the given pattern |
virtual const char* xvr2::Object::getClassName | ( | ) | [virtual, inherited] |
Returns the name of the current class.
static void xvr2::Object::debugmsg | ( | Object * | obj, | |
const char * | msg, | |||
int | linenumber = __LINE__ , |
|||
const char * | srcfile = __FILE__ | |||
) | [static, inherited] |
Will print a debug message to the screen.
static void xvr2::Object::debugmsgln | ( | Object * | obj, | |
const char * | msg, | |||
int | linenumber = __LINE__ , |
|||
const char * | srcfile = __FILE__ | |||
) | [static, inherited] |
virtual std::string xvr2::Object::toString | ( | ) | [virtual, inherited] |
std::ostream& operator<< | ( | std::ostream & | stream, | |
const Object & | s | |||
) | [friend, inherited] |
int xvr2::Text::Regex::cflags [protected, inherited] |
std::string xvr2::Object::__cls_name [protected, inherited] |