summaryrefslogtreecommitdiff
path: root/src/commodity.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-08 00:55:06 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-03-08 00:55:06 -0600
commit21e8b7f6f0a182f67899c5cd3689a5e646d8ed4a (patch)
tree2f9124c1ca3584532c457eab2d7679d4821f0a05 /src/commodity.cc
parent17a84642fbb4684d5a8415371003f12ccb760d99 (diff)
downloadfork-ledger-21e8b7f6f0a182f67899c5cd3689a5e646d8ed4a.tar.gz
fork-ledger-21e8b7f6f0a182f67899c5cd3689a5e646d8ed4a.tar.bz2
fork-ledger-21e8b7f6f0a182f67899c5cd3689a5e646d8ed4a.zip
Added nail_down() for pinning market value exprs
Diffstat (limited to 'src/commodity.cc')
-rw-r--r--src/commodity.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/commodity.cc b/src/commodity.cc
index 24d54695..dd1b2743 100644
--- a/src/commodity.cc
+++ b/src/commodity.cc
@@ -217,6 +217,15 @@ commodity_t::check_for_updated_price(const optional<price_point_t>& point,
return point;
}
+commodity_t& commodity_t::nail_down(const expr_t& expr)
+{
+ annotation_t new_details;
+ new_details.value_expr = expr;
+ commodity_t * new_comm =
+ commodity_pool_t::current_pool->find_or_create(symbol(), new_details);
+ return *new_comm;
+}
+
commodity_t::operator bool() const
{
return this != pool().null_commodity;