Added a "commodity" valexpr variable for xacts

This commit is contained in:
John Wiegley 2009-02-16 20:56:50 -04:00
parent 72cdb41727
commit db0689f547

View file

@ -154,6 +154,10 @@ namespace {
}
}
value_t get_commodity(xact_t& xact) {
return string_value(xact.amount.commodity().symbol());
}
value_t get_cost(xact_t& xact) {
if (xact.has_xdata() &&
xact.xdata().has_flags(XACT_EXT_COMPOUND)) {
@ -237,6 +241,8 @@ expr_t::ptr_op_t xact_t::lookup(const string& name)
return WRAP_FUNCTOR(get_wrapper<&get_count>);
else if (name == "calculated")
return WRAP_FUNCTOR(get_wrapper<&get_is_calculated>);
else if (name == "commodity")
return WRAP_FUNCTOR(get_wrapper<&get_commodity>);
break;
case 'd':