summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-22 01:25:03 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-22 01:27:05 -0400
commit7d005b8d98b5547e5847895140d52a2707545ed5 (patch)
tree2fe499086ffcbc7be4ac0cf7704137c14aa97b34 /src/value.cc
parent1c0785ce7813ba5f28cfc8a78ac4fe8d70ba13e4 (diff)
downloadfork-ledger-7d005b8d98b5547e5847895140d52a2707545ed5.tar.gz
fork-ledger-7d005b8d98b5547e5847895140d52a2707545ed5.tar.bz2
fork-ledger-7d005b8d98b5547e5847895140d52a2707545ed5.zip
Balances and sequences can be compared to amounts
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/value.cc b/src/value.cc
index 99837832..c34792b2 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -901,13 +901,10 @@ bool value_t::is_less_than(const value_t& val) const
switch (val.type()) {
case INTEGER:
case AMOUNT: {
- if (val.is_nonzero())
- break;
-
bool no_amounts = true;
foreach (const balance_t::amounts_map::value_type& pair,
as_balance().amounts) {
- if (pair.second >= 0L)
+ if (pair.second >= val)
return false;
no_amounts = false;
}
@@ -927,12 +924,9 @@ bool value_t::is_less_than(const value_t& val) const
switch (val.type()) {
case INTEGER:
case AMOUNT: {
- if (val.is_nonzero())
- break;
-
bool no_amounts = true;
foreach (const value_t& value, as_sequence()) {
- if (value >= 0L)
+ if (value >= val)
return false;
no_amounts = false;
}
@@ -1023,13 +1017,10 @@ bool value_t::is_greater_than(const value_t& val) const
switch (val.type()) {
case INTEGER:
case AMOUNT: {
- if (val.is_nonzero())
- break;
-
bool no_amounts = true;
foreach (const balance_t::amounts_map::value_type& pair,
as_balance().amounts) {
- if (pair.second <= 0L)
+ if (pair.second <= val)
return false;
no_amounts = false;
}
@@ -1049,12 +1040,9 @@ bool value_t::is_greater_than(const value_t& val) const
switch (val.type()) {
case INTEGER:
case AMOUNT: {
- if (val.is_nonzero())
- break;
-
bool no_amounts = true;
foreach (const value_t& value, as_sequence()) {
- if (value <= 0L)
+ if (value <= val)
return false;
no_amounts = false;
}