NAME

OTC_KeyItemCursor - Cursor over buckets containing both a key and an item.

SYNOPSIS


#include <OTC/collctn/kicursor.hh>

template<class T1, class T2, class L>
class OTC_KeyItemCursor : 
  public OTC_LinkCursor,
  public OTC_PairCursor<T1,T2>
{
  public:
    static os_typespec* get_os_typespec();
    ~OTC_KeyItemCursor();
    OTC_KeyItemCursor(
      OTC_LinkList* aList,
      OTC_Direction theDirection=OTCLIB_FORWARD,
      OTC_Protection theProtection=OTCLIB_SAFE
    );
    OTC_KeyItemCursor(
      OTC_LinkList* aList,
      OTC_Linkable* theStart,
      OTC_Linkable* theEnd,
      OTC_Direction theDirection=OTCLIB_FORWARD,
      OTC_Protection theProtection=OTCLIB_SAFE
    );
    OTC_KeyItemCursor(OTC_KeyItemCursor<T1,T2,L> const& theIter);
    void reset();
    void next();
    T1& key();
    T2& item();
    OTC_Boolean isValid() const;
    OTC_PairCursor<T1,T2>* clone();
};

CLASS TYPE

Concrete

DESCRIPTION

Derived version of OTC_Cursor, which iterates over the key/item pairs in an instance of OTC_LinkList. The type of the class derived from OTC_Link and which are held by the link list must be supplied as the second template argument. The class derived from OTC_Link must provide functions called key() and item(). The key() function must return a reference to a modifiable object of type T1. The item() function must return a reference to a modifiable object of type T2.

INITIALISATION

OTC_KeyItemCursor(
  OTC_LinkList* aList,
  OTC_Direction theDirection=OTCLIB_FORWARD,
  OTC_Protection theProtection=OTCLIB_SAFE
);
OTC_KeyItemCursor(
  OTC_LinkList* aList,
  OTC_Linkable* theStart,
  OTC_Linkable* theEnd,
  OTC_Direction theDirection=OTCLIB_FORWARD,
  OTC_Protection theProtection=OTCLIB_SAFE
);
OTC_KeyItemCursor(OTC_KeyItemCursor<T1,T2,L> const& theIter);

MOVEMENT

Following operations allow movement of the iterator over the list.
void reset();
void next();

RETRIEVAL

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

CLONING

OTC_PairCursor<T1,T2>* clone();

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

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