JsonArray.h 685 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. double getDouble(int index);
  22. JsonHashTable getHashTable(int index);
  23. long getLong(int index);
  24. char* getString(int index);
  25. private:
  26. JsonArray(char* json, jsmntok_t* tokens);
  27. jsmntok_t* getToken(int index);
  28. };
  29. #endif