2014-11-05 11:16:36 +01:00
|
|
|
// Copyright Benoit Blanchon 2014
|
|
|
|
// MIT License
|
|
|
|
//
|
|
|
|
// Arduino JSON library
|
|
|
|
// https://github.com/bblanchon/ArduinoJson
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2014-11-05 13:14:15 +01:00
|
|
|
#include "ListNode.hpp"
|
2014-11-05 11:16:36 +01:00
|
|
|
|
|
|
|
namespace ArduinoJson {
|
|
|
|
namespace Internals {
|
|
|
|
|
|
|
|
template <typename T>
|
2014-11-05 13:12:20 +01:00
|
|
|
class ListIterator {
|
2014-11-05 11:16:36 +01:00
|
|
|
public:
|
2014-11-05 13:14:15 +01:00
|
|
|
explicit ListIterator(ListNode<T> *node = NULL) : _node(node) {}
|
2014-11-05 11:16:36 +01:00
|
|
|
|
|
|
|
T &operator*() const { return _node->content; }
|
|
|
|
T *operator->() { return &_node->content; }
|
|
|
|
|
2014-11-05 13:12:20 +01:00
|
|
|
bool operator==(const ListIterator<T> &other) const {
|
2014-11-05 11:16:36 +01:00
|
|
|
return _node == other._node;
|
|
|
|
}
|
|
|
|
|
2014-11-05 13:12:20 +01:00
|
|
|
bool operator!=(const ListIterator<T> &other) const {
|
2014-11-05 11:16:36 +01:00
|
|
|
return _node != other._node;
|
|
|
|
}
|
|
|
|
|
2014-11-05 13:12:20 +01:00
|
|
|
ListIterator<T> &operator++() {
|
2014-11-05 11:16:36 +01:00
|
|
|
if (_node) _node = _node->next;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2014-11-05 13:14:15 +01:00
|
|
|
ListNode<T> *_node;
|
2014-11-05 11:16:36 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|