zorba::Iterator

#include <zorba/iterator.h>

Inherited from: zorba::SmartObject

Interface for an Iterator over a sequence of items. An iterator can be in one of the following two states: open or not-open. When in open state, only methods isOpen(), next() and close() may be called. When in not-open state, only isOpen() and open() may be called. The open() method changes the state from non-open to open, and the close() method changes the state from open to not-open.

Public Functions

void

addReference() const

void

close()=0

Stop iterating.

void

free()

long

getRefCount() const

bool

isOpen() const =0

brief Check whether the iterator is open or not

bool

next(Item &aItem)=0

Get the next Item of the sequence.

void

open()=0

Start iterating.

void

removeReference()

~Iterator()

Destructor.

Protected Attributes

unsigned int

theRefCount

Public Functions

addReference

void addReference() const

close

void close()=0

Stop iterating.

The purpose of this method is to release resources that were allocated during open. After calling close(), neither close() nor next() may be called again. However, the iterator may be re-opened (by calling open()).

Parameters

if an error occurs, or the Iterator has not been opened.

free

void free()

getRefCount

long getRefCount() const

isOpen

bool isOpen() const =0

brief Check whether the iterator is open or not

next

bool next(Item &aItem)=0

Get the next Item of the sequence.

Parameters

aItem the next Item of the sequence, unless all the items of the sequence have been returned already by previous invocations of next().

Returns

false if all the items of the sequence have been returned already by previous invocations of next(); true otherwise.

Parameters

if an error occurs, or the Iterator has not been opened.

open

void open()=0

Start iterating.

This function needs to be called before calling next() or close(). Its purpose is to create and initialize any resources that may be needed during the iteration. It should not be called again until after close() has been called.

Parameters

if an error occurs, or the iterator is open already.

removeReference

void removeReference()

~Iterator

 ~Iterator()

Destructor.

Protected Attributes

theRefCount

unsigned int theRefCount