Added comments

This commit is contained in:
Benoit Blanchon
2014-11-06 13:42:16 +01:00
parent a3425a6306
commit 79bfe731af
6 changed files with 43 additions and 13 deletions

View File

@@ -13,6 +13,10 @@
namespace ArduinoJson {
namespace Internals {
// Implements all the overloads of printTo() and prettyPrintTo()
// Caution: this class use a template parameter to avoid virtual methods.
// This is a bit curious but allows to reduce the size of JsonVariant, JsonArray
// and JsonObject.
template <typename T>
class JsonPrintable {
public:
@@ -21,6 +25,7 @@ class JsonPrintable {
downcast().writeTo(writer);
return writer.bytesWritten();
}
size_t printTo(char *buffer, size_t bufferSize) const {
StringBuilder sb(buffer, bufferSize);
return printTo(sb);
@@ -36,6 +41,7 @@ class JsonPrintable {
StringBuilder sb(buffer, bufferSize);
return prettyPrintTo(sb);
}
size_t prettyPrintTo(Print &print) const {
IndentedPrint indentedPrint = IndentedPrint(print);
return prettyPrintTo(indentedPrint);