summaryrefslogtreecommitdiff
path: root/walk.cc
diff options
context:
space:
mode:
Diffstat (limited to 'walk.cc')
-rw-r--r--walk.cc16
1 files changed, 7 insertions, 9 deletions
diff --git a/walk.cc b/walk.cc
index 88c423ff..ee915164 100644
--- a/walk.cc
+++ b/walk.cc
@@ -2,30 +2,28 @@
namespace ledger {
-class sum_in_account
-{
- public:
- void operator()(transaction_t * xact) const {
+struct sum_in_account : public item_handler<transaction_t> {
+ virtual void operator()(transaction_t * xact) const {
xact->account->value += *xact;
}
};
void calc__accounts(account_t * account,
- const item_predicate<transaction_t>& pred_functor,
+ const item_predicate<transaction_t>& pred,
unsigned int flags)
{
- sum_in_account functor;
+ sum_in_account handler;
for (transactions_list::iterator i = account->transactions.begin();
i != account->transactions.end();
i++)
- if (pred_functor(*i))
- handle_transaction(*i, functor, flags);
+ if (pred(*i))
+ handle_transaction(*i, handler, flags);
for (accounts_map::iterator i = account->accounts.begin();
i != account->accounts.end();
i++)
- calc__accounts((*i).second, pred_functor, flags);
+ calc__accounts((*i).second, pred, flags);
}
} // namespace ledger