SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWHashTableIterator Class Reference

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

#include <rw/hashtab.h>

Inheritance diagram for RWHashTableIterator:
RWIterator RWSetIterator RWHashDictionaryIterator

Public Member Functions

 RWHashTableIterator (RWHashTable &h)
 
virtual RWCollectablefindNext (const RWCollectable *target)
 
virtual RWCollectablekey () const
 
virtual RWCollectableoperator() ()
 
RWCollectableremove ()
 
RWCollectableremoveNext (const RWCollectable *target)
 
virtual void reset ()
 

Friends

class RWHashTableConstIterator
 

Detailed Description

Iterator for class RWHashTable, which allows sequential access to all the elements of RWHashTable.

Note
An RWHashTable is unordered, elements are not accessed in any particular order.

As with 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/hashtab.h>
Allows sequential access to all the elements of RWHashTable.
Definition hashtab.h:354
A simple hash table for objects inheriting from RWCollectable. Uses chaining (as implemented by class...
Definition hashtab.h:121
Persistence
None

Constructor & Destructor Documentation

◆ RWHashTableIterator()

RWHashTableIterator::RWHashTableIterator ( RWHashTable & h)

Constructs an iterator for an RWHashTable. After construction, the position of the iterator is undefined.

Member Function Documentation

◆ findNext()

virtual RWCollectable * RWHashTableIterator::findNext ( const RWCollectable * target)
virtual

Moves the iterator to the next item which isEqual() to the item pointed to by target and returns it.

Implements RWIterator.

Reimplemented in RWHashDictionaryIterator.

◆ key()

virtual RWCollectable * RWHashTableIterator::key ( ) const
virtual

Returns the item at the current iterator position.

Implements RWIterator.

Reimplemented in RWHashDictionaryIterator.

◆ operator()()

virtual RWCollectable * RWHashTableIterator::operator() ( )
virtual

Advances the iterator and returns the next item, or rwnil if the end of the collection has been reached.

Implements RWIterator.

Reimplemented in RWHashDictionaryIterator.

◆ remove()

RWCollectable * RWHashTableIterator::remove ( )

Removes the item at the current iterator position from the collection.

◆ removeNext()

RWCollectable * RWHashTableIterator::removeNext ( const RWCollectable * target)

Moves the iterator to the next item which isEqual() to the item pointed to by target, removes it from the collection and returns it. If no item is found, returns rwnil and the position of the iterator is undefined.

◆ reset()

virtual void RWHashTableIterator::reset ( )
virtual

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

Implements RWIterator.

Reimplemented in RWHashDictionaryIterator, and RWSetIterator.

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