source: CMT/HEAD/source/cmt_regexp.h

Last change on this file was 663, checked in by rybkin, 10 years ago

See C.L. 522

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