ARC SDK
|
A regular expression class. More...
#include <arc/ArcRegex.h>
Public Member Functions | |
RegularExpression () | |
Default constructor. More... | |
RegularExpression (std::string pattern, bool ignoreCase=false) | |
Creates a regex from a pattern string. More... | |
RegularExpression (const RegularExpression ®ex) | |
Copy constructor. More... | |
~RegularExpression () | |
Destructor. More... | |
RegularExpression & | operator= (const RegularExpression ®ex) |
Assignment operator. More... | |
bool | isOk () |
Returns true if the pattern of this regex is ok. More... | |
bool | hasPattern (std::string str) |
Returns true if this regex has the pattern provided. More... | |
bool | match (const std::string &str) const |
Returns true if this regex matches whole string provided. More... | |
bool | match (const std::string &str, std::list< std::string > &unmatched, std::list< std::string > &matched) const |
Returns true if this regex matches the string provided. More... | |
bool | match (const std::string &str, std::vector< std::string > &matched) const |
Try to match string. More... | |
std::string | getPattern () const |
Returns pattern. More... | |
A regular expression class.
This class is a wrapper around the functions provided in regex.h.
Arc::RegularExpression::RegularExpression | ( | ) |
Default constructor.
Arc::RegularExpression::RegularExpression | ( | std::string | pattern, |
bool | ignoreCase = false |
||
) |
Creates a regex from a pattern string.
Arc::RegularExpression::RegularExpression | ( | const RegularExpression & | regex | ) |
Copy constructor.
Arc::RegularExpression::~RegularExpression | ( | ) |
Destructor.
std::string Arc::RegularExpression::getPattern | ( | ) | const |
Returns pattern.
bool Arc::RegularExpression::hasPattern | ( | std::string | str | ) |
Returns true if this regex has the pattern provided.
bool Arc::RegularExpression::isOk | ( | ) |
Returns true if the pattern of this regex is ok.
bool Arc::RegularExpression::match | ( | const std::string & | str | ) | const |
Returns true if this regex matches whole string provided.
bool Arc::RegularExpression::match | ( | const std::string & | str, |
std::list< std::string > & | unmatched, | ||
std::list< std::string > & | matched | ||
) | const |
Returns true if this regex matches the string provided.
Unmatched parts of the string are stored in 'unmatched'. Matched parts of the string are stored in 'matched'. The first entry in matched is the string that matched the regex, and the following entries are parenthesised elements of the regex.
bool Arc::RegularExpression::match | ( | const std::string & | str, |
std::vector< std::string > & | matched | ||
) | const |
Try to match string.
The passed string is matched against this regular expression. If string matches, any matched subexpression will be appended to the passed vector, for any conditional subexpression failing to match a empty is appended.
str | string to match against this regular expression. |
matched | vector which to append matched subexpressions to. |
RegularExpression& Arc::RegularExpression::operator= | ( | const RegularExpression & | regex | ) |
Assignment operator.