#include <MAUtil/Map.h>
Inheritance diagram for MAUtil::Map< Key, Value >:
Public Types | |
typedef Pair< Key, Value > | PairKV |
typedef int(* | CompareFunction )(const Key &, const Key &) |
Public Member Functions | |
Map (int(*cf)(const Key &, const Key &)=&Compare< Key >) | |
Pair< typename D::Iterator, bool > | insert (const Key &key, const Value &value) |
Value & | operator[] (const Key &key) |
Iterator | find (const Key &) |
ConstIterator | find (const Key &) const |
bool | erase (const Key &) |
void | erase (Iterator) |
Iterator | begin () |
ConstIterator | begin () const |
Iterator | end () |
ConstIterator | end () const |
size_t | size () const |
void | clear () |
Protected Types | |
typedef Dictionary< Key, PairKV > | D |
typedef D::DictNode | DN |
Protected Member Functions | |
void | init (CompareFunction) |
Pair< Iterator, bool > | insert (const Pair< Key, Value > &) |
Static Protected Member Functions | |
static dnode_t * | alloc (void *) |
static void | free (dnode_t *node, void *) |
Protected Attributes | |
dict_t | mDict |
int | mKeyOffset |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Searches the Dictionary for a specified Key. The returned Iterator points to the element matching the Key if one was found, or to Dictionary::end() if not. |
|
|
|
Deletes an element, matching the specified Key, from the Dictionary. Returns true if an element was erased, or false if there was no element matching the Key. |
|
Deletes an element, pointed to by the specified Iterator. The Iterator is invalidated, so if you want to continue iterating through the Dictionary, you must use a different Iterator instance.
|
|
Returns an Iterator pointing to the first element in the Dictionary. |
|
|
|
Returns an Iterator pointing to a place beyond the last element of the Dictionary. This Iterator is often used to determine when another Iterator has reached its end. |
|
|
|
Returns the number of elements in the Dictionary. |
|
Deletes all elements. |
|
|
|
|
|
|
|
Inserts a new value into the Dictionary. Returns a Pair. The Pair's second element is true if the value was indeed inserted. The Pair's first element is an Iterator that points to the element in the Dictionary. An element which compares equal to the new one may already be present in the Dictionary; in that case, this operation does nothing, and the Iterator returned will point to the old element. |
|
|
|
|