kviewshell
GMapTemplate< KTYPE, VTYPE, TI > Class Template Reference
Common base class for all associative maps. More...
#include <GContainer.h>
Public Member Functions | |
GPosition | contains (const KTYPE &key, GPosition &pos) const |
GPosition | contains (const KTYPE &key) const |
void | del (const KTYPE &key) |
void | del (GPosition &pos) |
void | empty () |
void | first (GPosition &pos) const |
GPosition | firstpos () const |
int | isempty () const |
const KTYPE & | key (const GPosition &pos) const |
VTYPE * | next (GPosition &pos) |
const VTYPE * | next (GPosition &pos) const |
operator GPosition () const | |
VTYPE & | operator[] (const KTYPE &key) |
const VTYPE & | operator[] (const KTYPE &key) const |
const VTYPE & | operator[] (const GPosition &pos) const |
VTYPE & | operator[] (const GPosition &pos) |
int | size () const |
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.
Member Function Documentation
GPosition GMapTemplate< KTYPE, VTYPE, TI >::contains | ( | const KTYPE & | key, | |
GPosition & | pos | |||
) | const [inline] |
Definition at line 1170 of file GContainer.h.
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.
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.
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.
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.
void GMapTemplate< KTYPE, VTYPE, TI >::first | ( | GPosition & | pos | ) | const [inline] |
Definition at line 1217 of file GContainer.h.
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.
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.
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.
VTYPE* GMapTemplate< KTYPE, VTYPE, TI >::next | ( | GPosition & | pos | ) | [inline] |
Definition at line 1220 of file GContainer.h.
const VTYPE* GMapTemplate< KTYPE, VTYPE, TI >::next | ( | GPosition & | pos | ) | const [inline] |
Definition at line 1218 of file GContainer.h.
GMapTemplate< KTYPE, VTYPE, TI >::operator GPosition | ( | ) | const [inline] |
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.
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.
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.
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.
int GMapTemplate< KTYPE, VTYPE, TI >::size | ( | void | ) | const [inline] |
The documentation for this class was generated from the following file: