JsonArray.h 664 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * malloc-free JSON parser for Arduino
  3. * Benoit Blanchon 2014
  4. * MIT License
  5. */
  6. #ifndef __JSONARRAY_H
  7. #define __JSONARRAY_H
  8. #include "JsonObjectBase.h"
  9. class JsonHashTable;
  10. class JsonArray : public JsonObjectBase
  11. {
  12. friend class JsonParserBase;
  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. char* getString(int index);
  23. private:
  24. JsonArray(char* json, jsmntok_t* tokens)
  25. : JsonObjectBase(json, tokens)
  26. {
  27. }
  28. jsmntok_t* getToken(int index);
  29. };
  30. #endif