From 98c3431ddaef018dd37bfc644eefda3fb87acfe5 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 8 Nov 2013 21:12:22 +0100 Subject: [PATCH] Add missing == operator for the Value class. Refs #5036 --- lib/base/value.cpp | 13 +++++++++++++ lib/base/value.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/lib/base/value.cpp b/lib/base/value.cpp index 8094fe6ea..5a6bfa9ea 100644 --- a/lib/base/value.cpp +++ b/lib/base/value.cpp @@ -198,6 +198,19 @@ ValueType Value::GetType(void) const return static_cast(m_Value.which()); } +bool Value::operator==(bool rhs) +{ + if (!IsScalar()) + return false; + + return static_cast(*this) == rhs; +} + +bool Value::operator!=(bool rhs) +{ + return !(*this == rhs); +} + bool Value::operator==(int rhs) { if (!IsScalar()) diff --git a/lib/base/value.h b/lib/base/value.h index 777b7d86f..ecac6ee86 100644 --- a/lib/base/value.h +++ b/lib/base/value.h @@ -73,6 +73,9 @@ public: operator double(void) const; operator String(void) const; + bool operator==(bool rhs); + bool operator!=(bool rhs); + bool operator==(int rhs); bool operator!=(int rhs);