mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 00:38:27 +01:00
Extracting a common base class for JsonArray and JsonObject...
This commit is contained in:
38
include/ArduinoJson/Internals/List.hpp
Normal file
38
include/ArduinoJson/Internals/List.hpp
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright Benoit Blanchon 2014
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "NodeIterator.hpp"
|
||||
#include "NodeConstIterator.hpp"
|
||||
#include "../JsonBuffer.hpp"
|
||||
|
||||
namespace ArduinoJson {
|
||||
namespace Internals {
|
||||
|
||||
template <typename T>
|
||||
class List {
|
||||
public:
|
||||
typedef Node<T> node_type;
|
||||
typedef NodeIterator<T> iterator;
|
||||
typedef NodeConstIterator<T> const_iterator;
|
||||
|
||||
List(JsonBuffer *buffer) : _buffer(buffer), _firstNode(NULL) {}
|
||||
|
||||
bool success() const { return _buffer != NULL; }
|
||||
|
||||
iterator begin() { return iterator(_firstNode); }
|
||||
iterator end() { return iterator(NULL); }
|
||||
|
||||
const_iterator begin() const { return const_iterator(_firstNode); }
|
||||
const_iterator end() const { return const_iterator(NULL); }
|
||||
|
||||
protected:
|
||||
JsonBuffer *_buffer;
|
||||
node_type *_firstNode;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user