forked from bblanchon/ArduinoJson
Removing virtual methods...
This commit is contained in:
@ -10,7 +10,8 @@
|
||||
|
||||
#include "ArduinoJson/JsonBuffer.hpp"
|
||||
#include "ArduinoJson/JsonObject.hpp"
|
||||
#include "ArduinoJson/Internals/JsonWriter.hpp"
|
||||
#include "ArduinoJson/Internals/CompactJsonWriter.hpp"
|
||||
#include "ArduinoJson/Internals/PrettyJsonWriter.hpp"
|
||||
|
||||
using namespace ArduinoJson;
|
||||
using namespace ArduinoJson::Internals;
|
||||
@ -68,7 +69,8 @@ JsonObject &JsonArray::createNestedObject() {
|
||||
return object;
|
||||
}
|
||||
|
||||
void JsonArray::writeTo(JsonWriter &writer) const {
|
||||
template <typename T>
|
||||
void JsonArray::writeTo(T &writer) const {
|
||||
JsonArrayNode *child = _firstNode;
|
||||
|
||||
if (child) {
|
||||
@ -88,3 +90,6 @@ void JsonArray::writeTo(JsonWriter &writer) const {
|
||||
writer.writeEmptyArray();
|
||||
}
|
||||
}
|
||||
|
||||
template void JsonArray::writeTo<CompactJsonWriter>(CompactJsonWriter &) const;
|
||||
template void JsonArray::writeTo<PrettyJsonWriter>(PrettyJsonWriter &) const;
|
@ -12,7 +12,8 @@
|
||||
#include "ArduinoJson/JsonBuffer.hpp"
|
||||
#include "ArduinoJson/JsonArray.hpp"
|
||||
#include "ArduinoJson/JsonValue.hpp"
|
||||
#include "ArduinoJson/Internals/JsonWriter.hpp"
|
||||
#include "ArduinoJson/Internals/CompactJsonWriter.hpp"
|
||||
#include "ArduinoJson/Internals/PrettyJsonWriter.hpp"
|
||||
#include "ArduinoJson/Internals/StringBuilder.hpp"
|
||||
|
||||
using namespace ArduinoJson;
|
||||
@ -91,7 +92,8 @@ void JsonObject::removeNode(JsonObjectNode *nodeToRemove) {
|
||||
}
|
||||
}
|
||||
|
||||
void JsonObject::writeTo(JsonWriter &writer) const {
|
||||
template <typename T>
|
||||
void JsonObject::writeTo(T &writer) const {
|
||||
JsonObjectNode *node = _firstNode;
|
||||
|
||||
if (node) {
|
||||
@ -113,3 +115,6 @@ void JsonObject::writeTo(JsonWriter &writer) const {
|
||||
writer.writeEmptyObject();
|
||||
}
|
||||
}
|
||||
|
||||
template void JsonObject::writeTo(CompactJsonWriter &writer) const;
|
||||
template void JsonObject::writeTo(PrettyJsonWriter &writer) const;
|
||||
|
@ -13,30 +13,3 @@
|
||||
|
||||
using namespace ArduinoJson;
|
||||
using namespace ArduinoJson::Internals;
|
||||
|
||||
size_t JsonPrintable::printTo(char *buffer, size_t bufferSize) const {
|
||||
StringBuilder sb(buffer, bufferSize);
|
||||
return printTo(sb);
|
||||
}
|
||||
|
||||
size_t JsonPrintable::printTo(Print &p) const {
|
||||
CompactJsonWriter writer(&p);
|
||||
writeTo(writer);
|
||||
return writer.bytesWritten();
|
||||
}
|
||||
|
||||
size_t JsonPrintable::prettyPrintTo(char *buffer, size_t bufferSize) const {
|
||||
StringBuilder sb(buffer, bufferSize);
|
||||
return prettyPrintTo(sb);
|
||||
}
|
||||
|
||||
size_t JsonPrintable::prettyPrintTo(IndentedPrint &p) const {
|
||||
PrettyJsonWriter writer(&p);
|
||||
writeTo(writer);
|
||||
return writer.bytesWritten();
|
||||
}
|
||||
|
||||
size_t JsonPrintable::prettyPrintTo(Print &print) const {
|
||||
IndentedPrint indentedPrint = IndentedPrint(print);
|
||||
return prettyPrintTo(indentedPrint);
|
||||
}
|
||||
|
Reference in New Issue
Block a user