mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 03:52:16 +02:00
Test that boolean values can be stored in a JsonObject
This commit is contained in:
@ -2,6 +2,14 @@
|
||||
#include "JsonNode.h"
|
||||
#include "JsonValue.h"
|
||||
|
||||
void JsonValue::operator=(bool value)
|
||||
{
|
||||
if (!_node) return;
|
||||
|
||||
_node->type = JSON_BOOLEAN;
|
||||
_node->content.asBoolean = value;
|
||||
}
|
||||
|
||||
void JsonValue::operator=(double value)
|
||||
{
|
||||
if (!_node) return;
|
||||
@ -18,6 +26,13 @@ void JsonValue::operator=(int value)
|
||||
_node->content.asInteger = value;
|
||||
}
|
||||
|
||||
JsonValue::operator bool()
|
||||
{
|
||||
if (!_node || _node->type != JSON_BOOLEAN) return 0;
|
||||
|
||||
return _node->content.asBoolean;
|
||||
}
|
||||
|
||||
JsonValue::operator double()
|
||||
{
|
||||
if (!_node || _node->type < JSON_DOUBLE_0_DECIMALS) return 0;
|
||||
|
Reference in New Issue
Block a user