Lines Matching refs:KEY
33 template <typename KEY, typename VALUE>
37 typedef KEY key_type;
64 const VALUE& valueFor(const KEY& key) const;
66 const KEY& keyAt(size_t index) const;
67 ssize_t indexOfKey(const KEY& key) const;
73 VALUE& editValueFor(const KEY& key);
80 ssize_t add(const KEY& key, const VALUE& item);
81 ssize_t replaceValueFor(const KEY& key, const VALUE& item);
88 ssize_t removeItem(const KEY& key);
92 SortedVector< key_value_pair_t<KEY, VALUE> > mVector;
99 * valueFor() is called with a key that doesn't exist.
101 template <typename KEY, typename VALUE>
102 class DefaultKeyedVector : public KeyedVector<KEY, VALUE>
106 const VALUE& valueFor(const KEY& key) const;
114 template<typename KEY, typename VALUE> inline
115 KeyedVector<KEY,VALUE>::KeyedVector()
119 template<typename KEY, typename VALUE> inline
120 ssize_t KeyedVector<KEY,VALUE>::indexOfKey(const KEY& key) const {
121 return mVector.indexOf( key_value_pair_t<KEY,VALUE>(key) );
124 template<typename KEY, typename VALUE> inline
125 const VALUE& KeyedVector<KEY,VALUE>::valueFor(const KEY& key) const {
126 ssize_t i = indexOfKey(key);
131 template<typename KEY, typename VALUE> inline
132 const VALUE& KeyedVector<KEY,VALUE>::valueAt(size_t index) const {
136 template<typename KEY, typename VALUE> inline
137 const KEY& KeyedVector<KEY,VALUE>::keyAt(size_t index) const {
138 return mVector.itemAt(index).key;
141 template<typename KEY, typename VALUE> inline
142 VALUE& KeyedVector<KEY,VALUE>::editValueFor(const KEY& key) {
143 ssize_t i = indexOfKey(key);
148 template<typename KEY, typename VALUE> inline
149 VALUE& KeyedVector<KEY,VALUE>::editValueAt(size_t index) {
153 template<typename KEY, typename VALUE> inline
154 ssize_t KeyedVector<KEY,VALUE>::add(const KEY& key, const VALUE& value) {
155 return mVector.add( key_value_pair_t<KEY,VALUE>(key, value) );
158 template<typename KEY, typename VALUE> inline
159 ssize_t KeyedVector<KEY,VALUE>::replaceValueFor(const KEY& key, const VALUE& value) {
160 key_value_pair_t<KEY,VALUE> pair(key, value);
165 template<typename KEY, typename VALUE> inline
166 ssize_t KeyedVector<KEY,VALUE>::replaceValueAt(size_t index, const VALUE& item) {
174 template<typename KEY, typename VALUE> inline
175 ssize_t KeyedVector<KEY,VALUE>::removeItem(const KEY& key) {
176 return mVector.remove(key_value_pair_t<KEY,VALUE>(key));
179 template<typename KEY, typename VALUE> inline
180 ssize_t KeyedVector<KEY, VALUE>::removeItemsAt(size_t index, size_t count) {
186 template<typename KEY, typename VALUE> inline
187 DefaultKeyedVector<KEY,VALUE>::DefaultKeyedVector(const VALUE& defValue)
192 template<typename KEY, typename VALUE> inline
193 const VALUE& DefaultKeyedVector<KEY,VALUE>::valueFor(const KEY& key) const {
194 ssize_t i = indexOfKey(key);
195 return i >= 0 ? KeyedVector<KEY,VALUE>::valueAt(i) : mDefault;