summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-05-30 02:16:32 -0600
committerJohn Wiegley <johnw@newartisans.com>2010-05-30 02:16:32 -0600
commit7ec52d2b395bf4cfc656eef52d72b9d83c1c1523 (patch)
tree7a42842683f5e89d946aef84d10c7c08d9c239f4 /src
parent66a26252df84909224ec18b4ca2adaaca3b01268 (diff)
downloadledger-7ec52d2b395bf4cfc656eef52d72b9d83c1c1523.tar.gz
ledger-7ec52d2b395bf4cfc656eef52d72b9d83c1c1523.tar.bz2
ledger-7ec52d2b395bf4cfc656eef52d72b9d83c1c1523.zip
Comparison of boolean values is now allowed
true > false
Diffstat (limited to 'src')
-rw-r--r--src/value.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/value.cc b/src/value.cc
index 2888c335..9515de46 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -840,6 +840,23 @@ bool value_t::is_equal_to(const value_t& val) const
bool value_t::is_less_than(const value_t& val) const
{
switch (type()) {
+ case BOOLEAN:
+ if (val.is_boolean()) {
+ if (as_boolean()) {
+ if (! val.as_boolean())
+ return false;
+ else
+ return false;
+ }
+ else if (! as_boolean()) {
+ if (! val.as_boolean())
+ return false;
+ else
+ return true;
+ }
+ }
+ break;
+
case DATETIME:
if (val.is_datetime())
return as_datetime() < val.as_datetime();
@@ -935,6 +952,22 @@ bool value_t::is_less_than(const value_t& val) const
bool value_t::is_greater_than(const value_t& val) const
{
switch (type()) {
+ if (val.is_boolean()) {
+ if (as_boolean()) {
+ if (! val.as_boolean())
+ return true;
+ else
+ return false;
+ }
+ else if (! as_boolean()) {
+ if (! val.as_boolean())
+ return false;
+ else
+ return false;
+ }
+ }
+ break;
+
case DATETIME:
if (val.is_datetime())
return as_datetime() > val.as_datetime();