131#ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_DICTIONARY_H
132#define LASS_GUARDIAN_OF_INCLUSION_UTIL_DICTIONARY_H
146 typename KeyLess = std::less<KeyType>,
147 typename ValueLess = std::less<ValueType>
153 typedef KeyType TKey;
154 typedef ValueType TValue;
155 typedef KeyLess TKeyLess;
156 typedef ValueLess TValueLess;
157 typedef std::set<KeyType, KeyLess> TKeys;
158 typedef std::set<ValueType, ValueLess> TValues;
159 typedef typename CallTraits<KeyType>::TParam TKeyParam;
160 typedef typename CallTraits<ValueType>::TParam TValueParam;
163 explicit Dictionary(TKeyLess iKeyLess);
164 Dictionary(TKeyLess iKeyLess, TValueLess iValueLess);
166 void add(
const TKey& iKey,
const TValue& iValue);
167 void remove(
const TKey& iKey,
const TValue& iValue);
174 const TKey&
key(TValueParam iValue)
const;
179 TKeys
keys(TValueParam iValue)
const;
187 typedef std::multimap<TKey, TValue, KeyLess> TMap;
189 bool equalValues(TValueParam iA, TValueParam iB)
const;
193 TValue defaultValue_;
195 TValueLess valueLess_;
197 bool enableSuggestions_;
void remove(const TKey &iKey, const TValue &iValue)
remove a key and value from the dictionary.
bool hasDefault() const
return true if dictionary has value
void setDefault(const TKey &iKey, const TValue &iValue)
set key and value to be used as default ones.
bool isValue(TValueParam iValue) const
return true if iValue is a value of dictionary
void clearDefault()
clear default key and value.
const TKey & key(TValueParam iValue) const
look up a key by value
TValues values(TKeyParam iKey) const
return all values in the dictionary
void add(const TKey &iKey, const TValue &iValue)
add a key and value to dictionary as new entry.
TValues values() const
return all values in the dictionary
const TValue & operator[](TKeyParam iKey) const
look up a value by key
TKeys keys(TValueParam iValue) const
return all keys that have value iValue.
void enableSuggestions(bool enable=true)
if enabled, suggestions of valid keys or values will be included in the exception that is thrown in c...
bool isKey(TKeyParam iKey) const
return true if iKey is a key of dictionary
TKeys keys() const
return all keys in the dictionary
general utility, debug facilities, ...
Library for Assembled Shared Sources.