mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[Account.cpp] add gnc_account_and_descendants_empty (acc)
and deprecate xaccAccountCountSplits
This commit is contained in:
parent
630cf65f3a
commit
1b31c06b29
@ -3887,6 +3887,20 @@ xaccAccountCountSplits (const Account *acc, gboolean include_children)
|
||||
return nr;
|
||||
}
|
||||
|
||||
gboolean gnc_account_and_descendants_empty (Account *acc)
|
||||
{
|
||||
g_return_val_if_fail (GNC_IS_ACCOUNT (acc), FALSE);
|
||||
if (xaccAccountGetSplitList (acc)) return FALSE;
|
||||
auto empty = TRUE;
|
||||
auto *children = gnc_account_get_children (acc);
|
||||
for (auto *n = children; n && empty; n = n->next)
|
||||
{
|
||||
empty = gnc_account_and_descendants_empty ((Account*)n->data);
|
||||
}
|
||||
g_list_free (children);
|
||||
return empty;
|
||||
}
|
||||
|
||||
LotList *
|
||||
xaccAccountGetLotList (const Account *acc)
|
||||
{
|
||||
|
@ -256,6 +256,12 @@ void gnc_book_set_root_account(QofBook *book, Account *root);
|
||||
|
||||
/** @} */
|
||||
|
||||
/* Tests account and descendants -- if all have no splits then return TRUE.
|
||||
* Otherwise if any account or its descendants have split return FALSE.
|
||||
*/
|
||||
|
||||
gboolean gnc_account_and_descendants_empty (Account *acc);
|
||||
|
||||
/** Composes a translatable error message showing which account
|
||||
* names clash with the current account separator. Can be called
|
||||
* after gnc_account_list_name_violations to have a consistent
|
||||
@ -1020,7 +1026,9 @@ SplitList* xaccAccountGetSplitList (const Account *account);
|
||||
|
||||
|
||||
/** The xaccAccountCountSplits() routine returns the number of all
|
||||
* the splits in the account.
|
||||
* the splits in the account. xaccAccountCountSplits is O(N). if
|
||||
* testing for emptiness, use xaccAccountGetSplitList != NULL.
|
||||
|
||||
* @param acc the account for which to count the splits
|
||||
*
|
||||
* @param include_children also count splits in descendants (TRUE) or
|
||||
|
Loading…
Reference in New Issue
Block a user