summaryrefslogtreecommitdiff
path: root/src/balance.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-11 03:39:53 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-11 03:39:53 -0500
commitafe87280e091d4f094f068c5f21aecccd2d1831b (patch)
tree4be3e5c9bbcc9b450a6c0eea3f6b959daab22757 /src/balance.h
parent4a4ff9d4b21e7ed94524314ca496bd17c84fc4ed (diff)
downloadfork-ledger-afe87280e091d4f094f068c5f21aecccd2d1831b.tar.gz
fork-ledger-afe87280e091d4f094f068c5f21aecccd2d1831b.tar.bz2
fork-ledger-afe87280e091d4f094f068c5f21aecccd2d1831b.zip
Added floored() and in_place_floor() methods
Diffstat (limited to 'src/balance.h')
-rw-r--r--src/balance.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/balance.h b/src/balance.h
index 81a7ff13..8a40dea9 100644
--- a/src/balance.h
+++ b/src/balance.h
@@ -339,6 +339,18 @@ public:
*this = temp;
}
+ balance_t floored() const {
+ balance_t temp(*this);
+ temp.in_place_floor();
+ return temp;
+ }
+ void in_place_floor() {
+ balance_t temp;
+ foreach (const amounts_map::value_type& pair, amounts)
+ temp += pair.second.floored();
+ *this = temp;
+ }
+
balance_t unrounded() const {
balance_t temp(*this);
temp.in_place_unround();