summaryrefslogtreecommitdiff
path: root/balance.h
diff options
context:
space:
mode:
Diffstat (limited to 'balance.h')
-rw-r--r--balance.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/balance.h b/balance.h
index d18ffd60..932ca916 100644
--- a/balance.h
+++ b/balance.h
@@ -449,6 +449,19 @@ class balance_t
(*i).second.abs();
}
+ void reduce() {
+ for (amounts_map::iterator i = amounts.begin();
+ i != amounts.end();
+ i++)
+ (*i).second.reduce();
+ }
+
+ balance_t reduced() const {
+ balance_t temp(*this);
+ temp.reduce();
+ return temp;
+ }
+
void round() {
for (amounts_map::iterator i = amounts.begin();
i != amounts.end();
@@ -893,6 +906,17 @@ class balance_pair_t
return quantity.valid() && (! cost || cost->valid());
}
+ void reduce() {
+ quantity.reduce();
+ if (cost) cost->reduce();
+ }
+
+ balance_pair_t reduced() const {
+ balance_pair_t temp(*this);
+ temp.reduce();
+ return temp;
+ }
+
void round() {
quantity.round();
if (cost) cost->round();