#include <mmap.h>
Inheritance diagram for Map::
Public Methods | |
Map () | |
Map (int hashsize, int flags) | |
Map (const Map &orig) | |
~Map () | |
void | set (const keyclass &key, const valueclass &value) |
void | set (const keyclass &key, const valueclass *value) |
void | remove (const keyclass &key) |
bool | hasKey (const keyclass &key) const |
const valueclass& | operator[] (const keyclass &key) const |
valueclass& | operator[] (const keyclass &key) |
const valueclass& | get (const keyclass &key) const |
valueclass& | getv (const keyclass &key) |
const valueclass& | getOr (const keyclass &key, const valueclass &def) const |
const valueclass* | getp (const keyclass &key) const |
valueclass* | getvp (const keyclass &key) |
virtual DumpContext& | operator>> (DumpContext &out) const |
virtual ostream& | operator>> (ostream &out) const |
Map<keyclass,valueclass>& | operator+= (const Map< keyclass, valueclass > &other) |
Map<keyclass,valueclass>& | operator= (const Map< keyclass, valueclass > &other) |
void | empty () |
const GenHash* | gethash () const |
void | check () const |
void | failByThrow (bool bythrow=true) |
void | failByThrowOnce (bool bythrow=true) const |
void | failByNullOnce (bool bynull=true) const |
The key class has to inherit Comparable. The value class can be any inherit of Object.
The inserted objects are owned by the Map by default, and are thus destroyed along with it, or during various replacement methods. By giving the MAP_REF flag to the constructor causes the objects not to be owned by the Map.
Map<String,String> has a shorthand macro StringMap. Many Map-handling functions, especially for StringMaps, are not included in the template, but are global. Such methods include toString(), splitpairs(), and joinpairs(). See section "globals" for more information, or the header mmap.h.
Maps can be iterated using MapIter. Note also the forMap and forStringMap macros in mmap.h
Definition at line 165 of file mmap.h.
|
Default constructor uses the default hash size of GenHash.
|
|
Constructor.
|
|
Implementation for Object.
Reimplemented from Object. |
|
Destroys all the items from the Map.
|
|
Same as failByThrow(false), but applies to only one access call. Giving parameter 'false' to this method cancels a previously given failByNullOnce(true) currently in effect. |
|
Should the access-methods of Map report missing elements by throwing an exception (true) or by returning a null reference (false, which is the default). Null references to objects can be checked by the global isnull() function. |
|
Same as failByThrow(true), but applies to only one access call. Giving parameter 'false' to this method cancels a previously given failByThrowOnce(true) currently in effect. |
|
Returns a const reference to object associated to the key. For information about error handling and exceptions, see failByThrowOnce().
Definition at line 259 of file mmap.h. Referenced by getv(), and operator[](). |
|
Returns a const reference to object associated to the key, OR if the key is not found from the map, returns the 'def' reference back to the caller. For information about error handling and exceptions, see failByThrowOnce().
|
|
Returns the GenHash of the Map.
|
|
Returns a const pointer to object associated to the key, or NULL if the object was not found.
|
|
Returns a non-const reference to object associated to the key. For information about error handling and exceptions, see failByThrowOnce().
|
|
Returns a non-const pointer to object associated to the key, or NULL if the object was not found.
|
|
Queries whether the given key is in the map.
|
|
Union operator; adds the other Map to self.
|
|
Copy operator.
|
|
Implementation for Object.
Reimplemented from Object. |
|
Implementation for Object.
Reimplemented from Object. |
|
Returns a non-const reference to object associated to the key. For information about error handling and exceptions, see failByThrowOnce(). |
|
Returns a const reference to object associated to the key. For information about error handling and exceptions, see failByThrowOnce(). |
|
Removes an item from the map.
|
|
Sets the _key_ to _value_; takes ownership of the passed object.
|
|
Sets the _key_ to _value_; copies the given value object using the copy constructor.
|