JsonArray.h 655 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * malloc-free JSON parser for Arduino
  3. * Benoit Blanchon 2014 - MIT License
  4. */
  5. #ifndef __JSONARRAY_H
  6. #define __JSONARRAY_H
  7. #include "JsonObjectBase.h"
  8. class JsonHashTable;
  9. class JsonArray : public JsonObjectBase
  10. {
  11. template <int N>
  12. friend class JsonParser;
  13. friend class JsonHashTable;
  14. public:
  15. JsonArray() {}
  16. int getLength()
  17. {
  18. return tokens != 0 ? tokens[0].size : 0;
  19. }
  20. JsonArray getArray(int index);
  21. JsonHashTable getHashTable(int index);
  22. long getLong(int index);
  23. char* getString(int index);
  24. private:
  25. JsonArray(char* json, jsmntok_t* tokens);
  26. jsmntok_t* getToken(int index);
  27. };
  28. #endif