19 #ifndef SBUILD_REGEX_H 20 #define SBUILD_REGEX_H 26 #include <sbuild/sbuild-config.h> 27 # ifdef HAVE_REGEX_REGEX 30 # include <tr1/regex.hpp> 32 using std::tr1::regex;
33 using std::tr1::regex_error;
34 using std::tr1::regex_match;
35 using std::tr1::regex_search;
37 # elif HAVE_BOOST_REGEX 38 # include <boost/regex.hpp> 41 using boost::regex_error;
42 using boost::regex_match;
43 using boost::regex_search;
46 # error An regex implementation is not available 82 regex (std::string
const& pattern):
122 compare (
regex const& rhs)
const 124 return this->rstr != rhs.
rstr;
128 search (std::string
const& str)
const 130 return std::regex_search(str, this->comp);
142 template <
class charT,
class traits>
144 std::basic_istream<charT,traits>&
145 operator >> (std::basic_istream<charT,traits>& stream,
150 if (std::getline(stream, regex))
152 rhs.
comp.assign(regex, std::regex::extended);
166 template <
class charT,
class traits>
168 std::basic_ostream<charT,traits>&
169 operator << (std::basic_ostream<charT,traits>& stream,
172 return stream << rhs.str();
189 return regex.search(str);
POSIX extended regular expression.
Definition: sbuild-regex.h:66
~regex()
Definition: sbuild-regex.h:100
Debian source builder components.
Definition: sbuild-auth-null.h:24
regex()
The constructor.
Definition: sbuild-regex.h:70
std::string rstr
String containing the regex.
Definition: sbuild-regex.h:179
bool regex_search(const std::string &str, regex const ®ex)
Search using the regular expression.
Definition: sbuild-regex.h:186
regex(const char *pattern)
The constructor.
Definition: sbuild-regex.h:94
std::regex comp
Compiled regular expression.
Definition: sbuild-regex.h:177
regex(const regex &rhs)
The copy constructor.
Definition: sbuild-regex.h:110
regex(std::string const &pattern)
The constructor.
Definition: sbuild-regex.h:82