#include <BALL/DATATYPE/regularExpression.h>
Public Member Functions | |
Constructors and Destructors | |
RegularExpression () | |
Default constructor. | |
RegularExpression (const RegularExpression ®ular_expression) | |
Copy constructor. | |
RegularExpression (const String &pattern, bool wildcard_pattern=false) | |
virtual | ~RegularExpression () |
Destructor. | |
virtual void | clear () |
Reset the object attributes to their default values. | |
void | destroy () |
Destroy the instance. | |
Assignment | |
RegularExpression & | operator= (const RegularExpression &expression) |
Assignment operator. | |
void | set (const RegularExpression ®ular_expression) |
Assign from another instance. | |
void | set (const String &pattern, bool wildcard_pattern=false) |
Assign from a string. | |
void | get (RegularExpression ®ular_expression) const |
Assign to another instance. | |
Predicates | |
bool | isEmpty () const |
bool | operator== (const RegularExpression ®ular_expression) const |
bool | operator!= (const RegularExpression ®ular_expression) const |
bool | operator< (const RegularExpression ®ular_expression) const |
bool | operator<= (const RegularExpression ®ular_expression) const |
bool | operator>= (const RegularExpression ®ular_expression) const |
bool | operator> (const RegularExpression ®ular_expression) const |
Debugging and Diagnostics | |
virtual bool | isValid () const |
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const |
Static Public Attributes | |
String constants | |
static const String | ALPHA |
static const String | ALPHANUMERIC |
static const String | REAL |
static const String | IDENTIFIER |
static const String | INTEGER |
static const String | HEXADECIMAL_INTEGER |
static const String | LOWERCASE |
static const String | NON_ALPHA |
static const String | NON_ALPHANUMERIC |
static const String | NON_NUMERIC |
static const String | NON_WHITESPACE |
static const String | UPPERCASE |
static const String | WHITESPACE |
Private Member Functions | |
void | compilePattern_ () |
void | toExtendedRegularExpression_ () |
Private Attributes | |
regex_t | regex_ |
String | pattern_ |
bool | valid_pattern_ |
Friends | |
Storers | |
BALL_EXPORT friend std::ostream & | operator<< (std::ostream &s, const RegularExpression ®ular_expression) |
BALL_EXPORT friend std::istream & | operator>> (std::istream &s, RegularExpression ®ular_expression) |
Accessors | |
| |
const String & | getPattern () const |
Get the expression pattern. | |
Size | countSubexpressions () const |
Count subexpressions. | |
bool | match (const String &text, Index from=0, int execute_flags=0) const |
bool | match (const Substring &text, Index from=0, int execute_flags=0) const |
bool | match (const char *text, int execute_flags=0) const |
bool | find (const String &text, Substring &found, Index from=0, int execute_flags=0) const |
bool | find (const String &text, vector< Substring > &subexpressions, Index from=0, int execute_flags=0) const |
static bool | match (const char *text, const char *pattern, int compile_flags=0|REG_EXTENDED|REG_NOSUB, int execute_flags=0) |
Regular expression class
Definition at line 54 of file regularExpression.h.
BALL::RegularExpression::RegularExpression | ( | ) |
Default constructor.
BALL::RegularExpression::RegularExpression | ( | const RegularExpression & | regular_expression | ) |
Copy constructor.
BALL::RegularExpression::RegularExpression | ( | const String & | pattern, | |
bool | wildcard_pattern = false | |||
) |
virtual BALL::RegularExpression::~RegularExpression | ( | ) | [virtual] |
Destructor.
virtual void BALL::RegularExpression::clear | ( | ) | [virtual] |
Reset the object attributes to their default values.
void BALL::RegularExpression::compilePattern_ | ( | ) | [private] |
Size BALL::RegularExpression::countSubexpressions | ( | ) | const |
Count subexpressions.
void BALL::RegularExpression::destroy | ( | ) |
Destroy the instance.
virtual void BALL::RegularExpression::dump | ( | std::ostream & | s = std::cout , |
|
Size | depth = 0 | |||
) | const [virtual] |
Dump this instance to an ostream depth is normaly just used for internal use.
s | the ostream, default is the standard output | |
depth | the indentation depth of the output |
bool BALL::RegularExpression::find | ( | const String & | text, | |
vector< Substring > & | subexpressions, | |||
Index | from = 0 , |
|||
int | execute_flags = 0 | |||
) | const |
Find this expression in a string
text | to process | |
subexpressions | the results are stored here | |
from | index in the string to start the matching | |
execute_flags | ????? |
Exception::IndexUnderflow | if from < 0 | |
Exception::IndexOverflow | if from >= text.size() |
bool BALL::RegularExpression::find | ( | const String & | text, | |
Substring & | found, | |||
Index | from = 0 , |
|||
int | execute_flags = 0 | |||
) | const |
Find this expression in a string
from | index in the string to start the matching | |
found | the result is stored as a substring here | |
execute_flags | ????? |
Exception::IndexUnderflow | if from < 0 | |
Exception::IndexOverflow | if from >= text.size() |
void BALL::RegularExpression::get | ( | RegularExpression & | regular_expression | ) | const |
Assign to another instance.
const String& BALL::RegularExpression::getPattern | ( | ) | const |
Get the expression pattern.
bool BALL::RegularExpression::isEmpty | ( | ) | const |
Test if expression is empty.
virtual bool BALL::RegularExpression::isValid | ( | ) | const [virtual] |
Test if instance is valid.
bool BALL::RegularExpression::match | ( | const char * | text, | |
int | execute_flags = 0 | |||
) | const |
Match a C-String with this regular expression.
text | to process | |
execute_flags | ????? |
NullPointer | if text is NULL |
bool BALL::RegularExpression::match | ( | const Substring & | text, | |
Index | from = 0 , |
|||
int | execute_flags = 0 | |||
) | const |
Match a substring with this regular expression.
text | to process | |
from | index in the substring to start the matching | |
execute_flags | ????? |
Exception::InvalidSubstring | if text is invalid | |
Exception::IndexUnderflow | if from < 0 | |
Exception::IndexOverflow | if from > text.size() |
bool BALL::RegularExpression::match | ( | const String & | text, | |
Index | from = 0 , |
|||
int | execute_flags = 0 | |||
) | const |
Match a text with this regular expression.
text | to process | |
from | index in the string to start the matching | |
execute_flags | ????? |
Exception::IndexUnderflow | if from < 0 | |
Exception::IndexOverflow | if from > text.size() |
static bool BALL::RegularExpression::match | ( | const char * | text, | |
const char * | pattern, | |||
int | compile_flags = 0|REG_EXTENDED|REG_NOSUB , |
|||
int | execute_flags = 0 | |||
) | [static] |
Match a text with a given pattern.
text | to process | |
pattern | to compare with | |
compile_flags | ????? | |
execute_flags | ????? |
NullPointer | if text or pattern are NULL |
bool BALL::RegularExpression::operator!= | ( | const RegularExpression & | regular_expression | ) | const |
Inequality operator
bool BALL::RegularExpression::operator< | ( | const RegularExpression & | regular_expression | ) | const |
Less operator
bool BALL::RegularExpression::operator<= | ( | const RegularExpression & | regular_expression | ) | const |
Less or equal operator
RegularExpression& BALL::RegularExpression::operator= | ( | const RegularExpression & | expression | ) |
Assignment operator.
bool BALL::RegularExpression::operator== | ( | const RegularExpression & | regular_expression | ) | const |
Equality operator
bool BALL::RegularExpression::operator> | ( | const RegularExpression & | regular_expression | ) | const |
Greater operator
bool BALL::RegularExpression::operator>= | ( | const RegularExpression & | regular_expression | ) | const |
Greater or equal operator
Assign from a string.
void BALL::RegularExpression::set | ( | const RegularExpression & | regular_expression | ) |
Assign from another instance.
void BALL::RegularExpression::toExtendedRegularExpression_ | ( | ) | [private] |
BALL_EXPORT friend std::ostream& operator<< | ( | std::ostream & | s, | |
const RegularExpression & | regular_expression | |||
) | [friend] |
output operator
BALL_EXPORT friend std::istream& operator>> | ( | std::istream & | s, | |
RegularExpression & | regular_expression | |||
) | [friend] |
input operator
const String BALL::RegularExpression::ALPHA [static] |
alphabetic letters.
Definition at line 66 of file regularExpression.h.
const String BALL::RegularExpression::ALPHANUMERIC [static] |
alphanumeric letters
Definition at line 70 of file regularExpression.h.
const String BALL::RegularExpression::HEXADECIMAL_INTEGER [static] |
hexadecimal and integer characters
Definition at line 86 of file regularExpression.h.
const String BALL::RegularExpression::IDENTIFIER [static] |
identifier characters
Definition at line 78 of file regularExpression.h.
const String BALL::RegularExpression::INTEGER [static] |
integer characters
Definition at line 82 of file regularExpression.h.
const String BALL::RegularExpression::LOWERCASE [static] |
lowercase letters
Definition at line 90 of file regularExpression.h.
const String BALL::RegularExpression::NON_ALPHA [static] |
non alphabetic characters
Definition at line 94 of file regularExpression.h.
const String BALL::RegularExpression::NON_ALPHANUMERIC [static] |
non alphanumeric characters
Definition at line 98 of file regularExpression.h.
const String BALL::RegularExpression::NON_NUMERIC [static] |
non numeric characters
Definition at line 102 of file regularExpression.h.
const String BALL::RegularExpression::NON_WHITESPACE [static] |
non whitespace charcters
Definition at line 106 of file regularExpression.h.
String BALL::RegularExpression::pattern_ [private] |
Definition at line 298 of file regularExpression.h.
const String BALL::RegularExpression::REAL [static] |
real numbers
Definition at line 74 of file regularExpression.h.
regex_t BALL::RegularExpression::regex_ [private] |
Definition at line 296 of file regularExpression.h.
const String BALL::RegularExpression::UPPERCASE [static] |
uppercase letters.
Definition at line 110 of file regularExpression.h.
bool BALL::RegularExpression::valid_pattern_ [private] |
Definition at line 299 of file regularExpression.h.
const String BALL::RegularExpression::WHITESPACE [static] |
whitespace characters.
Definition at line 114 of file regularExpression.h.