File indexing completed on 2024-05-12 16:42:18

0001 /*
0002     SPDX-FileCopyrightText: 2016-2017 Thomas Baumgart <tbaumgart@kde.org>
0003     SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef LEDGERSPLIT_H
0008 #define LEDGERSPLIT_H
0009 
0010 // ----------------------------------------------------------------------------
0011 // QT Includes
0012 
0013 // ----------------------------------------------------------------------------
0014 // KDE Includes
0015 
0016 // ----------------------------------------------------------------------------
0017 // Project Includes
0018 
0019 #include "ledgertransaction.h"
0020 
0021 class MyMoneySplit;
0022 class MyMoneyTransaction;
0023 
0024 class LedgerSplitPrivate;
0025 class LedgerSplit : public LedgerTransaction
0026 {
0027 public:
0028     explicit LedgerSplit(const MyMoneyTransaction& t, const MyMoneySplit& s);
0029     LedgerSplit(const LedgerSplit & other);
0030     LedgerSplit(LedgerSplit && other);
0031     LedgerSplit & operator=(LedgerSplit other);
0032     friend void swap(LedgerSplit& first, LedgerSplit& second);
0033 
0034     ~LedgerSplit() override;
0035 
0036     /// @copydoc LedgerItem::memo()
0037     QString memo() const override;
0038 
0039 private:
0040     LedgerSplit();
0041     Q_DECLARE_PRIVATE(LedgerSplit)
0042 };
0043 
0044 inline void swap(LedgerSplit& first, LedgerSplit& second) // krazy:exclude=inline
0045 {
0046     using std::swap;
0047     swap(first.d_ptr, second.d_ptr);
0048 }
0049 
0050 inline LedgerSplit::LedgerSplit(LedgerSplit && other) : LedgerSplit() // krazy:exclude=inline
0051 {
0052     swap(*this, other);
0053 }
0054 
0055 inline LedgerSplit & LedgerSplit::operator=(LedgerSplit other) // krazy:exclude=inline
0056 {
0057     swap(*this, other);
0058     return *this;
0059 }
0060 
0061 #endif // LEDGERSPLIT_H