![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/data/HashMap.h>
Inheritance diagram for HashMap< K, T, H, A, E >: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 |
References HashTable< T, H, A >::add(), and elm::pair().
|
inline |
References HashTable< T, H, A >::allocator().
|
inline |
References HashTable< T, H, A >::allocator().
Referenced by HashMap< K, T, H, A, E >::operator*().
Remove all items of the map.
References HashTable< T, H, A >::clear().
Referenced by TextSerializer::flush().
|
inline |
|
inline |
Test if all items of collection c are in the map.
| c | Collection to test. |
References HashMap< K, T, H, A, E >::contains().
Referenced by HashMap< K, T, H, A, E >::equals(), and HashMap< K, T, H, A, E >::includes().
|
inline |
Count the number of items in the map.
References HashTable< T, H, A >::count().
|
inline |
|
inline |
|
inline |
Same as hasKey().
References HashMap< K, T, H, A, E >::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. |
References HashTable< T, H, A >::add(), HashTable< T, H, A >::get(), and elm::pair().
|
inline |
Get an item by its key.
| key | Looked key. |
References HashTable< T, H, A >::get(), elm::none, and elm::some().
Referenced by TextSerializer::flush(), and XOMUnserializer::flush().
|
inline |
Get an item by its key.
| key | Looked key. |
| def | Default value. |
References Equiv< T >::def, HashTable< T, H, A >::get(), and elm::io::p().
|
inline |
References HashTable< T, H, A >::get_const(), elm::none, and elm::some().
|
inline |
References Equiv< T >::def, and HashTable< T, H, A >::get_const().
|
inline |
References HashTable< T, H, A >::hash().
|
inline |
References HashTable< T, H, A >::hash().
|
inline |
Test if a key is in the map.
| key | Tested key. |
References HashTable< T, H, A >::hasKey().
Referenced by HashMap< K, T, H, A, E >::exists(), and XOMElementSerializer::onPointer().
|
inline |
References HashTable< T, H, A >::hasKey_const().
References HashMap< K, T, H, A, E >::containsAll().
Test if the map is empty.
References HashTable< T, H, A >::isEmpty().
Referenced by HashMap< K, T, H, A, E >::operator bool().
References elm::subiter().
|
inline |
|
inline |
|
inline |
References HashMap< K, T, H, A, E >::isEmpty().
References HashMap< K, T, H, A, E >::equals().
References HashMap< K, T, H, A, E >::begin().
References HashMap< K, T, H, A, E >::equals().
References HashMap< K, T, H, A, E >::equals().
References HashMap< K, T, H, A, E >::contains(), and HashMap< K, T, H, A, E >::equals().
References HashMap< K, T, H, A, E >::contains().
|
inline |
References HashMap< K, T, H, A, E >::Iter::key().
|
inline |
References HashTable< T, H, A >::get(), and HashMap< K, T, H, A, E >::Iter::key().
|
inline |
References HashTable< T, H, A >::get().
|
inline |
References elm::subiter().
|
inline |
Put a new item in the map matching the given key.
| key | Key of added item. |
| val | Added item. |
References elm::pair(), and HashTable< T, H, A >::put().
Referenced by XOMUnserializer::flush(), TextSerializer::onPointer(), XOMElementSerializer::onPointer(), and HashMap< K, T, H, A, E >::putAll().
|
inline |
References elm::io::p(), and HashMap< K, T, H, A, E >::put().
References HashTable< T, H, A >::remove().
|
inline |
Remove an item by its key.
| key | Key of the removed item. |
References HashTable< T, H, A >::remove().
|
inline |
|
inline |