diff options
author | John Wiegley <johnw@newartisans.com> | 2010-06-07 09:49:17 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2010-06-07 09:49:17 -0400 |
commit | be6cef93c479056169ab499d03ea212ff22db435 (patch) | |
tree | fba78156e5187bd690f519846427284cdc0b0193 /src/value.cc | |
parent | ae8ab8106218167036ef386159450b56c328f1b9 (diff) | |
download | fork-ledger-be6cef93c479056169ab499d03ea212ff22db435.tar.gz fork-ledger-be6cef93c479056169ab499d03ea212ff22db435.tar.bz2 fork-ledger-be6cef93c479056169ab499d03ea212ff22db435.zip |
A further simplification of -V and -X
With -X COMM, all values are computed in terms of COMM, regardless.
With -V, only secondary commodities will ever be computed, never
primaries. Further, if a secondary commodities has an associated price,
the valuation is done in terms of that price's commodity.
Diffstat (limited to 'src/value.cc')
-rw-r--r-- | src/value.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/value.cc b/src/value.cc index 7af2fd1e..e5ced56e 100644 --- a/src/value.cc +++ b/src/value.cc @@ -1401,8 +1401,7 @@ bool value_t::is_zero() const return false; } -value_t value_t::value(const bool primary_only, - const optional<datetime_t>& moment, +value_t value_t::value(const optional<datetime_t>& moment, const optional<commodity_t&>& in_terms_of) const { switch (type()) { @@ -1411,13 +1410,13 @@ value_t value_t::value(const bool primary_only, case AMOUNT: if (optional<amount_t> val = - as_amount().value(primary_only, moment, in_terms_of)) + as_amount().value(moment, in_terms_of)) return *val; return NULL_VALUE; case BALANCE: if (optional<balance_t> bal = - as_balance().value(primary_only, moment, in_terms_of)) + as_balance().value(moment, in_terms_of)) return *bal; return NULL_VALUE; @@ -1455,7 +1454,7 @@ value_t value_t::exchange_commodities(const std::string& commodities, if (commodity_t * commodity = commodity_pool_t::current_pool->parse_price_expression(p, add_prices, moment)) { - value_t result = value(false, moment, *commodity); + value_t result = value(moment, *commodity); if (! result.is_null()) return result; } |