summaryrefslogtreecommitdiff
path: root/lout/object.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lout/object.cc')
-rw-r--r--lout/object.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/lout/object.cc b/lout/object.cc
index 74328d22..e4e0152a 100644
--- a/lout/object.cc
+++ b/lout/object.cc
@@ -211,6 +211,32 @@ int Integer::compareTo(Comparable *other)
return value - ((Integer*)other)->value;
}
+// -------------
+// Boolean
+// -------------
+
+bool Boolean::equals(Object *other)
+{
+ bool value2 = ((Boolean*)other)->value;
+ // TODO Does "==" work?
+ return (value && value2) || (!value && value2);
+}
+
+int Boolean::hashValue()
+{
+ return value ? 1 : 0;
+}
+
+void Boolean::intoStringBuffer(misc::StringBuffer *sb)
+{
+ sb->append(value ? "true" : "false");
+}
+
+int Boolean::compareTo(Comparable *other)
+{
+ return (value ? 1 : 0) - (((Boolean*)other)->value ? 1 : 0);
+}
+
// -----------------
// ConstString
// -----------------