Last change
on this file since 581 was
581,
checked in by rybkin, 13 years ago
|
See C.L. 459
|
-
Property svn:eol-style set to
native
|
File size:
1.2 KB
|
Rev | Line | |
---|
[2] | 1 | //----------------------------------------------------------- |
---|
| 2 | // Copyright Christian Arnault LAL-Orsay CNRS |
---|
| 3 | // arnault@lal.in2p3.fr |
---|
| 4 | // See the complete license in cmt_license.txt "http://www.cecill.info". |
---|
| 5 | //----------------------------------------------------------- |
---|
| 6 | |
---|
| 7 | #ifndef __cmt_regexp_h__ |
---|
| 8 | #define __cmt_regexp_h__ |
---|
| 9 | |
---|
| 10 | #include "cmt_string.h" |
---|
| 11 | |
---|
| 12 | class cmt_regexp_node; |
---|
| 13 | |
---|
| 14 | class cmt_regexp |
---|
| 15 | { |
---|
| 16 | public: |
---|
| 17 | cmt_regexp (); |
---|
| 18 | cmt_regexp (const cmt_string& expression); |
---|
| 19 | ~cmt_regexp (); |
---|
[581] | 20 | void clear (); |
---|
[2] | 21 | |
---|
| 22 | void set (const cmt_string& expression); |
---|
| 23 | |
---|
| 24 | bool is_valid () const; |
---|
| 25 | |
---|
| 26 | class iterator |
---|
| 27 | { |
---|
| 28 | public: |
---|
| 29 | static const iterator null (); |
---|
| 30 | |
---|
| 31 | public: |
---|
| 32 | iterator (); |
---|
| 33 | iterator (int pos, int length); |
---|
| 34 | iterator (const iterator& other); |
---|
| 35 | |
---|
| 36 | int operator != (const iterator& other) const; |
---|
| 37 | int operator == (const iterator& other) const; |
---|
| 38 | int operator < (const iterator& other) const; |
---|
| 39 | |
---|
| 40 | cmt_string operator () (const cmt_string& text) const; |
---|
| 41 | |
---|
| 42 | int _pos; |
---|
| 43 | int _length; |
---|
| 44 | }; |
---|
| 45 | |
---|
| 46 | iterator begin (const cmt_string& text, int pos = 0); |
---|
| 47 | iterator end (); |
---|
| 48 | |
---|
| 49 | iterator begin (const cmt_string& text, int pos = 0) const; |
---|
| 50 | iterator end () const; |
---|
| 51 | |
---|
| 52 | bool match (const cmt_string& text) const; |
---|
| 53 | |
---|
| 54 | private: |
---|
| 55 | |
---|
| 56 | cmt_regexp_node* _root; |
---|
| 57 | }; |
---|
| 58 | |
---|
| 59 | #endif |
---|
| 60 | |
---|
Note: See
TracBrowser
for help on using the repository browser.