iflListIter(3) Image Format Library C++ Reference Manual iflListIter(3)NAME
iflListIter, iflListIterRev, iflMultiListIter, iflMultiListIterRev -
iterators for iflList and iflMultiList
INHERITS FROM
This is a base class.
HEADER FILE
#include <ifl/iflList.h>
CLASS DESCRIPTION
ifl[Multi]ListIter and ifl[Multi]ListIterRev provide lightweight
iterators for doubly-linked lists derived from iflList or iflMultiList.
Using iflListIter
Say you have built a list of some sort of item:
iflList<someItem> list;
for (int i = 0; i < 10; i++)
list.append(new someItem(i));
You can iterate through the items from the head to the tail by doing:
iflListIter<someItem> iter(list);
someItem* item;
while (item = iter.next()) {
// do something with item (and possibly unlink/delete it)
}
Alternatively, you can iterate backwards, from the tail to the head with:
iflListIterRev<someItem> iter(list);
someItem* item;
while (item = iter.next()) {
// do something with item (and possibly unlink/delete it)
}
CLASS MEMBER FUNCTION SUMMARY
Constructors
iflListIter<I>(const iflList<I>* list)
iflListIter<I>(const iflList<I>& list)
iflListIterRev<I>(const iflList<I>* list)
iflListIterRev<I>(const iflList<I>& list)
iflMultiListIter<I,L>(const iflMultiList<I,L>* list)
iflMultiListIter<I,L>(const iflMultiList<I,L>& list)
Page 1
iflListIter(3) Image Format Library C++ Reference Manual iflListIter(3)
iflMultiListIterRev<I,L>(const iflMultiList<I,L>* list)
iflMultiListIterRev<I,L>(const iflMultiList<I,L>& list)
Traversing
I* next()
I* curr() const
void reset()FUNCTION DESCRIPTIONSiflListIter()
iflListIter<I>(const iflList<I>* list)
iflListIter<I>(const iflList<I>& list)
Constructs a forward (head to tail) iterator from a pointer or
reference to an iflList, given by list.
iflMultiListIter()
iflMultiListIter<I,L>(const iflMultiList<I,L>* list)
iflMultiListIter<I,L>(const iflMultiList<I,L>& list)
Constructs a forward (head to tail) iterator from a pointer or
reference to an iflMultiList, given by list.
iflListIterRev()
iflListIterRev<I>(const iflList<I>* list)
iflListIterRev<I>(const iflList<I>& list)
Constructs a reverse (tail to head) iterator from a pointer or
reference to an iflList, given by list.
iflMultiListIterRev()
iflMultiListIterRev<I,L>(const iflMultiList<I,L>* list)
iflMultiListIterRev<I,L>(const iflMultiList<I,L>& list)
Constructs a reverse (tail to head) iterator from a pointer or
reference to an iflMultiList, given by list.
curr()
Page 2
iflListIter(3) Image Format Library C++ Reference Manual iflListIter(3)
I* curr() const
Returns the current element of the iteration; this is the same value
as that last returned from next().
next()
I* next()
Returns the next sequential element (the direction depends on the
type of iterator), or NULL if the end of the list has been reached.
The iterator is designed in such a way that it is safe to remove the
current item while traversing a list; no items will be skipped or
revisited.
reset()
void reset()
Resets the iterator to start from the first element again.
SEE ALSO
iflListItem, iflList, iflMultiList
Page 3