#ifndef __cmt_regexp_h__
#define __cmt_regexp_h__

#include "cmt_string.h"

class cmt_node;

class cmt_regexp
{
public:
  cmt_regexp (const cmt_string& expression);
  ~cmt_regexp ();

  bool is_valid () const;
  
  class iterator
  {
public:
    static const iterator null ();
    
public:
    iterator ();
    iterator (int pos, int length);
    iterator (const iterator& other);
    
    int operator != (const iterator& other) const;
    int operator == (const iterator& other) const;
    
    int _pos;
    int _length;
  };
  
  iterator begin (const cmt_string& text);
  iterator end ();
  
  iterator begin (const cmt_string& text) const;
  iterator end () const;

  bool match (const cmt_string& text) const;
  
private:
  
  cmt_node* _root;
};

#endif

