Skip to content

Commit

Permalink
Added an overload of prettyPrintTo()
Browse files Browse the repository at this point in the history
  • Loading branch information
bblanchon committed Sep 1, 2014
1 parent cd88fb0 commit 763aa7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion JsonGenerator/JsonPrintable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@
using namespace ArduinoJson::Generator;
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);
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
{
JsonPrettyPrint prettyPrint(p);
Expand Down
3 changes: 2 additions & 1 deletion JsonGenerator/JsonPrintable.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ namespace ArduinoJson

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(Print& p) const;
size_t prettyPrintTo(char* buffer, size_t bufferSize) const;
};
}
}

0 comments on commit 763aa7f

Please sign in to comment.