Line | |
---|
1 | #ifndef __cmt_regexp_h__ |
---|
2 | #define __cmt_regexp_h__ |
---|
3 | |
---|
4 | #include "cmt_string.h" |
---|
5 | |
---|
6 | class cmt_regexp_node; |
---|
7 | |
---|
8 | class cmt_regexp |
---|
9 | { |
---|
10 | public: |
---|
11 | cmt_regexp (); |
---|
12 | cmt_regexp (const cmt_string& expression); |
---|
13 | ~cmt_regexp (); |
---|
14 | |
---|
15 | void set (const cmt_string& expression); |
---|
16 | |
---|
17 | bool is_valid () const; |
---|
18 | |
---|
19 | class iterator |
---|
20 | { |
---|
21 | public: |
---|
22 | static const iterator null (); |
---|
23 | |
---|
24 | public: |
---|
25 | iterator (); |
---|
26 | iterator (int pos, int length); |
---|
27 | iterator (const iterator& other); |
---|
28 | |
---|
29 | int operator != (const iterator& other) const; |
---|
30 | int operator == (const iterator& other) const; |
---|
31 | |
---|
32 | int _pos; |
---|
33 | int _length; |
---|
34 | }; |
---|
35 | |
---|
36 | iterator begin (const cmt_string& text, int pos = 0); |
---|
37 | iterator end (); |
---|
38 | |
---|
39 | iterator begin (const cmt_string& text, int pos = 0) const; |
---|
40 | iterator end () const; |
---|
41 | |
---|
42 | bool match (const cmt_string& text) const; |
---|
43 | |
---|
44 | private: |
---|
45 | |
---|
46 | cmt_regexp_node* _root; |
---|
47 | }; |
---|
48 | |
---|
49 | #endif |
---|
50 | |
---|
Note: See
TracBrowser
for help on using the repository browser.