2014-10-23 23:39:22 +02:00
|
|
|
// Copyright Benoit Blanchon 2014
|
|
|
|
|
// MIT License
|
|
|
|
|
//
|
|
|
|
|
// Arduino JSON library
|
|
|
|
|
// https://github.com/bblanchon/ArduinoJson
|
|
|
|
|
|
2014-11-03 18:35:22 +01:00
|
|
|
#include "../../include/ArduinoJson/Internals/JsonWriter.hpp"
|
2014-11-04 10:01:21 +01:00
|
|
|
|
2014-11-03 18:35:22 +01:00
|
|
|
#include "../../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-11-03 18:28:24 +01:00
|
|
|
void JsonWriter::writeDouble(double value, uint8_t decimals) {
|
2014-10-23 19:54:00 +02:00
|
|
|
_length += _sink->print(value, decimals);
|
2014-10-23 23:45:36 +02:00
|
|
|
}
|