JsonParserBase.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Arduino JSON library
  3. * Benoit Blanchon 2014 - MIT License
  4. */
  5. #pragma once
  6. #include "JsonHashTable.h"
  7. #include "JsonArray.h"
  8. namespace ArduinoJson
  9. {
  10. namespace Parser
  11. {
  12. class JsonParserBase
  13. {
  14. public:
  15. JsonParserBase(jsmntok_t* tokens, int maxTokens)
  16. : tokens(tokens), maxTokens(maxTokens)
  17. {
  18. }
  19. JsonValue parse(char* json);
  20. /*
  21. * Parse the JSON string and return a array.
  22. *
  23. * The content of the string may be altered to add '\0' at the
  24. * end of string tokens
  25. */
  26. DEPRECATED JsonArray parseArray(char* json)
  27. {
  28. return (JsonArray)parse(json);
  29. }
  30. /*
  31. * Parse the JSON string and return a array.
  32. *
  33. * The content of the string may be altered to add '\0' at the
  34. * end of string tokens
  35. */
  36. DEPRECATED JsonHashTable parseHashTable(char* json)
  37. {
  38. return (JsonHashTable)parse(json);
  39. }
  40. private:
  41. jsmntok_t* tokens;
  42. int maxTokens;
  43. };
  44. }
  45. }