Test that integers can be stored in a JsonObject

This commit is contained in:
Benoit Blanchon
2014-09-27 14:51:50 +02:00
parent a2fc188526
commit 71fd2de675
7 changed files with 63 additions and 18 deletions

28
srcs/JsonValue.cpp Normal file
View 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;
}