3 #include "gmock-Account.h" 8 QofInstanceClass parent_class;
12 G_DEFINE_TYPE(
MockAccount, gnc_mockaccount, QOF_TYPE_INSTANCE)
21 gnc_mockaccount_class_init(MockAccountClass *klass)
29 return gnc_mockaccount_get_type();
35 ASSERT_TRUE(GNC_IS_MOCKACCOUNT(account));
36 gnc_mockaccount(account)->begin_edit();
42 ASSERT_TRUE(GNC_IS_MOCKACCOUNT(account));
43 gnc_mockaccount(account)->commit_edit();
47 gnc_account_get_book(
const Account *account)
50 auto mockaccount = gnc_mockaccount(account);
51 return mockaccount ? mockaccount->get_book() :
nullptr;
58 auto mockaccount = gnc_mockaccount(account);
59 return mockaccount ? mockaccount->get_commodity() :
nullptr;
67 auto mockaccount = gnc_mockaccount(acc);
68 return mockaccount ? mockaccount->for_each_transaction(proc, data) : 0;
75 auto mockaccount = gnc_mockaccount(account);
76 return mockaccount ? mockaccount->xaccAccountGetSplitList() :
nullptr;
79 const std::vector<Split*>&
80 xaccAccountGetSplits (
const Account *account)
83 auto mockaccount = gnc_mockaccount(account);
84 static const SplitsVec empty;
87 return mockaccount->xaccAccountGetSplits();
92 gnc_account_imap_find_account (
97 auto mockaccount = gnc_mockaccount(acc);
98 return mockaccount->find_account(category, key);
102 gnc_account_imap_add_account (
104 const char *category,
108 auto mockaccount = gnc_mockaccount(acc);
109 mockaccount->add_account(category, key, dest_acc);
117 std::vector<const char*> tokenVec;
119 for (
auto token = tokens; token; token = token->next)
121 tokenVec.push_back(static_cast <char const *> (token->data));
124 auto mockaccount = gnc_mockaccount(acc);
125 return mockaccount->find_account_bayes(tokenVec);
134 std::vector<const char*> tokenVec;
136 for (
auto token = tokens; token; token = token->next)
138 tokenVec.push_back(static_cast <char const *> (token->data));
141 auto mockaccount = gnc_mockaccount(acc);
142 mockaccount->add_account_bayes(tokenVec, added_acc);
gint xaccAccountForEachTransaction(const Account *acc, TransactionCallback proc, void *data)
The xaccAccountForEachTransaction() routine will traverse all of the transactions in account and call...
SplitList * xaccAccountGetSplitList(const Account *account)
The xaccAccountGetSplitList() routine returns a pointer to a GList of the splits in the account...
void gnc_account_imap_add_account_bayes(Account *acc, GList *tokens, Account *added_acc)
Updates the imap for a given account using a list of tokens.
GList SplitList
GList of Split.
GType gnc_account_get_type(void)
Returns the GType type system description of the Account class.
void xaccAccountBeginEdit(Account *account)
The xaccAccountBeginEdit() subroutine is the first phase of a two-phase-commit wrapper for account up...
gnc_commodity * xaccAccountGetCommodity(const Account *account)
Get the account's commodity.
void xaccAccountCommitEdit(Account *account)
ThexaccAccountCommitEdit() subroutine is the second phase of a two-phase-commit wrapper for account u...
Account * gnc_account_imap_find_account_bayes(Account *acc, GList *tokens)
Look up an Account in the map using Baysian.