Files
ArduinoJson/JsonParser/JsonParserBase.h

49 lines
1.2 KiB
C
Raw Permalink Normal View History

2014-07-14 13:17:30 +02:00
/*
* Arduino JSON library
* Benoit Blanchon 2014 - MIT License
2014-07-22 20:14:25 +02:00
*/
2014-07-14 13:17:30 +02:00
#pragma once
#include "JsonArray.h"
2014-07-18 16:46:01 +02:00
#include "JsonObject.h"
2014-07-14 13:17:30 +02:00
namespace ArduinoJson
{
namespace Parser
{
2014-07-22 20:14:25 +02:00
// Base class for the JSON parser, in case you want to provide your own buffer
2014-07-14 13:17:30 +02:00
class JsonParserBase
{
public:
2014-07-22 20:14:25 +02:00
// Create a JSON parser using the provided buffer
2014-07-14 13:17:30 +02:00
JsonParserBase(jsmntok_t* tokens, int maxTokens)
: tokens(tokens), maxTokens(maxTokens)
{
}
2014-07-22 20:14:25 +02:00
// Parse the JSON string and return a array
//
// The content of the string may be altered to add '\0' at the
// end of string tokens
2014-07-19 15:36:01 +02:00
JsonValue parse(char* json);
2014-07-22 20:14:25 +02:00
// Obsolete: use parse() instead
DEPRECATED JsonArray parseArray(char* json)
2014-07-14 13:17:30 +02:00
{
2014-07-19 15:36:01 +02:00
return parse(json);
2014-07-14 13:17:30 +02:00
}
2014-07-22 20:14:25 +02:00
// Obsolete: use parse() instead
2014-07-18 16:46:01 +02:00
DEPRECATED JsonObject parseHashTable(char* json)
2014-07-14 13:17:30 +02:00
{
2014-07-19 15:36:01 +02:00
return parse(json);
2014-07-14 13:17:30 +02:00
}
private:
jsmntok_t* tokens;
int maxTokens;
};
}
}