Renamed NodeIterator into ListIterator

This commit is contained in:
Benoit Blanchon
2014-11-05 13:12:20 +01:00
parent 64b4e15ce6
commit 8138c64116
3 changed files with 15 additions and 15 deletions

View File

@ -6,8 +6,8 @@
#pragma once #pragma once
#include "NodeIterator.hpp" #include "ListIterator.hpp"
#include "NodeConstIterator.hpp" #include "ListConstIterator.hpp"
#include "../JsonBuffer.hpp" #include "../JsonBuffer.hpp"
namespace ArduinoJson { namespace ArduinoJson {
@ -18,8 +18,8 @@ class List {
public: public:
typedef T value_type; typedef T value_type;
typedef Node<T> node_type; typedef Node<T> node_type;
typedef NodeIterator<T> iterator; typedef ListIterator<T> iterator;
typedef NodeConstIterator<T> const_iterator; typedef ListConstIterator<T> const_iterator;
List(JsonBuffer *buffer) : _buffer(buffer), _firstNode(NULL) {} List(JsonBuffer *buffer) : _buffer(buffer), _firstNode(NULL) {}
@ -41,4 +41,4 @@ class List {
node_type *_firstNode; node_type *_firstNode;
}; };
} }
} }

View File

@ -10,22 +10,22 @@ namespace ArduinoJson {
namespace Internals { namespace Internals {
template <typename T> template <typename T>
class NodeConstIterator { class ListConstIterator {
public: public:
explicit NodeConstIterator(const Node<T> *node = NULL) : _node(node) {} explicit ListConstIterator(const Node<T> *node = NULL) : _node(node) {}
const T &operator*() const { return _node->content; } const T &operator*() const { return _node->content; }
const T *operator->() { return &_node->content; } const T *operator->() { return &_node->content; }
bool operator==(const NodeConstIterator<T> &other) const { bool operator==(const ListConstIterator<T> &other) const {
return _node == other._node; return _node == other._node;
} }
bool operator!=(const NodeConstIterator<T> &other) const { bool operator!=(const ListConstIterator<T> &other) const {
return _node != other._node; return _node != other._node;
} }
NodeConstIterator<T> &operator++() { ListConstIterator<T> &operator++() {
if (_node) _node = _node->next; if (_node) _node = _node->next;
return *this; return *this;
} }

View File

@ -12,22 +12,22 @@ namespace ArduinoJson {
namespace Internals { namespace Internals {
template <typename T> template <typename T>
class NodeIterator { class ListIterator {
public: public:
explicit NodeIterator(Node<T> *node = NULL) : _node(node) {} explicit ListIterator(Node<T> *node = NULL) : _node(node) {}
T &operator*() const { return _node->content; } T &operator*() const { return _node->content; }
T *operator->() { return &_node->content; } T *operator->() { return &_node->content; }
bool operator==(const NodeIterator<T> &other) const { bool operator==(const ListIterator<T> &other) const {
return _node == other._node; return _node == other._node;
} }
bool operator!=(const NodeIterator<T> &other) const { bool operator!=(const ListIterator<T> &other) const {
return _node != other._node; return _node != other._node;
} }
NodeIterator<T> &operator++() { ListIterator<T> &operator++() {
if (_node) _node = _node->next; if (_node) _node = _node->next;
return *this; return *this;
} }