diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2020-09-07 12:57:04 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2020-09-07 12:57:04 +0200 |
commit | 0558244645611f314f47e0fa427f7323ce253eaf (patch) | |
tree | 824bcd55ec8577703345106d0a08e167407500a7 /include/lib/ArduinoJson/Deserialization/JsonParser.hpp | |
parent | 0248c6352f2117e50fac71dd632a79d8fa4f8737 (diff) |
remove external libraries from main branch
Diffstat (limited to 'include/lib/ArduinoJson/Deserialization/JsonParser.hpp')
-rw-r--r-- | include/lib/ArduinoJson/Deserialization/JsonParser.hpp | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/include/lib/ArduinoJson/Deserialization/JsonParser.hpp b/include/lib/ArduinoJson/Deserialization/JsonParser.hpp deleted file mode 100644 index 4cbaf45..0000000 --- a/include/lib/ArduinoJson/Deserialization/JsonParser.hpp +++ /dev/null @@ -1,102 +0,0 @@ -// ArduinoJson - arduinojson.org -// Copyright Benoit Blanchon 2014-2018 -// MIT License - -#pragma once - -#include "../JsonBuffer.hpp" -#include "../JsonVariant.hpp" -#include "../TypeTraits/IsConst.hpp" -#include "StringWriter.hpp" - -namespace ArduinoJson { -namespace Internals { - -// Parse JSON string to create JsonArrays and JsonObjects -// This internal class is not indended to be used directly. -// Instead, use JsonBuffer.parseArray() or .parseObject() -template <typename TReader, typename TWriter> -class JsonParser { - public: - JsonParser(JsonBuffer *buffer, TReader reader, TWriter writer, - uint8_t nestingLimit) - : _buffer(buffer), - _reader(reader), - _writer(writer), - _nestingLimit(nestingLimit) {} - - JsonArray &parseArray(); - JsonObject &parseObject(); - - JsonVariant parseVariant() { - JsonVariant result; - parseAnythingTo(&result); - return result; - } - - private: - JsonParser &operator=(const JsonParser &); // non-copiable - - static bool eat(TReader &, char charToSkip); - FORCE_INLINE bool eat(char charToSkip) { - return eat(_reader, charToSkip); - } - - const char *parseString(); - bool parseAnythingTo(JsonVariant *destination); - - inline bool parseArrayTo(JsonVariant *destination); - inline bool parseObjectTo(JsonVariant *destination); - inline bool parseStringTo(JsonVariant *destination); - - static inline bool isBetween(char c, char min, char max) { - return min <= c && c <= max; - } - - static inline bool canBeInNonQuotedString(char c) { - return isBetween(c, '0', '9') || isBetween(c, '_', 'z') || - isBetween(c, 'A', 'Z') || c == '+' || c == '-' || c == '.'; - } - - static inline bool isQuote(char c) { - return c == '\'' || c == '\"'; - } - - JsonBuffer *_buffer; - TReader _reader; - TWriter _writer; - uint8_t _nestingLimit; -}; - -template <typename TJsonBuffer, typename TString, typename Enable = void> -struct JsonParserBuilder { - typedef typename StringTraits<TString>::Reader InputReader; - typedef JsonParser<InputReader, TJsonBuffer &> TParser; - - static TParser makeParser(TJsonBuffer *buffer, TString &json, - uint8_t nestingLimit) { - return TParser(buffer, InputReader(json), *buffer, nestingLimit); - } -}; - -template <typename TJsonBuffer, typename TChar> -struct JsonParserBuilder<TJsonBuffer, TChar *, - typename EnableIf<!IsConst<TChar>::value>::type> { - typedef typename StringTraits<TChar *>::Reader TReader; - typedef StringWriter<TChar> TWriter; - typedef JsonParser<TReader, TWriter> TParser; - - static TParser makeParser(TJsonBuffer *buffer, TChar *json, - uint8_t nestingLimit) { - return TParser(buffer, TReader(json), TWriter(json), nestingLimit); - } -}; - -template <typename TJsonBuffer, typename TString> -inline typename JsonParserBuilder<TJsonBuffer, TString>::TParser makeParser( - TJsonBuffer *buffer, TString &json, uint8_t nestingLimit) { - return JsonParserBuilder<TJsonBuffer, TString>::makeParser(buffer, json, - nestingLimit); -} -} // namespace Internals -} // namespace ArduinoJson |