From e21e2ef707cc31715e9581ea33da6db1bf8eb089 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 18 Mar 2014 12:58:10 +0100 Subject: [PATCH] Make Value operators const where possible. Refs #5789 --- lib/base/value.cpp | 24 ++++++++++++------------ lib/base/value.h | 24 ++++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/base/value.cpp b/lib/base/value.cpp index 19ad822a2..a9028c28c 100644 --- a/lib/base/value.cpp +++ b/lib/base/value.cpp @@ -196,7 +196,7 @@ ValueType Value::GetType(void) const return static_cast(m_Value.which()); } -bool Value::operator==(bool rhs) +bool Value::operator==(bool rhs) const { if (!IsScalar()) return false; @@ -204,12 +204,12 @@ bool Value::operator==(bool rhs) return static_cast(*this) == rhs; } -bool Value::operator!=(bool rhs) +bool Value::operator!=(bool rhs) const { return !(*this == rhs); } -bool Value::operator==(int rhs) +bool Value::operator==(int rhs) const { if (!IsScalar()) return false; @@ -217,12 +217,12 @@ bool Value::operator==(int rhs) return static_cast(*this) == rhs; } -bool Value::operator!=(int rhs) +bool Value::operator!=(int rhs) const { return !(*this == rhs); } -bool Value::operator==(double rhs) +bool Value::operator==(double rhs) const { if (!IsScalar()) return false; @@ -230,32 +230,32 @@ bool Value::operator==(double rhs) return static_cast(*this) == rhs; } -bool Value::operator!=(double rhs) +bool Value::operator!=(double rhs) const { return !(*this == rhs); } -bool Value::operator==(const char *rhs) +bool Value::operator==(const char *rhs) const { return static_cast(*this) == rhs; } -bool Value::operator!=(const char *rhs) +bool Value::operator!=(const char *rhs) const { return !(*this == rhs); } -bool Value::operator==(const String& rhs) +bool Value::operator==(const String& rhs) const { return static_cast(*this) == rhs; } -bool Value::operator!=(const String& rhs) +bool Value::operator!=(const String& rhs) const { return !(*this == rhs); } -bool Value::operator==(const Value& rhs) +bool Value::operator==(const Value& rhs) const { if (IsEmpty() != rhs.IsEmpty()) return false; @@ -275,7 +275,7 @@ bool Value::operator==(const Value& rhs) return static_cast(*this) == static_cast(rhs); } -bool Value::operator!=(const Value& rhs) +bool Value::operator!=(const Value& rhs) const { return !(*this == rhs); } diff --git a/lib/base/value.h b/lib/base/value.h index 162767e9b..f8d8aa551 100644 --- a/lib/base/value.h +++ b/lib/base/value.h @@ -73,23 +73,23 @@ public: operator double(void) const; operator String(void) const; - bool operator==(bool rhs); - bool operator!=(bool rhs); + bool operator==(bool rhs) const; + bool operator!=(bool rhs) const; - bool operator==(int rhs); - bool operator!=(int rhs); + bool operator==(int rhs) const; + bool operator!=(int rhs) const; - bool operator==(double rhs); - bool operator!=(double rhs); + bool operator==(double rhs) const; + bool operator!=(double rhs) const; - bool operator==(const char *rhs); - bool operator!=(const char *rhs); + bool operator==(const char *rhs) const; + bool operator!=(const char *rhs) const; - bool operator==(const String& rhs); - bool operator!=(const String& rhs); + bool operator==(const String& rhs) const; + bool operator!=(const String& rhs) const; - bool operator==(const Value& rhs); - bool operator!=(const Value& rhs); + bool operator==(const Value& rhs) const; + bool operator!=(const Value& rhs) const; template operator shared_ptr(void) const -- 2.40.0