Public Member Functions | Protected Attributes | Friends
Iterator Class Reference

Interface for an Iterator over an instance of the XML Data Model (i.e., a sequence of items). More...

List of all members.

Public Member Functions

void close ()
 Stop iterating.
void destroy ()
 brief Destroy this iterator from memory
bool isOpen ()
 brief Check whether the iterator is open or not
 Iterator ()
 Iterator (const Iterator &anIterator)
 Iterator (zorba::Iterator_t anIterator)
 Iterator (zorba::Item &aItem)
bool next (Item &aItem)
 Get the next Item of the sequence.
void open ()
 Start iterating.

Protected Attributes

bool theConsumed
zorba::Item theItem
zorba::Iterator_t theIterator

Friends

class Collection
class CollectionManager
class DocumentManager
class DynamicContext
class ItemSequence
class StaticContext
class XQuery

Detailed Description

Interface for an Iterator over an instance of the XML Data Model (i.e., 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.

Note: Iterator is not a thread-safe class, i.e., none of its methods should ever be called by two or more threads in parallel.

Examples:
Test_Zorba.java.

Definition at line 32 of file Iterator.h.


Constructor & Destructor Documentation

Iterator::Iterator ( )

Definition at line 47 of file Iterator.h.

Iterator::Iterator ( const Iterator anIterator)

Definition at line 48 of file Iterator.h.

Iterator::Iterator ( zorba::Iterator_t  anIterator)

Definition at line 53 of file Iterator.h.

Iterator::Iterator ( zorba::Item &  aItem)

Definition at line 57 of file Iterator.h.


Member Function Documentation

void Iterator::close ( )

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()).

Exceptions:
ZorbaExceptionif an error occurs, or the Iterator has not been opened.
Examples:
Test_Zorba.java.
void Iterator::destroy ( )

brief Destroy this iterator from memory

bool Iterator::isOpen ( )

brief Check whether the iterator is open or not

bool Iterator::next ( Item aItem)

Get the next Item of the sequence.

Parameters:
aItemthe next Item of the result sequence, if true is returned by the function.
Returns:
false if all the items of the sequence have been returned already by previous invocations of next(); true otherwise.
Exceptions:
ZorbaExceptionif an error occurs, or the Iterator has not been opened.
Examples:
Test_Zorba.java.
void Iterator::open ( )

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.

Exceptions:
ZorbaExceptionif an error occurs, or the iterator is open already.
Examples:
Test_Zorba.java.

Friends And Related Function Documentation

friend class Collection
friend

Definition at line 38 of file Iterator.h.

friend class CollectionManager
friend

Definition at line 37 of file Iterator.h.

friend class DocumentManager
friend

Definition at line 36 of file Iterator.h.

friend class DynamicContext
friend

Definition at line 35 of file Iterator.h.

friend class ItemSequence
friend

Definition at line 41 of file Iterator.h.

friend class StaticContext
friend

Definition at line 39 of file Iterator.h.

friend class XQuery
friend

Definition at line 40 of file Iterator.h.


Member Data Documentation

bool Iterator::theConsumed
protected

Definition at line 44 of file Iterator.h.

zorba::Item Iterator::theItem
protected

Definition at line 43 of file Iterator.h.

zorba::Iterator_t Iterator::theIterator
protected

Definition at line 42 of file Iterator.h.


The documentation for this class was generated from the following file:
blog comments powered by Disqus