NAME

OTC_PairIterator - Interface to a cursor of a key/item pair.

SYNOPSIS


#include <OTC/collctn/pritertr.hh>

template<class T1, class T2>
class OTC_PairIterator
{
  public:
    static os_typespec* get_os_typespec();
    inline ~OTC_PairIterator();
    inline OTC_PairIterator();
    inline OTC_PairIterator(OTC_PairCursor<T1,T2>* theIter);
    inline OTC_PairIterator(OTC_PairIterator<T1,T2> const& theIter);
    inline OTC_PairIterator<T1,T2>& operator=(
      OTC_PairCursor<T1,T2>* theIter
    );
    inline OTC_PairIterator<T1,T2>& operator=(
      OTC_PairIterator<T1,T2> const& theIter
    );
    inline void next();
    inline void reset();
    inline T1 const& key() const;
    inline T2 const& item() const;
    inline OTC_Boolean isValid() const;
    inline OTC_PairIterator<T1,T2> clone() const;
    inline void apply(OTC_PairVisitor<T1,T2>& theApplicator);
  protected:
    inline T2& _item() const;
    inline OTC_PairCursor<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.

INITIALISATION

inline OTC_PairIterator();
inline OTC_PairIterator(OTC_PairCursor<T1,T2>* theIter);
inline OTC_PairIterator(OTC_PairIterator<T1,T2> const& theIter);
inline OTC_PairIterator<T1,T2>& operator=(
  OTC_PairCursor<T1,T2>* theIter
);
inline OTC_PairIterator<T1,T2>& operator=(
  OTC_PairIterator<T1,T2> const& theIter
);

MOVEMENT

inline void next();
inline void reset();

RETRIEVAL

inline T1 const& key() const;
inline T2 const& item() const;
inline OTC_Boolean isValid() const;

CLONING

inline OTC_PairIterator<T1,T2> clone() const;

APPLICATOR

inline void apply(OTC_PairVisitor<T1,T2>& theApplicator);

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

Copyright 1993 TELSTRA CORPORATION LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED