GMapTemplate< KTYPE, VTYPE, TI > Class Template Reference

#include <GContainer.h>

Inheritance diagram for GMapTemplate< KTYPE, VTYPE, TI >:

GMapImpl< KTYPE, TI > GSetImpl< KTYPE > GSetBase GCont List of all members.

Detailed Description

template<class KTYPE, class VTYPE, class TI>
class GMapTemplate< KTYPE, VTYPE, TI >

Common base class for all associative maps.

Class GArrayTemplate} implements all methods for manipulating associative maps with key type KTYPE# and value type VTYPE#. You should not however create instances of this class. You should instead use class GMap} or GPMap}.

Definition at line 1147 of file GContainer.h.


Public Member Functions

int size () const
GPosition firstpos () const
 operator GPosition () const
int isempty () const
GPosition contains (const KTYPE &key) const
GPosition contains (const KTYPE &key, GPosition &pos) const
void empty ()
const KTYPE & key (const GPosition &pos) const
VTYPE & operator[] (const GPosition &pos)
const VTYPE & operator[] (const GPosition &pos) const
const VTYPE & operator[] (const KTYPE &key) const
VTYPE & operator[] (const KTYPE &key)
void del (GPosition &pos)
void del (const KTYPE &key)
void first (GPosition &pos) const
const VTYPE * next (GPosition &pos) const
VTYPE * next (GPosition &pos)

Member Function Documentation

template<class KTYPE, class VTYPE, class TI>
GPosition GMapTemplate< KTYPE, VTYPE, TI >::contains ( const KTYPE &  key  )  const [inline]

Searches an entry for key key#.

If the map contains an entry whose key is equal to key# according to KTYPE::operator==(const KTYPE&)#, this function returns its position. Otherwise it returns an invalid position.

Reimplemented from GSetImpl< KTYPE >.

Definition at line 1167 of file GContainer.h.

template<class KTYPE, class VTYPE, class TI>
void GMapTemplate< KTYPE, VTYPE, TI >::del ( const KTYPE &  key  )  [inline]

Destroys the map entry for key key#.

Nothing is done if there is no entry for key key#.

Reimplemented from GSetImpl< KTYPE >.

Definition at line 1213 of file GContainer.h.

template<class KTYPE, class VTYPE, class TI>
void GMapTemplate< KTYPE, VTYPE, TI >::del ( GPosition pos  )  [inline]

Destroys the map entry for position pos#.

Nothing is done if position pos# is not a valid position.

Reimplemented from GSetBase.

Definition at line 1209 of file GContainer.h.

template<class KTYPE, class VTYPE, class TI>
void GMapTemplate< KTYPE, VTYPE, TI >::empty (  )  [inline]

Erases the associative map contents.

All entries are destroyed and removed. The map is left with zero entries.

Reimplemented from GSetBase.

Definition at line 1175 of file GContainer.h.

template<class KTYPE, class VTYPE, class TI>
GPosition GMapTemplate< KTYPE, VTYPE, TI >::firstpos (  )  const [inline]

Returns the first position in the map.

Reimplemented from GSetBase.

Definition at line 1154 of file GContainer.h.

template<class KTYPE, class VTYPE, class TI>
int GMapTemplate< KTYPE, VTYPE, TI >::isempty (  )  const [inline]

Tests whether the associative map is empty.

Returns a non zero value if and only if the map contains zero entries.

Definition at line 1161 of file GContainer.h.

template<class KTYPE, class VTYPE, class TI>
const KTYPE& GMapTemplate< KTYPE, VTYPE, TI >::key ( const GPosition pos  )  const [inline]

Returns a constant reference to the key of the map entry at position pos#.

An exception GException} is thrown if position pos# is not valid. There is no direct way to change the key of a map entry.

Definition at line 1180 of file GContainer.h.

template<class KTYPE, class VTYPE, class TI>
GMapTemplate< KTYPE, VTYPE, TI >::operator GPosition (  )  const [inline]

Implicit notation for GMap::firstpos().

Definition at line 1157 of file GContainer.h.

template<class KTYPE, class VTYPE, class TI>
VTYPE& GMapTemplate< KTYPE, VTYPE, TI >::operator[] ( const KTYPE &  key  )  [inline]

Returns a reference to the value of the map entry for key key#.

This reference can be used for both reading (as "#a[n]#") and modifying (as "#a[n]=v#"). If there is no entry for key key#, a new entry is created for that key with the null constructor VTYPE::VTYPE()#.

Definition at line 1205 of file GContainer.h.

template<class KTYPE, class VTYPE, class TI>
const VTYPE& GMapTemplate< KTYPE, VTYPE, TI >::operator[] ( const KTYPE &  key  )  const [inline]

Returns a constant reference to the value of the map entry for key key#.

This reference can only be used for reading (as "#a[n]#") the entry value. An exception GException} is thrown if no entry contains key key#. This variant of operator[]# is necessary when dealing with a const GMAP<KTYPE,VTYPE>#.

Definition at line 1199 of file GContainer.h.

template<class KTYPE, class VTYPE, class TI>
const VTYPE& GMapTemplate< KTYPE, VTYPE, TI >::operator[] ( const GPosition pos  )  const [inline]

Returns a constant reference to the value of the map entry at position pos#.

This reference can only be used for reading (as "#a[n]#") the entry value. An exception GException} is thrown if position pos# is not valid.

Definition at line 1192 of file GContainer.h.

template<class KTYPE, class VTYPE, class TI>
VTYPE& GMapTemplate< KTYPE, VTYPE, TI >::operator[] ( const GPosition pos  )  [inline]

Returns a reference to the value of the map entry at position pos#.

This reference can be used for both reading (as "#a[n]#") and modifying (as "#a[n]=v#"). An exception GException} is thrown if position pos# is not valid.

Definition at line 1186 of file GContainer.h.

template<class KTYPE, class VTYPE, class TI>
int GMapTemplate< KTYPE, VTYPE, TI >::size ( void   )  const [inline]

Returns the number of elements in the map.

Definition at line 1151 of file GContainer.h.


The documentation for this class was generated from the following file:
KDE Home | KDE Accessibility Home | Description of Access Keys