Removed value_t::price and balance_t::price

This commit is contained in:
John Wiegley 2012-03-07 10:32:24 -06:00
parent 7bb83173da
commit b1107f85ae
8 changed files with 1 additions and 38 deletions

View file

@ -202,16 +202,6 @@ balance_t::value(const optional<datetime_t>& moment,
return resolved ? temp : optional<balance_t>();
}
balance_t balance_t::price() const
{
balance_t temp;
foreach (const amounts_map::value_type& pair, amounts)
temp += pair.second.price();
return temp;
}
optional<amount_t>
balance_t::commodity_amount(const optional<const commodity_t&>& commodity) const
{

View file

@ -387,8 +387,6 @@ public:
value(const optional<datetime_t>& moment = none,
const optional<commodity_t&>& in_terms_of = none) const;
balance_t price() const;
/**
* Truth tests. An balance may be truth test in two ways:
*

View file

@ -201,8 +201,6 @@ void export_balance()
.def("value", py_value_1, args("in_terms_of"))
.def("value", py_value_2, args("in_terms_of", "moment"))
.def("price", &balance_t::price)
.def("__nonzero__", &balance_t::is_nonzero)
.def("is_nonzero", &balance_t::is_nonzero)
.def("is_zero", &balance_t::is_zero)

View file

@ -266,8 +266,7 @@ void export_value()
.def("value", py_value_1, args("in_terms_of"))
.def("value", py_value_2, args("in_terms_of", "moment"))
.def("value", &value_t::value, value_overloads())
.def("price", &value_t::price)
//.def("value", &value_t::value, value_overloads())
.def("exchange_commodities", &value_t::exchange_commodities,
exchange_commodities_overloads())

View file

@ -731,11 +731,6 @@ value_t report_t::fn_percent(call_scope_t& args)
(args.get<amount_t>(0) / args.get<amount_t>(1)).number());
}
value_t report_t::fn_price(call_scope_t& args)
{
return args[0].price();
}
value_t report_t::fn_commodity(call_scope_t& args)
{
return string_value(args.get<amount_t>(0).commodity().symbol());
@ -1278,8 +1273,6 @@ expr_t::ptr_op_t report_t::lookup(const symbol_t::kind_t kind,
return WRAP_FUNCTOR(fn_false);
else if (is_eq(p, "percent"))
return MAKE_FUNCTOR(report_t::fn_percent);
else if (is_eq(p, "price"))
return MAKE_FUNCTOR(report_t::fn_price);
else if (is_eq(p, "print"))
return MAKE_FUNCTOR(report_t::fn_print);
break;

View file

@ -169,7 +169,6 @@ public:
value_t fn_format_date(call_scope_t& scope);
value_t fn_ansify_if(call_scope_t& scope);
value_t fn_percent(call_scope_t& scope);
value_t fn_price(call_scope_t& scope);
value_t fn_commodity(call_scope_t& scope);
value_t fn_lot_date(call_scope_t& scope);
value_t fn_lot_price(call_scope_t& scope);

View file

@ -1427,18 +1427,6 @@ value_t value_t::value(const optional<datetime_t>& moment,
return NULL_VALUE;
}
value_t value_t::price() const
{
switch (type()) {
case AMOUNT:
return as_amount().price();
case BALANCE:
return as_balance().price();
default:
return *this;
}
}
value_t value_t::exchange_commodities(const std::string& commodities,
const bool add_prices,
const optional<datetime_t>& moment)

View file

@ -480,8 +480,6 @@ public:
value_t value(const optional<datetime_t>& moment = none,
const optional<commodity_t&>& in_terms_of = none) const;
value_t price() const;
value_t exchange_commodities(const std::string& commodities,
const bool add_prices = false,
const optional<datetime_t>& moment = none);