summaryrefslogtreecommitdiff
path: root/valexpr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'valexpr.cc')
-rw-r--r--valexpr.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/valexpr.cc b/valexpr.cc
index 8b6b5d7d..c40b962c 100644
--- a/valexpr.cc
+++ b/valexpr.cc
@@ -901,14 +901,23 @@ void dump_value_expr(std::ostream& out, const value_expr_t * node)
using namespace boost::python;
using namespace ledger;
+value_t py_compute_1(value_expr_t& value_expr, const details_t& item)
+{
+ value_t result;
+ value_expr.compute(result, item);
+ return result;
+}
+
template <typename T>
-value_t py_compute(value_expr_t& value_expr, const T& item) {
+value_t py_compute(value_expr_t& value_expr, const T& item)
+{
value_t result;
value_expr.compute(result, details_t(item));
return result;
}
-value_expr_t * py_parse_value_expr(const std::string& str) {
+value_expr_t * py_parse_value_expr(const std::string& str)
+{
return parse_value_expr(str);
}
@@ -929,6 +938,7 @@ void export_valexpr()
;
class_< value_expr_t > ("ValueExpr", init<value_expr_t::kind_t>())
+ .def("compute", py_compute_1)
.def("compute", py_compute<account_t>)
.def("compute", py_compute<entry_t>)
.def("compute", py_compute<transaction_t>)