RWTIsvDlistIterator(3C++) RWTIsvDlistIterator(3C++)
Name
RWTIsvDlistIterator<T> - Rogue Wave library class
Synopsis
#include <rw/tidlist.h>
RWTIsvDlist<T> list;
RWTIsvDlistIterator<T> iterator(list);
Description
Iterator for class RWTIsvDlist<T>, allowing sequential access to all the
elements of a doubly-linked parameterized intrusive list. Elements are
accessed in order, in either direction. 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
RWTIsvDlistIterator(RWTIsvDlist<T>& c);
Constructs an iterator to be used with the list c.
Public Operators
T*
operator++();
Advances the iterator one position, returning a pointer to the new link,
or nil if the end of the list has been reached.
T*
operator--();
Reverses the iterator one position, returning a pointer to the new link,
or nil if the beginning of the list has been reached.
T*
operator+=(size_t n);
Advances the iterator n positions, returning a pointer to the new link,
Page 1
RWTIsvDlistIterator(3C++) RWTIsvDlistIterator(3C++)
or nil if the end of the list has been reached.
T*
operator-=(size_t n);
Reverses the iterator n positions, returning a pointer to the new link,
or nil if the beginning of the list has been reached.
T*
operator()();
Advances the iterator one position, returning a pointer to the new link,
or nil if the end of the list has been reached.
Public Member Functions
RWTIsvDlist<T>*
container() const;
Returns a pointer to the collection over which this iterator is
iterating.
T*
findNext(RWBoolean (*testFun)(const T*, void*),void*);
Advances the iterator to the first link for which the tester function
pointed to by testFun returns TRUE and returns it, or nil if there is no
such link.
void
insertAfterPoint(T* a);
Inserts the link pointed to by a into the iterator's associated
collection in the position immediately after the iterator's current
position.
T*
key() const;
Returns the link at the iterator's current position. Returns nil if the
iterator is not valid.
T*
remove();
Removes and returns the current link from the iterator's associated
Page 2
RWTIsvDlistIterator(3C++) RWTIsvDlistIterator(3C++)
collection. Returns nil if unsuccessful. Afterwards, if successful, the
iterator will be positioned at the element immediately before the removed
link.
T*
removeNext(RWBoolean (*testFun)(const T*, void*),void*);
Advances the iterator to the first link for which the tester function
pointed to by testFun returns TRUE, removes and returns it. Returns
FALSE if unsuccessful. Afterwards, if successful, the iterator will be
positioned at the element immediately before the removed element.
void
reset();
Resets the iterator to the state it had immediately after construction.
void
reset(RWTIsvDlist<TL>& c);
Resets the iterator to iterate over the collection c.
Page 3