Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

RegularExpression Class Reference
[Miscellaneous]

Regular expression class. More...

#include <regularExpression.h>

List of all members.

Accessors

const StringgetPattern () const throw ()
 Get the expression pattern.
Size countSubexpressions () const throw ()
 Count subexpressions.
bool match (const String &text, Index from=0, int execute_flags=0) const throw (Exception::NullPointer, Exception::IndexUnderflow, Exception::IndexOverflow)
 Match a text with this regular expression.
bool match (const Substring &text, Index from=0, int execute_flags=0) const throw (Substring::InvalidSubstring, Exception::IndexUnderflow, Exception::IndexOverflow)
 Match a substring with this regular expression.
bool match (const char *text, int execute_flags=0) const throw (Exception::NullPointer)
 Match a C-String with this regular expression.
bool find (const String &text, Substring &found, Index from=0, int execute_flags=0) const throw (Exception::IndexUnderflow, Exception::IndexOverflow)
 Find this expression in a string.
bool find (const String &text, vector< Substring > &subexpressions, Index from=0, int execute_flags=0) const throw (Exception::IndexUnderflow, Exception::IndexOverflow)
 Find this expression in a string.
bool match (const char *text, const char *pattern, int compile_flags=0|REG_EXTENDED|REG_NOSUB, int execute_flags=0) throw (Exception::NullPointer)
 Match a text with a given pattern.

Public Member Functions

Constructors and Destructors
 RegularExpression () throw ()
 Default constructor.
 RegularExpression (const RegularExpression &regular_expression) throw ()
 Copy constructor.
 RegularExpression (const String &pattern, bool wildcard_pattern=false) throw ()
virtual ~RegularExpression () throw ()
 Destructor.
virtual void clear () throw ()
 Reset the object attributes to their default values.
void destroy () throw ()
 Destroy the instance.
Assignment
RegularExpressionoperator= (const RegularExpression &expression) throw ()
 Assignment operator.
void set (const RegularExpression &regular_expression) throw ()
 Assign from another instance.
void set (const String &pattern, bool wildcard_pattern=false) throw ()
 Assign from a string.
void get (RegularExpression &regular_expression) const throw ()
 Assign to another instance.
Predicates
bool isEmpty () const throw ()
 Test if expression is empty.
bool operator== (const RegularExpression &regular_expression) const throw ()
 Equality operator.
bool operator!= (const RegularExpression &regular_expression) const throw ()
 Inequality operator.
bool operator< (const RegularExpression &regular_expression) const throw ()
 Less operator.
bool operator<= (const RegularExpression &regular_expression) const throw ()
 Less or equal operator.
bool operator>= (const RegularExpression &regular_expression) const throw ()
 Greater or equal operator.
bool operator> (const RegularExpression &regular_expression) const throw ()
 Greater operator.
Debugging and Diagnostics
virtual bool isValid () const throw ()
 Test if instance is valid.
virtual void dump (std::ostream &s=std::cout, Size depth=0) const throw ()
 Dump this instance to an ostream depth is normaly just used for internal use.

Static Public Attributes

String constants
const String ALPHA
 alphabetic letters.
const String ALPHANUMERIC
 alphanumeric letters
const String REAL
 real numbers
const String IDENTIFIER
 identifier characters
const String INTEGER
 integer characters
const String HEXADECIMAL_INTEGER
 hexadecimal and integer characters
const String LOWERCASE
 lowercase letters
const String NON_ALPHA
 non alphabetic characters
const String NON_ALPHANUMERIC
 non alphanumeric characters
const String NON_NUMERIC
 non numeric characters
const String NON_WHITESPACE
 non whitespace charcters
const String UPPERCASE
 uppercase letters.
const String WHITESPACE
 whitespace characters.

Friends

Storers
BALL_EXPORT friend std::ostream & operator<< (std::ostream &s, const RegularExpression &regular_expression) throw ()
 output operator
BALL_EXPORT friend std::istream & operator>> (std::istream &s, RegularExpression &regular_expression) throw ()
 input operator


Detailed Description

Regular expression class.


Member Function Documentation

virtual void RegularExpression::dump std::ostream &  s = std::cout,
Size  depth = 0
const throw () [virtual]
 

Dump this instance to an ostream depth is normaly just used for internal use.

Parameters:
s the ostream, default is the standard output
depth the indentation depth of the output

bool RegularExpression::find const String text,
vector< Substring > &  subexpressions,
Index  from = 0,
int  execute_flags = 0
const throw (Exception::IndexUnderflow, Exception::IndexOverflow)
 

Find this expression in a string.

Parameters:
text to process
subexpressions the results are stored here
from index in the string to start the matching
execute_flags ?????

bool RegularExpression::find const String text,
Substring found,
Index  from = 0,
int  execute_flags = 0
const throw (Exception::IndexUnderflow, Exception::IndexOverflow)
 

Find this expression in a string.

Parameters:
from index in the string to start the matching
found the result is stored as a substring here
execute_flags ?????

bool RegularExpression::isEmpty  )  const throw ()
 

Test if expression is empty.

virtual bool RegularExpression::isValid  )  const throw () [virtual]
 

Test if instance is valid.

bool RegularExpression::match const char *  text,
int  execute_flags = 0
const throw (Exception::NullPointer)
 

Match a C-String with this regular expression.

Parameters:
text to process
execute_flags ?????

bool RegularExpression::match const Substring text,
Index  from = 0,
int  execute_flags = 0
const throw (Substring::InvalidSubstring, Exception::IndexUnderflow, Exception::IndexOverflow)
 

Match a substring with this regular expression.

Parameters:
text to process
from index in the substring to start the matching
execute_flags ?????

bool RegularExpression::match const String text,
Index  from = 0,
int  execute_flags = 0
const throw (Exception::NullPointer, Exception::IndexUnderflow, Exception::IndexOverflow)
 

Match a text with this regular expression.

Parameters:
text to process
from index in the string to start the matching
execute_flags ?????

bool RegularExpression::match const char *  text,
const char *  pattern,
int  compile_flags = 0|REG_EXTENDED|REG_NOSUB,
int  execute_flags = 0
throw (Exception::NullPointer) [static]
 

Match a text with a given pattern.

Parameters:
text to process
pattern to compare with
compile_flags ?????
execute_flags ?????
Exceptions:
NullPointer if text or pattern are NULL


Member Data Documentation

const String RegularExpression::ALPHA [static]
 

alphabetic letters.

const String RegularExpression::UPPERCASE [static]
 

uppercase letters.

const String RegularExpression::WHITESPACE [static]
 

whitespace characters.