RWDlistCollectablesIterator(3C++) RWDlistCollectablesIterator(3C++)
NameRWDlistCollectablesIterator - Rogue Wave library class
Synopsis
#include <rw/dlistcol.h>
RWDlistCollectables d;
RWDlistCollectablesIteratorit(d) ;
Description
Iterator for class RWDlistCollectables. Traverses the linked-list from
the first (head) to the last (tail) item. Functions are provided for
moving in either direction. 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 will bring undefined results.
Persistence
None
Public ConstructorRWDlistCollectablesIterator (RWDlistCollectables& d);
Construct an RWDlistCollectablesIterator from an RWDlistCollectables.
Immediately after construction, the position of the iterator is
undefined.
Public Member Operators
virtual RWCollectable*
operator()();
Redefined from class RWIterator. Advances the iterator to the next item
and returns it. Returns nil when the end of the list is reached.
void
operator++();
Advances the iterator one item.
void
operator--();
Page 1
RWDlistCollectablesIterator(3C++) RWDlistCollectablesIterator(3C++)
Moves the iterator back one item.
void
operator+=(size_t n);
Advances the iterator n items.
void
operator-=(size_t n);
Moves the iterator back n items.
Public Member Functions
RWBoolean
atFirst() const;
Returns TRUE if the iterator is at the beginning of the list, otherwise
FALSE;
RWBoolean
atLast() const;
Returns TRUE if the iterator is at the end of the list, otherwise FALSE;
virtual RWCollectable*
findNext(const RWCollectable* target);
Redefined from class RWIterator. Moves iterator to the next item which
isEqual to the item pointed to by target and returns it. If no item is
found, returns nil and the position of the iterator will be undefined.
RWCollectable*
findNextReference(const RWCollectable* e);
Moves iterator to the next item which is identical to the item pointed to
by e (that is, that has address e) and returns it. If no item is found,
returns nil and the position of the iterator will be undefined.
RWCollectable*
insertAfterPoint(RWCollectable* a);
Insert item a after the current cursor position and return the item. The
cursor's position will be unchanged.
Page 2
RWDlistCollectablesIterator(3C++) RWDlistCollectablesIterator(3C++)
virtual RWCollectable*
key() const;
Redefined from class RWIterator. Returns the item at the current
iterator position.
RWCollectable*
remove();
Removes and returns the item at the current cursor position. Afterwards,
the iterator will be positioned at the previous item in the list.
RWCollectable*
removeNext(const RWCollectable* target);
Moves iterator to the next item in the list which isEqual to the item
pointed to by target, removes it from the list and returns it.
Afterwards, the iterator will be positioned at the previous item in the
list. If no item is found, returns nil and the position of the iterator
will be undefined.
RWCollectable*
removeNextReference(const RWCollectable* e);
Moves iterator to the next item in the list which is identical to the
item pointed to by e (that is, that has address e), removes it from the
list and returns it. Afterwards, the iterator will be positioned at the
previous item in the list. If no item is found, returns nil and the
position of the iterator will be undefined.
virtual void
reset();
Redefined from class RWIterator. Resets the iterator. Afterwards, the
position of the iterator will be undefined.
void
toFirst();
Moves the iterator to the beginning of the list.
void
toLast();
Moves the iterator to the end of the list.
Page 3