rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWHashDictionaryIterator Class Reference
[RWCollectable-derived]

Allows sequential access to all the elements of RWHashDictionary. More...

#include <rw/hashdict.h>

Inheritance diagram for RWHashDictionaryIterator:
RWSetIterator RWHashTableIterator RWIterator

List of all members.

Public Member Functions

 RWHashDictionaryIterator (RWHashDictionary &hd)
virtual ~RWHashDictionaryIterator ()
RWCollectablefindNext (const RWCollectable *target)
RWCollectablekey () const
RWCollectableoperator() ()
RWCollectableremove ()
RWCollectableremoveNext (const RWCollectable *target)
RWCollectablevalue () const
RWCollectablevalue (RWCollectable *newValue) const

Detailed Description

Iterator for class RWHashDictionary, allowing sequential access to all the elements of RWHashDictionary. Since RWHashDictionary is unordered, elements are not accessed in any particular order.

Like all Rogue Wave iterators, the "current item" is undefined immediately after construction -- you must define it by using operator()() or some other (valid) operation.

Once the iterator has advanced beyond the end of the collection it is no longer valid -- continuing to use it brings undefined results.

Synopsis

 #include <rw/hashdict.h>
 RWHashDictionary hd;
 RWHashDictionaryIterator  iter(hd);

Persistence

None


Constructor & Destructor Documentation

RWHashDictionaryIterator::RWHashDictionaryIterator ( RWHashDictionary hd  )  [inline]

Constructs an iterator for an RWHashDictionary collection. Immediately after construction, the position of the iterator is undefined until positioned.

virtual RWHashDictionaryIterator::~RWHashDictionaryIterator (  )  [inline, virtual]

Empty destructor.


Member Function Documentation

RWCollectable* RWHashDictionaryIterator::findNext ( const RWCollectable target  )  [virtual]

Moves the iterator to the next key-value pair where the key isEqual() to the object pointed to by target. Returns the key or rwnil if no key was found.

Reimplemented from RWHashTableIterator.

RWCollectable* RWHashDictionaryIterator::key (  )  const [virtual]

Returns the item at the current iterator position.

Reimplemented from RWHashTableIterator.

RWCollectable* RWHashDictionaryIterator::operator() (  )  [virtual]

Advances the iterator to the next key-value pair and returns the key. Returns rwnil if the cursor is at the end of the collection. Use member function value() to recover the value.

Reimplemented from RWHashTableIterator.

RWCollectable* RWHashDictionaryIterator::remove (  ) 

Removes the key-value pair at the current iterator position. Returns the key, or rwnil if there was no key-value pair.

Reimplemented from RWHashTableIterator.

RWCollectable* RWHashDictionaryIterator::removeNext ( const RWCollectable target  ) 

Moves the iterator to the next key-value pair where the key isEqual() to the object pointed to by target. Removes the key-value pair, returning the key or rwnil if there was no match.

Reimplemented from RWHashTableIterator.

RWCollectable* RWHashDictionaryIterator::value ( RWCollectable newValue  )  const

Replaces the value at the current iterator position and returns the old value.

RWCollectable* RWHashDictionaryIterator::value (  )  const

Returns the value at the current iterator position.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.