Renamed JsonHashTable into JsonObject

This commit is contained in:
Benoit Blanchon
2014-07-18 16:46:01 +02:00
parent daa62b3737
commit b75d32e980
12 changed files with 45 additions and 47 deletions

View File

@ -4,14 +4,14 @@
*/
#include "JsonArray.h"
#include "JsonHashTable.h"
#include "JsonObject.h"
using namespace ArduinoJson::Parser;
using namespace ArduinoJson::Internal;
DEPRECATED JsonHashTable JsonArray::getHashTable(int index)
DEPRECATED JsonObject JsonArray::getHashTable(int index)
{
return (JsonHashTable) (*this)[index];
return (JsonObject) (*this)[index];
}
/*

View File

@ -13,7 +13,7 @@ namespace ArduinoJson
{
namespace Parser
{
class JsonHashTable;
class JsonObject;
class JsonArray
{
@ -73,7 +73,7 @@ namespace ArduinoJson
return (double) (*this)[index];
}
DEPRECATED JsonHashTable getHashTable(int index);
DEPRECATED JsonObject getHashTable(int index);
DEPRECATED long getLong(int index)
{

View File

@ -12,8 +12,6 @@ namespace ArduinoJson
{
namespace Parser
{
class JsonHashTable;
class JsonArrayIterator
{
public:

View File

@ -4,14 +4,14 @@
*/
#include <string.h> // for strcmp()
#include "JsonHashTable.h"
#include "JsonArray.h"
#include "JsonObject.h"
#include "JsonValue.h"
using namespace ArduinoJson::Parser;
using namespace ArduinoJson::Internal;
DEPRECATED JsonArray JsonHashTable::getArray(const char* key)
DEPRECATED JsonArray JsonObject::getArray(const char* key)
{
return (*this)[key];
}
@ -19,7 +19,7 @@ DEPRECATED JsonArray JsonHashTable::getArray(const char* key)
/*
* Returns the token for the value associated with the specified key
*/
JsonValue JsonHashTable::getValue(const char* desiredKey)
JsonValue JsonObject::getValue(const char* desiredKey)
{
// sanity check
if (desiredKey == 0 || !token.isObject())

View File

@ -13,13 +13,17 @@ namespace ArduinoJson
{
class JsonArray;
class JsonHashTable
class JsonObject
{
friend class JsonValue;
public:
JsonHashTable()
JsonObject(char* json, Internal::JsonToken token)
: json(json), token(token)
{
}
JsonObject()
: token(Internal::JsonToken::null())
{
}
@ -51,7 +55,7 @@ namespace ArduinoJson
return getValue(key);
}
DEPRECATED JsonHashTable getHashTable(const char* key)
DEPRECATED JsonObject getHashTable(const char* key)
{
return getValue(key);
}
@ -66,23 +70,19 @@ namespace ArduinoJson
return getValue(key);
}
static JsonHashTable null()
static JsonObject null()
{
return JsonHashTable();
return JsonObject();
}
private:
JsonHashTable(char* json, Internal::JsonToken token)
: json(json), token(token)
{
}
char* json;
Internal::JsonToken token;
JsonValue getValue(const char* key);
};
typedef JsonObject JsonHashTable;
}
}

View File

@ -5,8 +5,8 @@
#pragma once
#include "JsonHashTable.h"
#include "JsonArray.h"
#include "JsonObject.h"
namespace ArduinoJson
{
@ -31,7 +31,7 @@ namespace ArduinoJson
*/
DEPRECATED JsonArray parseArray(char* json)
{
return (JsonArray)parse(json);
return parse(json);
}
/*
@ -40,9 +40,9 @@ namespace ArduinoJson
* The content of the string may be altered to add '\0' at the
* end of string tokens
*/
DEPRECATED JsonHashTable parseHashTable(char* json)
DEPRECATED JsonObject parseHashTable(char* json)
{
return (JsonHashTable)parse(json);
return parse(json);
}
private:

View File

@ -5,7 +5,7 @@
#include <stdlib.h> // for strtol, strtod
#include "JsonArray.h"
#include "JsonHashTable.h"
#include "JsonObject.h"
#include "JsonValue.h"
using namespace ArduinoJson::Parser;
@ -18,7 +18,7 @@ JsonValue JsonValue::operator[](int index)
JsonValue JsonValue::operator[](const char* key)
{
return JsonHashTable(json, token)[key];
return JsonObject(json, token)[key];
}
JsonValue::operator bool()
@ -62,9 +62,9 @@ JsonValue::operator JsonArray()
: JsonArray::null();
}
JsonValue::operator JsonHashTable()
JsonValue::operator JsonObject()
{
return token.isObject()
? JsonHashTable(json, token)
: JsonHashTable::null();
? JsonObject(json, token)
: JsonObject::null();
}

View File

@ -22,7 +22,7 @@ namespace ArduinoJson
namespace Parser
{
class JsonArray;
class JsonHashTable;
class JsonObject;
class JsonValue
{
@ -44,7 +44,7 @@ namespace ArduinoJson
operator long();
operator char*();
operator JsonArray();
operator JsonHashTable();
operator JsonObject();
JsonValue operator[](int index);
JsonValue operator[](const char*key);