mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 20:12:16 +02:00
Added "const" to cast operators
This commit is contained in:
@ -34,28 +34,28 @@ void JsonValue::operator=(int value)
|
|||||||
_node->content.asInteger = value;
|
_node->content.asInteger = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonValue::operator bool()
|
JsonValue::operator bool() const
|
||||||
{
|
{
|
||||||
if (!_node || _node->type != JSON_BOOLEAN) return 0;
|
if (!_node || _node->type != JSON_BOOLEAN) return 0;
|
||||||
|
|
||||||
return _node->content.asBoolean;
|
return _node->content.asBoolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonValue::operator char const*()
|
JsonValue::operator char const*() const
|
||||||
{
|
{
|
||||||
if (!_node || _node->type != JSON_STRING) return 0;
|
if (!_node || _node->type != JSON_STRING) return 0;
|
||||||
|
|
||||||
return _node->content.asString;
|
return _node->content.asString;
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonValue::operator double()
|
JsonValue::operator double() const
|
||||||
{
|
{
|
||||||
if (!_node || _node->type < JSON_DOUBLE_0_DECIMALS) return 0;
|
if (!_node || _node->type < JSON_DOUBLE_0_DECIMALS) return 0;
|
||||||
|
|
||||||
return _node->content.asDouble;
|
return _node->content.asDouble;
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonValue::operator int()
|
JsonValue::operator int() const
|
||||||
{
|
{
|
||||||
if (!_node || _node->type != JSON_INTEGER) return 0;
|
if (!_node || _node->type != JSON_INTEGER) return 0;
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ public:
|
|||||||
void operator=(double);
|
void operator=(double);
|
||||||
void operator=(int);
|
void operator=(int);
|
||||||
|
|
||||||
operator bool();
|
operator bool() const;
|
||||||
operator const char*();
|
operator const char*() const;
|
||||||
operator double();
|
operator double() const;
|
||||||
operator int();
|
operator int() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//JsonBuffer& _buffer;
|
//JsonBuffer& _buffer;
|
||||||
|
Reference in New Issue
Block a user