SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWHashDictionaryIterator Class Reference

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

#include <rw/hashdict.h>

Inheritance diagram for RWHashDictionaryIterator:
RWSetIterator RWHashTableIterator RWIterator

Public Member Functions

 RWHashDictionaryIterator (RWHashDictionary &hd)
 
virtual ~RWHashDictionaryIterator ()
 
RWCollectablefindNext (const RWCollectable *target)
 
RWCollectablekey () const
 
RWCollectableoperator() ()
 
RWCollectableremove ()
 
RWCollectableremoveNext (const RWCollectable *target)
 
void reset ()
 
RWCollectablevalue () const
 
RWCollectablevalue (RWCollectable *newValue) const
 
- Public Member Functions inherited from RWSetIterator
 RWSetIterator (RWSet &h)
 
void reset ()
 
- Public Member Functions inherited from RWHashTableIterator
 RWHashTableIterator (RWHashTable &h)
 
RWCollectableremove ()
 
RWCollectableremoveNext (const RWCollectable *target)
 

Friends

class RWHashDictionaryConstIterator
 

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>
Allows sequential access to all the elements of RWHashDictionary.
Definition hashdict.h:340
Represents a group of unordered values, accessible by external keys.
Definition hashdict.h:48
Persistence
None

Constructor & Destructor Documentation

◆ RWHashDictionaryIterator()

RWHashDictionaryIterator::RWHashDictionaryIterator ( RWHashDictionary & hd)
inline

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

◆ ~RWHashDictionaryIterator()

virtual RWHashDictionaryIterator::~RWHashDictionaryIterator ( )
inlinevirtual

Empty destructor.

Member Function Documentation

◆ findNext()

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.

◆ key()

RWCollectable * RWHashDictionaryIterator::key ( ) const
virtual

Returns the item at the current iterator position.

Reimplemented from RWHashTableIterator.

◆ operator()()

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.

◆ remove()

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.

◆ removeNext()

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.

◆ reset()

void RWHashDictionaryIterator::reset ( )
inlinevirtual

Resets the iterator to the state it had immediately after construction.

Reimplemented from RWHashTableIterator.

◆ value() [1/2]

RWCollectable * RWHashDictionaryIterator::value ( ) const

Returns the value at the current iterator position.

◆ value() [2/2]

RWCollectable * RWHashDictionaryIterator::value ( RWCollectable * newValue) const

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

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.