diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-16 20:56:50 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-16 20:56:50 -0400 |
commit | db0689f547593f6904208939f21981a84c73b2c5 (patch) | |
tree | 1c2f18422ce7cac617c9b7fb837e0f4d5a1a1d66 /src/xact.cc | |
parent | 72cdb41727d53cc9e108b70c59d4adf3b8389a58 (diff) | |
download | fork-ledger-db0689f547593f6904208939f21981a84c73b2c5.tar.gz fork-ledger-db0689f547593f6904208939f21981a84c73b2c5.tar.bz2 fork-ledger-db0689f547593f6904208939f21981a84c73b2c5.zip |
Added a "commodity" valexpr variable for xacts
Diffstat (limited to 'src/xact.cc')
-rw-r--r-- | src/xact.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/xact.cc b/src/xact.cc index 1f5d4f47..bbe8ff47 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -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': |