Line | |
---|
1 | // Copyright Benoit Blanchon 2014-2016
|
---|
2 | // MIT License
|
---|
3 | //
|
---|
4 | // Arduino JSON library
|
---|
5 | // https://github.com/bblanchon/ArduinoJson
|
---|
6 | // If you like this project, please add a star!
|
---|
7 |
|
---|
8 | #pragma once
|
---|
9 |
|
---|
10 | #include "../JsonBuffer.hpp"
|
---|
11 | #include "../JsonVariant.hpp"
|
---|
12 |
|
---|
13 | namespace ArduinoJson {
|
---|
14 | namespace Internals {
|
---|
15 |
|
---|
16 | // Parse JSON string to create JsonArrays and JsonObjects
|
---|
17 | // This internal class is not indended to be used directly.
|
---|
18 | // Instead, use JsonBuffer.parseArray() or .parseObject()
|
---|
19 | class JsonParser {
|
---|
20 | public:
|
---|
21 | JsonParser(JsonBuffer *buffer, char *json, uint8_t nestingLimit)
|
---|
22 | : _buffer(buffer),
|
---|
23 | _readPtr(json ? json : ""),
|
---|
24 | _writePtr(json),
|
---|
25 | _nestingLimit(nestingLimit) {}
|
---|
26 |
|
---|
27 | JsonArray &parseArray();
|
---|
28 | JsonObject &parseObject();
|
---|
29 |
|
---|
30 | private:
|
---|
31 | bool skip(char charToSkip);
|
---|
32 |
|
---|
33 | const char *parseString();
|
---|
34 | bool parseAnythingTo(JsonVariant *destination);
|
---|
35 | FORCE_INLINE bool parseAnythingToUnsafe(JsonVariant *destination);
|
---|
36 |
|
---|
37 | inline bool parseArrayTo(JsonVariant *destination);
|
---|
38 | inline bool parseObjectTo(JsonVariant *destination);
|
---|
39 | inline bool parseStringTo(JsonVariant *destination);
|
---|
40 |
|
---|
41 | JsonBuffer *_buffer;
|
---|
42 | const char *_readPtr;
|
---|
43 | char *_writePtr;
|
---|
44 | uint8_t _nestingLimit;
|
---|
45 | };
|
---|
46 | }
|
---|
47 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.