summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-15 16:26:26 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-15 16:26:26 -0400
commitfcd7f4f73b50ec02ec1f501a8ebde502c6736850 (patch)
treea3af572793c1a14d0e28a8a9581011beb4017b12
parent48d985aacc5106592aa191c707315ee24917aacb (diff)
downloadfork-ledger-fcd7f4f73b50ec02ec1f501a8ebde502c6736850.tar.gz
fork-ledger-fcd7f4f73b50ec02ec1f501a8ebde502c6736850.tar.bz2
fork-ledger-fcd7f4f73b50ec02ec1f501a8ebde502c6736850.zip
Removed "total_cost" valexpr, and value_t::cost
Since cost reports are now calculated by setting the amount_ expression, there is no need to track a separate "total cost" entity.
-rw-r--r--python/py_value.cc2
-rw-r--r--src/account.cc7
-rw-r--r--src/value.cc16
-rw-r--r--src/value.h2
-rw-r--r--src/xact.cc17
5 files changed, 4 insertions, 40 deletions
diff --git a/python/py_value.cc b/python/py_value.cc
index 87a2f0cd..c94475ec 100644
--- a/python/py_value.cc
+++ b/python/py_value.cc
@@ -193,8 +193,6 @@ void export_value()
.def("value", &value_t::value, value_overloads())
- .def("cost", &value_t::cost)
-
.def("__nonzero__", &value_t::is_nonzero)
.def("is_nonzero", &value_t::is_nonzero)
.def("is_realzero", &value_t::is_realzero)
diff --git a/src/account.cc b/src/account.cc
index 339d1ef4..104d0cee 100644
--- a/src/account.cc
+++ b/src/account.cc
@@ -161,11 +161,6 @@ namespace {
return account.xdata_->total;
}
- value_t get_total_cost(account_t& account) {
- assert(account.xdata_);
- return account.xdata_->total.cost();
- }
-
value_t get_amount(account_t& account) {
assert(account.xdata_);
return account.xdata_->value;
@@ -216,8 +211,6 @@ expr_t::ptr_op_t account_t::lookup(const string& name)
case 't':
if (name == "total")
return WRAP_FUNCTOR(get_wrapper<&get_total>);
- else if (name == "total_cost")
- return WRAP_FUNCTOR(get_wrapper<&get_total_cost>);
break;
}
diff --git a/src/value.cc b/src/value.cc
index 6e4574ca..9eb5b2e1 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -1245,22 +1245,6 @@ value_t value_t::strip_annotations(const keep_details_t& what_to_keep) const
return NULL_VALUE;
}
-value_t value_t::cost() const
-{
- switch (type()) {
- case INTEGER:
- case AMOUNT:
- case BALANCE:
- return *this;
-
- default:
- break;
- }
-
- throw_(value_error, "Cannot find the cost of " << label());
- return NULL_VALUE;
-}
-
void value_t::print(std::ostream& out,
const int first_width,
const int latter_width,
diff --git a/src/value.h b/src/value.h
index e5c76780..c24e8257 100644
--- a/src/value.h
+++ b/src/value.h
@@ -425,8 +425,6 @@ public:
// Return the "market value" of a given value at a specific time.
value_t value(const optional<datetime_t>& moment = none,
const optional<commodity_t&>& in_terms_of = none) const;
- value_t cost() const;
-
/**
* Truth tests.
diff --git a/src/xact.cc b/src/xact.cc
index 93e66369..83e36078 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -157,7 +157,7 @@ namespace {
value_t get_cost(xact_t& xact) {
if (xact.has_xdata() &&
xact.xdata().has_flags(XACT_EXT_COMPOUND)) {
- return xact.xdata().value.cost();
+ return xact.xdata().value;
} else {
if (xact.cost)
return *xact.cost;
@@ -173,18 +173,11 @@ namespace {
return xact.amount;
}
- value_t get_total_cost(xact_t& xact) {
+ value_t get_count(xact_t& xact) {
if (xact.xdata_)
- return xact.xdata_->total.cost();
- else if (xact.cost)
- return *xact.cost;
+ return xact.xdata_->count;
else
- return xact.amount;
- }
-
- value_t get_count(xact_t& xact) {
- assert(xact.xdata_);
- return xact.xdata_->count;
+ return 1L;
}
value_t get_account(call_scope_t& scope)
@@ -260,8 +253,6 @@ expr_t::ptr_op_t xact_t::lookup(const string& name)
case 't':
if (name[1] == '\0' || name == "total")
return WRAP_FUNCTOR(get_wrapper<&get_total>);
- else if (name == "total_cost")
- return WRAP_FUNCTOR(get_wrapper<&get_total_cost>);
break;
case 'v':