summaryrefslogtreecommitdiff
path: root/src/iterators.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2017-01-04 12:02:15 -0800
committerJohn Wiegley <johnw@newartisans.com>2017-01-04 12:02:15 -0800
commitf27d7776ca8fb29c5a523c859d64f3c570ce8985 (patch)
tree9ae01f8c316bc3a3e6f9709192f17bf388adc89c /src/iterators.h
parent0e1c6115b37cc2ddde2d981dfd0e329be626316c (diff)
downloadfork-ledger-f27d7776ca8fb29c5a523c859d64f3c570ce8985.tar.gz
fork-ledger-f27d7776ca8fb29c5a523c859d64f3c570ce8985.tar.bz2
fork-ledger-f27d7776ca8fb29c5a523c859d64f3c570ce8985.zip
Item sorting should have access to the report scope
Diffstat (limited to 'src/iterators.h')
-rw-r--r--src/iterators.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/iterators.h b/src/iterators.h
index a3f535b1..84f857e0 100644
--- a/src/iterators.h
+++ b/src/iterators.h
@@ -50,6 +50,7 @@
namespace ledger {
class journal_t;
+class report_t;
template <typename Derived, typename Value, typename CategoryOrTraversal>
class iterator_facade_base
@@ -279,8 +280,9 @@ class sorted_accounts_iterator
: public iterator_facade_base<sorted_accounts_iterator, account_t *,
boost::forward_traversal_tag>
{
- expr_t sort_cmp;
- bool flatten_all;
+ expr_t sort_cmp;
+ report_t& report;
+ bool flatten_all;
typedef std::deque<account_t *> accounts_deque_t;
@@ -290,16 +292,21 @@ class sorted_accounts_iterator
public:
sorted_accounts_iterator(account_t& account,
- const expr_t& _sort_cmp, bool _flatten_all)
- : sort_cmp(_sort_cmp), flatten_all(_flatten_all) {
+ const expr_t& _sort_cmp,
+ report_t& _report,
+ bool _flatten_all)
+ : sort_cmp(_sort_cmp), report(_report),
+ flatten_all(_flatten_all) {
push_back(account);
increment();
- TRACE_CTOR(sorted_accounts_iterator, "account_t&, expr_t, bool");
+ TRACE_CTOR(sorted_accounts_iterator,
+ "account_t&, expr_t, report_t&, bool");
}
sorted_accounts_iterator(const sorted_accounts_iterator& i)
: iterator_facade_base<sorted_accounts_iterator, account_t *,
boost::forward_traversal_tag>(i),
- sort_cmp(i.sort_cmp), flatten_all(i.flatten_all),
+ sort_cmp(i.sort_cmp), report(i.report),
+ flatten_all(i.flatten_all),
accounts_list(i.accounts_list),
sorted_accounts_i(i.sorted_accounts_i),
sorted_accounts_end(i.sorted_accounts_end) {