00001
00002
00003 #ifndef BASE_REGEX_H
00004 #define BASE_REGEX_H
00005
00006 #include <regex.h>
00007 #include "portable.h"
00008
00009 namespace base {
00011
00015 class PPBASE_EXPORT Regex {
00016 public:
00018 Regex();
00019
00021 ~Regex();
00022
00024
00029 void compile(const char *expression, int flags = 0);
00030
00032
00039 std::pair<int, int> getMatch(unsigned n);
00040
00042
00051 bool match(const char *string, int flags = 0, unsigned nmatch = 0);
00052
00053 private:
00054 bool _compiled;
00055 unsigned _matchcnt;
00056 regmatch_t *_matches;
00057 regex_t _regex;
00058
00059 DISALLOW_COPY_CONSTRUCTOR_AND_ASSIGNMENT(Regex);
00060 };
00061 }
00062
00063 #endif