mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Added JsonArray::getHashTable()
This commit is contained in:
		| @@ -5,6 +5,7 @@ | ||||
|  */ | ||||
|  | ||||
| #include "JsonArray.h" | ||||
| #include "JsonHashTable.h" | ||||
|  | ||||
| jsmntok_t* JsonArray::getToken(int index) | ||||
| { | ||||
| @@ -27,4 +28,10 @@ JsonArray JsonArray::getArray(int index) | ||||
| { | ||||
| 	jsmntok_t* token = getToken(index); | ||||
| 	return JsonArray(json, token); | ||||
| } | ||||
|  | ||||
| JsonHashTable JsonArray::getHashTable(int index) | ||||
| { | ||||
| 	jsmntok_t* token = getToken(index); | ||||
| 	return JsonHashTable(json, token); | ||||
| } | ||||
							
								
								
									
										18
									
								
								JsonArray.h
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								JsonArray.h
									
									
									
									
									
								
							| @@ -9,6 +9,8 @@ | ||||
|  | ||||
| #include "JsonObjectBase.h" | ||||
|  | ||||
| class JsonHashTable; | ||||
|  | ||||
| class JsonArray : public JsonObjectBase | ||||
| { | ||||
| 	friend class JsonParserBase; | ||||
| @@ -16,25 +18,21 @@ class JsonArray : public JsonObjectBase | ||||
|  | ||||
| public: | ||||
|  | ||||
| public: | ||||
| 	JsonArray()	{} | ||||
|  | ||||
| 	JsonArray() | ||||
| 	int getLength() | ||||
| 	{ | ||||
|  | ||||
| 		return tokens != 0 ? tokens[0].size : 0; | ||||
| 	} | ||||
|  | ||||
| 	JsonArray getArray(int index); | ||||
|  | ||||
| 	char* getString(int index) | ||||
| 	{ | ||||
| 		jsmntok_t* token = getToken(index); | ||||
| 		return token != 0 ? json + token->start : 0; | ||||
| 	} | ||||
| 	 | ||||
| 	int getLength() | ||||
| 	{ | ||||
| 		return tokens != 0 ? tokens[0].size : 0; | ||||
| 	} | ||||
|  | ||||
| 	JsonArray getArray(int index); | ||||
| 	JsonHashTable getHashTable(int index); | ||||
|  | ||||
| private: | ||||
|  | ||||
|   | ||||
| @@ -13,14 +13,12 @@ class JsonArray; | ||||
|  | ||||
| class JsonHashTable : public JsonObjectBase | ||||
| { | ||||
| 	friend class JsonArray; | ||||
| 	friend class JsonParserBase; | ||||
|  | ||||
| public: | ||||
|  | ||||
| 	JsonHashTable() | ||||
| 	{ | ||||
|  | ||||
| 	} | ||||
| 	JsonHashTable() {} | ||||
|  | ||||
| 	char* getString(char* key) | ||||
| 	{ | ||||
| @@ -35,7 +33,6 @@ private: | ||||
| 	JsonHashTable(char* json, jsmntok_t* tokens) | ||||
| 		: JsonObjectBase(json, tokens) | ||||
| 	{ | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	jsmntok_t* getToken(char* key); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user