BALL  1.4.79
List of all members
BALL::RegularExpression Class Reference

#include <BALL/DATATYPE/regularExpression.h>

Public Member Functions

Constructors and Destructors
 RegularExpression ()
 Default constructor. More...
 
 RegularExpression (const RegularExpression &regular_expression)
 Copy constructor. More...
 
 RegularExpression (const String &pattern, bool wildcard_pattern=false)
 
virtual ~RegularExpression ()
 Destructor. More...
 
virtual void clear ()
 Reset the object attributes to their default values. More...
 
void destroy ()
 Destroy the instance. More...
 
Assignment
RegularExpressionoperator= (const RegularExpression &expression)
 Assignment operator. More...
 
void set (const RegularExpression &regular_expression)
 Assign from another instance. More...
 
void set (const String &pattern, bool wildcard_pattern=false)
 Assign from a string. More...
 
void get (RegularExpression &regular_expression) const
 Assign to another instance. More...
 
Predicates
bool isEmpty () const
 
bool operator== (const RegularExpression &regular_expression) const
 
bool operator!= (const RegularExpression &regular_expression) const
 
bool operator< (const RegularExpression &regular_expression) const
 
bool operator<= (const RegularExpression &regular_expression) const
 
bool operator>= (const RegularExpression &regular_expression) const
 
bool operator> (const RegularExpression &regular_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
 

Friends

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

Accessors

const StringgetPattern () const
 Get the expression pattern. More...
 
Size countSubexpressions () const
 Count subexpressions. More...
 
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)
 

Detailed Description

Regular expression class

Definition at line 54 of file regularExpression.h.

Constructor & Destructor Documentation

§ RegularExpression() [1/3]

BALL::RegularExpression::RegularExpression ( )

Default constructor.

§ RegularExpression() [2/3]

BALL::RegularExpression::RegularExpression ( const RegularExpression regular_expression)

Copy constructor.

§ RegularExpression() [3/3]

BALL::RegularExpression::RegularExpression ( const String pattern,
bool  wildcard_pattern = false 
)

§ ~RegularExpression()

virtual BALL::RegularExpression::~RegularExpression ( )
virtual

Destructor.

Member Function Documentation

§ clear()

virtual void BALL::RegularExpression::clear ( )
virtual

Reset the object attributes to their default values.

§ countSubexpressions()

Size BALL::RegularExpression::countSubexpressions ( ) const

Count subexpressions.

§ destroy()

void BALL::RegularExpression::destroy ( )

Destroy the instance.

§ dump()

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.

Parameters
sthe ostream, default is the standard output
depththe indentation depth of the output

§ find() [1/2]

bool BALL::RegularExpression::find ( const String text,
Substring found,
Index  from = 0,
int  execute_flags = 0 
) const

Find this expression in a string

Parameters
fromindex in the string to start the matching
foundthe result is stored as a substring here
execute_flags?????
Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= text.size()

§ find() [2/2]

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

Find this expression in a string

Parameters
textto process
subexpressionsthe results are stored here
fromindex in the string to start the matching
execute_flags?????
Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from >= text.size()

§ get()

void BALL::RegularExpression::get ( RegularExpression regular_expression) const

Assign to another instance.

§ getPattern()

const String& BALL::RegularExpression::getPattern ( ) const

Get the expression pattern.

§ isEmpty()

bool BALL::RegularExpression::isEmpty ( ) const

Test if expression is empty.

§ isValid()

virtual bool BALL::RegularExpression::isValid ( ) const
virtual

Test if instance is valid.

§ match() [1/4]

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.

Parameters
textto process
patternto compare with
compile_flags?????
execute_flags?????
Exceptions
NullPointerif text or pattern are NULL

§ match() [2/4]

bool BALL::RegularExpression::match ( const String text,
Index  from = 0,
int  execute_flags = 0 
) const

Match a text with this regular expression.

Parameters
textto process
fromindex in the string to start the matching
execute_flags?????
Exceptions
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from > text.size()

§ match() [3/4]

bool BALL::RegularExpression::match ( const Substring text,
Index  from = 0,
int  execute_flags = 0 
) const

