mirror of
				https://github.com/bblanchon/ArduinoJson.git
				synced 2025-10-30 22:21:38 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			58 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
| * Arduino JSON library
 | |
| * Benoit Blanchon 2014 - MIT License
 | |
| */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include "JsonValue.h"
 | |
| #include "JsonPair.h"
 | |
| #include "JsonToken.h"
 | |
| 
 | |
| namespace ArduinoJson
 | |
| {
 | |
|     namespace Parser
 | |
|     {
 | |
|         // An iterator for JsonObject
 | |
|         class JsonObjectIterator : JsonToken
 | |
|         {
 | |
|         public:
 | |
| 
 | |
|             // Create an iterator pointing at the specified token
 | |
|             JsonObjectIterator(JsonToken token)
 | |
|                 : JsonToken(token)
 | |
|             {
 | |
|             }
 | |
| 
 | |
|             // Move to the next JsonPair
 | |
|             void operator++()
 | |
|             {
 | |
|                 *this = JsonObjectIterator(nextSibling().nextSibling());
 | |
|             }
 | |
| 
 | |
|             // Get the JsonPair pointed by the iterator
 | |
|             JsonPair operator*() const
 | |
|             {
 | |
|                 return JsonPair(*this);
 | |
|             }
 | |
| 
 | |
|             // Test iterator equality
 | |
|             bool operator!= (const JsonObjectIterator& other) const
 | |
|             {
 | |
|                 return JsonToken::operator!=(other);
 | |
|             }
 | |
| 
 | |
|             // Get the key of the JsonPair pointed by the iterator
 | |
|             const char* key() const
 | |
|             {
 | |
|                 return operator*().key();
 | |
|             }
 | |
| 
 | |
|             // Get the key of the JsonPair pointed by the iterator
 | |
|             JsonValue value() const
 | |
|             {
 | |
|                 return operator*().value();
 | |
|             }
 | |
|         };
 | |
|     }
 | |
| } |