summaryrefslogtreecommitdiff
path: root/src/compare.cc
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/compare.cc
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/compare.cc')
-rw-r--r--src/compare.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/compare.cc b/src/compare.cc
index 547acc18..f0edff76 100644
--- a/src/compare.cc
+++ b/src/compare.cc
@@ -33,8 +33,10 @@
#include "compare.h"
#include "op.h"
+#include "scope.h"
#include "post.h"
#include "account.h"
+#include "report.h"
namespace ledger {
@@ -65,6 +67,20 @@ void push_sort_value(std::list<sort_value_t>& sort_values,
}
template <>
+void compare_items<post_t>::find_sort_values(
+ std::list<sort_value_t>& sort_values, scope_t& scope) {
+ bind_scope_t bound_scope(report, scope);
+ push_sort_value(sort_values, sort_order.get_op(), bound_scope);
+}
+
+template <>
+void compare_items<account_t>::find_sort_values(
+ std::list<sort_value_t>& sort_values, scope_t& scope) {
+ bind_scope_t bound_scope(report, scope);
+ push_sort_value(sort_values, sort_order.get_op(), bound_scope);
+}
+
+template <>
bool compare_items<post_t>::operator()(post_t * left, post_t * right)
{
assert(left);