Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/data/HashMap.h>
Classes | |
class | Iter |
class | KeyIter |
class | PairIter |
Public Types | |
typedef K | key_t |
typedef T | val_t |
typedef HashMap< K, T, H, A, E > | self_t |
Public Types inherited from Equiv< T > | |
typedef T | t |
Public Member Functions | |
HashMap (int _size=211) | |
HashMap (const self_t &h) | |
const H & | hash () const |
H & | hash () |
const A & | allocator () const |
A & | allocator () |
const E & | equivalence () const |
E & | equivalence () |
void | clear (void) |
void | add (const K &key, const T &val) |
T & | fetch (const K &k) |
Option< T > | get (const K &k) const |
const T & | get (const K &k, const T &def) const |
bool | hasKey (const K &k) const |
Option< T > | get_const (const K &k) const |
const T & | get_const (const K &k, const T &def) const |
bool | hasKey_const (const K &k) const |
Iterable< KeyIter > | keys () const |
Iterable< PairIter > | pairs () const |
int | count () const |
bool | isEmpty () const |
operator bool () const | |
Iter | begin (void) const |
Iter | end (void) const |
bool | contains (const T &item) const |
template<class C > | |
bool | containsAll (const C &c) const |
bool | equals (const HashMap< K, T > &t) const |
bool | operator== (const HashMap< K, T > &t) const |
bool | operator!= (const HashMap< K, T > &t) const |
bool | includes (const HashMap< K, T > &t) const |
bool | operator<= (const HashMap< K, T > &t) const |
bool | operator>= (const HashMap< K, T > &t) const |
bool | operator< (const HashMap< K, T > &t) const |
bool | operator> (const HashMap< K, T > &t) const |
void | put (const K &key, const T &val) |
void | remove (const K &k) |
void | remove (const Iter &i) |
const T & | operator[] (const K &k) const |
StrictMapDelegate< self_t > | operator[] (const K &key) |
const T & | operator[] (const Iter &i) const |
StrictMapDelegate< self_t > | operator[] (const Iter &i) |
template<class C > | |
void | putAll (const C &c) |
int | minEntry (void) const |
int | maxEntry (void) const |
int | zeroEntry (void) const |
int | size (void) const |
bool | exists (const K &k) const |
Iter | operator* (void) const |
Public Member Functions inherited from Equiv< T > | |
bool | isEqual (const T &v1, const T &v2) const |
Additional Inherited Members | |
Static Public Member Functions inherited from Equiv< T > | |
static bool | equals (const T &v1, const T &v2) |
Static Public Attributes inherited from Equiv< T > | |
static Equiv< T > | def |
Map implemented using an hash table.
K | Type of the key. |
T | Type of values. |
M | Used manager (default to HashManager). |
typedef K key_t |
typedef T val_t |
|
inline |
Build an hash map with the given size. Improved efficiency is obtained with prime number as sizes.
size | Table size (default to 211). |
|
inline |
|
inline |
|
inline |
Referenced by HashMap< elm::CString, void * >::operator*().
Remove all items of the map.
Referenced by TextSerializer::flush().
|
inline |
|
inline |
Test if all items of collection c are in the map.
c | Collection to test. |
Referenced by HashMap< elm::CString, void * >::equals(), and HashMap< elm::CString, void * >::includes().
|
inline |
Count the number of items in the map.
|
inline |
|
inline |
|
inline |
Same as hasKey().
Referenced by TextSerializer::onPointer().
|
inline |
Get a reference to the data stored with the key k. If no data is already associated with key k, an entry and corresponding data are created and returns a reference to it.
k | Key of looked data. |
|
inline |
Get an item by its key.
key | Looked key. |
Referenced by TextSerializer::flush(), and XOMUnserializer::flush().
|
inline |
Get an item by its key.
key | Looked key. |
def | Default value. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Test if a key is in the map.
key | Tested key. |
Referenced by HashMap< elm::CString, void * >::exists(), and XOMElementSerializer::onPointer().
|
inline |
|
inline |
Test if the map is empty.
Referenced by HashMap< elm::CString, void * >::operator bool().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Put a new item in the map matching the given key.
key | Key of added item. |
val | Added item. |
Referenced by XOMUnserializer::flush(), TextSerializer::onPointer(), XOMElementSerializer::onPointer(), and HashMap< elm::CString, void * >::putAll().
|
inline |
|
inline |
Remove an item by its key.
key | Key of the removed item. |
|
inline |
|
inline |