summaryrefslogtreecommitdiff
path: root/src/balance.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-27 02:54:07 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-27 02:54:07 -0400
commite1eb12a6e450f59b9e084378a77b9e496c0fa843 (patch)
tree72e302d1fa210faee23abdf977f7df90201ec969 /src/balance.h
parenta8e2a674a85b71c84c044c6cfa140e2bbfb58a4b (diff)
downloadfork-ledger-e1eb12a6e450f59b9e084378a77b9e496c0fa843.tar.gz
fork-ledger-e1eb12a6e450f59b9e084378a77b9e496c0fa843.tar.bz2
fork-ledger-e1eb12a6e450f59b9e084378a77b9e496c0fa843.zip
balance_t is no longer a superclass
Diffstat (limited to 'src/balance.h')
-rw-r--r--src/balance.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/balance.h b/src/balance.h
index 71fc41be..ea0e3a4e 100644
--- a/src/balance.h
+++ b/src/balance.h
@@ -146,7 +146,7 @@ public:
* Destructor. Destroys all of the accumulated amounts in the
* balance.
*/
- virtual ~balance_t() {
+ ~balance_t() {
TRACE_DTOR(balance_t);
}
@@ -232,7 +232,7 @@ public:
balance_t& operator-=(const balance_t& bal);
balance_t& operator-=(const amount_t& amt);
- virtual balance_t& operator*=(const amount_t& amt);
+ balance_t& operator*=(const amount_t& amt);
balance_t& operator*=(const double val) {
return *this *= amount_t(val);
@@ -244,7 +244,7 @@ public:
return *this *= amount_t(val);
}
- virtual balance_t& operator/=(const amount_t& amt);
+ balance_t& operator/=(const amount_t& amt);
balance_t& operator/=(const double val) {
return *this /= amount_t(val);
@@ -295,10 +295,9 @@ public:
temp.in_place_negate();
return temp;
}
- virtual balance_t& in_place_negate() {
+ void in_place_negate() {
foreach (amounts_map::value_type& pair, amounts)
pair.second.in_place_negate();
- return *this;
}
balance_t operator-() const {
return negate();
@@ -352,13 +351,13 @@ public:
temp.in_place_reduce();
return temp;
}
- virtual balance_t& in_place_reduce() {
+ void in_place_reduce() {
// A temporary must be used here because reduction may cause
// multiple component amounts to collapse to the same commodity.
balance_t temp;
foreach (const amounts_map::value_type& pair, amounts)
temp += pair.second.reduced();
- return *this = temp;
+ *this = temp;
}
balance_t unreduced() const {
@@ -366,13 +365,13 @@ public:
temp.in_place_unreduce();
return temp;
}
- virtual balance_t& in_place_unreduce() {
+ void in_place_unreduce() {
// A temporary must be used here because unreduction may cause
// multiple component amounts to collapse to the same commodity.
balance_t temp;
foreach (const amounts_map::value_type& pair, amounts)
temp += pair.second.unreduced();
- return *this = temp;
+ *this = temp;
}
optional<balance_t>
@@ -522,7 +521,7 @@ public:
out << ")";
}
- virtual bool valid() const {
+ bool valid() const {
foreach (const amounts_map::value_type& pair, amounts)
if (! pair.second.valid())
return false;