diff options
author | John Wiegley <johnw@newartisans.com> | 2004-07-31 02:36:20 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-07-31 02:36:20 -0400 |
commit | 3273be3dccbdd56035b588f5e7edc5a26544f841 (patch) | |
tree | 7f37c898e924b09485b434780ff253ba67ad3d1a | |
parent | c06fad4291d385c7021dc1876a1d06d52a0508c1 (diff) | |
download | fork-ledger-3273be3dccbdd56035b588f5e7edc5a26544f841.tar.gz fork-ledger-3273be3dccbdd56035b588f5e7edc5a26544f841.tar.bz2 fork-ledger-3273be3dccbdd56035b588f5e7edc5a26544f841.zip |
restore sorting of register reports
-rw-r--r-- | item.cc | 8 | ||||
-rw-r--r-- | main.cc | 14 |
2 files changed, 12 insertions, 10 deletions
@@ -129,6 +129,7 @@ item_t * walk_entries(entries_list::const_iterator begin, subitem->payee = item->payee; subitem->account = (*j)->account; subitem->value = *(*j); + item->value += subitem->value; item->subitems.push_back(subitem); } @@ -163,19 +164,20 @@ item_t * walk_entries(entries_list::const_iterator begin, struct cmp_items { const node_t * sort_order; - cmp_items(const node_t * _sort_order) : sort_order(_sort_order) {} + cmp_items(const node_t * _sort_order) : sort_order(_sort_order) { + assert(sort_order); + } bool operator()(const item_t * left, const item_t * right) const { assert(left); assert(right); - assert(sort_order); return sort_order->compute(left) < sort_order->compute(right); } }; void item_t::sort(const node_t * sort_order) { - std::sort(subitems.begin(), subitems.end(), cmp_items(sort_order)); + std::stable_sort(subitems.begin(), subitems.end(), cmp_items(sort_order)); } } // namespace ledger @@ -59,13 +59,13 @@ unsigned int show_balances(std::ostream& out, return headlines; } -void balance_report(std::ostream& out, - item_t * top, - const node_t * predicate, - const node_t * sort_order, - const format_t& format, - const bool show_expanded, - const bool show_subtotals) +void balance_report(std::ostream& out, + item_t * top, + const node_t * predicate, + const node_t * sort_order, + const format_t& format, + const bool show_expanded, + const bool show_subtotals) { if (sort_order) top->sort(sort_order); |