JsonParser.h 921 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Arduino JSON library
  3. * Benoit Blanchon 2014 - MIT License
  4. */
  5. #pragma once
  6. #include "JsonParserBase.h"
  7. namespace ArduinoJson
  8. {
  9. namespace Parser
  10. {
  11. // The JSON parser.
  12. //
  13. // You need to specifiy the number of token to be allocated for that parser.
  14. //
  15. // CAUTION: JsonArray, JsonObject and JsonValue contain pointers to tokens of the
  16. // JsonParser, so they need the JsonParser to be in memory to work.
  17. // As a result, you must not create JsonArray, JsonObject or JsonValue that have a
  18. // longer life that the JsonParser.
  19. template <int MAX_TOKENS>
  20. class JsonParser : public JsonParserBase
  21. {
  22. public:
  23. JsonParser()
  24. : JsonParserBase(tokens, MAX_TOKENS)
  25. {
  26. }
  27. private:
  28. jsmntok_t tokens[MAX_TOKENS];
  29. };
  30. }
  31. }