diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-12 20:44:46 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-12 20:44:46 -0400 |
commit | e0e181d2af4aff5ac6c253fe25737bf93bfb6996 (patch) | |
tree | 2529b3a51d012ced6c94c6f97e1c86284f9eecc9 | |
parent | e6bea6c3ebfc0762543b7a8ed68719aaf3abff16 (diff) | |
download | fork-ledger-e0e181d2af4aff5ac6c253fe25737bf93bfb6996.tar.gz fork-ledger-e0e181d2af4aff5ac6c253fe25737bf93bfb6996.tar.bz2 fork-ledger-e0e181d2af4aff5ac6c253fe25737bf93bfb6996.zip |
Made (un)reduce rvalue methods more consistent
They names were changed from reduce/unreduce to reduced/unreduced, since
they return the modified value. This is more consistent with the naming
of rounded/rounded.
-rw-r--r-- | python/py_value.cc | 4 | ||||
-rw-r--r-- | src/amount.h | 4 | ||||
-rw-r--r-- | src/balance.h | 8 | ||||
-rw-r--r-- | src/textual.cc | 7 | ||||
-rw-r--r-- | src/value.h | 4 |
5 files changed, 16 insertions, 11 deletions
diff --git a/python/py_value.cc b/python/py_value.cc index fa79009b..87a2f0cd 100644 --- a/python/py_value.cc +++ b/python/py_value.cc @@ -185,10 +185,10 @@ void export_value() .def("rounded", &value_t::rounded) .def("unrounded", &value_t::unrounded) - .def("reduce", &value_t::reduce) + .def("reduced", &value_t::reduced) .def("in_place_reduce", &value_t::in_place_reduce) - .def("unreduce", &value_t::unreduce) + .def("unreduced", &value_t::unreduced) .def("in_place_unreduce", &value_t::in_place_unreduce) .def("value", &value_t::value, value_overloads()) diff --git a/src/amount.h b/src/amount.h index a9077a4b..d07fd18e 100644 --- a/src/amount.h +++ b/src/amount.h @@ -330,7 +330,7 @@ public: utilize "scaling commodities". For example, an amount of \c 1h after reduction will be \c 3600s. */ - amount_t reduce() const { + amount_t reduced() const { amount_t temp(*this); temp.in_place_reduce(); return temp; @@ -341,7 +341,7 @@ public: compact form greater than one. That is, \c 3599s will unreduce to \c 59.98m, while \c 3601 unreduces to \c 1h. */ - amount_t unreduce() const { + amount_t unreduced() const { amount_t temp(*this); temp.in_place_unreduce(); return temp; diff --git a/src/balance.h b/src/balance.h index 2c4e4993..49435767 100644 --- a/src/balance.h +++ b/src/balance.h @@ -325,7 +325,7 @@ public: return temp; } - balance_t reduce() const { + balance_t reduced() const { balance_t temp(*this); temp.in_place_reduce(); return temp; @@ -335,11 +335,11 @@ public: // multiple component amounts to collapse to the same commodity. balance_t temp; foreach (const amounts_map::value_type& pair, amounts) - temp += pair.second.reduce(); + temp += pair.second.reduced(); return *this = temp; } - balance_t unreduce() const { + balance_t unreduced() const { balance_t temp(*this); temp.in_place_unreduce(); return temp; @@ -349,7 +349,7 @@ public: // multiple component amounts to collapse to the same commodity. balance_t temp; foreach (const amounts_map::value_type& pair, amounts) - temp += pair.second.unreduce(); + temp += pair.second.unreduced(); return *this = temp; } diff --git a/src/textual.cc b/src/textual.cc index d2554c47..4c1ed8e8 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -812,8 +812,13 @@ xact_t * instance_t::parse_xact(char * line, static_cast<uint_least8_t>(expr_t::PARSE_NO_REDUCE) | static_cast<uint_least8_t>(expr_t::PARSE_NO_ASSIGN)); +#if 0 + // jww (2009-02-12): This isn't quite working yet; it causes cost computes + // to skyrocket, since the per-unit price isn't also being reduced by the + // same factor. if (! xact->amount.is_null()) - xact->amount.reduce(); + xact->amount.in_place_reduce(); +#endif DEBUG("textual.parse", "line " << linenum << ": " << "xact amount = " << xact->amount); diff --git a/src/value.h b/src/value.h index 7b058065..049d3d01 100644 --- a/src/value.h +++ b/src/value.h @@ -408,14 +408,14 @@ public: value_t rounded() const; value_t unrounded() const; - value_t reduce() const { + value_t reduced() const { value_t temp(*this); temp.in_place_reduce(); return temp; } void in_place_reduce(); // exists for efficiency's sake - value_t unreduce() const { + value_t unreduced() const { value_t temp(*this); temp.in_place_unreduce(); return temp; |