6 #include "gmock-Split.h" 7 #include "gmock-qofbook.h" 12 QofInstanceClass parent_class;
16 G_DEFINE_TYPE(
MockSplit, gnc_mocksplit, QOF_TYPE_INSTANCE)
25 gnc_mocksplit_class_init (MockSplitClass *klass)
31 GType gnc_split_get_type(
void)
33 return gnc_mocksplit_get_type();
41 return mockbook ? mockbook->malloc_split() :
nullptr;
48 auto mocksplit = gnc_mocksplit(split);
49 return mocksplit ? mocksplit->get_book() :
nullptr;
56 auto mocksplit = gnc_mocksplit(split);
57 return mocksplit ? mocksplit->get_account() :
nullptr;
61 xaccSplitSetAccount (Split *split,
Account *acc)
63 ASSERT_TRUE(GNC_IS_MOCKSPLIT(split));
64 ASSERT_TRUE(GNC_IS_ACCOUNT(acc));
65 gnc_mocksplit(split)->set_account(acc);
72 auto mocksplit = gnc_mocksplit(split);
73 return mocksplit ? mocksplit->get_amount() : gnc_numeric_zero();
79 ASSERT_TRUE(GNC_IS_MOCKSPLIT(split));
80 gnc_mocksplit(split)->set_amount(amt);
87 auto mocksplit = gnc_mocksplit(split);
88 return mocksplit ? mocksplit->get_value() : gnc_numeric_zero();
94 ASSERT_TRUE(GNC_IS_MOCKSPLIT(split));
95 gnc_mocksplit(split)->set_value(val);
102 auto mocksplit = gnc_mocksplit(split);
103 return mocksplit ? mocksplit->get_memo() :
"";
109 ASSERT_TRUE(GNC_IS_MOCKSPLIT(split));
110 gnc_mocksplit(split)->set_memo(memo);
117 auto mocksplit = gnc_mocksplit(split);
118 return mocksplit ? mocksplit->get_reconcile() :
VREC;
124 ASSERT_TRUE(GNC_IS_MOCKSPLIT(split));
125 gnc_mocksplit(split)->set_reconcile(recn);
131 ASSERT_TRUE(GNC_IS_MOCKSPLIT(split));
132 gnc_mocksplit(split)->set_date_reconciled_secs(secs);
139 auto mocksplit = gnc_mocksplit(split);
140 return mocksplit ? mocksplit->get_action() :
"";
147 auto mocksplit = gnc_mocksplit(split);
148 return mocksplit ? mocksplit->get_other_split() :
nullptr;
155 auto mocksplit = gnc_mocksplit(split);
156 return mocksplit ? mocksplit->get_parent() :
nullptr;
160 xaccSplitSetParent(Split *split, Transaction *trans)
162 ASSERT_TRUE(GNC_IS_MOCKSPLIT(split));
163 ASSERT_TRUE(GNC_IS_TRANSACTION(trans));
164 gnc_mocksplit(split)->set_parent(trans);
void xaccSplitSetValue(Split *split, gnc_numeric val)
The xaccSplitSetValue() method sets the value of this split in the transaction's commodity.
char xaccSplitGetReconcile(const Split *split)
Returns the value of the reconcile flag.
void xaccSplitSetReconcile(Split *split, char recn)
Set the reconcile flag.
Transaction * xaccSplitGetParent(const Split *split)
Returns the parent transaction of the split.
QofBook * xaccSplitGetBook(const Split *split)
Returns the book of this split, i.e.
#define VREC
split is void
void xaccSplitSetAmount(Split *split, gnc_numeric amt)
The xaccSplitSetAmount() method sets the amount in the account's commodity that the split should have...
Account handling public routines.
void xaccSplitSetMemo(Split *split, const char *memo)
The memo is an arbitrary string associated with a split.
Split * xaccMallocSplit(QofBook *book)
Constructor.
void xaccSplitSetDateReconciledSecs(Split *split, time64 secs)
Set the date on which this split was reconciled by specifying the time as time64. ...
gnc_numeric xaccSplitGetValue(const Split *split)
Returns the value of this split in the transaction's commodity.
Account * xaccSplitGetAccount(const Split *split)
Returns the account of this split, which was set through xaccAccountInsertSplit().
Split * xaccSplitGetOtherSplit(const Split *split)
The xaccSplitGetOtherSplit() is a convenience routine that returns the other of a pair of splits...
const char * xaccSplitGetMemo(const Split *split)
Returns the memo string.
const char * xaccSplitGetAction(const Split *split)
Returns the action string.
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
API for Transactions and Splits (journal entries)
gnc_numeric xaccSplitGetAmount(const Split *split)
Returns the amount of the split in the account's commodity.