mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-18 04:52:22 +02:00
Added JsonObjectIterator
This commit is contained in:
47
JsonParser/JsonObjectIterator.h
Normal file
47
JsonParser/JsonObjectIterator.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Arduino JSON library
|
||||
* Benoit Blanchon 2014 - MIT License
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "JsonValue.h"
|
||||
#include "JsonPair.h"
|
||||
#include "JsonToken.h"
|
||||
|
||||
namespace ArduinoJson
|
||||
{
|
||||
namespace Parser
|
||||
{
|
||||
class JsonObjectIterator
|
||||
{
|
||||
public:
|
||||
|
||||
JsonObjectIterator(char* json, Internal::JsonToken token)
|
||||
: json(json), token(token)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void operator++()
|
||||
{
|
||||
token = token.nextSibling().nextSibling();
|
||||
}
|
||||
|
||||
JsonPair operator*() const
|
||||
{
|
||||
return JsonPair(json, token);
|
||||
}
|
||||
|
||||
bool operator !=(const JsonObjectIterator& other)
|
||||
{
|
||||
return token != other.token;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
char* json;
|
||||
Internal::JsonToken token;
|
||||
};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user