diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-15 23:00:16 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-15 23:00:16 -0400 |
commit | 8c2a70e1979377660ab0b88d0161b4b7f5be62f0 (patch) | |
tree | b7e9a20e9802b90da1d674ee3d356ceb42ec2e84 /src/filters.cc | |
parent | 14ffc2b31a38a7fdd25bd93fe21d17132b16062a (diff) | |
download | fork-ledger-8c2a70e1979377660ab0b88d0161b4b7f5be62f0.tar.gz fork-ledger-8c2a70e1979377660ab0b88d0161b4b7f5be62f0.tar.bz2 fork-ledger-8c2a70e1979377660ab0b88d0161b4b7f5be62f0.zip |
Made several of the filters more context aware
This resolves certain issues where value expressions were not being
looked up within their full context.
Diffstat (limited to 'src/filters.cc')
-rw-r--r-- | src/filters.cc | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/filters.cc b/src/filters.cc index 118e8c5e..c3007f01 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -764,7 +764,8 @@ void forecast_xacts::flush() if (temp.has_xdata() && temp.xdata().has_flags(XACT_EXT_MATCHES)) { - if (! pred(temp)) + bind_scope_t bound_scope(context, temp); + if (! pred(bound_scope)) break; last = temp.date(); passed.clear(); @@ -789,15 +790,21 @@ void forecast_xacts::flush() pass_down_accounts::pass_down_accounts(acct_handler_ptr handler, accounts_iterator& iter, - const optional<item_predicate>& predicate) - : item_handler<account_t>(handler), pred(predicate) + const optional<item_predicate>& _pred, + const optional<scope_t&>& _context) + : item_handler<account_t>(handler), pred(_pred), context(_context) { - TRACE_CTOR(pass_down_accounts, - "acct_handler_ptr, accounts_iterator"); + TRACE_CTOR(pass_down_accounts, "acct_handler_ptr, accounts_iterator, ..."); - for (account_t * account = iter(); account; account = iter()) - if (! pred || (*pred)(*account)) + for (account_t * account = iter(); account; account = iter()) { + if (! pred) { item_handler<account_t>::operator()(*account); + } else { + bind_scope_t bound_scope(*context, *account); + if ((*pred)(bound_scope)) + item_handler<account_t>::operator()(*account); + } + } item_handler<account_t>::flush(); } |