Added namespace for the parser

This commit is contained in:
Benoît Blanchon committed 2014-07-03 14:01:45 +02:00
1 parent 78a920a5fc
commit 50b2a1b4a7
12 files changed
+156 -122

No files matched your search

+38 -32
View File
@@ -7,41 +7,47 @@
#include "jsmn.h"
class JsonObjectBase
namespace ArduinoJson
{
public:
namespace Parser
{
class JsonObjectBase
{
public:
JsonObjectBase()
{
makeInvalid();
}
JsonObjectBase()
{
makeInvalid();
}
bool success()
{
return json != 0 && tokens != 0;
}
bool success()
{
return json != 0 && tokens != 0;
}
protected:
JsonObjectBase(char* json, jsmntok_t* tokens)
{
this->json = json;
this->tokens = tokens;
}
void makeInvalid()
{
json = 0;
tokens = 0;
}
static int getNestedTokenCount(jsmntok_t* token);
protected:
bool getBoolFromToken(jsmntok_t* token);
double getDoubleFromToken(jsmntok_t* token);
long getLongFromToken(jsmntok_t* token);
char* getStringFromToken(jsmntok_t* token);
JsonObjectBase(char* json, jsmntok_t* tokens)
{
this->json = json;
this->tokens = tokens;
}
char* json;
jsmntok_t* tokens;
};
void makeInvalid()
{
json = 0;
tokens = 0;
}
static int getNestedTokenCount(jsmntok_t* token);
bool getBoolFromToken(jsmntok_t* token);
double getDoubleFromToken(jsmntok_t* token);
long getLongFromToken(jsmntok_t* token);
char* getStringFromToken(jsmntok_t* token);
char* json;
jsmntok_t* tokens;
};
}
}