summaryrefslogtreecommitdiff
path: root/src/commodity.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-09-25 13:59:01 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-09-25 13:59:01 -0400
commitb5386b25345494757bdeb8be6ae00878f7c92c43 (patch)
treeba596381dfc11c39819cd06bb47364ee4cbe5a0b /src/commodity.h
parent6007e3cbfe1e2b5a94e71eccc30f7298f0983535 (diff)
downloadfork-ledger-b5386b25345494757bdeb8be6ae00878f7c92c43.tar.gz
fork-ledger-b5386b25345494757bdeb8be6ae00878f7c92c43.tar.bz2
fork-ledger-b5386b25345494757bdeb8be6ae00878f7c92c43.zip
Added code to recursively search for a price in a given commodity.
Diffstat (limited to 'src/commodity.h')
-rw-r--r--src/commodity.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/commodity.h b/src/commodity.h
index 29011a7f..1277b2c2 100644
--- a/src/commodity.h
+++ b/src/commodity.h
@@ -77,26 +77,26 @@ public:
optional<amount_t> find_price(const optional<datetime_t>& moment = none);
};
- typedef std::map<const commodity_t *, history_t> history_by_commodity_map;
+ typedef std::map<commodity_t *, history_t> history_by_commodity_map;
struct varied_history_t
{
history_by_commodity_map histories;
void add_price(const datetime_t& date, const amount_t& price);
- bool remove_price(const datetime_t& date, const commodity_t& commodity);
+ bool remove_price(const datetime_t& date, commodity_t& commodity);
optional<amount_t>
- find_price(const optional<const commodity_t&>& commodity = none,
- const optional<datetime_t>& moment = none);
+ find_price(const optional<commodity_t&>& commodity = none,
+ const optional<datetime_t>& moment = none);
optional<amount_t>
- find_price(const std::vector<const commodity_t *>& commodities,
- const optional<datetime_t>& moment = none);
+ find_price(const std::vector<commodity_t *>& commodities,
+ const optional<datetime_t>& moment = none);
optional<history_t&>
- history(const optional<const commodity_t&>& commodity = none);
+ history(const optional<commodity_t&>& commodity = none);
optional<history_t&>
- history(const std::vector<const commodity_t *>& commodities);
+ history(const std::vector<commodity_t *>& commodities);
};
#define COMMODITY_STYLE_DEFAULTS 0x00
@@ -230,12 +230,12 @@ protected:
}
optional<history_t&>
- history(const optional<const commodity_t&>& commodity);
+ history(const optional<commodity_t&>& commodity);
optional<history_t&>
- history(const std::vector<const commodity_t *>& commodities);
+ history(const std::vector<commodity_t *>& commodities);
optional<history_t>
- find_price(const commodity_t& commodity,
+ find_price(commodity_t& commodity,
const optional<datetime_t>& moment,
std::vector<bool *>& bools);
@@ -249,23 +249,23 @@ public:
base->varied_history->add_price(date, price);
}
- bool remove_price(const datetime_t& date, const commodity_t& commodity) {
+ bool remove_price(const datetime_t& date, commodity_t& commodity) {
if (base->varied_history)
base->varied_history->remove_price(date, commodity);
return false;
}
optional<amount_t>
- find_price(const optional<const commodity_t&>& commodity = none,
- const optional<datetime_t>& moment = none) {
+ find_price(const optional<commodity_t&>& commodity = none,
+ const optional<datetime_t>& moment = none) {
if (base->varied_history)
return base->varied_history->find_price(commodity, moment);
return none;
}
optional<amount_t>
- find_price(const std::vector<const commodity_t *>& commodities,
- const optional<datetime_t>& moment = none) {
+ find_price(const std::vector<commodity_t *>& commodities,
+ const optional<datetime_t>& moment = none) {
if (base->varied_history)
return base->varied_history->find_price(commodities, moment);
return none;