Elm
1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/genstruct/AssocList.h>
Classes | |
class | Iterator |
class | KeyIterator |
class | PairIterator |
Public Member Functions | |
AssocList (void) | |
AssocList (const AssocList &alist) | |
int | count (void) const |
bool | contains (const T &item) const |
bool | isEmpty (void) const |
operator bool (void) const | |
const T & | first (void) const |
const T & | last (void) const |
Iterator | find (const T &item) |
Iterator | find (const T &item, const Iterator &iter) |
Option< T > | get (const K &key) const |
T | get (const K &key, const T &def) const |
bool | hasKey (const K &key) const |
void | put (const K &key, const T &value) |
void | remove (const K &key) |
void | remove (const PairIterator &iter) |
An associative list is a sorted list providing assocition between a key and to value. It may be used to store a collection of item indexed that support fast retrieval or deletion.
Note that this collection is implemented as a list. If the size of the list is n, each operation has a complexity of O(n/2) in average. In practice, this class becomes wholly inefficient when the list contains several tens of values.
K | Indexed key type. |
T | Stored value type. |
C | Comparator used to compare K keys (default to elm::Comparator<K>). |
E | Equivalence relation for T (default to Equiv<T>). |
N | Null value for T (default to type_infow<T>). |
elm::genstruct::AssocList< K, T, C, E, N >::AssocList | ( | void | ) |
Build an empty associative list.
elm::genstruct::AssocList< K, T, C, E, N >::AssocList | ( | const AssocList< K, T, C, E, N > & | alist | ) |
Build an associative list by cloning another one.
alist | Associative list to clone. |
bool elm::genstruct::AssocList< K, T, C, E, N >::contains | ( | const T & | item | ) | const |
int elm::genstruct::AssocList< K, T, C, E, N >::count | ( | void | ) | const |
Iterator elm::genstruct::AssocList< K, T, C, E, N >::find | ( | const T & | item | ) |
Iterator elm::genstruct::AssocList< K, T, C, E, N >::find | ( | const T & | item, |
const Iterator & | iter | ||
) |
const T& elm::genstruct::AssocList< K, T, C, E, N >::first | ( | void | ) | const |
Option<T> elm::genstruct::AssocList< K, T, C, E, N >::get | ( | const K & | key | ) | const |
Referenced by elm::ini::Section::get(), and elm::ini::File::get().
T elm::genstruct::AssocList< K, T, C, E, N >::get | ( | const K & | key, |
const T & | def | ||
) | const |
bool elm::genstruct::AssocList< K, T, C, E, N >::hasKey | ( | const K & | key | ) | const |
Referenced by elm::ini::Section::get(), and elm::ini::Section::isDefined().
bool elm::genstruct::AssocList< K, T, C, E, N >::isEmpty | ( | void | ) | const |
const T& elm::genstruct::AssocList< K, T, C, E, N >::last | ( | void | ) | const |
elm::genstruct::AssocList< K, T, C, E, N >::operator bool | ( | void | ) | const |
void elm::genstruct::AssocList< K, T, C, E, N >::put | ( | const K & | key, |
const T & | value | ||
) |
Referenced by elm::ini::File::load(), and elm::xom::XSLTransform::setParameter().
void elm::genstruct::AssocList< K, T, C, E, N >::remove | ( | const K & | key | ) |
void elm::genstruct::AssocList< K, T, C, E, N >::remove | ( | const PairIterator & | iter | ) |