mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-02 00:38:26 +01:00
Inlined the content of JsonWriter.cpp
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../Arduino/Print.hpp"
|
#include "../Arduino/Print.hpp"
|
||||||
|
#include "QuotedString.hpp"
|
||||||
|
|
||||||
namespace ArduinoJson {
|
namespace ArduinoJson {
|
||||||
namespace Internals {
|
namespace Internals {
|
||||||
@@ -35,14 +36,22 @@ class JsonWriter {
|
|||||||
void endObject() { write('}'); }
|
void endObject() { write('}'); }
|
||||||
void writeEmptyObject() { write("{}"); }
|
void writeEmptyObject() { write("{}"); }
|
||||||
|
|
||||||
void writeString(const char *value);
|
|
||||||
void writeInteger(long value);
|
|
||||||
void writeBoolean(bool value);
|
|
||||||
void writeDouble(double value, uint8_t decimals);
|
|
||||||
|
|
||||||
void writeColon() { write(':'); }
|
void writeColon() { write(':'); }
|
||||||
void writeComma() { write(','); }
|
void writeComma() { write(','); }
|
||||||
|
|
||||||
|
void writeString(const char *value) {
|
||||||
|
_length += QuotedString::printTo(value, _sink);
|
||||||
|
}
|
||||||
|
|
||||||
|
void writeInteger(long value) { _length += _sink.print(value); }
|
||||||
|
|
||||||
|
void writeBoolean(bool value) {
|
||||||
|
_length += _sink.print(value ? "true" : "false");
|
||||||
|
}
|
||||||
|
void writeDouble(double value, uint8_t decimals) {
|
||||||
|
_length += _sink.print(value, decimals);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void write(char c) { _length += _sink.write(c); }
|
void write(char c) { _length += _sink.write(c); }
|
||||||
void write(const char *s) { _length += _sink.print(s); }
|
void write(const char *s) { _length += _sink.print(s); }
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
// Copyright Benoit Blanchon 2014
|
|
||||||
// MIT License
|
|
||||||
//
|
|
||||||
// Arduino JSON library
|
|
||||||
// https://github.com/bblanchon/ArduinoJson
|
|
||||||
|
|
||||||
#include "../../include/ArduinoJson/Internals/JsonWriter.hpp"
|
|
||||||
|
|
||||||
#include "../../include/ArduinoJson/Internals/QuotedString.hpp"
|
|
||||||
|
|
||||||
using namespace ArduinoJson::Internals;
|
|
||||||
|
|
||||||
void JsonWriter::writeString(char const *value) {
|
|
||||||
_length += QuotedString::printTo(value, _sink);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JsonWriter::writeInteger(long value) { _length += _sink.print(value); }
|
|
||||||
|
|
||||||
void JsonWriter::writeBoolean(bool value) {
|
|
||||||
_length += _sink.print(value ? "true" : "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
void JsonWriter::writeDouble(double value, uint8_t decimals) {
|
|
||||||
_length += _sink.print(value, decimals);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user