19 #ifndef SBUILD_REGEX_H
20 #define SBUILD_REGEX_H
26 #include <sbuild/sbuild-config.h>
27 #ifdef HAVE_REGEX_REGEX
30 # include <boost/regex.hpp>
33 using boost::regex_error;
34 using boost::regex_search;
71 regex (std::string
const& pattern):
111 compare (
regex const& rhs)
const
113 return this->
rstr != rhs.rstr;
117 search (std::string
const& str)
const
119 return std::regex_search(str, this->
comp);
131 template <
class charT,
class traits>
133 std::basic_istream<charT,traits>&
139 if (std::getline(stream, regex))
141 rhs.
comp.assign(regex, std::regex::extended);
155 template <
class charT,
class traits>
157 std::basic_ostream<charT,traits>&
158 operator << (std::basic_ostream<charT,traits>& stream,
161 return stream << rhs.str();
178 return regex.search(str);
POSIX extended regular expression.
Definition: sbuild-regex.h:55
~regex()
Definition: sbuild-regex.h:89
regex()
The constructor.
Definition: sbuild-regex.h:59
friend std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &stream, regex &rhs)
Get the regex name from a stream.
Definition: sbuild-regex.h:134
std::string rstr
String containing the regex.
Definition: sbuild-regex.h:168
bool regex_search(const std::string &str, regex const ®ex)
Search using the regular expression.
Definition: sbuild-regex.h:175
regex(const char *pattern)
The constructor.
Definition: sbuild-regex.h:83
std::regex comp
Compiled regular expression.
Definition: sbuild-regex.h:166
regex(const regex &rhs)
The copy constructor.
Definition: sbuild-regex.h:99
regex(std::string const &pattern)
The constructor.
Definition: sbuild-regex.h:71