JsonObjectIterator.h 913 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Arduino JSON library
  3. * Benoit Blanchon 2014 - MIT License
  4. */
  5. #pragma once
  6. #include "JsonValue.h"
  7. #include "JsonPair.h"
  8. #include "JsonToken.h"
  9. namespace ArduinoJson
  10. {
  11. namespace Parser
  12. {
  13. class JsonObjectIterator
  14. {
  15. public:
  16. JsonObjectIterator(char* json, Internal::JsonToken token)
  17. : json(json), token(token)
  18. {
  19. }
  20. void operator++()
  21. {
  22. token = token.nextSibling().nextSibling();
  23. }
  24. JsonPair operator*() const
  25. {
  26. return JsonPair(json, token);
  27. }
  28. bool operator !=(const JsonObjectIterator& other)
  29. {
  30. return token != other.token;
  31. }
  32. private:
  33. char* json;
  34. Internal::JsonToken token;
  35. };
  36. }
  37. }