From a7ff04db0e3841f603a1047a4051d71f77d61107 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Sat, 27 Sep 2014 15:25:00 +0200 Subject: [PATCH] Added "const" to cast operators --- srcs/JsonValue.cpp | 8 ++++---- srcs/JsonValue.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/srcs/JsonValue.cpp b/srcs/JsonValue.cpp index 212cf7de..7055182c 100644 --- a/srcs/JsonValue.cpp +++ b/srcs/JsonValue.cpp @@ -34,28 +34,28 @@ void JsonValue::operator=(int value) _node->content.asInteger = value; } -JsonValue::operator bool() +JsonValue::operator bool() const { if (!_node || _node->type != JSON_BOOLEAN) return 0; return _node->content.asBoolean; } -JsonValue::operator char const*() +JsonValue::operator char const*() const { if (!_node || _node->type != JSON_STRING) return 0; return _node->content.asString; } -JsonValue::operator double() +JsonValue::operator double() const { if (!_node || _node->type < JSON_DOUBLE_0_DECIMALS) return 0; return _node->content.asDouble; } -JsonValue::operator int() +JsonValue::operator int() const { if (!_node || _node->type != JSON_INTEGER) return 0; diff --git a/srcs/JsonValue.h b/srcs/JsonValue.h index 2afdba7a..53ebf820 100644 --- a/srcs/JsonValue.h +++ b/srcs/JsonValue.h @@ -18,10 +18,10 @@ public: void operator=(double); void operator=(int); - operator bool(); - operator const char*(); - operator double(); - operator int(); + operator bool() const; + operator const char*() const; + operator double() const; + operator int() const; private: //JsonBuffer& _buffer;