TokenizerIterator Class Reference

String tokenizer as an Iterator. More...

#include <Tokenizer.hpp>

Inheritance diagram for TokenizerIterator:
Inheritance graph

Public Member Functions

 TokenizerIterator (const char *text, const char *separator)
virtual ~TokenizerIterator ()
void first ()
void next ()
bool isDone ()
char *& item ()
- Public Member Functions inherited from Iterator< char * >
char ** operator-> ()
char *& operator* ()
void iterate (const Functor &f)
virtual void setItem (char *&i)
bool get (std::vector< char * > &current)
virtual void reset ()
virtual void finalize ()
virtual std::vector< Iterator< char * > * > getComposition ()
- Public Member Functions inherited from SmartPointer
void use ()
void forget ()
- Public Member Functions inherited from ISmartPointer
virtual ~ISmartPointer ()

Additional Inherited Members

- Protected Member Functions inherited from SmartPointer
 SmartPointer ()
virtual ~SmartPointer ()

Detailed Description

String tokenizer as an Iterator.

Tool for tokenizing strings (like strtok) that follows our Iterator concept.

One should provide both the string to be tokenized and a string holding characters to be considered as separators.

Code sample:

void sample ()
// We create a tokenizer with spaces as separators.
TokenizerIterator it ("this is the text to tokenize", " ");
// We loop the iterator
for (it.first(); !it.isDone();
// We get the current token
char* token = it.currentItem ();

Constructor & Destructor Documentation

TokenizerIterator ( const char *  text,
const char *  separator 


text: the string to be tokenized.
separator: the separator characters.
~TokenizerIterator ( )


Member Function Documentation

void first ( )

Method that initializes the iteration.

Implements Iterator< char * >.

bool isDone ( )

Method telling whether the iteration is finished or not.

true if iteration is finished, false otherwise.

Implements Iterator< char * >.

char*& item ( )

Method that returns the current iterated item. Note that the returned type is the template type.

the current item in the iteration.

Implements Iterator< char * >.

void next ( )

Method that goes to the next item in the iteration.

status of the iteration

Implements Iterator< char * >.

The documentation for this class was generated from the following files: