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