sbuild  1.7.1
Public Member Functions | Private Attributes | Friends | List of all members
sbuild::regex Class Reference

POSIX extended regular expression. More...

#include <regex.h>

+ Collaboration diagram for sbuild::regex:

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

sbuild::regex::regex ( const std::string &  pattern)
inline

The constructor.

May throw if the regex is invalid.

Parameters
patterna regex
sbuild::regex::regex ( const char *  pattern)
inline

The constructor.

May throw if the regex is invalid.

Parameters
patterna regex
sbuild::regex::~regex ( )
inline
  • The destructor.
sbuild::regex::regex ( const regex rhs)
inline

The copy constructor.

May throw if the regex is invalid.

Parameters
patterna regex

Friends And Related Function Documentation

template<class charT , class traits >
std::basic_ostream<charT,traits>& operator<< ( std::basic_ostream< charT, traits > &  stream,
const regex rhs 
)
friend

Print the regex name to a stream.

Parameters
streamthe stream to output to.
rhsthe regex to output.
Returns
the stream.
template<class charT , class traits >
std::basic_istream<charT,traits>& operator>> ( std::basic_istream< charT, traits > &  stream,
regex rhs 
)
friend

Get the regex name from a stream.

May throw if the regex is invalid.

Parameters
streamthe stream to get input from.
rhsthe regex to set.
Returns
the stream.

The documentation for this class was generated from the following file: