#ifndef TOKENIZERFIND_H
#define TOKENIZERFIND_H

#include <tokenizer.h>

/**
\brief Search and index into the string without changing it.

Excludes tokenizer::current.  
Compare this with tokenizer::atomize_next which
 tokenizes the finds.
*/
class tokenizerfind
{
public:

  /** Reference. */
  tokenizer& ref;
  
  /** Index into the string pointed to by ref.current */
  string::size_type index;
  /** Immediate target string. */
  string atom;

  /** Constructor. */
  tokenizerfind(tokenizer& ref_)
    : ref(ref_), index(0) {}
  /** Constructor. */
  tokenizerfind(tokenizer& ref_, stringc& atom_)
    : ref(ref_), index(0), atom(atom_) {}

  /** From current find the next atom1. */
  boolc find(stringc& atom1);
  boolc find(stringc& atom1, stringc& atom2);
  boolc find(stringc& atom1, stringc& atom2, stringc& atom3);
  boolc find(stringc& atom1, stringc& atom2, stringc& atom3, stringc& atom4);
  boolc find(stringc& atom1, stringc& atom2, stringc& atom3, stringc& atom4, stringc& atom5);
  boolc find(stringc& atom1, stringc& atom2, stringc& atom3, stringc& atom4, stringc& atom5, stringc& atom6);

  /** Resets token iteration. */
  boolc reset();
//    { return ref.find(index,atom); }
  /** Can the stream be read?  */
  boolc operator !();
//    { return !ref; }
  /** Increment the stream's index. */
  void operator ++ ();
//    { ++index; ref.find(index,atom,index); }
  /** Access the current token in the stream. */
  stringc & operator() () const;
//    { return ref(); }
  string & operator * ();
//    { return *ref; }

};


#endif


