Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/mymoneykeyvaluecontainer.h
Show All 30 Lines | |||||
31 | #include <qglobal.h> | 31 | #include <qglobal.h> | ||
32 | 32 | | |||
33 | // ---------------------------------------------------------------------------- | 33 | // ---------------------------------------------------------------------------- | ||
34 | // Project Includes | 34 | // Project Includes | ||
35 | 35 | | |||
36 | #include "mymoneyunittestable.h" | 36 | #include "mymoneyunittestable.h" | ||
37 | 37 | | |||
38 | class QString; | 38 | class QString; | ||
39 | class QDomDocument; | | |||
40 | class QDomElement; | | |||
41 | 39 | | |||
42 | template <class Key, class Value> class QMap; | 40 | template <class Key, class Value> class QMap; | ||
43 | 41 | | |||
44 | /** | 42 | /** | ||
45 | * This class implements a container for key/value pairs. This is used | 43 | * This class implements a container for key/value pairs. This is used | ||
46 | * to store an arbitrary number of attributes with any of the engine | 44 | * to store an arbitrary number of attributes with any of the engine | ||
47 | * object. The container can also be used to have attributes that are | 45 | * object. The container can also be used to have attributes that are | ||
48 | * attached to this object only for a limited time (e.g. between | 46 | * attached to this object only for a limited time (e.g. between | ||
Show All 9 Lines | 55 | { | |||
58 | Q_DECLARE_PRIVATE(MyMoneyKeyValueContainer) | 56 | Q_DECLARE_PRIVATE(MyMoneyKeyValueContainer) | ||
59 | KMM_MYMONEY_UNIT_TESTABLE | 57 | KMM_MYMONEY_UNIT_TESTABLE | ||
60 | 58 | | |||
61 | protected: | 59 | protected: | ||
62 | MyMoneyKeyValueContainerPrivate * d_ptr; | 60 | MyMoneyKeyValueContainerPrivate * d_ptr; | ||
63 | 61 | | |||
64 | public: | 62 | public: | ||
65 | MyMoneyKeyValueContainer(); | 63 | MyMoneyKeyValueContainer(); | ||
66 | explicit MyMoneyKeyValueContainer(const QDomElement& node); | | |||
67 | 64 | | |||
68 | MyMoneyKeyValueContainer(const MyMoneyKeyValueContainer & other); | 65 | MyMoneyKeyValueContainer(const MyMoneyKeyValueContainer & other); | ||
69 | MyMoneyKeyValueContainer(MyMoneyKeyValueContainer && other); | 66 | MyMoneyKeyValueContainer(MyMoneyKeyValueContainer && other); | ||
70 | MyMoneyKeyValueContainer & operator=(MyMoneyKeyValueContainer other); | 67 | MyMoneyKeyValueContainer & operator=(MyMoneyKeyValueContainer other); | ||
71 | friend void swap(MyMoneyKeyValueContainer& first, MyMoneyKeyValueContainer& second); | 68 | friend void swap(MyMoneyKeyValueContainer& first, MyMoneyKeyValueContainer& second); | ||
72 | virtual ~MyMoneyKeyValueContainer(); | 69 | virtual ~MyMoneyKeyValueContainer(); | ||
73 | 70 | | |||
74 | /** | 71 | /** | ||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | |||||
128 | /** | 125 | /** | ||
129 | * This operator tests for equality of two MyMoneyKeyValueContainer objects | 126 | * This operator tests for equality of two MyMoneyKeyValueContainer objects | ||
130 | */ | 127 | */ | ||
131 | bool operator == (const MyMoneyKeyValueContainer &) const; | 128 | bool operator == (const MyMoneyKeyValueContainer &) const; | ||
132 | 129 | | |||
133 | QString operator[](const QString& k) const; | 130 | QString operator[](const QString& k) const; | ||
134 | 131 | | |||
135 | QString& operator[](const QString& k); | 132 | QString& operator[](const QString& k); | ||
136 | | ||||
137 | /** | | |||
138 | * This method creates a QDomElement for the @p document | | |||
139 | * under the parent node @p parent. | | |||
140 | * | | |||
141 | * @param document reference to QDomDocument | | |||
142 | * @param parent reference to QDomElement parent node | | |||
143 | */ | | |||
144 | void writeXML(QDomDocument& document, QDomElement& parent) const; | | |||
145 | }; | 133 | }; | ||
146 | 134 | | |||
147 | inline void swap(MyMoneyKeyValueContainer& first, MyMoneyKeyValueContainer& second) // krazy:exclude=inline | 135 | inline void swap(MyMoneyKeyValueContainer& first, MyMoneyKeyValueContainer& second) // krazy:exclude=inline | ||
148 | { | 136 | { | ||
149 | using std::swap; | 137 | using std::swap; | ||
150 | swap(first.d_ptr, second.d_ptr); | 138 | swap(first.d_ptr, second.d_ptr); | ||
151 | } | 139 | } | ||
152 | 140 | | |||
Show All 12 Lines |