RWTIsvSlistIterator(3C++) RWTIsvSlistIterator(3C++)
Name
RWTIsvSlistIterator<T> - Rogue Wave library class
Synopsis
#include <rw/tislist.h>
RWTIsvSlist<T> list;
RWTIsvSlistIterator<T> iterator(list);
Description
Iterator for class RWTIsvSlist<T>, allowing sequential access to all the
elements of a singly-linked parameterized intrusive list. Elements are
accessed in order, from first to last. 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
RWTIsvSlistIterator(RWTIsvSlist<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+=(size_t n);
Advances the iterator n positions, returning a pointer to the new link,
or nil if the end of the list has been reached.
T*
operator()();
Advances the iterator one position, returning a pointer to the new link,
Page 1
RWTIsvSlistIterator(3C++) RWTIsvSlistIterator(3C++)
or nil if the end of the list has been reached.
Public Member Functions
RWTIsvSlist<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
collection. Returns nil if unsuccessful. Afterwards, if successful, the
iterator will be positioned at the element immediately before the removed
link. This function is relatively inefficient for a singly-linked list.
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.
Page 2
RWTIsvSlistIterator(3C++) RWTIsvSlistIterator(3C++)
void
reset();
Resets the iterator to the state it had immediately after construction.
void
reset(RWTIsvSlist<TL>& c);
Resets the iterator to iterate over the collection c.
Page 3