VIPER REFERENCE MANUAL


NAME
iflMultiListIter - forward iterator for iflMultiList

HEADER FILE
#include <ifl/iflList.h>

PUBLIC METHOD SUMMARY

   Constructors
template<class itemType, class linkageType> iflMultiListIter ( const iflMultiList<itemType, linkageType>* list);
template<class itemType, class linkageType> iflMultiListIter ( const iflMultiList<itemType, linkageType>& list);

   Moving through the list
itemType* next (  );
itemType* curr (  ) const;
void reset (  );

CLASS DESCRIPTION
iflMultiListIter provides a lightweight iterator for doubly-linked lists derived from iflMultiList. For iflList derived lists use iflListIter

   Using iflMultiListIter
Say you have built a list of some sort of item:
    iflMultiList<someItem,linkType> 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:
    iflMultiListIter<someItem,linkType> iter(list);
    someItem* item;
    while (item = iter.next()) {
        // do something with item (and possibly unlink/delete it)
    }
You can interate backwards using iflMultiListIterRev

METHOD DESCRIPTIONS

   iflMultiListIter()
template<class itemType, class linkageType> iflMultiListIter ( const iflMultiList<itemType, linkageType>* list);
template<class itemType, class linkageType> iflMultiListIter ( const iflMultiList<itemType, linkageType>& list);

Constructs a forward (head to tail) iterator from a pointer or reference to an iflMultiList, given by list.

   curr()
itemType* curr (  ) const;

Returns the current element of the iteration; this is the same value as that last returned from next().

   next()
itemType* next (  );

Returns the next sequential element, 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 head element again.

SEE ALSO
iflListIter, iflMultiList, iflMultiListIterRev