diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-12 20:45:33 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-12 20:45:33 -0400 |
commit | 092542a3bf056fac545f4b5a1062195569561fd3 (patch) | |
tree | f854942e66033567e47c8f227c357ef59daa7866 /src/compare.h | |
parent | e0e181d2af4aff5ac6c253fe25737bf93bfb6996 (diff) | |
download | fork-ledger-092542a3bf056fac545f4b5a1062195569561fd3.tar.gz fork-ledger-092542a3bf056fac545f4b5a1062195569561fd3.tar.bz2 fork-ledger-092542a3bf056fac545f4b5a1062195569561fd3.zip |
Sorting expr now uses "-" to indicate descending
For example: -S payee,-date sorts 1) ascending by payee, then 2)
descending by date.
Diffstat (limited to 'src/compare.h')
-rw-r--r-- | src/compare.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/compare.h b/src/compare.h index 70b44ed3..e4d68aa2 100644 --- a/src/compare.h +++ b/src/compare.h @@ -74,17 +74,20 @@ public: ~compare_items() throw() { TRACE_DTOR(compare_items); } + + void find_sort_values(std::list<sort_value_t>& sort_values, T * scope); + bool operator()(T * left, T * right); }; -bool value_is_less_than(const value_t& left, const value_t& right); +sort_value_t calc_sort_value(const expr_t::ptr_op_t op); template <typename T> bool compare_items<T>::operator()(T * left, T * right) { - assert(left); - assert(right); - return sort_order.calc(*left) < sort_order.calc(*right); + assert(left); assert(right); + return value_is_less_than(find_sort_values(left), + find_sort_values(right)); } template <> |