Files
ArduinoJson/JsonGeneratorTests/JsonValue.cpp

30 lines
599 B
C++
Raw Normal View History

2014-06-27 13:42:26 +02:00
/*
* Arduino JSON library
* Benoit Blanchon 2014 - MIT License
*/
#include "JsonValue.h"
#include "JsonObjectBase.h"
void JsonValue::writeBooleanTo(StringBuilder& sb)
2014-06-27 13:42:26 +02:00
{
sb.append(content.boolean ? "true" : "false");
}
2014-06-27 13:42:26 +02:00
void JsonValue::writeNumberTo(StringBuilder& sb)
{
sb.append(content.number);
}
2014-06-27 13:42:26 +02:00
void JsonValue::writeObjectTo(StringBuilder& sb)
{
if (content.object)
((JsonObjectBase*) content.object)->writeTo(sb);
else
sb.append("null");
}
2014-06-27 13:42:26 +02:00
void JsonValue::writeStringTo(StringBuilder& sb)
{
sb.appendEscaped(content.string);
2014-06-27 13:42:26 +02:00
}