Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages | Examples

rdaDataIterator Class Reference

An iterator over an rdaData object. More...

List of all members.

Public Member Functions

 rdaDataIterator (const rdaData &d)
 Constructs an iterator attached to the specified data object.

 ~rdaDataIterator ()
 Destructor.

bool hasNext ()
 Returns true if the iteration has more elements.

rdaDataEntrynext ()
 Returns a pointer to the next data entry in the data object, or NULL if the iteration has no more elements.


Detailed Description

An iterator over an rdaData object.

Provides sequential access to the rdaDataEntry objects contained in an rdaData. For example, you can use the following code to print tags of all entries in a data object:

    //
    // Create a data object and insert few entries into it
    //
    rdaData data;
    data.insert("Entry1", 1.0);
    data.insert("Entry2", 1.0);
    data.insert("Entry3", 1.0);
    //
    // Print out all entry tags 
    //
    rdaDataIterator iter(data);
    while (iter.hasNext())
    {
       printf("%s\n", iter.next()->tag());
    }     
The iterator cannot be used to remove a data entry while iterating through a data object. The behavior of an iterator is unspecified if the underlying data object is modified (a data entry is added to or removed from it) while the iteration is in progress.


Member Function Documentation

bool rdaDataIterator::hasNext  ) 
 

Returns true if the iteration has more elements.

In other words, returns true if next() would return a valid data entry pointer rather than NULL.


The documentation for this class was generated from the following file:
RDA-2.3 documentation - 27 Jun 2007 - N.Trofimov