summaryrefslogtreecommitdiff
path: root/balance.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-03-08 18:24:56 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:29 -0400
commite32d9e64a768f276e04fe79c14f1b28d88bd4185 (patch)
tree198f0b5a65a2eeb6f1f0a61dc59bf5111e7ae50d /balance.h
parentb737cd8e6dd185beeae902caa4eee6c4cee8bc36 (diff)
downloadfork-ledger-e32d9e64a768f276e04fe79c14f1b28d88bd4185.tar.gz
fork-ledger-e32d9e64a768f276e04fe79c14f1b28d88bd4185.tar.bz2
fork-ledger-e32d9e64a768f276e04fe79c14f1b28d88bd4185.zip
Added much better error location.
Diffstat (limited to 'balance.h')
-rw-r--r--balance.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/balance.h b/balance.h
index f2d78233..71929f13 100644
--- a/balance.h
+++ b/balance.h
@@ -416,6 +416,16 @@ class balance_t
if ((*i).second.commodity())
(*i).second = (*i).second.round();
}
+
+ balance_t unround() const {
+ balance_t temp;
+ for (amounts_map::const_iterator i = amounts.begin();
+ i != amounts.end();
+ i++)
+ if ((*i).second.commodity())
+ temp += (*i).second.unround();
+ return temp;
+ }
};
inline balance_t abs(const balance_t& bal) {
@@ -847,6 +857,13 @@ class balance_pair_t
quantity.round();
if (cost) cost->round();
}
+
+ balance_pair_t unround() {
+ balance_pair_t temp(quantity.unround());
+ if (cost)
+ temp.cost = new balance_t(cost->unround());
+ return temp;
+ }
};
inline balance_pair_t abs(const balance_pair_t& bal_pair) {