template<class KTYPE, class VTYPE, class TI> class GMapTemplate: protected GMapImpl<KTYPE, TI>

Common base class for all associative maps.

Inheritance:


Public Methods

[more]int size() const
Returns the number of elements in the map.
[more]GPosition firstpos() const
Returns the first position in the map.
[more] operator GPosition() const
Implicit notation for GMap::firstpos().
[more]int isempty() const
Tests whether the associative map is empty.
[more]GPosition contains(const KTYPE &key) const
Searches an entry for key key.
[more]void empty()
Erases the associative map contents.
[more]const KTYPE& key(const GPosition &pos) const
Returns a constant reference to the key of the map entry at position pos.
[more]VTYPE& operator[](const GPosition &pos)
Returns a reference to the value of the map entry at position pos.
[more]const VTYPE& operator[](const GPosition &pos) const
Returns a constant reference to the value of the map entry at position pos.
[more]const VTYPE& operator[](const KTYPE &key) const
Returns a constant reference to the value of the map entry for key key.
[more]VTYPE& operator[](const KTYPE &key)
Returns a reference to the value of the map entry for key key.
[more]void del(GPosition &pos)
Destroys the map entry for position pos.
[more]void del(const KTYPE &key)
Destroys the map entry for key key.


Documentation

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.
oint size() const
Returns the number of elements in the map.

oGPosition firstpos() const
Returns the first position in the map.

o operator GPosition() const
Implicit notation for GMap::firstpos().

oint isempty() const
Tests whether the associative map is empty. Returns a non zero value if and only if the map contains zero entries.

oGPosition contains(const KTYPE &key) const
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.

ovoid empty()
Erases the associative map contents. All entries are destroyed and removed. The map is left with zero entries.

oconst KTYPE& key(const GPosition &pos) const
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.

oVTYPE& operator[](const GPosition &pos)
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.

oconst VTYPE& operator[](const GPosition &pos) const
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.

oconst VTYPE& operator[](const KTYPE &key) const
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>.

oVTYPE& operator[](const KTYPE &key)
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().

ovoid del(GPosition &pos)
Destroys the map entry for position pos. Nothing is done if position pos is not a valid position.

ovoid del(const KTYPE &key)
Destroys the map entry for key key. Nothing is done if there is no entry for key key.


Direct child classes:
GPMap
GMap

Alphabetic index HTML hierarchy of classes or Java


DjVu is a trademark of LizardTech, Inc.
All other products mentioned are registered trademarks or trademarks of their respective companies.