diff options
author | John Wiegley <johnw@newartisans.com> | 2006-03-19 21:11:49 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:41:31 -0400 |
commit | 32bdfe20d98f1c8e6c0aabe9b26f0507326d2baa (patch) | |
tree | 50a4c5490f842ff4241ed6c574d3debd0ed6e1b6 /balance.h | |
parent | ab748ed13ed87369e2e4ed5a617b5de12750fda6 (diff) | |
download | fork-ledger-32bdfe20d98f1c8e6c0aabe9b26f0507326d2baa.tar.gz fork-ledger-32bdfe20d98f1c8e6c0aabe9b26f0507326d2baa.tar.bz2 fork-ledger-32bdfe20d98f1c8e6c0aabe9b26f0507326d2baa.zip |
Tons of corrections and fixes to value expressions and lot figures.
Diffstat (limited to 'balance.h')
-rw-r--r-- | balance.h | 50 |
1 files changed, 45 insertions, 5 deletions
@@ -216,7 +216,15 @@ class balance_t return true; } bool operator<(const amount_t& amt) const { - return amount(amt.commodity()) < amt; + if (amt.commodity()) + return amount(amt.commodity()) < amt; + + for (amounts_map::const_iterator i = amounts.begin(); + i != amounts.end(); + i++) + if ((*i).second < amt) + return true; + return false; } template <typename T> bool operator<(T val) const { @@ -244,7 +252,15 @@ class balance_t return true; } bool operator<=(const amount_t& amt) const { - return amount(amt.commodity()) <= amt; + if (amt.commodity()) + return amount(amt.commodity()) <= amt; + + for (amounts_map::const_iterator i = amounts.begin(); + i != amounts.end(); + i++) + if ((*i).second <= amt) + return true; + return false; } template <typename T> bool operator<=(T val) const { @@ -275,7 +291,15 @@ class balance_t return true; } bool operator>(const amount_t& amt) const { - return amount(amt.commodity()) > amt; + if (amt.commodity()) + return amount(amt.commodity()) > amt; + + for (amounts_map::const_iterator i = amounts.begin(); + i != amounts.end(); + i++) + if ((*i).second > amt) + return true; + return false; } template <typename T> bool operator>(T val) const { @@ -303,7 +327,15 @@ class balance_t return true; } bool operator>=(const amount_t& amt) const { - return amount(amt.commodity()) >= amt; + if (amt.commodity()) + return amount(amt.commodity()) >= amt; + + for (amounts_map::const_iterator i = amounts.begin(); + i != amounts.end(); + i++) + if ((*i).second >= amt) + return true; + return false; } template <typename T> bool operator>=(T val) const { @@ -327,7 +359,15 @@ class balance_t return i == amounts.end() && j == bal.amounts.end(); } bool operator==(const amount_t& amt) const { - return amounts.size() == 1 && (*amounts.begin()).second == amt; + if (amt.commodity()) + return amounts.size() == 1 && (*amounts.begin()).second == amt; + + for (amounts_map::const_iterator i = amounts.begin(); + i != amounts.end(); + i++) + if ((*i).second == amt) + return true; + return false; } template <typename T> bool operator==(T val) const { |