forked from bblanchon/ArduinoJson
Added namespace for the parser
This commit is contained in:
@ -6,6 +6,8 @@
|
|||||||
#include "JsonArray.h"
|
#include "JsonArray.h"
|
||||||
#include "JsonHashTable.h"
|
#include "JsonHashTable.h"
|
||||||
|
|
||||||
|
using namespace ArduinoJson::Parser;
|
||||||
|
|
||||||
JsonArray::JsonArray(char* json, jsmntok_t* tokens)
|
JsonArray::JsonArray(char* json, jsmntok_t* tokens)
|
||||||
: JsonObjectBase(json, tokens)
|
: JsonObjectBase(json, tokens)
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
|
|
||||||
#include "JsonObjectBase.h"
|
#include "JsonObjectBase.h"
|
||||||
|
|
||||||
|
namespace ArduinoJson
|
||||||
|
{
|
||||||
|
namespace Parser
|
||||||
|
{
|
||||||
class JsonHashTable;
|
class JsonHashTable;
|
||||||
|
|
||||||
class JsonArray : public JsonObjectBase
|
class JsonArray : public JsonObjectBase
|
||||||
@ -37,3 +41,5 @@ private:
|
|||||||
JsonArray(char* json, jsmntok_t* tokens);
|
JsonArray(char* json, jsmntok_t* tokens);
|
||||||
jsmntok_t* getToken(int index);
|
jsmntok_t* getToken(int index);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -3,10 +3,11 @@
|
|||||||
* Benoit Blanchon 2014 - MIT License
|
* Benoit Blanchon 2014 - MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string.h> // for strcmp()
|
||||||
#include "JsonArray.h"
|
#include "JsonArray.h"
|
||||||
#include "JsonHashTable.h"
|
#include "JsonHashTable.h"
|
||||||
|
|
||||||
#include <string.h> // for strcmp()
|
using namespace ArduinoJson::Parser;
|
||||||
|
|
||||||
JsonHashTable::JsonHashTable(char* json, jsmntok_t* tokens)
|
JsonHashTable::JsonHashTable(char* json, jsmntok_t* tokens)
|
||||||
: JsonObjectBase(json, tokens)
|
: JsonObjectBase(json, tokens)
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
|
|
||||||
#include "JsonObjectBase.h"
|
#include "JsonObjectBase.h"
|
||||||
|
|
||||||
|
namespace ArduinoJson
|
||||||
|
{
|
||||||
|
namespace Parser
|
||||||
|
{
|
||||||
class JsonArray;
|
class JsonArray;
|
||||||
|
|
||||||
class JsonHashTable : public JsonObjectBase
|
class JsonHashTable : public JsonObjectBase
|
||||||
@ -34,3 +38,5 @@ private:
|
|||||||
JsonHashTable(char* json, jsmntok_t* tokens);
|
JsonHashTable(char* json, jsmntok_t* tokens);
|
||||||
jsmntok_t* getToken(const char* key);
|
jsmntok_t* getToken(const char* key);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -3,9 +3,10 @@
|
|||||||
* Benoit Blanchon 2014 - MIT License
|
* Benoit Blanchon 2014 - MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h> // for strtol, strtod
|
||||||
#include "JsonObjectBase.h"
|
#include "JsonObjectBase.h"
|
||||||
|
|
||||||
#include <stdlib.h> // for strtol, strtod
|
using namespace ArduinoJson::Parser;
|
||||||
|
|
||||||
int JsonObjectBase::getNestedTokenCount(jsmntok_t* token)
|
int JsonObjectBase::getNestedTokenCount(jsmntok_t* token)
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
|
|
||||||
#include "jsmn.h"
|
#include "jsmn.h"
|
||||||
|
|
||||||
|
namespace ArduinoJson
|
||||||
|
{
|
||||||
|
namespace Parser
|
||||||
|
{
|
||||||
class JsonObjectBase
|
class JsonObjectBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -45,3 +49,5 @@ protected:
|
|||||||
char* json;
|
char* json;
|
||||||
jsmntok_t* tokens;
|
jsmntok_t* tokens;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -8,6 +8,10 @@
|
|||||||
#include "JsonHashTable.h"
|
#include "JsonHashTable.h"
|
||||||
#include "JsonArray.h"
|
#include "JsonArray.h"
|
||||||
|
|
||||||
|
namespace ArduinoJson
|
||||||
|
{
|
||||||
|
namespace Parser
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* The JSON parser.
|
* The JSON parser.
|
||||||
*
|
*
|
||||||
@ -63,3 +67,5 @@ private:
|
|||||||
|
|
||||||
jsmntok_t tokens[MAX_TOKENS];
|
jsmntok_t tokens[MAX_TOKENS];
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@
|
|||||||
#include "JsonParser.h"
|
#include "JsonParser.h"
|
||||||
|
|
||||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||||
|
using namespace ArduinoJson::Parser;
|
||||||
|
|
||||||
namespace ArduinoJsonParserTests
|
namespace ArduinoJsonParserTests
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "JsonParser.h"
|
#include "JsonParser.h"
|
||||||
|
|
||||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||||
|
using namespace ArduinoJson::Parser;
|
||||||
|
|
||||||
namespace ArduinoJsonParserTests
|
namespace ArduinoJsonParserTests
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||||
|
using namespace ArduinoJson::Parser;
|
||||||
|
|
||||||
namespace ArduinoJsonParserTests
|
namespace ArduinoJsonParserTests
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||||
|
using namespace ArduinoJson::Parser;
|
||||||
|
|
||||||
namespace ArduinoJsonParserTests
|
namespace ArduinoJsonParserTests
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include <JsonParser.h>
|
#include <JsonParser.h>
|
||||||
|
|
||||||
|
using namespace ArduinoJson::Parser;
|
||||||
|
|
||||||
void ParseAnObject()
|
void ParseAnObject()
|
||||||
{
|
{
|
||||||
char json[] = "{\"Name\":\"Blanchon\",\"Skills\":[\"C\",\"C++\",\"C#\"],\"Age\":32,\"Online\":true}";
|
char json[] = "{\"Name\":\"Blanchon\",\"Skills\":[\"C\",\"C++\",\"C#\"],\"Age\":32,\"Online\":true}";
|
||||||
|
Reference in New Issue
Block a user