00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #ifndef _RE_H_
00010 #define _RE_H_
00011 
00012 #include <string>
00013 #include <sys/types.h>
00014 #include "regex.h"
00015 #include "agfioError.h"
00016 
00018 class DllExport RE
00019 {
00020 private:
00021   regex_t *preg;
00022   size_t nmatch;
00023   regmatch_t *pmatch;
00024   string s;
00025   int span[2];
00026   bool matched;
00027 
00028 public:
00030   class CompError : public agfioError
00031   {
00032   public:
00033     CompError(const string& s): agfioError("RE:" + s) {}
00034   };
00035 
00037 
00041   class MatchError : public agfioError
00042   {
00043   public:
00044     MatchError(const string& s): agfioError("RE:" + s) {}
00045   };
00046 
00053   class GetError : public agfioError
00054   {
00055   public:
00056     GetError(const string& s): agfioError("RE:" + s) {}
00057   };
00058 
00060 
00064   RE(const string &pattern);
00065   ~RE();
00066 
00072   bool match(const string &s);
00073 
00084   string
00085   get_matched(const int i);
00086 
00098   const int*
00099   get_span(const int i);
00100   
00102   int
00103   get_nsub();
00104 };
00105 
00106 #endif