00001 #ifndef __cmt_regexp_h__ 00002 #define __cmt_regexp_h__ 00003 00004 #include "cmt_string.h" 00005 00006 class cmt_node; 00007 00008 class cmt_regexp 00009 { 00010 public: 00011 cmt_regexp (const cmt_string& expression); 00012 ~cmt_regexp (); 00013 00014 bool is_valid () const; 00015 00016 class iterator 00017 { 00018 public: 00019 static const iterator null (); 00020 00021 public: 00022 iterator (); 00023 iterator (int pos, int length); 00024 iterator (const iterator& other); 00025 00026 int operator != (const iterator& other) const; 00027 int operator == (const iterator& other) const; 00028 00029 int _pos; 00030 int _length; 00031 }; 00032 00033 iterator begin (const cmt_string& text, int pos = 0); 00034 iterator end (); 00035 00036 iterator begin (const cmt_string& text, int pos = 0) const; 00037 iterator end () const; 00038 00039 bool match (const cmt_string& text) const; 00040 00041 private: 00042 00043 cmt_node* _root; 00044 }; 00045 00046 #endif 00047