JsonHashTableBase.cpp 667 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Arduino JSON library
  3. * Benoit Blanchon 2014 - MIT License
  4. */
  5. #include "JsonHashTable.h"
  6. using namespace ArduinoJson::Generator;
  7. size_t JsonHashTableBase::printTo(Print& p) const
  8. {
  9. size_t n = 0;
  10. n += p.write('{');
  11. // NB: the code has been optimized for a small size on a 8-bit AVR
  12. const KeyValuePair* current = items;
  13. for (int i = count; i > 0; i--)
  14. {
  15. n += current->key.printTo(p);
  16. n += p.write(':');
  17. n += current->value.printTo(p);
  18. current++;
  19. if (i > 1)
  20. {
  21. n += p.write(',');
  22. }
  23. }
  24. n += p.write('}');
  25. return n;
  26. }