Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/mymoneyobject.h
Context not available. | |||||
20 | // ---------------------------------------------------------------------------- | 20 | // ---------------------------------------------------------------------------- | ||
---|---|---|---|---|---|
21 | // QT Includes | 21 | // QT Includes | ||
22 | 22 | | |||
23 | #include <QString> | 23 | #include <qglobal.h> | ||
24 | class QDomDocument; | | |||
25 | class QDomElement; | | |||
26 | 24 | | |||
27 | // ---------------------------------------------------------------------------- | 25 | // ---------------------------------------------------------------------------- | ||
28 | // Project Includes | 26 | // Project Includes | ||
Context not available. | |||||
30 | #include "kmm_mymoney_export.h" | 28 | #include "kmm_mymoney_export.h" | ||
31 | #include "mymoneyunittestable.h" | 29 | #include "mymoneyunittestable.h" | ||
32 | 30 | | |||
31 | class QString; | ||||
32 | class QDomDocument; | ||||
33 | class QDomElement; | ||||
34 | | ||||
33 | /** | 35 | /** | ||
34 | * @author Thomas Baumgart | 36 | * @author Thomas Baumgart | ||
35 | */ | 37 | */ | ||
Context not available. | |||||
37 | /** | 39 | /** | ||
38 | * This class represents the base class of all MyMoney objects. | 40 | * This class represents the base class of all MyMoney objects. | ||
39 | */ | 41 | */ | ||
42 | class MyMoneyObjectPrivate; | ||||
40 | class KMM_MYMONEY_EXPORT MyMoneyObject | 43 | class KMM_MYMONEY_EXPORT MyMoneyObject | ||
41 | { | 44 | { | ||
45 | Q_DECLARE_PRIVATE(MyMoneyObject) | ||||
46 | | ||||
42 | KMM_MYMONEY_UNIT_TESTABLE | 47 | KMM_MYMONEY_UNIT_TESTABLE | ||
43 | 48 | | |||
44 | public: | 49 | public: | ||
45 | /** | 50 | /** | ||
46 | * This is the constructor for the MyMoneyObject object | 51 | * This is the constructor for the MyMoneyObject object | ||
47 | */ | 52 | */ | ||
48 | MyMoneyObject(); | 53 | MyMoneyObject(); | ||
54 | | ||||
55 | MyMoneyObject(const MyMoneyObject & other); | ||||
56 | MyMoneyObject(MyMoneyObject && other); | ||||
57 | friend void swap(MyMoneyObject& first, MyMoneyObject& second); | ||||
49 | 58 | | |||
50 | /** | 59 | /** | ||
51 | * This is the destructor for the MyMoneyObject object | 60 | * This is the destructor for the MyMoneyObject object | ||
Context not available. | |||||
86 | 95 | | |||
87 | bool operator == (const MyMoneyObject& right) const; | 96 | bool operator == (const MyMoneyObject& right) const; | ||
88 | 97 | | |||
89 | static const QString& emptyId(); | | |||
90 | | ||||
91 | protected: | 98 | protected: | ||
99 | MyMoneyObjectPrivate * d_ptr; | ||||
100 | MyMoneyObject(MyMoneyObjectPrivate &dd); | ||||
101 | MyMoneyObject(MyMoneyObjectPrivate &dd, | ||||
102 | const QString& id); | ||||
103 | MyMoneyObject(MyMoneyObjectPrivate &dd, | ||||
104 | const QDomElement& node, | ||||
105 | bool forceId = true); | ||||
106 | | ||||
92 | /** | 107 | /** | ||
93 | * This contructor assigns the id to the MyMoneyObject | 108 | * This contructor assigns the id to the MyMoneyObject | ||
94 | * | 109 | * | ||
Context not available. | |||||
110 | * used by objects, which are stored w/o id (eg. splits, | 125 | * used by objects, which are stored w/o id (eg. splits, | ||
111 | * transactions within schedules) | 126 | * transactions within schedules) | ||
112 | */ | 127 | */ | ||
113 | MyMoneyObject(const QDomElement& node, const bool forceId = true); | 128 | explicit MyMoneyObject(const QDomElement& node, bool forceId = true); | ||
114 | 129 | }; | |||
115 | void setId(const QString& id); | | |||
116 | 130 | | |||
117 | /** | 131 | inline void swap(MyMoneyObject& first, MyMoneyObject& second) // krazy:exclude=inline | ||
118 | * This method writes out the members contained in this object. | 132 | { | ||
119 | */ | 133 | using std::swap; | ||
120 | void writeBaseXML(QDomDocument& document, QDomElement& el) const; | 134 | swap(first.d_ptr, second.d_ptr); | ||
135 | } | ||||
121 | 136 | | |||
122 | protected: | 137 | inline MyMoneyObject::MyMoneyObject(MyMoneyObject && other) : MyMoneyObject() // krazy:exclude=inline | ||
123 | QString m_id; | 138 | { | ||
124 | static const QString m_emptyId; | 139 | swap(*this, other); | ||
125 | }; | 140 | } | ||
126 | 141 | | |||
127 | #endif | 142 | #endif | ||
128 | 143 | | |||
Context not available. |