Added class JsonValue.

Added subscript operator on JsonArray and JsonHashTable
This commit is contained in:
Benoît Blanchon
2014-07-16 13:26:11 +02:00
parent 9f07cdcabf
commit d189bd7140
10 changed files with 205 additions and 132 deletions

52
JsonParser/JsonValue.h Normal file
View File

@ -0,0 +1,52 @@
/*
* Arduino JSON library
* Benoit Blanchon 2014 - MIT License
*/
#pragma once
#include "jsmn.h"
namespace ArduinoJson
{
namespace Parser
{
class JsonArray;
class JsonHashTable;
class JsonValue
{
friend JsonArray;
friend JsonHashTable;
public:
bool success()
{
return token != 0;
}
operator bool();
operator double();
operator long();
operator char*();
operator JsonArray();
operator JsonHashTable();
private:
JsonValue()
: json(0), token(0)
{
}
JsonValue(char* json, jsmntok_t* token)
: json(json), token(token)
{
}
char* json;
jsmntok_t* token;
};
}
}