JsonArrayConstIterator.hpp 786 B

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