mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-02 08:48:27 +01:00
Added JsonObjectIterator
This commit is contained in:
52
include/ArduinoJson/JsonObjectIterator.hpp
Normal file
52
include/ArduinoJson/JsonObjectIterator.hpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include "ArduinoJson/JsonObjectKeyValue.hpp"
|
||||
|
||||
namespace ArduinoJson
|
||||
{
|
||||
class JsonObject;
|
||||
|
||||
class JsonObjectIterator
|
||||
{
|
||||
friend class JsonObject;
|
||||
|
||||
public:
|
||||
explicit JsonObjectIterator(Internals::JsonNode* node)
|
||||
: _node(node)
|
||||
{
|
||||
}
|
||||
|
||||
const char* key() const
|
||||
{
|
||||
return operator*().key();
|
||||
}
|
||||
|
||||
JsonValue value() const
|
||||
{
|
||||
return operator*().value();
|
||||
}
|
||||
|
||||
void operator++()
|
||||
{
|
||||
_node = _node->next;
|
||||
}
|
||||
|
||||
JsonObjectKeyValue operator*() const
|
||||
{
|
||||
return JsonObjectKeyValue(_node);
|
||||
}
|
||||
|
||||
bool operator==(const JsonObjectIterator& other) const
|
||||
{
|
||||
return _node == other._node;
|
||||
}
|
||||
|
||||
bool operator!=(const JsonObjectIterator& other) const
|
||||
{
|
||||
return _node != other._node;
|
||||
}
|
||||
|
||||
private:
|
||||
Internals::JsonNode* _node;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user