SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWConstIterator Class Referenceabstract

Contains virtual functions for positioning and resetting the const iterator. More...

#include <rw/iterator.h>

Inheritance diagram for RWConstIterator:
RWBagConstIterator RWBinaryTreeConstIterator RWDlistCollectablesConstIterator RWHashTableConstIterator RWOrderedConstIterator RWSlistCollectablesConstIterator RWSetConstIterator RWHashDictionaryConstIterator

Public Member Functions

virtual const RWCollectablefindNext (const RWCollectable *target)=0
 
virtual const RWCollectablekey () const =0
 
virtual const RWCollectableoperator() ()=0
 
virtual void reset ()=0
 

Detailed Description

Class RWConstIterator is an abstract base class for const iterators used by the Smalltalk-like collection classes. The const iterators do not change any information in the data structure upon which they iterate.

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.

Synopsis
#include <rw/iterator.h>
(Abstract base class)
Persistence
None

Member Function Documentation

◆ findNext()

virtual const RWCollectable * RWConstIterator::findNext ( const RWCollectable * target)
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() indicates 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 RWBagConstIterator, RWBinaryTreeConstIterator, RWDlistCollectablesConstIterator, RWHashDictionaryConstIterator, RWHashTableConstIterator, RWOrderedConstIterator, and RWSlistCollectablesConstIterator.

◆ key()

virtual const RWCollectable * RWConstIterator::key ( ) const
pure virtual

◆ operator()()

virtual const RWCollectable * RWConstIterator::operator() ( )
pure virtual

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

Implemented in RWBagConstIterator, RWBinaryTreeConstIterator, RWDlistCollectablesConstIterator, RWHashDictionaryConstIterator, RWHashTableConstIterator, RWOrderedConstIterator, and RWSlistCollectablesConstIterator.

◆ reset()

virtual void RWConstIterator::reset ( )
pure virtual

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