From 0558244645611f314f47e0fa427f7323ce253eaf Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 7 Sep 2020 12:57:04 +0200 Subject: remove external libraries from main branch --- .../lib/ArduinoJson/StringTraits/ArduinoStream.hpp | 61 ----------------- .../lib/ArduinoJson/StringTraits/CharPointer.hpp | 64 ------------------ .../lib/ArduinoJson/StringTraits/FlashString.hpp | 61 ----------------- include/lib/ArduinoJson/StringTraits/StdStream.hpp | 60 ----------------- include/lib/ArduinoJson/StringTraits/StdString.hpp | 77 ---------------------- .../lib/ArduinoJson/StringTraits/StringTraits.hpp | 36 ---------- 6 files changed, 359 deletions(-) delete mode 100644 include/lib/ArduinoJson/StringTraits/ArduinoStream.hpp delete mode 100644 include/lib/ArduinoJson/StringTraits/CharPointer.hpp delete mode 100644 include/lib/ArduinoJson/StringTraits/FlashString.hpp delete mode 100644 include/lib/ArduinoJson/StringTraits/StdStream.hpp delete mode 100644 include/lib/ArduinoJson/StringTraits/StdString.hpp delete mode 100644 include/lib/ArduinoJson/StringTraits/StringTraits.hpp (limited to 'include/lib/ArduinoJson/StringTraits') diff --git a/include/lib/ArduinoJson/StringTraits/ArduinoStream.hpp b/include/lib/ArduinoJson/StringTraits/ArduinoStream.hpp deleted file mode 100644 index 5db0852..0000000 --- a/include/lib/ArduinoJson/StringTraits/ArduinoStream.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// ArduinoJson - arduinojson.org -// Copyright Benoit Blanchon 2014-2018 -// MIT License - -#pragma once - -#if ARDUINOJSON_ENABLE_ARDUINO_STREAM - -#include - -namespace ArduinoJson { -namespace Internals { - -struct ArduinoStreamTraits { - class Reader { - Stream& _stream; - char _current, _next; - - public: - Reader(Stream& stream) : _stream(stream), _current(0), _next(0) {} - - void move() { - _current = _next; - _next = 0; - } - - char current() { - if (!_current) _current = read(); - return _current; - } - - char next() { - // assumes that current() has been called - if (!_next) _next = read(); - return _next; - } - - private: - char read() { - // don't use _stream.read() as it ignores the timeout - char c = 0; - _stream.readBytes(&c, 1); - return c; - } - }; - - static const bool has_append = false; - static const bool has_equals = false; -}; - -template -struct StringTraits< - TStream, - // match any type that is derived from Stream: - typename EnableIf< - IsBaseOf::type>::value>::type> - : ArduinoStreamTraits {}; -} -} - -#endif diff --git a/include/lib/ArduinoJson/StringTraits/CharPointer.hpp b/include/lib/ArduinoJson/StringTraits/CharPointer.hpp deleted file mode 100644 index 98896cc..0000000 --- a/include/lib/ArduinoJson/StringTraits/CharPointer.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// ArduinoJson - arduinojson.org -// Copyright Benoit Blanchon 2014-2018 -// MIT License - -#pragma once - -namespace ArduinoJson { -namespace Internals { - -template -struct CharPointerTraits { - class Reader { - const TChar* _ptr; - - public: - Reader(const TChar* ptr) - : _ptr(ptr ? ptr : reinterpret_cast("")) {} - - void move() { - ++_ptr; - } - - char current() const { - return char(_ptr[0]); - } - - char next() const { - return char(_ptr[1]); - } - }; - - static bool equals(const TChar* str, const char* expected) { - const char* actual = reinterpret_cast(str); - if (!actual || !expected) return actual == expected; - return strcmp(actual, expected) == 0; - } - - static bool is_null(const TChar* str) { - return !str; - } - - typedef const char* duplicate_t; - - template - static duplicate_t duplicate(const TChar* str, Buffer* buffer) { - if (!str) return NULL; - size_t size = strlen(reinterpret_cast(str)) + 1; - void* dup = buffer->alloc(size); - if (dup != NULL) memcpy(dup, str, size); - return static_cast(dup); - } - - static const bool has_append = false; - static const bool has_equals = true; - static const bool should_duplicate = !IsConst::value; -}; - -// char*, unsigned char*, signed char* -// const char*, const unsigned char*, const signed char* -template -struct StringTraits::value>::type> - : CharPointerTraits {}; -} // namespace Internals -} // namespace ArduinoJson diff --git a/include/lib/ArduinoJson/StringTraits/FlashString.hpp b/include/lib/ArduinoJson/StringTraits/FlashString.hpp deleted file mode 100644 index 0701b9b..0000000 --- a/include/lib/ArduinoJson/StringTraits/FlashString.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// ArduinoJson - arduinojson.org -// Copyright Benoit Blanchon 2014-2018 -// MIT License - -#pragma once - -#if ARDUINOJSON_ENABLE_PROGMEM - -namespace ArduinoJson { -namespace Internals { -template <> -struct StringTraits { - class Reader { - const char* _ptr; - - public: - Reader(const __FlashStringHelper* ptr) - : _ptr(reinterpret_cast(ptr)) {} - - void move() { - _ptr++; - } - - char current() const { - return pgm_read_byte_near(_ptr); - } - - char next() const { - return pgm_read_byte_near(_ptr + 1); - } - }; - - static bool equals(const __FlashStringHelper* str, const char* expected) { - const char* actual = reinterpret_cast(str); - if (!actual || !expected) return actual == expected; - return strcmp_P(expected, actual) == 0; - } - - static bool is_null(const __FlashStringHelper* str) { - return !str; - } - - typedef const char* duplicate_t; - - template - static duplicate_t duplicate(const __FlashStringHelper* str, Buffer* buffer) { - if (!str) return NULL; - size_t size = strlen_P((const char*)str) + 1; - void* dup = buffer->alloc(size); - if (dup != NULL) memcpy_P(dup, (const char*)str, size); - return static_cast(dup); - } - - static const bool has_append = false; - static const bool has_equals = true; - static const bool should_duplicate = true; -}; -} // namespace Internals -} // namespace ArduinoJson - -#endif diff --git a/include/lib/ArduinoJson/StringTraits/StdStream.hpp b/include/lib/ArduinoJson/StringTraits/StdStream.hpp deleted file mode 100644 index 227c744..0000000 --- a/include/lib/ArduinoJson/StringTraits/StdStream.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// ArduinoJson - arduinojson.org -// Copyright Benoit Blanchon 2014-2018 -// MIT License - -#pragma once - -#if ARDUINOJSON_ENABLE_STD_STREAM - -#include - -namespace ArduinoJson { -namespace Internals { - -struct StdStreamTraits { - class Reader { - std::istream& _stream; - char _current, _next; - - public: - Reader(std::istream& stream) : _stream(stream), _current(0), _next(0) {} - - void move() { - _current = _next; - _next = 0; - } - - char current() { - if (!_current) _current = read(); - return _current; - } - - char next() { - // assumes that current() has been called - if (!_next) _next = read(); - return _next; - } - - private: - Reader& operator=(const Reader&); // Visual Studio C4512 - - char read() { - return _stream.eof() ? '\0' : static_cast(_stream.get()); - } - }; - - static const bool has_append = false; - static const bool has_equals = false; -}; - -template -struct StringTraits< - TStream, - // match any type that is derived from std::istream: - typename EnableIf::type>::value>::type> - : StdStreamTraits {}; -} -} - -#endif diff --git a/include/lib/ArduinoJson/StringTraits/StdString.hpp b/include/lib/ArduinoJson/StringTraits/StdString.hpp deleted file mode 100644 index 35f4461..0000000 --- a/include/lib/ArduinoJson/StringTraits/StdString.hpp +++ /dev/null @@ -1,77 +0,0 @@ -// ArduinoJson - arduinojson.org -// Copyright Benoit Blanchon 2014-2018 -// MIT License - -#pragma once - -#if ARDUINOJSON_ENABLE_STD_STRING || ARDUINOJSON_ENABLE_ARDUINO_STRING - -#if ARDUINOJSON_ENABLE_ARDUINO_STRING -#include -#endif - -#if ARDUINOJSON_ENABLE_STD_STRING -#include -#endif - -namespace ArduinoJson { -namespace Internals { - -template -struct StdStringTraits { - typedef const char* duplicate_t; - - template - static duplicate_t duplicate(const TString& str, Buffer* buffer) { - if (!str.c_str()) return NULL; // <- Arduino string can return NULL - size_t size = str.length() + 1; - void* dup = buffer->alloc(size); - if (dup != NULL) memcpy(dup, str.c_str(), size); - return static_cast(dup); - } - - static bool is_null(const TString& str) { - // Arduino's String::c_str() can return NULL - return !str.c_str(); - } - - struct Reader : CharPointerTraits::Reader { - Reader(const TString& str) : CharPointerTraits::Reader(str.c_str()) {} - }; - - static bool equals(const TString& str, const char* expected) { - // Arduino's String::c_str() can return NULL - const char* actual = str.c_str(); - if (!actual || !expected) return actual == expected; - return 0 == strcmp(actual, expected); - } - - static void append(TString& str, char c) { - str += c; - } - - static void append(TString& str, const char* s) { - str += s; - } - - static const bool has_append = true; - static const bool has_equals = true; - static const bool should_duplicate = true; -}; - -#if ARDUINOJSON_ENABLE_ARDUINO_STRING -template <> -struct StringTraits : StdStringTraits {}; -template <> -struct StringTraits : StdStringTraits { -}; -#endif - -#if ARDUINOJSON_ENABLE_STD_STRING -template <> -struct StringTraits : StdStringTraits {}; -#endif -} // namespace Internals -} // namespace ArduinoJson - -#endif diff --git a/include/lib/ArduinoJson/StringTraits/StringTraits.hpp b/include/lib/ArduinoJson/StringTraits/StringTraits.hpp deleted file mode 100644 index dd5694b..0000000 --- a/include/lib/ArduinoJson/StringTraits/StringTraits.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// ArduinoJson - arduinojson.org -// Copyright Benoit Blanchon 2014-2018 -// MIT License - -#pragma once - -#include -#include "../Configuration.hpp" -#include "../TypeTraits/EnableIf.hpp" -#include "../TypeTraits/IsBaseOf.hpp" -#include "../TypeTraits/IsChar.hpp" -#include "../TypeTraits/IsConst.hpp" -#include "../TypeTraits/RemoveReference.hpp" - -namespace ArduinoJson { -namespace Internals { - -template -struct StringTraits { - static const bool has_append = false; - static const bool has_equals = false; -}; - -template -struct StringTraits : StringTraits {}; - -template -struct StringTraits : StringTraits {}; -} -} - -#include "ArduinoStream.hpp" -#include "CharPointer.hpp" -#include "FlashString.hpp" -#include "StdStream.hpp" -#include "StdString.hpp" -- cgit v1.2.3