sbuild
1.7.1
|
POSIX extended regular expression. More...
#include <regex.h>
Public Member Functions | |
regex () | |
The constructor. | |
regex (const std::string &pattern) | |
The constructor. More... | |
regex (const char *pattern) | |
The constructor. More... | |
~regex () | |
regex (const regex &rhs) | |
The copy constructor. More... | |
std::string const & | str () const |
bool | compare (const regex &rhs) const |
bool | search (const std::string &str) const |
Private Attributes | |
std::regex | comp |
Compiled regular expression. | |
std::string | rstr |
String containing the regex. | |
Friends | |
template<class charT , class traits > | |
std::basic_istream< charT, traits > & | operator>> (std::basic_istream< charT, traits > &stream, regex &rhs) |
Get the regex name from a stream. More... | |
template<class charT , class traits > | |
std::basic_ostream< charT, traits > & | operator<< (std::basic_ostream< charT, traits > &stream, const regex &rhs) |
Print the regex name to a stream. More... | |
POSIX extended regular expression.
Note that this extends the C++ std::regex type to provide the stream interface needed by the keyfile class. Not all methods are overloaded, so this is not safe enough to be generally usable. For example, it's possible to use non-overloaded assignment operators which will not update the stored string (which is required due to the C++ regex class not providing str() and compare() methods, while the Boost version does. This class provides these methods in order to be compatible with both the C++11 and Boost regex classes. Additionally, this class always uses extended regexes, which using non-overloaded methods would permit this expectation to be broken.
|
inline |
The constructor.
May throw if the regex is invalid.
pattern | a regex |
|
inline |
The constructor.
May throw if the regex is invalid.
pattern | a regex |
|
inline |
|
inline |
The copy constructor.
May throw if the regex is invalid.
pattern | a regex |
|
friend |
Print the regex name to a stream.
stream | the stream to output to. |
rhs | the regex to output. |
|
friend |
Get the regex name from a stream.
May throw if the regex is invalid.
stream | the stream to get input from. |
rhs | the regex to set. |