JsonArray.h 712 B

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