JsonArrayIterator.hpp 760 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright Benoit Blanchon 2014
  2. // MIT License
  3. //
  4. // Arduino JSON library
  5. // https://github.com/bblanchon/ArduinoJson
  6. #pragma once
  7. #include "Internals/JsonArrayNode.hpp"
  8. namespace ArduinoJson {
  9. class JsonArrayIterator {
  10. public:
  11. explicit JsonArrayIterator(Internals::JsonArrayNode *node) : _node(node) {}
  12. JsonValue &operator*() const { return _node->value; }
  13. JsonValue *operator->() { return &_node->value; }
  14. bool operator==(const JsonArrayIterator &other) const {
  15. return _node == other._node;
  16. }
  17. bool operator!=(const JsonArrayIterator &other) const {
  18. return _node != other._node;
  19. }
  20. JsonArrayIterator &operator++() {
  21. if (_node) _node = _node->next;
  22. return *this;
  23. }
  24. private:
  25. Internals::JsonArrayNode *_node;
  26. };
  27. }