JsonValue.cpp 722 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Arduino JSON library
  3. * Benoit Blanchon 2014 - MIT License
  4. */
  5. #include "EscapedString.h"
  6. #include "JsonValue.h"
  7. using namespace ArduinoJson::Generator;
  8. using namespace ArduinoJson::Internals;
  9. size_t JsonValue::printBoolTo(const Content& c, Print& p)
  10. {
  11. return p.print(c.asBool ? "true" : "false");
  12. }
  13. size_t JsonValue::printLongTo(const Content& c, Print& p)
  14. {
  15. return p.print(c.asLong);
  16. }
  17. size_t JsonValue::printPrintableTo(const Content& c, Print& p)
  18. {
  19. if (c.asPrintable)
  20. return c.asPrintable->printTo(p);
  21. else
  22. return p.print("null");
  23. }
  24. size_t JsonValue::printStringTo(const Content& c, Print& p)
  25. {
  26. return EscapedString::printTo(c.asString, p);
  27. }