JsonArrayIterator.hpp 600 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include "ArduinoJson/JsonValue.hpp"
  3. namespace ArduinoJson
  4. {
  5. class JsonArray;
  6. class JsonArrayIterator
  7. {
  8. friend class JsonArray;
  9. public:
  10. explicit JsonArrayIterator(Internals::JsonNode* node)
  11. : _node(node)
  12. {
  13. }
  14. void operator++()
  15. {
  16. _node = _node->next;
  17. }
  18. JsonValue operator*() const
  19. {
  20. return JsonValue(_node);
  21. }
  22. bool operator==(const JsonArrayIterator& other) const
  23. {
  24. return _node == other._node;
  25. }
  26. bool operator!=(const JsonArrayIterator& other) const
  27. {
  28. return _node != other._node;
  29. }
  30. private:
  31. Internals::JsonNode* _node;
  32. };
  33. }