Removed value_t::price and balance_t::price
This commit is contained in:
parent
7bb83173da
commit
b1107f85ae
8 changed files with 1 additions and 38 deletions
|
|
@ -202,16 +202,6 @@ balance_t::value(const optional<datetime_t>& moment,
|
||||||
return resolved ? temp : optional<balance_t>();
|
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>
|
optional<amount_t>
|
||||||
balance_t::commodity_amount(const optional<const commodity_t&>& commodity) const
|
balance_t::commodity_amount(const optional<const commodity_t&>& commodity) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -387,8 +387,6 @@ public:
|
||||||
value(const optional<datetime_t>& moment = none,
|
value(const optional<datetime_t>& moment = none,
|
||||||
const optional<commodity_t&>& in_terms_of = none) const;
|
const optional<commodity_t&>& in_terms_of = none) const;
|
||||||
|
|
||||||
balance_t price() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Truth tests. An balance may be truth test in two ways:
|
* Truth tests. An balance may be truth test in two ways:
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -201,8 +201,6 @@ void export_balance()
|
||||||
.def("value", py_value_1, args("in_terms_of"))
|
.def("value", py_value_1, args("in_terms_of"))
|
||||||
.def("value", py_value_2, args("in_terms_of", "moment"))
|
.def("value", py_value_2, args("in_terms_of", "moment"))
|
||||||
|
|
||||||
.def("price", &balance_t::price)
|
|
||||||
|
|
||||||
.def("__nonzero__", &balance_t::is_nonzero)
|
.def("__nonzero__", &balance_t::is_nonzero)
|
||||||
.def("is_nonzero", &balance_t::is_nonzero)
|
.def("is_nonzero", &balance_t::is_nonzero)
|
||||||
.def("is_zero", &balance_t::is_zero)
|
.def("is_zero", &balance_t::is_zero)
|
||||||
|
|
|
||||||
|
|
@ -266,8 +266,7 @@ void export_value()
|
||||||
.def("value", py_value_1, args("in_terms_of"))
|
.def("value", py_value_1, args("in_terms_of"))
|
||||||
.def("value", py_value_2, args("in_terms_of", "moment"))
|
.def("value", py_value_2, args("in_terms_of", "moment"))
|
||||||
|
|
||||||
.def("value", &value_t::value, value_overloads())
|
//.def("value", &value_t::value, value_overloads())
|
||||||
.def("price", &value_t::price)
|
|
||||||
.def("exchange_commodities", &value_t::exchange_commodities,
|
.def("exchange_commodities", &value_t::exchange_commodities,
|
||||||
exchange_commodities_overloads())
|
exchange_commodities_overloads())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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());
|
(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)
|
value_t report_t::fn_commodity(call_scope_t& args)
|
||||||
{
|
{
|
||||||
return string_value(args.get<amount_t>(0).commodity().symbol());
|
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);
|
return WRAP_FUNCTOR(fn_false);
|
||||||
else if (is_eq(p, "percent"))
|
else if (is_eq(p, "percent"))
|
||||||
return MAKE_FUNCTOR(report_t::fn_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"))
|
else if (is_eq(p, "print"))
|
||||||
return MAKE_FUNCTOR(report_t::fn_print);
|
return MAKE_FUNCTOR(report_t::fn_print);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,6 @@ public:
|
||||||
value_t fn_format_date(call_scope_t& scope);
|
value_t fn_format_date(call_scope_t& scope);
|
||||||
value_t fn_ansify_if(call_scope_t& scope);
|
value_t fn_ansify_if(call_scope_t& scope);
|
||||||
value_t fn_percent(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_commodity(call_scope_t& scope);
|
||||||
value_t fn_lot_date(call_scope_t& scope);
|
value_t fn_lot_date(call_scope_t& scope);
|
||||||
value_t fn_lot_price(call_scope_t& scope);
|
value_t fn_lot_price(call_scope_t& scope);
|
||||||
|
|
|
||||||
12
src/value.cc
12
src/value.cc
|
|
@ -1427,18 +1427,6 @@ value_t value_t::value(const optional<datetime_t>& moment,
|
||||||
return NULL_VALUE;
|
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,
|
value_t value_t::exchange_commodities(const std::string& commodities,
|
||||||
const bool add_prices,
|
const bool add_prices,
|
||||||
const optional<datetime_t>& moment)
|
const optional<datetime_t>& moment)
|
||||||
|
|
|
||||||
|
|
@ -480,8 +480,6 @@ public:
|
||||||
value_t value(const optional<datetime_t>& moment = none,
|
value_t value(const optional<datetime_t>& moment = none,
|
||||||
const optional<commodity_t&>& in_terms_of = none) const;
|
const optional<commodity_t&>& in_terms_of = none) const;
|
||||||
|
|
||||||
value_t price() const;
|
|
||||||
|
|
||||||
value_t exchange_commodities(const std::string& commodities,
|
value_t exchange_commodities(const std::string& commodities,
|
||||||
const bool add_prices = false,
|
const bool add_prices = false,
|
||||||
const optional<datetime_t>& moment = none);
|
const optional<datetime_t>& moment = none);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue