2014-07-03 13:58:08 +02:00
|
|
|
/*
|
|
|
|
* Arduino JSON library
|
|
|
|
* Benoit Blanchon 2014 - MIT License
|
|
|
|
*/
|
2014-01-11 15:05:35 +01:00
|
|
|
|
2014-07-03 13:58:08 +02:00
|
|
|
#pragma once
|
2014-01-11 15:05:35 +01:00
|
|
|
|
2014-07-16 13:26:11 +02:00
|
|
|
#include "JsonValue.h"
|
|
|
|
|
2014-07-03 14:00:51 +02:00
|
|
|
namespace ArduinoJson
|
2014-01-11 15:05:35 +01:00
|
|
|
{
|
2014-07-03 14:00:51 +02:00
|
|
|
namespace Parser
|
|
|
|
{
|
|
|
|
class JsonHashTable;
|
|
|
|
|
2014-07-17 13:12:12 +02:00
|
|
|
class JsonArray
|
2014-07-03 14:00:51 +02:00
|
|
|
{
|
|
|
|
public:
|
2014-01-11 15:05:35 +01:00
|
|
|
|
2014-07-03 14:00:51 +02:00
|
|
|
JsonArray() {}
|
2014-01-11 15:05:35 +01:00
|
|
|
|
2014-07-17 13:12:12 +02:00
|
|
|
JsonArray(JsonValue& value)
|
|
|
|
: value(value)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-07-16 13:41:00 +02:00
|
|
|
bool success()
|
|
|
|
{
|
2014-07-17 13:12:12 +02:00
|
|
|
return value.success();
|
2014-07-16 13:41:00 +02:00
|
|
|
}
|
|
|
|
|
2014-07-16 14:01:04 +02:00
|
|
|
int size()
|
2014-07-03 14:00:51 +02:00
|
|
|
{
|
2014-07-17 13:12:12 +02:00
|
|
|
return value.size();
|
2014-07-03 14:00:51 +02:00
|
|
|
}
|
2014-01-11 15:05:35 +01:00
|
|
|
|
2014-07-17 13:12:12 +02:00
|
|
|
JsonValue operator[](int index)
|
|
|
|
{
|
|
|
|
return value[index];
|
|
|
|
}
|
2014-07-16 14:01:04 +02:00
|
|
|
|
|
|
|
DEPRECATED int getLength()
|
|
|
|
{
|
|
|
|
return size();
|
|
|
|
}
|
2014-07-16 13:26:11 +02:00
|
|
|
|
2014-07-16 13:53:56 +02:00
|
|
|
DEPRECATED JsonArray getArray(int index)
|
2014-07-16 13:26:11 +02:00
|
|
|
{
|
|
|
|
return (JsonArray) (*this)[index];
|
|
|
|
}
|
|
|
|
|
2014-07-16 13:53:56 +02:00
|
|
|
DEPRECATED bool getBool(int index)
|
2014-07-16 13:26:11 +02:00
|
|
|
{
|
|
|
|
return (bool) (*this)[index];
|
|
|
|
}
|
|
|
|
|
2014-07-16 13:53:56 +02:00
|
|
|
DEPRECATED double getDouble(int index)
|
2014-07-16 13:26:11 +02:00
|
|
|
{
|
|
|
|
return (double) (*this)[index];
|
|
|
|
}
|
|
|
|
|
2014-07-16 13:53:56 +02:00
|
|
|
DEPRECATED JsonHashTable getHashTable(int index);
|
2014-07-16 13:26:11 +02:00
|
|
|
|
2014-07-16 13:53:56 +02:00
|
|
|
DEPRECATED long getLong(int index)
|
2014-07-16 13:26:11 +02:00
|
|
|
{
|
|
|
|
return (long) (*this)[index];
|
|
|
|
}
|
|
|
|
|
2014-07-16 13:53:56 +02:00
|
|
|
DEPRECATED char* getString(int index)
|
2014-07-16 13:26:11 +02:00
|
|
|
{
|
|
|
|
return (char*) (*this)[index];
|
|
|
|
}
|
2014-01-11 15:15:52 +01:00
|
|
|
|
2014-07-03 14:00:51 +02:00
|
|
|
private:
|
2014-01-11 15:05:35 +01:00
|
|
|
|
2014-07-17 13:12:12 +02:00
|
|
|
JsonValue value;
|
2014-07-03 14:00:51 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|