mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[Account.cpp][api] gnc_account_foreach_split takes std::function<void(Split*)>
This commit is contained in:
@@ -1137,6 +1137,20 @@ xaccInitAccount (Account * acc, QofBook *book)
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
void
|
||||
gnc_account_foreach_split (const Account *acc, std::function<void(Split*)> func,
|
||||
bool reverse)
|
||||
{
|
||||
if (!GNC_IS_ACCOUNT (acc))
|
||||
return;
|
||||
|
||||
auto splits{GET_PRIVATE(acc)->splits};
|
||||
if (reverse)
|
||||
std::for_each(splits.rbegin(), splits.rend(), func);
|
||||
else
|
||||
std::for_each(splits.begin(), splits.end(), func);
|
||||
}
|
||||
|
||||
Split*
|
||||
gnc_account_find_split (const Account *acc, std::function<bool(const Split*)> predicate,
|
||||
bool reverse)
|
||||
|
||||
@@ -41,6 +41,8 @@ using SplitsVec = std::vector<Split*>;
|
||||
|
||||
const SplitsVec xaccAccountGetSplits (const Account*);
|
||||
|
||||
void gnc_account_foreach_split (const Account*, std::function<void(Split*)>, bool);
|
||||
|
||||
/** scans account split list (in forward or reverse order) until
|
||||
* predicate split->bool returns true. Maybe return the split.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user