|
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
21 #ifndef ELM_DATA_LISTMAP_H_
22 #define ELM_DATA_LISTMAP_H_
24 #include "SortedList.h"
28 template <
class K,
class T,
class C = Comparator<K>,
class E = Equiv<T>,
class A = DefaultAlloc >
45 inline const T&
item(
void)
const {
return (*i).snd; }
57 inline const K&
item(
void)
const {
return (*i).fst; }
65 inline Iter
begin(
void)
const {
return Iter(*
this); }
66 inline Iter
end(
void)
const {
return Iter(); }
69 {
for(
const auto& i: *
this)
if(E::isEqual(i, v))
return true;
return false; }
70 template <
class CC>
inline bool containsAll(
const CC& c)
const
71 {
for(
const auto i: c)
if(!
contains(i))
return false;
return true; }
76 inline operator Iter(
void)
const {
return begin(); }
89 inline const T &
get(
const K &k,
const T &d)
const
90 {
PairIter i = lookup(k);
if(i())
return (*i).snd;
else return d; }
91 inline bool hasKey(
const K &k)
const {
return lookup(k)(); }
97 void put(
const K& k,
const T& v) {
121 template <
class K,
class T,
class M>
void next(void)
Definition: List.h:72
Iter begin(void) const
Definition: ListMap.h:65
bool operator<=(const T &v, const FragTable< T, E, A > &t)
Definition: FragTable.h:158
Iterable< I > subiter(const I &b, const I &e)
Definition: util.h:231
bool operator<(const self_t &m) const
Definition: ListMap.h:82
bool operator<=(const self_t &m) const
Definition: ListMap.h:81
bool isEmpty(void) const
Definition: ListMap.h:72
bool equals(const Iter &i) const
Definition: List.h:73
KeyIter(const ListMap< K, T > &l)
Definition: ListMap.h:55
base_t::Iter PairIter
Definition: ListMap.h:33
Iter(const ListMap< K, T > &l)
Definition: ListMap.h:43
Definition: type_info.h:79
bool isEmpty(void) const
Definition: SortedList.h:57
Iter items(void) const
Definition: ListMap.h:74
const K & item(void) const
Definition: ListMap.h:57
Pair< T1, T2 > pair(const T1 &v1, const T2 &v2)
Definition: Pair.h:63
void add(const T &value)
Definition: SortedList.h:85
bool contains(const T &item) const
Definition: SortedList.h:53
void next(void)
Definition: ListMap.h:58
Definition: SortedList.h:34
bool operator==(const self_t &m) const
Definition: ListMap.h:78
E & equivalence()
Definition: ListMap.h:37
bool ended(void) const
Definition: ListMap.h:44
Iter end(void) const
Definition: SortedList.h:69
ListMap()
Definition: ListMap.h:35
KeyIter(void)
Definition: ListMap.h:54
bool containsAll(const CC &c) const
Definition: ListMap.h:70
Option< T > some(const T &val)
Definition: Option.h:81
ListMap< K, T, C, E, A > self_t
Definition: ListMap.h:32
void remove(const T &item)
Definition: SortedList.h:96
Iterable< PairIter > pairs() const
Definition: ListMap.h:94
bool equals(const Iter &ii) const
Definition: ListMap.h:47
const T & item(void) const
Definition: ListMap.h:45
ListMap(const ListMap< K, T > &l)
Definition: ListMap.h:36
bool equals(const KeyIter &ii)
Definition: ListMap.h:59
void next(void)
Definition: ListMap.h:46
const OptionalNone none
Definition: util_Option.cpp:154
int count(void) const
Definition: SortedList.h:51
bool operator>=(const self_t &m) const
Definition: ListMap.h:83
bool equals(const SortedList< T > &l) const
Definition: SortedList.h:71
int count(void) const
Definition: ListMap.h:67
Iterable< KeyIter > keys() const
Definition: ListMap.h:93
Iter end(void) const
Definition: ListMap.h:66
const T & get(const K &k, const T &d) const
Definition: ListMap.h:89
void put(const K &k, const T &v)
Definition: ListMap.h:97
bool operator>(const self_t &m) const
Definition: ListMap.h:84
bool ended(void) const
Definition: ListMap.h:56
Option< T > get(const K &k) const
Definition: ListMap.h:87
void set(Iter i, const T &val)
Definition: SortedList.h:125
void remove(const Iter &i)
Definition: ListMap.h:104
void remove(const K &k)
Definition: ListMap.h:105
bool hasKey(const K &k) const
Definition: ListMap.h:91
Iter operator*(void) const
Definition: ListMap.h:75
bool equals(const self_t &m) const
Definition: ListMap.h:77
bool contains(const T &v) const
Definition: ListMap.h:68
Iter()
Definition: ListMap.h:42
bool contains(const self_t &m) const
Definition: ListMap.h:80
bool ended(void) const
Definition: List.h:70
Definition: SortedList.h:60
bool operator!=(const self_t &m) const
Definition: ListMap.h:79
Iter begin(void) const
Definition: SortedList.h:68
C & comparator()
Definition: SortedList.h:43