Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/models/ledgertransaction.h
- This file was added.
1 | /*************************************************************************** | ||||
---|---|---|---|---|---|
2 | ledgertransaction.h | ||||
3 | ------------------- | ||||
4 | begin : Sat Aug 8 2015 | ||||
5 | copyright : (C) 2015 by Thomas Baumgart | ||||
6 | email : Thomas Baumgart <tbaumgart@kde.org> | ||||
7 | (C) 2017 by Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> | ||||
8 | ***************************************************************************/ | ||||
9 | | ||||
10 | /*************************************************************************** | ||||
11 | * * | ||||
12 | * This program is free software; you can redistribute it and/or modify * | ||||
13 | * it under the terms of the GNU General Public License as published by * | ||||
14 | * the Free Software Foundation; either version 2 of the License, or * | ||||
15 | * (at your option) any later version. * | ||||
16 | * * | ||||
17 | ***************************************************************************/ | ||||
18 | | ||||
19 | #ifndef LEDGERTRANSACTION_H | ||||
20 | #define LEDGERTRANSACTION_H | ||||
21 | | ||||
22 | // ---------------------------------------------------------------------------- | ||||
23 | // QT Includes | ||||
24 | | ||||
25 | //#include <QScopedPointer> | ||||
26 | | ||||
27 | // ---------------------------------------------------------------------------- | ||||
28 | // KDE Includes | ||||
29 | | ||||
30 | // ---------------------------------------------------------------------------- | ||||
31 | // Project Includes | ||||
32 | | ||||
33 | #include "ledgeritem.h" | ||||
34 | | ||||
35 | class MyMoneyMoney; | ||||
36 | class MyMoneySplit; | ||||
37 | class MyMoneyTransaction; | ||||
38 | | ||||
39 | class LedgerTransactionPrivate; | ||||
40 | class LedgerTransaction : public LedgerItem | ||||
41 | { | ||||
42 | public: | ||||
43 | explicit LedgerTransaction(const MyMoneyTransaction& t, const MyMoneySplit& s); | ||||
44 | LedgerTransaction(const LedgerTransaction & other); | ||||
45 | LedgerTransaction(LedgerTransaction && other); | ||||
46 | LedgerTransaction & operator=(LedgerTransaction other); | ||||
47 | friend void swap(LedgerTransaction& first, LedgerTransaction& second); | ||||
48 | | ||||
49 | virtual ~LedgerTransaction(); | ||||
50 | | ||||
51 | static LedgerTransaction newTransactionEntry(); | ||||
52 | | ||||
53 | /// @copydoc LedgerItem::postDate() | ||||
54 | QDate postDate() const override; | ||||
55 | | ||||
56 | /// @copydoc LedgerItem::transaction() | ||||
57 | MyMoneyTransaction transaction() const override; | ||||
58 | | ||||
59 | /// @copydoc LedgerItem::split() | ||||
60 | const MyMoneySplit& split() const override; | ||||
61 | | ||||
62 | /// @copydoc LedgerItem::accountId() | ||||
63 | QString accountId() const override; | ||||
64 | | ||||
65 | /// @copydoc LedgerItem::account() | ||||
66 | QString account() const override; | ||||
67 | | ||||
68 | /// @copydoc LedgerItem::counterAccountId() | ||||
69 | QString counterAccountId() const override; | ||||
70 | | ||||
71 | /// @copydoc LedgerItem::counterAccount() | ||||
72 | QString counterAccount() const override; | ||||
73 | | ||||
74 | /// @copydoc LedgerItem::costCenterId() | ||||
75 | QString costCenterId() const override; | ||||
76 | | ||||
77 | /// @copydoc LedgerItem::payeeName() | ||||
78 | QString payeeName() const override; | ||||
79 | | ||||
80 | /// @copydoc LedgerItem::payeeId() | ||||
81 | QString payeeId() const override; | ||||
82 | | ||||
83 | /// @copydoc LedgerItem::transactionNumber() | ||||
84 | QString transactionNumber() const override; | ||||
85 | | ||||
86 | /// @copydoc LedgerItem::flags() | ||||
87 | Qt::ItemFlags flags() const override; | ||||
88 | | ||||
89 | /// @copydoc LedgerItem::transactionSplitId() | ||||
90 | QString transactionSplitId() const override; | ||||
91 | | ||||
92 | /// @copydoc LedgerItem::splitCount() | ||||
93 | int splitCount() const override; | ||||
94 | | ||||
95 | /// @copydoc LedgerItem::transactionId() | ||||
96 | QString transactionId() const override; | ||||
97 | | ||||
98 | /// @copydoc LedgerItem::reconciliationState() | ||||
99 | eMyMoney::Split::State reconciliationState() const override; | ||||
100 | | ||||
101 | /// @copydoc LedgerItem::reconciliationStateShort() | ||||
102 | QString reconciliationStateShort() const override; | ||||
103 | | ||||
104 | /// @copydoc LedgerItem::reconciliationStateShort() | ||||
105 | QString reconciliationStateLong() const override; | ||||
106 | | ||||
107 | /// @copydoc LedgerItem::payment() | ||||
108 | QString payment() const override; | ||||
109 | | ||||
110 | /// @copydoc LedgerItem::deposit() | ||||
111 | QString deposit() const override; | ||||
112 | | ||||
113 | /// @copydoc LedgerItem::setBalance() | ||||
114 | void setBalance(QString txt) override; | ||||
115 | | ||||
116 | /// @copydoc LedgerItem::balance() | ||||
117 | QString balance() const override; | ||||
118 | | ||||
119 | /// @copydoc LedgerItem::shares() | ||||
120 | MyMoneyMoney shares() const override; | ||||
121 | | ||||
122 | /// @copydoc LedgerItem::sharesAmount() | ||||
123 | QString sharesAmount() const override; | ||||
124 | | ||||
125 | /// @copydoc LedgerItem::signedSharesAmount() | ||||
126 | QString signedSharesAmount() const override; | ||||
127 | | ||||
128 | /// @copydoc LedgerItem::sharesSuffix() | ||||
129 | QString sharesSuffix() const override; | ||||
130 | | ||||
131 | /// @copydoc LedgerItem::value() | ||||
132 | MyMoneyMoney value() const override; | ||||
133 | | ||||
134 | /// @copydoc LedgerItem::memo() | ||||
135 | QString memo() const override; | ||||
136 | | ||||
137 | /// @copydoc LedgerItem::isErroneous() | ||||
138 | bool isErroneous() const override; | ||||
139 | | ||||
140 | /// @copydoc LedgerItem::isImported() | ||||
141 | bool isImported() const override; | ||||
142 | | ||||
143 | /// @copydoc LedgerItem::isNewTransactionEntry() | ||||
144 | bool isNewTransactionEntry() const override; | ||||
145 | | ||||
146 | /// @copydoc LedgerItem::transactionCommodity() | ||||
147 | QString transactionCommodity() const override; | ||||
148 | | ||||
149 | protected: | ||||
150 | LedgerTransactionPrivate *d_ptr; | ||||
151 | LedgerTransaction(LedgerTransactionPrivate &dd); | ||||
152 | LedgerTransaction(LedgerTransactionPrivate &dd, | ||||
153 | const MyMoneyTransaction &t, | ||||
154 | const MyMoneySplit &s); | ||||
155 | | ||||
156 | private: | ||||
157 | LedgerTransaction(); | ||||
158 | Q_DECLARE_PRIVATE(LedgerTransaction) | ||||
159 | }; | ||||
160 | | ||||
161 | inline void swap(LedgerTransaction& first, LedgerTransaction& second) // krazy:exclude=inline | ||||
162 | { | ||||
163 | using std::swap; | ||||
164 | swap(first.d_ptr, second.d_ptr); | ||||
165 | } | ||||
166 | | ||||
167 | inline LedgerTransaction::LedgerTransaction(LedgerTransaction && other) : LedgerTransaction() // krazy:exclude=inline | ||||
168 | { | ||||
169 | swap(*this, other); | ||||
170 | } | ||||
171 | | ||||
172 | inline LedgerTransaction & LedgerTransaction::operator=(LedgerTransaction other) // krazy:exclude=inline | ||||
173 | { | ||||
174 | swap(*this, other); | ||||
175 | return *this; | ||||
176 | } | ||||
177 | | ||||
178 | #endif // LEDGERTRANSACTION_H | ||||
179 | |