00001
00002
00003
00004
00005
00006
00007
00008 #ifndef BOOSTER_PERL_REGEX_H
00009 #define BOOSTER_PERL_REGEX_H
00010
00011 #include <booster/config.h>
00012 #include <booster/copy_ptr.h>
00013 #include <string>
00014 #include <vector>
00015 #include <booster/backtrace.h>
00016
00017 namespace booster {
00021 class regex_error : public booster::runtime_error {
00022 public:
00023 regex_error(std::string const &s) : booster::runtime_error(s)
00024 {
00025 }
00026 };
00027
00035 class BOOSTER_API regex {
00036 public:
00037 typedef char value_type;
00038
00039 explicit regex();
00044 regex(regex const &);
00049 regex const &operator=(regex const &);
00050
00051 ~regex();
00052
00059 regex(std::string const &pattern,int flags = normal);
00060
00061
00068 void assign(std::string const &pattern,int flags = normal);
00072 int flags() const;
00076 std::string str() const;
00080 unsigned mark_count() const;
00081
00087
00088 bool match(char const *begin,char const *end,int flags = 0) const;
00097 bool match(char const *begin,char const *end,std::vector<std::pair<int,int> > &marks,int flags = 0) const;
00098
00104
00105 bool search(char const *begin,char const *end,int flags = 0) const;
00114 bool search(char const *begin,char const *end,std::vector<std::pair<int,int> > &marks,int flags = 0) const;
00115
00119 bool empty() const;
00120
00121 static const int perl = 0;
00122 static const int normal = 0;
00123
00124 private:
00125 struct data;
00126 copy_ptr<data> d;
00127 };
00128 }
00129
00130
00131 #endif