summaryrefslogtreecommitdiff
path: root/src/balance.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-09-14 19:36:55 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-09-14 19:36:55 -0400
commit0135c28049839c2db25351b8d8114f9f31649afc (patch)
tree6a7871175a462eacd92468b77fced92714169f0b /src/balance.h
parent3add2229e0dd1f583596a313a76991249a521bae (diff)
downloadfork-ledger-0135c28049839c2db25351b8d8114f9f31649afc.tar.gz
fork-ledger-0135c28049839c2db25351b8d8114f9f31649afc.tar.bz2
fork-ledger-0135c28049839c2db25351b8d8114f9f31649afc.zip
Added in_place_round method to all Ledger numerical types.
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 fcf4fe36..d00fadb1 100644
--- a/src/balance.h
+++ b/src/balance.h
@@ -324,12 +324,24 @@ public:
temp += pair.second.round();
return temp;
}
+ balance_t& in_place_round() {
+ foreach (amounts_map::value_type& pair, amounts)
+ pair.second.in_place_round();
+ return *this;
+ }
+
balance_t round(amount_t::precision_t prec) const {
balance_t temp;
foreach (const amounts_map::value_type& pair, amounts)
temp += pair.second.round(prec);
return temp;
}
+ balance_t& in_place_round(amount_t::precision_t prec) {
+ foreach (amounts_map::value_type& pair, amounts)
+ pair.second.in_place_round(prec);
+ return *this;
+ }
+
balance_t unround() const {
balance_t temp;
foreach (const amounts_map::value_type& pair, amounts)