TIMap.h
Go to the documentation of this file.
1 #ifndef istd_TIMap_included
2 #define istd_TIMap_included
3 
4 
5 // Qt includes
6 #include <QtCore/QSet>
7 
8 // ACF includes
9 #include <istd/IPolymorphic.h>
10 
11 
12 namespace istd
13 {
14 
15 
19 template <typename Key, typename Value>
20 class TIMap: virtual public IPolymorphic
21 {
22 public:
23  typedef Key KeyType;
24  typedef Value ValueType;
25  typedef QSet<KeyType> Keys;
26 
30  virtual int GetElementsCount() const = 0;
31 
36  virtual ValueType& operator[](const KeyType& key) = 0;
37 
42  virtual const ValueType& operator[](const KeyType& key) const = 0;
43 
47  virtual int FindIndex(const KeyType& key) const = 0;
48 
53  virtual const ValueType* FindElement(const KeyType& key) const = 0;
54 
59  virtual void GetKeys(Keys& result, bool doAppend = false) const = 0;
60 
64  virtual const KeyType& GetKeyAt(int index) const = 0;
65 
69  virtual const ValueType& GetValueAt(int index) const = 0;
70 };
71 
72 
73 };
74 
75 
76 #endif // !istd_TIMap_included
77 
78 
virtual const ValueType & GetValueAt(int index) const =0
Get mapped value at specified index.
virtual ValueType & operator[](const KeyType &key)=0
Element access operator.
Value ValueType
Definition: TIMap.h:24
Generic interface for a key/value mapping.
Definition: TIMap.h:20
Key KeyType
Definition: TIMap.h:23
virtual const ValueType * FindElement(const KeyType &key) const =0
Find value element associated with specified key.
Base interface for all used interfaces and implementations.
Definition: IPolymorphic.h:17
virtual int GetElementsCount() const =0
Get number of elements.
virtual void GetKeys(Keys &result, bool doAppend=false) const =0
Get list of keys stored in this map.
virtual int FindIndex(const KeyType &key) const =0
Find index index of specified key.
virtual const KeyType & GetKeyAt(int index) const =0
Get key value at specified index.
QSet< KeyType > Keys
Definition: TIMap.h:25

© 2007-2017 Witold Gantzke and Kirill Lepskiy