JsonPrintable.cpp 821 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Arduino JSON library
  3. * Benoit Blanchon 2014 - MIT License
  4. */
  5. #include "JsonPrintable.h"
  6. #include "JsonPrettyPrint.h"
  7. #include "StringBuilder.h"
  8. using namespace ArduinoJson::Generator;
  9. using namespace ArduinoJson::Internals;
  10. size_t JsonPrintable::printTo(char* buffer, size_t bufferSize) const
  11. {
  12. StringBuilder sb(buffer, bufferSize);
  13. return printTo(sb);
  14. }
  15. size_t JsonPrintable::prettyPrintTo(char* buffer, size_t bufferSize) const
  16. {
  17. StringBuilder sb(buffer, bufferSize);
  18. return prettyPrintTo(sb);
  19. }
  20. size_t JsonPrintable::prettyPrintTo(IndentedPrint& p) const
  21. {
  22. JsonPrettyPrint prettyPrint(p);
  23. return printTo(prettyPrint);
  24. }
  25. size_t JsonPrintable::prettyPrintTo(Print& p) const
  26. {
  27. IndentedPrint indentedPrint(p);
  28. return prettyPrintTo(indentedPrint);
  29. }