Make Value operators const where possible.

Refs #5789
This commit is contained in:
Gunnar Beutner 2014-03-18 12:58:10 +01:00
parent e0ad30a9c6
commit e21e2ef707
2 changed files with 24 additions and 24 deletions

View File

@ -196,7 +196,7 @@ ValueType Value::GetType(void) const
return static_cast<ValueType>(m_Value.which()); return static_cast<ValueType>(m_Value.which());
} }
bool Value::operator==(bool rhs) bool Value::operator==(bool rhs) const
{ {
if (!IsScalar()) if (!IsScalar())
return false; return false;
@ -204,12 +204,12 @@ bool Value::operator==(bool rhs)
return static_cast<double>(*this) == rhs; return static_cast<double>(*this) == rhs;
} }
bool Value::operator!=(bool rhs) bool Value::operator!=(bool rhs) const
{ {
return !(*this == rhs); return !(*this == rhs);
} }
bool Value::operator==(int rhs) bool Value::operator==(int rhs) const
{ {
if (!IsScalar()) if (!IsScalar())
return false; return false;
@ -217,12 +217,12 @@ bool Value::operator==(int rhs)
return static_cast<double>(*this) == rhs; return static_cast<double>(*this) == rhs;
} }
bool Value::operator!=(int rhs) bool Value::operator!=(int rhs) const
{ {
return !(*this == rhs); return !(*this == rhs);
} }
bool Value::operator==(double rhs) bool Value::operator==(double rhs) const
{ {
if (!IsScalar()) if (!IsScalar())
return false; return false;
@ -230,32 +230,32 @@ bool Value::operator==(double rhs)
return static_cast<double>(*this) == rhs; return static_cast<double>(*this) == rhs;
} }
bool Value::operator!=(double rhs) bool Value::operator!=(double rhs) const
{ {
return !(*this == rhs); return !(*this == rhs);
} }
bool Value::operator==(const char *rhs) bool Value::operator==(const char *rhs) const
{ {
return static_cast<String>(*this) == rhs; return static_cast<String>(*this) == rhs;
} }
bool Value::operator!=(const char *rhs) bool Value::operator!=(const char *rhs) const
{ {
return !(*this == rhs); return !(*this == rhs);
} }
bool Value::operator==(const String& rhs) bool Value::operator==(const String& rhs) const
{ {
return static_cast<String>(*this) == rhs; return static_cast<String>(*this) == rhs;
} }
bool Value::operator!=(const String& rhs) bool Value::operator!=(const String& rhs) const
{ {
return !(*this == rhs); return !(*this == rhs);
} }
bool Value::operator==(const Value& rhs) bool Value::operator==(const Value& rhs) const
{ {
if (IsEmpty() != rhs.IsEmpty()) if (IsEmpty() != rhs.IsEmpty())
return false; return false;
@ -275,7 +275,7 @@ bool Value::operator==(const Value& rhs)
return static_cast<String>(*this) == static_cast<String>(rhs); return static_cast<String>(*this) == static_cast<String>(rhs);
} }
bool Value::operator!=(const Value& rhs) bool Value::operator!=(const Value& rhs) const
{ {
return !(*this == rhs); return !(*this == rhs);
} }

View File

@ -73,23 +73,23 @@ public:
operator double(void) const; operator double(void) const;
operator String(void) const; operator String(void) const;
bool operator==(bool rhs); bool operator==(bool rhs) const;
bool operator!=(bool rhs); bool operator!=(bool rhs) const;
bool operator==(int rhs); bool operator==(int rhs) const;
bool operator!=(int rhs); bool operator!=(int rhs) const;
bool operator==(double rhs); bool operator==(double rhs) const;
bool operator!=(double rhs); bool operator!=(double rhs) const;
bool operator==(const char *rhs); bool operator==(const char *rhs) const;
bool operator!=(const char *rhs); bool operator!=(const char *rhs) const;
bool operator==(const String& rhs); bool operator==(const String& rhs) const;
bool operator!=(const String& rhs); bool operator!=(const String& rhs) const;
bool operator==(const Value& rhs); bool operator==(const Value& rhs) const;
bool operator!=(const Value& rhs); bool operator!=(const Value& rhs) const;
template<typename T> template<typename T>
operator shared_ptr<T>(void) const operator shared_ptr<T>(void) const