Match a substring with this regular expression.

Parameters
textto process
fromindex in the substring to start the matching
execute_flags?????
Exceptions
Exception::InvalidSubstringif text is invalid
Exception::IndexUnderflowif from < 0
Exception::IndexOverflowif from > text.size()

§ match() [4/4]

bool BALL::RegularExpression::match ( const char *  text,
int  execute_flags = 0 
) const

Match a C-String with this regular expression.

Parameters
textto process
execute_flags?????
Exceptions
NullPointerif text is NULL

§ operator!=()

bool BALL::RegularExpression::operator!= ( const RegularExpression regular_expression) const

Inequality operator

§ operator<()

bool BALL::RegularExpression::operator< ( const RegularExpression regular_expression) const

Less operator

§ operator<=()

bool BALL::RegularExpression::operator<= ( const RegularExpression regular_expression) const

Less or equal operator

§ operator=()

RegularExpression& BALL::RegularExpression::operator= ( const RegularExpression expression)

Assignment operator.

§ operator==()

bool BALL::RegularExpression::operator== ( const RegularExpression regular_expression) const

Equality operator

§ operator>()

bool BALL::RegularExpression::operator> ( const RegularExpression regular_expression) const

Greater operator

§ operator>=()

bool BALL::RegularExpression::operator>= ( const RegularExpression regular_expression) const

Greater or equal operator

§ set() [1/2]

void BALL::RegularExpression::set ( const RegularExpression regular_expression)

Assign from another instance.

§ set() [2/2]

void BALL::RegularExpression::set ( const String pattern,
bool  wildcard_pattern = false 
)

Assign from a string.

Friends And Related Function Documentation

§ operator<<

BALL_EXPORT friend std::ostream& operator<< ( std::ostream &  s,
const RegularExpression regular_expression 
)
friend

output operator

§ operator>>

BALL_EXPORT friend std::istream& operator>> ( std::istream &  s,
RegularExpression regular_expression 
)
friend

input operator

Member Data Documentation

§ ALPHA

const String BALL::RegularExpression::ALPHA
static

alphabetic letters.

Definition at line 66 of file regularExpression.h.

§ ALPHANUMERIC

const String BALL::RegularExpression::ALPHANUMERIC
static

alphanumeric letters

Definition at line 70 of file regularExpression.h.

§ HEXADECIMAL_INTEGER

const String BALL::RegularExpression::HEXADECIMAL_INTEGER
static

hexadecimal and integer characters

Definition at line 86 of file regularExpression.h.

§ IDENTIFIER

const String BALL::RegularExpression::IDENTIFIER
static

identifier characters

Definition at line 78 of file regularExpression.h.

§ INTEGER

const String BALL::RegularExpression::INTEGER
static

integer characters

Definition at line 82 of file regularExpression.h.

§ LOWERCASE

const String BALL::RegularExpression::LOWERCASE
static

lowercase letters

Definition at line 90 of file regularExpression.h.

§ NON_ALPHA

const String BALL::RegularExpression::NON_ALPHA
static

non alphabetic characters

Definition at line 94 of file regularExpression.h.

§ NON_ALPHANUMERIC

const String BALL::RegularExpression::NON_ALPHANUMERIC
static

non alphanumeric characters

Definition at line 98 of file regularExpression.h.

§ NON_NUMERIC

const String BALL::RegularExpression::NON_NUMERIC
static

non numeric characters

Definition at line 102 of file regularExpression.h.

§ NON_WHITESPACE

const String BALL::RegularExpression::NON_WHITESPACE
static

non whitespace charcters

Definition at line 106 of file regularExpression.h.

§ REAL

const String BALL::RegularExpression::REAL
static

real numbers

Definition at line 74 of file regularExpression.h.

§ UPPERCASE

const String BALL::RegularExpression::UPPERCASE
static

uppercase letters.

Definition at line 110 of file regularExpression.h.

§ WHITESPACE

const String BALL::RegularExpression::WHITESPACE
static

whitespace characters.

Definition at line 114 of file regularExpression.h.