RWHashDictionaryIterator(3C++) RWHashDictionaryIterator(3C++)
NameRWHashDictionaryIterator - Rogue Wave library class
Synopsis
#include <rw/hashdict.h>
RWHashDictionary hd;
RWHashDictionaryIteratoriter(hd);
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 will bring
undefined results.
Persistence
None
Public Constructor
RWHashDictionaryIterator(RWHashDictionary&);
Construct an iterator for an RWHashDictionary collection. Immediately
after construction, the position of the iterator is undefined until
positioned.
Public Member Operator
virtual RWCollectable*
operator()();
Redefined from class RWIterator. Advances the iterator to the next key-
value pair and returns the key. Returns nil if the cursor is at the end
of the collection. Use member function value() to recover the value.
Public Member Functions
virtual RWCollectable*
findNext(const RWCollectable* target);
Redefined from class RWIterator. Moves the iterator to the next key-
value pair where the key isEqual to the object pointed to by target.
Page 1
RWHashDictionaryIterator(3C++) RWHashDictionaryIterator(3C++)
Returns the key or nil if no key was found.
virtual RWCollectable*
key() const;
Redefined from class RWIterator. Returns the key at the current iterator
position.
RWCollectable*
remove();
Removes the key-value pair at the current iterator position. Returns the
key, or nil if there was no key-value pair.
RWCollectable*
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 nil if there was no match.
virtual void
reset();
Redefined from class RWIterator. Inherited from class RWSetIterator.
Resets the iterator to its initial state.
RWCollectable*
value() const;
Returns the value at the current iterator position.
RWCollectable*
value(RWCollectable* newValue) const;
Replaces the value at the current iterator position and returns the old
value.
Page 2