Added an overload of prettyPrintTo()

This commit is contained in:
Benoit Blanchon
2014-09-01 21:22:56 +02:00
parent cd88fb0882
commit 763aa7fe37
2 changed files with 9 additions and 2 deletions

View File

@ -10,12 +10,18 @@
using namespace ArduinoJson::Generator; using namespace ArduinoJson::Generator;
using namespace ArduinoJson::Internals; using namespace ArduinoJson::Internals;
size_t JsonPrintable::printTo(char* buffer, size_t bufferSize) size_t JsonPrintable::printTo(char* buffer, size_t bufferSize) const
{ {
StringBuilder sb(buffer, bufferSize); StringBuilder sb(buffer, bufferSize);
return printTo(sb); return printTo(sb);
} }
size_t JsonPrintable::prettyPrintTo(char* buffer, size_t bufferSize) const
{
StringBuilder sb(buffer, bufferSize);
return prettyPrintTo(sb);
}
size_t JsonPrintable::prettyPrintTo(IndentedPrint& p) const size_t JsonPrintable::prettyPrintTo(IndentedPrint& p) const
{ {
JsonPrettyPrint prettyPrint(p); JsonPrettyPrint prettyPrint(p);

View File

@ -19,10 +19,11 @@ namespace ArduinoJson
virtual size_t printTo(Print& p) const = 0; virtual size_t printTo(Print& p) const = 0;
size_t printTo(char* buffer, size_t bufferSize); size_t printTo(char* buffer, size_t bufferSize) const;
size_t prettyPrintTo(IndentedPrint& p) const; size_t prettyPrintTo(IndentedPrint& p) const;
size_t prettyPrintTo(Print& p) const; size_t prettyPrintTo(Print& p) const;
size_t prettyPrintTo(char* buffer, size_t bufferSize) const;
}; };
} }
} }