JsonObjectIterator.hpp 754 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 "JsonPairInternal.hpp"
  8. namespace ArduinoJson {
  9. namespace Internals {
  10. class JsonObjectIterator {
  11. public:
  12. explicit JsonObjectIterator(Internals::JsonNode *node) : _pair(node) {}
  13. JsonPair operator*() const { return _pair; }
  14. JsonPair *operator->() { return &_pair; }
  15. bool operator==(const JsonObjectIterator &other) const {
  16. return _pair.isSameAs(other._pair);
  17. }
  18. bool operator!=(const JsonObjectIterator &other) const {
  19. return !_pair.isSameAs(other._pair);
  20. }
  21. JsonObjectIterator &operator++() {
  22. _pair.moveToNext();
  23. return *this;
  24. }
  25. private:
  26. JsonPairInternal _pair;
  27. };
  28. }
  29. }