Contains virtual functions for positioning and resetting the iterator. More...
#include <rw/iterator.h>
Public Member Functions | |
virtual RWCollectable * | findNext (const RWCollectable *target)=0 |
virtual RWCollectable * | key () const =0 |
virtual RWCollectable * | operator() ()=0 |
virtual void | reset ()=0 |
Class RWIterator is an abstract base class for iterators used by the Smalltalk-like collection classes. The class contains virtual functions for positioning and resetting the iterator. They are all pure virtual functions, meaning that deriving classes must supply a definition. The descriptions below are intended to be generic – all inheriting iterators generally follow the described pattern.
|
pure virtual |
Moves the iterator forward to the next item which "matches" the object pointed to by target and returns it or rwnil if no item was found. For most collections, an item "matches" the target if either RWCollectable::isEqual() or RWCollectable::compareTo() indicate equivalence, whichever is appropriate for the actual collection type. However, when an iterator is used with an "identity collection" (i.e., RWIdentitySet and RWIdentityDictionary), it looks for an item with the same address (i.e., "is identical to").
Implemented in RWSlistCollectablesIterator, RWDlistCollectablesIterator, RWHashTableIterator, RWOrderedIterator, RWHashDictionaryIterator, RWBinaryTreeIterator, and RWBagIterator.
|
pure virtual |
Returns the item at the current iterator position.
Implemented in RWSlistCollectablesIterator, RWDlistCollectablesIterator, RWHashTableIterator, RWOrderedIterator, RWHashDictionaryIterator, RWBinaryTreeIterator, and RWBagIterator.
|
pure virtual |
Advances the iterator and returns the next item, or rwnil if the end of the collection has been reached.
Implemented in RWSlistCollectablesIterator, RWDlistCollectablesIterator, RWHashTableIterator, RWOrderedIterator, RWHashDictionaryIterator, RWBinaryTreeIterator, and RWBagIterator.
|
pure virtual |
Resets the iterator to the state it had immediately after construction.
Implemented in RWSlistCollectablesIterator, RWDlistCollectablesIterator, RWHashTableIterator, RWOrderedIterator, RWHashDictionaryIterator, RWBinaryTreeIterator, RWBagIterator, and RWSetIterator.
Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |