Files
ArduinoJson/JsonParser/JsonObjectBase.h

51 lines
902 B
C
Raw Normal View History

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
#include "jsmn.h"
2014-01-11 15:05:35 +01:00
2014-07-16 13:53:56 +02:00
#ifdef __GNUC__
#define DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#define DEPRECATED __declspec(deprecated)
#else
#define DEPRECATED
#endif
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 JsonObjectBase
{
public:
JsonObjectBase()
: json(0), tokens(0)
{
2014-07-03 14:00:51 +02:00
}
bool success()
{
return json != 0 && tokens != 0;
}
protected:
JsonObjectBase(char* json, jsmntok_t* tokens)
: json(json), tokens(tokens)
2014-07-03 14:00:51 +02:00
{
}
static int getNestedTokenCount(jsmntok_t* token);
char* json;
jsmntok_t* tokens;
};
}
}