2014-09-27 14:51:50 +02:00
|
|
|
#include "JsonObject.h"
|
|
|
|
#include "JsonNode.h"
|
|
|
|
#include "JsonValue.h"
|
|
|
|
|
2014-09-27 15:04:06 +02:00
|
|
|
void JsonValue::operator=(bool value)
|
|
|
|
{
|
|
|
|
if (!_node) return;
|
|
|
|
|
|
|
|
_node->type = JSON_BOOLEAN;
|
|
|
|
_node->content.asBoolean = value;
|
|
|
|
}
|
|
|
|
|
2014-09-27 14:59:02 +02:00
|
|
|
void JsonValue::operator=(double value)
|
|
|
|
{
|
|
|
|
if (!_node) return;
|
|
|
|
|
|
|
|
_node->type = JSON_DOUBLE_2_DECIMALS;
|
|
|
|
_node->content.asDouble = value;
|
|
|
|
}
|
2014-09-27 14:51:50 +02:00
|
|
|
|
|
|
|
void JsonValue::operator=(int value)
|
|
|
|
{
|
|
|
|
if (!_node) return;
|
|
|
|
|
|
|
|
_node->type = JSON_INTEGER;
|
|
|
|
_node->content.asInteger = value;
|
|
|
|
}
|
|
|
|
|
2014-09-27 15:04:06 +02:00
|
|
|
JsonValue::operator bool()
|
|
|
|
{
|
|
|
|
if (!_node || _node->type != JSON_BOOLEAN) return 0;
|
|
|
|
|
|
|
|
return _node->content.asBoolean;
|
|
|
|
}
|
|
|
|
|
2014-09-27 14:59:02 +02:00
|
|
|
JsonValue::operator double()
|
|
|
|
{
|
|
|
|
if (!_node || _node->type < JSON_DOUBLE_0_DECIMALS) return 0;
|
|
|
|
|
|
|
|
return _node->content.asDouble;
|
|
|
|
}
|
2014-09-27 14:51:50 +02:00
|
|
|
|
|
|
|
JsonValue::operator int()
|
|
|
|
{
|
|
|
|
if (!_node || _node->type != JSON_INTEGER) return 0;
|
|
|
|
|
|
|
|
return _node->content.asInteger;
|
|
|
|
}
|