mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 03:52:16 +02:00
Test that integers can be stored in a JsonObject
This commit is contained in:
28
srcs/JsonValue.cpp
Normal file
28
srcs/JsonValue.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "JsonObject.h"
|
||||
#include "JsonNode.h"
|
||||
#include "JsonValue.h"
|
||||
|
||||
//void JsonValue::operator=(JsonObject const& object)
|
||||
//{
|
||||
// _node = object._node;
|
||||
//}
|
||||
|
||||
void JsonValue::operator=(int value)
|
||||
{
|
||||
if (!_node) return;
|
||||
|
||||
_node->type = JSON_INTEGER;
|
||||
_node->content.asInteger = value;
|
||||
}
|
||||
|
||||
//JsonValue::operator JsonObject()
|
||||
//{
|
||||
// return JsonObject(_buffer, _node);
|
||||
//}
|
||||
|
||||
JsonValue::operator int()
|
||||
{
|
||||
if (!_node || _node->type != JSON_INTEGER) return 0;
|
||||
|
||||
return _node->content.asInteger;
|
||||
}
|
Reference in New Issue
Block a user