Jive reference manual
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
jem::util::DictionaryEnumerator Class Referenceabstract

Iterates over the key/value pairs in a dictionary. More...

#include <jem/util/DictionaryEnumerator.h>

Inheritance diagram for jem::util::DictionaryEnumerator:
Inheritance graph

Public Types

typedef Enumerator Super
 
typedef DictionaryEnumerator Self
 

Public Member Functions

virtual ClassgetClass () const
 Returns the Class instance representing the runtime class of this object. More...
 
virtual Ref< Objectget () const
 Returns the current key/value pair as an object. More...
 
virtual String getKey () const =0
 Returns the key in the current key/value pair. More...
 
virtual Ref< ObjectgetValue () const =0
 Returns the value in the current key/value pair. More...
 
- Public Member Functions inherited from jem::util::Enumerator
virtual bool atEnd () const =0
 Checks whether this enumerator points to an end object. More...
 
virtual void toNext ()=0
 Advances this enumerator to the next object. More...
 
- Public Member Functions inherited from jem::Object
virtual String toString () const
 Returns a short textual description of this object. More...
 
virtual long hashValue () const
 Returns a hash value for this object. More...
 
virtual bool equals (const Ref< Object > &obj) const
 Tests whether two objects are equal. More...
 
Ref< Objectclone () const
 Returns a copy of this object. More...
 

Static Public Member Functions

static ClassmakeClass ()
 
static ClassgetType ()
 
- Static Public Member Functions inherited from jem::util::Enumerator
static ClassmakeClass ()
 
static ClassgetType ()
 
- Static Public Member Functions inherited from jem::Object
static ClassgetType ()
 Returns the Class instance representing the Object class. More...
 

Protected Member Functions

virtual ~DictionaryEnumerator ()
 
- Protected Member Functions inherited from jem::util::Enumerator
virtual ~Enumerator ()
 
- Protected Member Functions inherited from jem::Collectable
 Collectable ()
 Creates an empty Collectable. More...
 
 ~Collectable ()
 Frees resources. More...
 

Detailed Description

The abstract class DictionaryEnumerator can be used to iterate over all key/value pairs in a Dictionary. It extends the Enumerator class with the member functions getKey() and getValue() that return the key and value, respectively, in a key/value pair.

A DictionaryEnumerator points either to a key/value pair or to an end object that comes right after the last key/value pair. An end object is a conceptual object that can not be accessed. Only the function atEnd() may be called when a DictionaryEnumerator points to an end object.

See also
Dictionary

Member Typedef Documentation

Constructor & Destructor Documentation

virtual jem::util::DictionaryEnumerator::~DictionaryEnumerator ( )
protectedvirtual

Member Function Documentation

static Class* jem::util::DictionaryEnumerator::makeClass ( )
static
static Class* jem::util::DictionaryEnumerator::getType ( )
static
virtual Class* jem::util::DictionaryEnumerator::getClass ( ) const
virtual

Returns a pointer to the Class instance representing the runtime class of this object. If T denotes the runtime class of this object, then this function is equivalent with T::getType(). The pointer is valid during the entire lifetime of the program.

Returns
A pointer to the Class instance representing the runtime class of this object.

Reimplemented from jem::util::Enumerator.

virtual Ref<Object> jem::util::DictionaryEnumerator::get ( ) const
virtual

Returns an object containing the key/value pair that this enumerator is currently pointing to. The dynamic type of the returned object is not specified. The only requirement is that the returned object can be passed to the function add() of the dictionary that created this enumerator.

The implementation of this function provided by the DictionaryEnumerator return the key/value pair as an ObjectPair. That is, it executes the following code:

return newInstance<ObjectPair> (
);

This function may not be called when this enumerator points to the end object.

Precondition
atEnd() == false
Returns
An object containing the current key/value pair.

Implements jem::util::Enumerator.

virtual String jem::util::DictionaryEnumerator::getKey ( ) const
pure virtual

Returns the key in the current key/value pair. This function may not be called when this enumerator points to the end object.

Precondition
atEnd() == false
Returns
The key in the current key/value pair.
virtual Ref<Object> jem::util::DictionaryEnumerator::getValue ( ) const
pure virtual

Returns a reference to the value in the current key/value pair. This function may not be called when this enumerator points to the end object.

Precondition
atEnd() == fale
Returns
A reference to the value in the current key/value pair.