summaryrefslogtreecommitdiff
path: root/include/lib/ArduinoJson/Polyfills
diff options
context:
space:
mode:
Diffstat (limited to 'include/lib/ArduinoJson/Polyfills')
-rw-r--r--include/lib/ArduinoJson/Polyfills/alias_cast.hpp29
-rw-r--r--include/lib/ArduinoJson/Polyfills/assert.hpp14
-rw-r--r--include/lib/ArduinoJson/Polyfills/attributes.hpp54
-rw-r--r--include/lib/ArduinoJson/Polyfills/ctype.hpp20
-rw-r--r--include/lib/ArduinoJson/Polyfills/integer.hpp30
-rw-r--r--include/lib/ArduinoJson/Polyfills/limits.hpp45
-rw-r--r--include/lib/ArduinoJson/Polyfills/math.hpp27
-rw-r--r--include/lib/ArduinoJson/Polyfills/mpl/max.hpp26
-rw-r--r--include/lib/ArduinoJson/Polyfills/pgmspace.hpp79
-rw-r--r--include/lib/ArduinoJson/Polyfills/pgmspace_generic.hpp32
-rw-r--r--include/lib/ArduinoJson/Polyfills/preprocessor.hpp35
-rw-r--r--include/lib/ArduinoJson/Polyfills/safe_strcmp.hpp32
-rw-r--r--include/lib/ArduinoJson/Polyfills/static_array.hpp34
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits.hpp24
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/conditional.hpp20
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/declval.hpp14
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/enable_if.hpp19
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/integral_constant.hpp19
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/is_array.hpp21
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/is_base_of.hpp26
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/is_class.hpp26
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/is_const.hpp17
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/is_convertible.hpp47
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/is_enum.hpp22
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/is_floating_point.hpp19
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/is_integral.hpp33
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/is_pointer.hpp16
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/is_same.hpp17
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/is_signed.hpp43
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/is_unsigned.hpp37
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/make_unsigned.hpp49
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/remove_const.hpp20
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/remove_reference.hpp20
-rw-r--r--include/lib/ArduinoJson/Polyfills/type_traits/type_identity.hpp15
-rw-r--r--include/lib/ArduinoJson/Polyfills/utility.hpp28
35 files changed, 1009 insertions, 0 deletions
diff --git a/include/lib/ArduinoJson/Polyfills/alias_cast.hpp b/include/lib/ArduinoJson/Polyfills/alias_cast.hpp
new file mode 100644
index 0000000..8f8e277
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/alias_cast.hpp
@@ -0,0 +1,29 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <stdint.h>
+#include <stdlib.h> // for size_t
+
+#include <ArduinoJson/Configuration.hpp>
+#include "math.hpp"
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename T, typename F>
+struct alias_cast_t {
+ union {
+ F raw;
+ T data;
+ };
+};
+
+template <typename T, typename F>
+T alias_cast(F raw_data) {
+ alias_cast_t<T, F> ac;
+ ac.raw = raw_data;
+ return ac.data;
+}
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/assert.hpp b/include/lib/ArduinoJson/Polyfills/assert.hpp
new file mode 100644
index 0000000..1030ec6
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/assert.hpp
@@ -0,0 +1,14 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Configuration.hpp>
+
+#if ARDUINOJSON_DEBUG
+#include <assert.h>
+#define ARDUINOJSON_ASSERT(X) assert(X)
+#else
+#define ARDUINOJSON_ASSERT(X) ((void)0)
+#endif
diff --git a/include/lib/ArduinoJson/Polyfills/attributes.hpp b/include/lib/ArduinoJson/Polyfills/attributes.hpp
new file mode 100644
index 0000000..f04c9ac
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/attributes.hpp
@@ -0,0 +1,54 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#ifdef _MSC_VER // Visual Studio
+
+#define FORCE_INLINE // __forceinline causes C4714 when returning std::string
+#define NO_INLINE __declspec(noinline)
+
+#ifndef ARDUINOJSON_DEPRECATED
+#define ARDUINOJSON_DEPRECATED(msg) __declspec(deprecated(msg))
+#endif
+
+#elif defined(__GNUC__) // GCC or Clang
+
+#define FORCE_INLINE __attribute__((always_inline))
+#define NO_INLINE __attribute__((noinline))
+
+#ifndef ARDUINOJSON_DEPRECATED
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+#define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated(msg)))
+#else
+#define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated))
+#endif
+#endif
+
+#else // Other compilers
+
+#define FORCE_INLINE
+#define NO_INLINE
+
+#ifndef ARDUINOJSON_DEPRECATED
+#define ARDUINOJSON_DEPRECATED(msg)
+#endif
+
+#endif
+
+#if __cplusplus >= 201103L
+#define NOEXCEPT noexcept
+#else
+#define NOEXCEPT throw()
+#endif
+
+#if defined(__has_attribute)
+#if __has_attribute(no_sanitize)
+#define ARDUINOJSON_NO_SANITIZE(check) __attribute__((no_sanitize(check)))
+#else
+#define ARDUINOJSON_NO_SANITIZE(check)
+#endif
+#else
+#define ARDUINOJSON_NO_SANITIZE(check)
+#endif
diff --git a/include/lib/ArduinoJson/Polyfills/ctype.hpp b/include/lib/ArduinoJson/Polyfills/ctype.hpp
new file mode 100644
index 0000000..bd7a8cc
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/ctype.hpp
@@ -0,0 +1,20 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+
+namespace ARDUINOJSON_NAMESPACE {
+
+#ifndef isdigit
+inline bool isdigit(char c) {
+ return '0' <= c && c <= '9';
+}
+#endif
+
+inline bool issign(char c) {
+ return '-' == c || c == '+';
+}
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/integer.hpp b/include/lib/ArduinoJson/Polyfills/integer.hpp
new file mode 100644
index 0000000..066c7b8
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/integer.hpp
@@ -0,0 +1,30 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <stdint.h> // int8_t, int16_t
+
+#include <ArduinoJson/Namespace.hpp>
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <int Bits>
+struct int_t;
+
+template <>
+struct int_t<8> {
+ typedef int8_t type;
+};
+
+template <>
+struct int_t<16> {
+ typedef int16_t type;
+};
+
+template <>
+struct int_t<32> {
+ typedef int32_t type;
+};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/limits.hpp b/include/lib/ArduinoJson/Polyfills/limits.hpp
new file mode 100644
index 0000000..8004828
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/limits.hpp
@@ -0,0 +1,45 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "type_traits.hpp"
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4310)
+#endif
+
+namespace ARDUINOJSON_NAMESPACE {
+
+// Differs from standard because we can't use the symbols "min" and "max"
+template <typename T, typename Enable = void>
+struct numeric_limits;
+
+template <typename T>
+struct numeric_limits<T, typename enable_if<is_unsigned<T>::value>::type> {
+ static T lowest() {
+ return 0;
+ }
+ static T highest() {
+ return T(-1);
+ }
+};
+
+template <typename T>
+struct numeric_limits<
+ T, typename enable_if<is_integral<T>::value && is_signed<T>::value>::type> {
+ static T lowest() {
+ return T(T(1) << (sizeof(T) * 8 - 1));
+ }
+ static T highest() {
+ return T(~lowest());
+ }
+};
+
+} // namespace ARDUINOJSON_NAMESPACE
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
diff --git a/include/lib/ArduinoJson/Polyfills/math.hpp b/include/lib/ArduinoJson/Polyfills/math.hpp
new file mode 100644
index 0000000..eff272a
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/math.hpp
@@ -0,0 +1,27 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+
+namespace ARDUINOJSON_NAMESPACE {
+
+// Some libraries #define isnan() and isinf() so we need to check before
+// using this name
+
+#ifndef isnan
+template <typename T>
+bool isnan(T x) {
+ return x != x;
+}
+#endif
+
+#ifndef isinf
+template <typename T>
+bool isinf(T x) {
+ return x != 0.0 && x * 2 == x;
+}
+#endif
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/mpl/max.hpp b/include/lib/ArduinoJson/Polyfills/mpl/max.hpp
new file mode 100644
index 0000000..9ac47a5
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/mpl/max.hpp
@@ -0,0 +1,26 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+
+#include <stddef.h> // for size_t
+
+namespace ARDUINOJSON_NAMESPACE {
+
+// A meta-function that returns the highest value
+template <size_t X, size_t Y, bool MaxIsX = (X > Y)>
+struct Max {};
+
+template <size_t X, size_t Y>
+struct Max<X, Y, true> {
+ static const size_t value = X;
+};
+
+template <size_t X, size_t Y>
+struct Max<X, Y, false> {
+ static const size_t value = Y;
+};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/pgmspace.hpp b/include/lib/ArduinoJson/Polyfills/pgmspace.hpp
new file mode 100644
index 0000000..f253818
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/pgmspace.hpp
@@ -0,0 +1,79 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Configuration.hpp>
+#include <ArduinoJson/Namespace.hpp>
+#include <ArduinoJson/Polyfills/assert.hpp>
+
+namespace ARDUINOJSON_NAMESPACE {
+// Wraps a const char* so that the our functions are picked only if the
+// originals are missing
+struct pgm_p {
+ pgm_p(const char* p) : address(p) {}
+ const char* address;
+};
+} // namespace ARDUINOJSON_NAMESPACE
+
+#ifndef strlen_P
+inline size_t strlen_P(ARDUINOJSON_NAMESPACE::pgm_p s) {
+ const char* p = s.address;
+ ARDUINOJSON_ASSERT(p != NULL);
+ while (pgm_read_byte(p)) p++;
+ return size_t(p - s.address);
+}
+#endif
+
+#ifndef strncmp_P
+inline int strncmp_P(const char* a, ARDUINOJSON_NAMESPACE::pgm_p b, size_t n) {
+ const char* s1 = a;
+ const char* s2 = b.address;
+ ARDUINOJSON_ASSERT(s1 != NULL);
+ ARDUINOJSON_ASSERT(s2 != NULL);
+ while (n-- > 0) {
+ char c1 = *s1++;
+ char c2 = static_cast<char>(pgm_read_byte(s2++));
+ if (c1 < c2)
+ return -1;
+ if (c1 > c2)
+ return 1;
+ if (c1 == 0 /* and c2 as well */)
+ return 0;
+ }
+ return 0;
+}
+#endif
+
+#ifndef strcmp_P
+inline int strcmp_P(const char* a, ARDUINOJSON_NAMESPACE::pgm_p b) {
+ const char* s1 = a;
+ const char* s2 = b.address;
+ ARDUINOJSON_ASSERT(s1 != NULL);
+ ARDUINOJSON_ASSERT(s2 != NULL);
+ for (;;) {
+ char c1 = *s1++;
+ char c2 = static_cast<char>(pgm_read_byte(s2++));
+ if (c1 < c2)
+ return -1;
+ if (c1 > c2)
+ return 1;
+ if (c1 == 0 /* and c2 as well */)
+ return 0;
+ }
+}
+#endif
+
+#ifndef memcpy_P
+inline void* memcpy_P(void* dst, ARDUINOJSON_NAMESPACE::pgm_p src, size_t n) {
+ uint8_t* d = reinterpret_cast<uint8_t*>(dst);
+ const char* s = src.address;
+ ARDUINOJSON_ASSERT(d != NULL);
+ ARDUINOJSON_ASSERT(s != NULL);
+ while (n-- > 0) {
+ *d++ = pgm_read_byte(s++);
+ }
+ return dst;
+}
+#endif
diff --git a/include/lib/ArduinoJson/Polyfills/pgmspace_generic.hpp b/include/lib/ArduinoJson/Polyfills/pgmspace_generic.hpp
new file mode 100644
index 0000000..f5bbd85
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/pgmspace_generic.hpp
@@ -0,0 +1,32 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+#include <ArduinoJson/Polyfills/type_traits.hpp>
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename T>
+typename enable_if<is_pointer<T>::value, T>::type pgm_read(const void* p) {
+ return reinterpret_cast<T>(pgm_read_ptr(p));
+}
+
+template <typename T>
+typename enable_if<is_floating_point<T>::value &&
+ sizeof(T) == sizeof(float), // on AVR sizeof(double) ==
+ // sizeof(float)
+ T>::type
+pgm_read(const void* p) {
+ return pgm_read_float(p);
+}
+
+template <typename T>
+typename enable_if<is_same<T, uint32_t>::value, T>::type pgm_read(
+ const void* p) {
+ return pgm_read_dword(p);
+}
+
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/preprocessor.hpp b/include/lib/ArduinoJson/Polyfills/preprocessor.hpp
new file mode 100644
index 0000000..488654b
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/preprocessor.hpp
@@ -0,0 +1,35 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#define ARDUINOJSON_EXPAND6(a, b, c, d, e, f) a, b, c, d, e, f
+#define ARDUINOJSON_EXPAND9(a, b, c, d, e, f, g, h, i) a, b, c, d, e, f, g, h, i
+#define ARDUINOJSON_EXPAND18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, \
+ q, r) \
+ a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r
+
+#define ARDUINOJSON_CONCAT_(A, B) A##B
+#define ARDUINOJSON_CONCAT2(A, B) ARDUINOJSON_CONCAT_(A, B)
+#define ARDUINOJSON_CONCAT4(A, B, C, D) \
+ ARDUINOJSON_CONCAT2(ARDUINOJSON_CONCAT2(A, B), ARDUINOJSON_CONCAT2(C, D))
+
+#define ARDUINOJSON_HEX_DIGIT_0000() 0
+#define ARDUINOJSON_HEX_DIGIT_0001() 1
+#define ARDUINOJSON_HEX_DIGIT_0010() 2
+#define ARDUINOJSON_HEX_DIGIT_0011() 3
+#define ARDUINOJSON_HEX_DIGIT_0100() 4
+#define ARDUINOJSON_HEX_DIGIT_0101() 5
+#define ARDUINOJSON_HEX_DIGIT_0110() 6
+#define ARDUINOJSON_HEX_DIGIT_0111() 7
+#define ARDUINOJSON_HEX_DIGIT_1000() 8
+#define ARDUINOJSON_HEX_DIGIT_1001() 9
+#define ARDUINOJSON_HEX_DIGIT_1010() A
+#define ARDUINOJSON_HEX_DIGIT_1011() B
+#define ARDUINOJSON_HEX_DIGIT_1100() C
+#define ARDUINOJSON_HEX_DIGIT_1101() D
+#define ARDUINOJSON_HEX_DIGIT_1110() E
+#define ARDUINOJSON_HEX_DIGIT_1111() F
+#define ARDUINOJSON_HEX_DIGIT_(A, B, C, D) ARDUINOJSON_HEX_DIGIT_##A##B##C##D()
+#define ARDUINOJSON_HEX_DIGIT(A, B, C, D) ARDUINOJSON_HEX_DIGIT_(A, B, C, D)
diff --git a/include/lib/ArduinoJson/Polyfills/safe_strcmp.hpp b/include/lib/ArduinoJson/Polyfills/safe_strcmp.hpp
new file mode 100644
index 0000000..e017b5d
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/safe_strcmp.hpp
@@ -0,0 +1,32 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+
+#include <stdint.h> // int8_t
+
+namespace ARDUINOJSON_NAMESPACE {
+
+inline int safe_strcmp(const char* a, const char* b) {
+ if (a == b)
+ return 0;
+ if (!a)
+ return -1;
+ if (!b)
+ return 1;
+ return strcmp(a, b);
+}
+
+inline int safe_strncmp(const char* a, const char* b, size_t n) {
+ if (a == b)
+ return 0;
+ if (!a)
+ return -1;
+ if (!b)
+ return 1;
+ return strncmp(a, b, n);
+}
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/static_array.hpp b/include/lib/ArduinoJson/Polyfills/static_array.hpp
new file mode 100644
index 0000000..a877b4c
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/static_array.hpp
@@ -0,0 +1,34 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Configuration.hpp>
+
+#if ARDUINOJSON_ENABLE_PROGMEM
+
+#include <ArduinoJson/Polyfills/pgmspace_generic.hpp>
+
+#ifndef ARDUINOJSON_DEFINE_STATIC_ARRAY
+#define ARDUINOJSON_DEFINE_STATIC_ARRAY(type, name, value) \
+ static type const name[] PROGMEM = value;
+#endif
+
+#ifndef ARDUINOJSON_READ_STATIC_ARRAY
+#define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) \
+ pgm_read<type>(name + index)
+#endif
+
+#else // i.e. ARDUINOJSON_ENABLE_PROGMEM == 0
+
+#ifndef ARDUINOJSON_DEFINE_STATIC_ARRAY
+#define ARDUINOJSON_DEFINE_STATIC_ARRAY(type, name, value) \
+ static type const name[] = value;
+#endif
+
+#ifndef ARDUINOJSON_READ_STATIC_ARRAY
+#define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) name[index]
+#endif
+
+#endif
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits.hpp b/include/lib/ArduinoJson/Polyfills/type_traits.hpp
new file mode 100644
index 0000000..4a8ff4b
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits.hpp
@@ -0,0 +1,24 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "type_traits/conditional.hpp"
+#include "type_traits/enable_if.hpp"
+#include "type_traits/integral_constant.hpp"
+#include "type_traits/is_array.hpp"
+#include "type_traits/is_base_of.hpp"
+#include "type_traits/is_class.hpp"
+#include "type_traits/is_const.hpp"
+#include "type_traits/is_convertible.hpp"
+#include "type_traits/is_enum.hpp"
+#include "type_traits/is_floating_point.hpp"
+#include "type_traits/is_integral.hpp"
+#include "type_traits/is_pointer.hpp"
+#include "type_traits/is_same.hpp"
+#include "type_traits/is_signed.hpp"
+#include "type_traits/is_unsigned.hpp"
+#include "type_traits/make_unsigned.hpp"
+#include "type_traits/remove_const.hpp"
+#include "type_traits/remove_reference.hpp"
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/conditional.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/conditional.hpp
new file mode 100644
index 0000000..e42d1bb
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/conditional.hpp
@@ -0,0 +1,20 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <bool Condition, class TrueType, class FalseType>
+struct conditional {
+ typedef TrueType type;
+};
+
+template <class TrueType, class FalseType>
+struct conditional<false, TrueType, FalseType> {
+ typedef FalseType type;
+};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/declval.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/declval.hpp
new file mode 100644
index 0000000..8708112
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/declval.hpp
@@ -0,0 +1,14 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename T>
+T declval();
+
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/enable_if.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/enable_if.hpp
new file mode 100644
index 0000000..cc29b33
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/enable_if.hpp
@@ -0,0 +1,19 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+
+namespace ARDUINOJSON_NAMESPACE {
+
+// A meta-function that return the type T if Condition is true.
+template <bool Condition, typename T = void>
+struct enable_if {};
+
+template <typename T>
+struct enable_if<true, T> {
+ typedef T type;
+};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/integral_constant.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/integral_constant.hpp
new file mode 100644
index 0000000..b53d711
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/integral_constant.hpp
@@ -0,0 +1,19 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename T, T v>
+struct integral_constant {
+ static const T value = v;
+};
+
+typedef integral_constant<bool, true> true_type;
+typedef integral_constant<bool, false> false_type;
+
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/is_array.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/is_array.hpp
new file mode 100644
index 0000000..ee739a7
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/is_array.hpp
@@ -0,0 +1,21 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+
+#include <stddef.h> // size_t
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename T>
+struct is_array : false_type {};
+
+template <typename T>
+struct is_array<T[]> : true_type {};
+
+template <typename T, size_t N>
+struct is_array<T[N]> : true_type {};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/is_base_of.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/is_base_of.hpp
new file mode 100644
index 0000000..32b41cd
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/is_base_of.hpp
@@ -0,0 +1,26 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+
+namespace ARDUINOJSON_NAMESPACE {
+
+// A meta-function that returns true if Derived inherits from TBase is an
+// integral type.
+template <typename TBase, typename TDerived>
+class is_base_of {
+ protected: // <- to avoid GCC's "all member functions in class are private"
+ typedef char Yes[1];
+ typedef char No[2];
+
+ static Yes &probe(const TBase *);
+ static No &probe(...);
+
+ public:
+ static const bool value =
+ sizeof(probe(reinterpret_cast<TDerived *>(0))) == sizeof(Yes);
+};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/is_class.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/is_class.hpp
new file mode 100644
index 0000000..a3808f3
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/is_class.hpp
@@ -0,0 +1,26 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "declval.hpp"
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename T>
+struct is_class {
+ protected: // <- to avoid GCC's "all member functions in class are private"
+ typedef char Yes[1];
+ typedef char No[2];
+
+ template <typename U>
+ static Yes &probe(void (U::*)(void));
+ template <typename>
+ static No &probe(...);
+
+ public:
+ static const bool value = sizeof(probe<T>(0)) == sizeof(Yes);
+};
+
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/is_const.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/is_const.hpp
new file mode 100644
index 0000000..32e758c
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/is_const.hpp
@@ -0,0 +1,17 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "integral_constant.hpp"
+
+namespace ARDUINOJSON_NAMESPACE {
+
+// A meta-function that return the type T without the const modifier
+template <typename T>
+struct is_const : false_type {};
+
+template <typename T>
+struct is_const<const T> : true_type {};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/is_convertible.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/is_convertible.hpp
new file mode 100644
index 0000000..847525a
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/is_convertible.hpp
@@ -0,0 +1,47 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "declval.hpp"
+
+#ifdef _MSC_VER
+#pragma warning(push)
+// conversion from 'T' to 'To', possible loss of data
+#pragma warning(disable : 4244)
+#endif
+
+// clang-format off
+#ifdef __ICCARM__
+// Suppress IAR Compiler Warning[Pa093]: implicit conversion from floating point to integer
+#pragma diag_suppress=Pa093
+#endif
+// clang-format on
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename From, typename To>
+struct is_convertible {
+ protected: // <- to avoid GCC's "all member functions in class are private"
+ typedef char Yes[1];
+ typedef char No[2];
+
+ static Yes &probe(To);
+ static No &probe(...);
+
+ public:
+ static const bool value = sizeof(probe(declval<From>())) == sizeof(Yes);
+};
+
+} // namespace ARDUINOJSON_NAMESPACE
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+// clang-format off
+#ifdef __ICCARM__
+#pragma diag_default=Pa093
+#endif
+// clang-format on
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/is_enum.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/is_enum.hpp
new file mode 100644
index 0000000..26aec1d
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/is_enum.hpp
@@ -0,0 +1,22 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "is_class.hpp"
+#include "is_convertible.hpp"
+#include "is_floating_point.hpp"
+#include "is_integral.hpp"
+#include "is_same.hpp"
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename T>
+struct is_enum {
+ static const bool value = is_convertible<T, int>::value &&
+ !is_class<T>::value && !is_integral<T>::value &&
+ !is_floating_point<T>::value;
+};
+
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/is_floating_point.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/is_floating_point.hpp
new file mode 100644
index 0000000..b7e9d3d
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/is_floating_point.hpp
@@ -0,0 +1,19 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "integral_constant.hpp"
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename>
+struct is_floating_point : false_type {};
+
+template <>
+struct is_floating_point<float> : true_type {};
+
+template <>
+struct is_floating_point<double> : true_type {};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/is_integral.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/is_integral.hpp
new file mode 100644
index 0000000..26e895c
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/is_integral.hpp
@@ -0,0 +1,33 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Configuration.hpp>
+#include "is_same.hpp"
+
+namespace ARDUINOJSON_NAMESPACE {
+
+// A meta-function that returns true if T is an integral type.
+template <typename T>
+struct is_integral {
+ static const bool value =
+ is_same<T, signed char>::value || is_same<T, unsigned char>::value ||
+ is_same<T, signed short>::value || is_same<T, unsigned short>::value ||
+ is_same<T, signed int>::value || is_same<T, unsigned int>::value ||
+ is_same<T, signed long>::value || is_same<T, unsigned long>::value ||
+#if ARDUINOJSON_HAS_LONG_LONG
+ is_same<T, signed long long>::value ||
+ is_same<T, unsigned long long>::value ||
+#endif
+#if ARDUINOJSON_HAS_INT64
+ is_same<T, signed __int64>::value ||
+ is_same<T, unsigned __int64>::value ||
+#endif
+ is_same<T, char>::value || is_same<T, bool>::value;
+};
+
+template <typename T>
+struct is_integral<const T> : is_integral<T> {};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/is_pointer.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/is_pointer.hpp
new file mode 100644
index 0000000..a249539
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/is_pointer.hpp
@@ -0,0 +1,16 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "integral_constant.hpp"
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename T>
+struct is_pointer : false_type {};
+
+template <typename T>
+struct is_pointer<T*> : true_type {};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/is_same.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/is_same.hpp
new file mode 100644
index 0000000..db5da9b
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/is_same.hpp
@@ -0,0 +1,17 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "integral_constant.hpp"
+
+namespace ARDUINOJSON_NAMESPACE {
+
+// A meta-function that returns true if types T and U are the same.
+template <typename T, typename U>
+struct is_same : false_type {};
+
+template <typename T>
+struct is_same<T, T> : true_type {};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/is_signed.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/is_signed.hpp
new file mode 100644
index 0000000..fbb701c
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/is_signed.hpp
@@ -0,0 +1,43 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "integral_constant.hpp"
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename>
+struct is_signed : false_type {};
+
+template <>
+struct is_signed<char> : true_type {};
+
+template <>
+struct is_signed<signed char> : true_type {};
+
+template <>
+struct is_signed<signed short> : true_type {};
+
+template <>
+struct is_signed<signed int> : true_type {};
+
+template <>
+struct is_signed<signed long> : true_type {};
+
+template <>
+struct is_signed<float> : true_type {};
+
+template <>
+struct is_signed<double> : true_type {};
+
+#if ARDUINOJSON_HAS_LONG_LONG
+template <>
+struct is_signed<signed long long> : true_type {};
+#endif
+
+#if ARDUINOJSON_HAS_INT64
+template <>
+struct is_signed<signed __int64> : true_type {};
+#endif
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/is_unsigned.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/is_unsigned.hpp
new file mode 100644
index 0000000..be26498
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/is_unsigned.hpp
@@ -0,0 +1,37 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "integral_constant.hpp"
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename>
+struct is_unsigned : false_type {};
+
+template <>
+struct is_unsigned<bool> : true_type {};
+
+template <>
+struct is_unsigned<unsigned char> : true_type {};
+
+template <>
+struct is_unsigned<unsigned short> : true_type {};
+
+template <>
+struct is_unsigned<unsigned int> : true_type {};
+
+template <>
+struct is_unsigned<unsigned long> : true_type {};
+
+#if ARDUINOJSON_HAS_INT64
+template <>
+struct is_unsigned<unsigned __int64> : true_type {};
+#endif
+
+#if ARDUINOJSON_HAS_LONG_LONG
+template <>
+struct is_unsigned<unsigned long long> : true_type {};
+#endif
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/make_unsigned.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/make_unsigned.hpp
new file mode 100644
index 0000000..4cf2d08
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/make_unsigned.hpp
@@ -0,0 +1,49 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "type_identity.hpp"
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename T>
+struct make_unsigned;
+
+template <>
+struct make_unsigned<char> : type_identity<unsigned char> {};
+
+template <>
+struct make_unsigned<signed char> : type_identity<unsigned char> {};
+template <>
+struct make_unsigned<unsigned char> : type_identity<unsigned char> {};
+
+template <>
+struct make_unsigned<signed short> : type_identity<unsigned short> {};
+template <>
+struct make_unsigned<unsigned short> : type_identity<unsigned short> {};
+
+template <>
+struct make_unsigned<signed int> : type_identity<unsigned int> {};
+template <>
+struct make_unsigned<unsigned int> : type_identity<unsigned int> {};
+
+template <>
+struct make_unsigned<signed long> : type_identity<unsigned long> {};
+template <>
+struct make_unsigned<unsigned long> : type_identity<unsigned long> {};
+
+#if ARDUINOJSON_HAS_LONG_LONG
+template <>
+struct make_unsigned<signed long long> : type_identity<unsigned long long> {};
+template <>
+struct make_unsigned<unsigned long long> : type_identity<unsigned long long> {};
+#endif
+
+#if ARDUINOJSON_HAS_INT64
+template <>
+struct make_unsigned<signed __int64> : type_identity<unsigned __int64> {};
+template <>
+struct make_unsigned<unsigned __int64> : type_identity<unsigned __int64> {};
+#endif
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/remove_const.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/remove_const.hpp
new file mode 100644
index 0000000..5a19eb1
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/remove_const.hpp
@@ -0,0 +1,20 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+
+namespace ARDUINOJSON_NAMESPACE {
+
+// A meta-function that return the type T without the const modifier
+template <typename T>
+struct remove_const {
+ typedef T type;
+};
+template <typename T>
+struct remove_const<const T> {
+ typedef T type;
+};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/remove_reference.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/remove_reference.hpp
new file mode 100644
index 0000000..1812850
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/remove_reference.hpp
@@ -0,0 +1,20 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Namespace.hpp>
+
+namespace ARDUINOJSON_NAMESPACE {
+
+// A meta-function that return the type T without the reference modifier.
+template <typename T>
+struct remove_reference {
+ typedef T type;
+};
+template <typename T>
+struct remove_reference<T&> {
+ typedef T type;
+};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/type_traits/type_identity.hpp b/include/lib/ArduinoJson/Polyfills/type_traits/type_identity.hpp
new file mode 100644
index 0000000..c464a47
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/type_traits/type_identity.hpp
@@ -0,0 +1,15 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "integral_constant.hpp"
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename T>
+struct type_identity {
+ typedef T type;
+};
+} // namespace ARDUINOJSON_NAMESPACE
diff --git a/include/lib/ArduinoJson/Polyfills/utility.hpp b/include/lib/ArduinoJson/Polyfills/utility.hpp
new file mode 100644
index 0000000..c99bc99
--- /dev/null
+++ b/include/lib/ArduinoJson/Polyfills/utility.hpp
@@ -0,0 +1,28 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include "type_traits.hpp"
+
+namespace ARDUINOJSON_NAMESPACE {
+template <typename T>
+inline void swap(T& a, T& b) {
+ T t(a);
+ a = b;
+ b = t;
+}
+
+#if ARDUINOJSON_HAS_RVALUE_REFERENCES
+template <typename T>
+typename remove_reference<T>::type&& move(T&& t) {
+ return static_cast<typename remove_reference<T>::type&&>(t);
+}
+#else
+template <typename T>
+T& move(T& t) {
+ return t;
+}
+#endif
+} // namespace ARDUINOJSON_NAMESPACE