*** empty log message ***
This commit is contained in:
parent
b1a04923fe
commit
31b68bbebc
2 changed files with 23 additions and 23 deletions
23
amount.cc
23
amount.cc
|
|
@ -1396,6 +1396,29 @@ amount_t amount_t::strip_annotations(const bool _keep_price,
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
amount_t amount_t::price() const
|
||||||
|
{
|
||||||
|
if (commodity_ && commodity_->annotated) {
|
||||||
|
amount_t temp(((annotated_commodity_t *)commodity_)->price);
|
||||||
|
temp *= *this;
|
||||||
|
DEBUG_PRINT("amounts.commodities",
|
||||||
|
"Returning price of " << *this << " = " << temp);
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::time_t amount_t::date() const
|
||||||
|
{
|
||||||
|
if (commodity_ && commodity_->annotated) {
|
||||||
|
DEBUG_PRINT("amounts.commodities",
|
||||||
|
"Returning date of " << *this << " = "
|
||||||
|
<< ((annotated_commodity_t *)commodity_)->date);
|
||||||
|
return ((annotated_commodity_t *)commodity_)->date;
|
||||||
|
}
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void commodity_base_t::add_price(const std::time_t date, const amount_t& price)
|
void commodity_base_t::add_price(const std::time_t date, const amount_t& price)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
23
amount.h
23
amount.h
|
|
@ -595,29 +595,6 @@ inline commodity_t& amount_t::commodity() const {
|
||||||
return *commodity_;
|
return *commodity_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline amount_t amount_t::price() const {
|
|
||||||
if (commodity_ && commodity_->annotated) {
|
|
||||||
amount_t temp(((annotated_commodity_t *)commodity_)->price);
|
|
||||||
temp *= *this;
|
|
||||||
DEBUG_PRINT("amounts.commodities",
|
|
||||||
"Returning price of " << *this << " = " << temp);
|
|
||||||
return temp;
|
|
||||||
} else {
|
|
||||||
return 0L;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::time_t amount_t::date() const {
|
|
||||||
if (commodity_ && commodity_->annotated) {
|
|
||||||
DEBUG_PRINT("amounts.commodities",
|
|
||||||
"Returning date of " << *this << " = "
|
|
||||||
<< ((annotated_commodity_t *)commodity_)->date);
|
|
||||||
return ((annotated_commodity_t *)commodity_)->date;
|
|
||||||
} else {
|
|
||||||
return 0L;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class amount_error : public error {
|
class amount_error : public error {
|
||||||
public:
|
public:
|
||||||
amount_error(const std::string& reason) throw() : error(reason) {}
|
amount_error(const std::string& reason) throw() : error(reason) {}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue