00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SBUILD_REGEX_H
00021 #define SBUILD_REGEX_H
00022
00023 #include <istream>
00024 #include <ostream>
00025 #include <string>
00026
00027 #include <boost/regex.hpp>
00028
00029 namespace sbuild
00030 {
00031
00035 class regex : public boost::regex
00036 {
00037 public:
00039 regex ():
00040 boost::regex()
00041 {}
00042
00050 regex (std::string const& pattern):
00051 boost::regex(pattern, boost::regex::extended)
00052 {}
00053
00061 regex (const char *pattern):
00062 boost::regex(pattern, boost::regex::extended)
00063 {}
00064
00066 ~regex ()
00067 {}
00068
00078 template <class charT, class traits>
00079 friend
00080 std::basic_istream<charT,traits>&
00081 operator >> (std::basic_istream<charT,traits>& stream,
00082 regex& rhs)
00083 {
00084 std::string regex;
00085
00086 if (std::getline(stream, regex))
00087 {
00088 rhs.assign(regex, boost::regex::extended);
00089 }
00090
00091 return stream;
00092 }
00093
00101 template <class charT, class traits>
00102 friend
00103 std::basic_ostream<charT,traits>&
00104 operator << (std::basic_ostream<charT,traits>& stream,
00105 regex const& rhs)
00106 {
00107 return stream << rhs.str();
00108 }
00109 };
00110
00111 }
00112
00113 #endif
00114
00115
00116
00117
00118
00119