NAME
OTC_PairModifier -
Interface to a cursor over a key/item pair.
SYNOPSIS
#include <OTC/collctn/prmodifr.hh>
template<class T1, class T2>
class OTC_PairModifier : public OTC_PairIterator<T1,T2>
{
public:
static os_typespec* get_os_typespec();
inline OTC_PairModifier();
inline OTC_PairModifier(OTC_PairCursor<T1,T2>* theIter);
inline OTC_PairModifier(OTC_PairModifier<T1,T2> const& theIter);
inline OTC_PairModifier<T1,T2>& operator=(
OTC_PairCursor<T1,T2>* theIter
);
inline OTC_PairModifier<T1,T2>& operator=(
OTC_PairModifier<T1,T2> const& theIter
);
inline T2& item() const;
inline OTC_PairModifier<T1,T2> clone() const;
inline void apply(OTC_PairVisitor<T1,T2>& theApplicator);
inline void apply(OTC_PairWorker<T1,T2>& theApplicator);
};
CLASS TYPE
Concrete
DESCRIPTION
This class exists so that the user of an iterator for collections
holding key/item pairs, does not have to worry about deleting the
iterator when finished with it, nor need to know how to create an
iterator for a specific type of collection. This class will ensure
that the iterator is destroyed, when this class goes out of scope.
In order for this to work correctly, an instance of this class
should never be created using new. The difference between
this class and OTC_PairModifier is that it is possible to
modify the items through this class.
INITIALISATION
inline OTC_PairModifier();
inline OTC_PairModifier(OTC_PairCursor<T1,T2>* theIter);
Constructor used when an iterator
for a particular type of collection is
first created. If theIter is 0 a
null iterator is constructed.
inline OTC_PairModifier(OTC_PairModifier<T1,T2> const& theIter);
Copy constructor for when an iterator is
used as return type.
inline OTC_PairModifier<T1,T2>& operator=(
OTC_PairCursor<T1,T2>* theIter
);
Sets this iterator to theIter.
If theIter is 0, the iterator
is turned into a null iterator and
all associations with the previous
collection are lost.
inline OTC_PairModifier<T1,T2>& operator=(
OTC_PairModifier<T1,T2> const& theIter
);
Sets this iterator to theIter.
RETRIEVAL
inline T2& item() const;
Returns the item under the current
location of the iterator. If no such item
exists, or this is a null iterator, an
exception is raised.
CLONING
inline OTC_PairModifier<T1,T2> clone() const;
Returns an iterator which is
a clone of this iterator. The new
iterator will initially be located
over the same item as this iterator,
however, subsequent operations will be
independent of this iterator.
APPLICATOR
inline void apply(OTC_PairVisitor<T1,T2>& theApplicator);
Applies theApplicator to each key/item
pair accessible by this iterator.
inline void apply(OTC_PairWorker<T1,T2>& theApplicator);
Applies theApplicator to each key/item
pair accessible by this iterator.
LIBRARY
OTC
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1993 TELSTRA CORPORATION LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED