summaryrefslogtreecommitdiff
path: root/valexpr.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-06 21:38:27 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-06 21:38:27 -0400
commit5db1e1165b05ae56e0348a4634144072dfcace1f (patch)
tree18e6f9981d99c8042aa8d93208a8a85ad6382d58 /valexpr.h
parent88df7968809717123d09c45be5709b673a4b7172 (diff)
downloadfork-ledger-5db1e1165b05ae56e0348a4634144072dfcace1f.tar.gz
fork-ledger-5db1e1165b05ae56e0348a4634144072dfcace1f.tar.bz2
fork-ledger-5db1e1165b05ae56e0348a4634144072dfcace1f.zip
improvements to transaction formatting
Diffstat (limited to 'valexpr.h')
-rw-r--r--valexpr.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/valexpr.h b/valexpr.h
index d2521998..aadbb03f 100644
--- a/valexpr.h
+++ b/valexpr.h
@@ -136,6 +136,25 @@ inline node_t * find_node(node_t * node, node_t::kind_t type) {
return result;
}
+template <typename T>
+class item_predicate
+{
+ const node_t * predicate;
+
+ public:
+ item_predicate(const node_t * _predicate) : predicate(_predicate) {}
+
+ bool operator()(const T * item) const {
+ if (predicate) {
+ balance_t result;
+ predicate->compute(result, details_t(item));
+ return result;
+ } else {
+ return true;
+ }
+ }
+};
+
} // namespace report
#endif // _REPORT_H