Tools.h++ Manual

21-172 104011 Tandem Computers Incorporated
21
RWSlistCollectablesIterator
RWSlistCollectablesIterator
||
RWIterator RWSlistIterator
Synopsis
// Smalltalk typedef.
typedef RWSlistCollectablesIterator LinkedListIterator;
#include <rw/slistcol.h>
RWSlistCollectables sc;
RWSlistCollectablesIterator sci(sc);
Description Iterator for class
RWSlistCollectables
. Traverses the linked-list from the
first to last item.
Like all Tools.h++ 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.
Public constructor
RWSlistCollectablesIterator (RWSlistCollectables&);
Constructs an iterator from a singly-linked list. Immediately after
construction, the position of the iterator will be undefined.
Public member operators
virtual RWCollectable* operator()();
Redefined from class
RWIterator
. Advances the iterator to the next element
and returns it. Returns nil when the end of the collection is reached.
void operator++();
Advances the iterator one item.
void operator+=(size_t n);
Advances the iterator
n
items.
Public member functions
RWBoolean atFirst() const;
Returns
TRUE
if the iterator is at the beginning of the list, otherwise
FALSE
;