Serialize floats in objects

This commit is contained in:
Benoit Blanchon
2014-09-30 17:32:45 +02:00
parent c1ab55f9d9
commit f251563af1
4 changed files with 15 additions and 6 deletions

View File

@ -19,10 +19,15 @@ void JsonValue::operator=(char const* value)
}
void JsonValue::operator=(double value)
{
set(value, 2);
}
void JsonValue::set(double value, int decimals)
{
if (!_node) return;
_node->type = JSON_DOUBLE_2_DECIMALS;
_node->type = (JsonNodeType) (JSON_DOUBLE_0_DECIMALS + decimals);
_node->content.asDouble = value;
}