diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-22 04:43:34 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-22 04:51:11 -0400 |
commit | e124811d8a31292c06430815683b2e0fe87f7ceb (patch) | |
tree | e165b781aa87402980c3a47a5617794387e81494 /src/xact.cc | |
parent | 04fd1ae24c3be6f9d3400c55bce90c3fd743e96b (diff) | |
download | fork-ledger-e124811d8a31292c06430815683b2e0fe87f7ceb.tar.gz fork-ledger-e124811d8a31292c06430815683b2e0fe87f7ceb.tar.bz2 fork-ledger-e124811d8a31292c06430815683b2e0fe87f7ceb.zip |
Added --exchange (-x) option
This is like -V, except it lets you specify the goal commodity to report
in terms of, for example:
reg -x CAD
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 ca0b9baf..5818b687 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -159,6 +159,10 @@ namespace { return string_value(xact.amount.commodity().symbol()); } + value_t get_commodity_is_primary(xact_t& xact) { + return xact.amount.commodity().has_flags(COMMODITY_PRIMARY); + } + value_t get_cost(xact_t& xact) { if (xact.has_xdata() && xact.xdata().has_flags(XACT_EXT_COMPOUND)) { @@ -262,6 +266,8 @@ expr_t::ptr_op_t xact_t::lookup(const string& name) case 'p': if (name == "payee") return WRAP_FUNCTOR(get_wrapper<&get_payee>); + else if (name == "primary") + return WRAP_FUNCTOR(get_wrapper<&get_commodity_is_primary>); break; case 't': |