2014-10-23 23:39:22 +02:00
|
|
|
// Copyright Benoit Blanchon 2014
|
|
|
|
|
// MIT License
|
|
|
|
|
//
|
|
|
|
|
// Arduino JSON library
|
|
|
|
|
// https://github.com/bblanchon/ArduinoJson
|
|
|
|
|
|
2014-10-19 15:46:36 +02:00
|
|
|
#include "ArduinoJson/Internals/JsonWriter.hpp"
|
|
|
|
|
#include "ArduinoJson/Internals/QuotedString.hpp"
|
2014-10-16 16:25:42 +02:00
|
|
|
|
|
|
|
|
using namespace ArduinoJson::Internals;
|
|
|
|
|
|
2014-10-23 19:54:00 +02:00
|
|
|
void JsonWriter::writeString(char const *value) {
|
|
|
|
|
_length += QuotedString::printTo(value, _sink);
|
2014-10-16 16:25:42 +02:00
|
|
|
}
|
|
|
|
|
|
2014-10-23 19:54:00 +02:00
|
|
|
void JsonWriter::writeInteger(long value) { _length += _sink->print(value); }
|
|
|
|
|
|
|
|
|
|
void JsonWriter::writeBoolean(bool value) {
|
|
|
|
|
_length += _sink->print(value ? "true" : "false");
|
2014-10-16 16:25:42 +02:00
|
|
|
}
|
|
|
|
|
|
2014-10-23 19:54:00 +02:00
|
|
|
void JsonWriter::writeDouble(double value, int decimals) {
|
|
|
|
|
_length += _sink->print(value, decimals);
|
2014-10-23 23:45:36 +02:00
|
|
|
}
|