From 092542a3bf056fac545f4b5a1062195569561fd3 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 12 Feb 2009 20:45:33 -0400 Subject: Sorting expr now uses "-" to indicate descending For example: -S payee,-date sorts 1) ascending by payee, then 2) descending by date. --- src/compare.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/compare.h') 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_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 bool compare_items::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 <> -- cgit v1.2.3