NAME
OTC_MListModifier -
Inherits from OTC_MListIterator to allow modification of items.
SYNOPSIS
#include <OTC/collctn/mlstmdfr.hh>
template<class T>
class OTC_MListModifier : public OTC_MListIterator<T>
{
public:
inline OTC_MListModifier(
OTC_MList<T>& theList,
OTC_Protection theProtection=OTCLIB_SAFE
);
inline T& item() const;
inline void remove();
inline void addBefore(T const& theItem);
inline void addAfter(T const& theItem);
};
CLASS TYPE
Concrete
DESCRIPTION
This class inherits from OTC_MListIterator to allow modification
of items held by an instance of OTC_MList. Items in the list can
also be removed using the iterator.
This iterator can be moved both forward and backwards. The
life of the iterator, cannot extend beyond the life of the
list being iterated over.
INITIALISATION
inline OTC_MListModifier(
OTC_MList<T>& theList,
OTC_Protection theProtection=OTCLIB_SAFE
);
Initialises the iterator. The iterator
will be located over the first item in
theList, or if the list is empty at the
start of the list. The argument
theProtection determines if reference
counting will actually be performed on
links in the list. The default of
OTCLIB_SAFE will result in reference
counting being performed. A value of
OTCLIB_UNSAFE will turn of reference
counting. In this later case, the list
should not be modified while the iterator
exists as the state of the iterator will
be corrupted.
RETRIEVAL
inline T& item() const;
Returns the item under the current
location of the iterator. Raises an
exception if there is no item under the
iterator.
REMOVAL
inline void remove();
If the iterator is located on a valid item
in the list, the item is removed from the
list.
ADDITION
inline void addBefore(T const& theItem);
Adds theItem in the list before the
item where the iterator is currently
located. If the iterator is at the
start of the list, the item will be
added as the first item in the list.
inline void addAfter(T const& theItem);
Adds theItem in the list after the
item where the iterator is currently
located. If the iterator is at the
end of the list, the item will be
added as the last item in the list.
SEE ALSO
OTC_MListIterator
LIBRARY
OTC
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED