summaryrefslogtreecommitdiff
path: root/include/lib/ArduinoJson/TypeTraits
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-09-07 12:57:04 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2020-09-07 12:57:04 +0200
commit0558244645611f314f47e0fa427f7323ce253eaf (patch)
tree824bcd55ec8577703345106d0a08e167407500a7 /include/lib/ArduinoJson/TypeTraits
parent0248c6352f2117e50fac71dd632a79d8fa4f8737 (diff)
remove external libraries from main branch
Diffstat (limited to 'include/lib/ArduinoJson/TypeTraits')
-rw-r--r--include/lib/ArduinoJson/TypeTraits/EnableIf.hpp19
-rw-r--r--include/lib/ArduinoJson/TypeTraits/FloatTraits.hpp171
-rw-r--r--include/lib/ArduinoJson/TypeTraits/IsArray.hpp24
-rw-r--r--include/lib/ArduinoJson/TypeTraits/IsBaseOf.hpp27
-rw-r--r--include/lib/ArduinoJson/TypeTraits/IsChar.hpp23
-rw-r--r--include/lib/ArduinoJson/TypeTraits/IsConst.hpp21
-rw-r--r--include/lib/ArduinoJson/TypeTraits/IsFloatingPoint.hpp18
-rw-r--r--include/lib/ArduinoJson/TypeTraits/IsIntegral.hpp26
-rw-r--r--include/lib/ArduinoJson/TypeTraits/IsSame.hpp21
-rw-r--r--include/lib/ArduinoJson/TypeTraits/IsSignedIntegral.hpp28
-rw-r--r--include/lib/ArduinoJson/TypeTraits/IsUnsignedIntegral.hpp28
-rw-r--r--include/lib/ArduinoJson/TypeTraits/IsVariant.hpp17
-rw-r--r--include/lib/ArduinoJson/TypeTraits/RemoveConst.hpp20
-rw-r--r--include/lib/ArduinoJson/TypeTraits/RemoveReference.hpp20
14 files changed, 0 insertions, 463 deletions
diff --git a/include/lib/ArduinoJson/TypeTraits/EnableIf.hpp b/include/lib/ArduinoJson/TypeTraits/EnableIf.hpp
deleted file mode 100644
index 83fc5e0..0000000
--- a/include/lib/ArduinoJson/TypeTraits/EnableIf.hpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-namespace ArduinoJson {
-namespace Internals {
-
-// A meta-function that return the type T if Condition is true.
-template <bool Condition, typename T = void>
-struct EnableIf {};
-
-template <typename T>
-struct EnableIf<true, T> {
- typedef T type;
-};
-}
-}
diff --git a/include/lib/ArduinoJson/TypeTraits/FloatTraits.hpp b/include/lib/ArduinoJson/TypeTraits/FloatTraits.hpp
deleted file mode 100644
index 648cc82..0000000
--- a/include/lib/ArduinoJson/TypeTraits/FloatTraits.hpp
+++ /dev/null
@@ -1,171 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-#include <stdint.h>
-#include <stdlib.h> // for size_t
-#include "../Configuration.hpp"
-#include "../Polyfills/math.hpp"
-
-namespace ArduinoJson {
-namespace Internals {
-
-template <typename T, size_t = sizeof(T)>
-struct FloatTraits {};
-
-template <typename T>
-struct FloatTraits<T, 8 /*64bits*/> {
- typedef int64_t mantissa_type;
- static const short mantissa_bits = 52;
- static const mantissa_type mantissa_max =
- (static_cast<mantissa_type>(1) << mantissa_bits) - 1;
-
- typedef int16_t exponent_type;
- static const exponent_type exponent_max = 308;
-
- template <typename TExponent>
- static T make_float(T m, TExponent e) {
- if (e > 0) {
- for (uint8_t index = 0; e != 0; index++) {
- if (e & 1) m *= positiveBinaryPowerOfTen(index);
- e >>= 1;
- }
- } else {
- e = TExponent(-e);
- for (uint8_t index = 0; e != 0; index++) {
- if (e & 1) m *= negativeBinaryPowerOfTen(index);
- e >>= 1;
- }
- }
- return m;
- }
-
- static T positiveBinaryPowerOfTen(int index) {
- static T factors[] = {
- 1e1,
- 1e2,
- 1e4,
- 1e8,
- 1e16,
- forge(0x4693B8B5, 0xB5056E17), // 1e32
- forge(0x4D384F03, 0xE93FF9F5), // 1e64
- forge(0x5A827748, 0xF9301D32), // 1e128
- forge(0x75154FDD, 0x7F73BF3C) // 1e256
- };
- return factors[index];
- }
-
- static T negativeBinaryPowerOfTen(int index) {
- static T factors[] = {
- forge(0x3FB99999, 0x9999999A), // 1e-1
- forge(0x3F847AE1, 0x47AE147B), // 1e-2
- forge(0x3F1A36E2, 0xEB1C432D), // 1e-4
- forge(0x3E45798E, 0xE2308C3A), // 1e-8
- forge(0x3C9CD2B2, 0x97D889BC), // 1e-16
- forge(0x3949F623, 0xD5A8A733), // 1e-32
- forge(0x32A50FFD, 0x44F4A73D), // 1e-64
- forge(0x255BBA08, 0xCF8C979D), // 1e-128
- forge(0x0AC80628, 0x64AC6F43) // 1e-256
- };
- return factors[index];
- }
-
- static T negativeBinaryPowerOfTenPlusOne(int index) {
- static T factors[] = {
- 1e0,
- forge(0x3FB99999, 0x9999999A), // 1e-1
- forge(0x3F50624D, 0xD2F1A9FC), // 1e-3
- forge(0x3E7AD7F2, 0x9ABCAF48), // 1e-7
- forge(0x3CD203AF, 0x9EE75616), // 1e-15
- forge(0x398039D6, 0x65896880), // 1e-31
- forge(0x32DA53FC, 0x9631D10D), // 1e-63
- forge(0x25915445, 0x81B7DEC2), // 1e-127
- forge(0x0AFE07B2, 0x7DD78B14) // 1e-255
- };
- return factors[index];
- }
-
- static T nan() {
- return forge(0x7ff80000, 0x00000000);
- }
-
- static T inf() {
- return forge(0x7ff00000, 0x00000000);
- }
-
- // constructs a double floating point values from its binary representation
- // we use this function to workaround platforms with single precision literals
- // (for example, when -fsingle-precision-constant is passed to GCC)
- static T forge(uint32_t msb, uint32_t lsb) {
- union {
- uint64_t integerBits;
- T floatBits;
- };
- integerBits = (uint64_t(msb) << 32) | lsb;
- return floatBits;
- }
-};
-
-template <typename T>
-struct FloatTraits<T, 4 /*32bits*/> {
- typedef int32_t mantissa_type;
- static const short mantissa_bits = 23;
- static const mantissa_type mantissa_max =
- (static_cast<mantissa_type>(1) << mantissa_bits) - 1;
-
- typedef int8_t exponent_type;
- static const exponent_type exponent_max = 38;
-
- template <typename TExponent>
- static T make_float(T m, TExponent e) {
- if (e > 0) {
- for (uint8_t index = 0; e != 0; index++) {
- if (e & 1) m *= positiveBinaryPowerOfTen(index);
- e >>= 1;
- }
- } else {
- e = -e;
- for (uint8_t index = 0; e != 0; index++) {
- if (e & 1) m *= negativeBinaryPowerOfTen(index);
- e >>= 1;
- }
- }
- return m;
- }
-
- static T positiveBinaryPowerOfTen(int index) {
- static T factors[] = {1e1f, 1e2f, 1e4f, 1e8f, 1e16f, 1e32f};
- return factors[index];
- }
-
- static T negativeBinaryPowerOfTen(int index) {
- static T factors[] = {1e-1f, 1e-2f, 1e-4f, 1e-8f, 1e-16f, 1e-32f};
- return factors[index];
- }
-
- static T negativeBinaryPowerOfTenPlusOne(int index) {
- static T factors[] = {1e0f, 1e-1f, 1e-3f, 1e-7f, 1e-15f, 1e-31f};
- return factors[index];
- }
-
- static T forge(uint32_t bits) {
- union {
- uint32_t integerBits;
- T floatBits;
- };
- integerBits = bits;
- return floatBits;
- }
-
- static T nan() {
- return forge(0x7fc00000);
- }
-
- static T inf() {
- return forge(0x7f800000);
- }
-};
-}
-}
diff --git a/include/lib/ArduinoJson/TypeTraits/IsArray.hpp b/include/lib/ArduinoJson/TypeTraits/IsArray.hpp
deleted file mode 100644
index da42072..0000000
--- a/include/lib/ArduinoJson/TypeTraits/IsArray.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-namespace ArduinoJson {
-namespace Internals {
-
-// A meta-function that return the type T without the const modifier
-template <typename T>
-struct IsArray {
- static const bool value = false;
-};
-template <typename T>
-struct IsArray<T[]> {
- static const bool value = true;
-};
-template <typename T, size_t TN>
-struct IsArray<T[TN]> {
- static const bool value = true;
-};
-}
-}
diff --git a/include/lib/ArduinoJson/TypeTraits/IsBaseOf.hpp b/include/lib/ArduinoJson/TypeTraits/IsBaseOf.hpp
deleted file mode 100644
index bf24e96..0000000
--- a/include/lib/ArduinoJson/TypeTraits/IsBaseOf.hpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-namespace ArduinoJson {
-namespace Internals {
-
-// A meta-function that returns true if Derived inherits from TBase is an
-// integral type.
-template <typename TBase, typename TDerived>
-class IsBaseOf {
- 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:
- enum {
- value = sizeof(probe(reinterpret_cast<TDerived *>(0))) == sizeof(Yes)
- };
-};
-}
-}
diff --git a/include/lib/ArduinoJson/TypeTraits/IsChar.hpp b/include/lib/ArduinoJson/TypeTraits/IsChar.hpp
deleted file mode 100644
index d97cec2..0000000
--- a/include/lib/ArduinoJson/TypeTraits/IsChar.hpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-#include "IsSame.hpp"
-
-namespace ArduinoJson {
-namespace Internals {
-
-// A meta-function that returns true if T is a charater
-template <typename T>
-struct IsChar {
- static const bool value = IsSame<T, char>::value ||
- IsSame<T, signed char>::value ||
- IsSame<T, unsigned char>::value;
-};
-
-template <typename T>
-struct IsChar<const T> : IsChar<T> {};
-}
-}
diff --git a/include/lib/ArduinoJson/TypeTraits/IsConst.hpp b/include/lib/ArduinoJson/TypeTraits/IsConst.hpp
deleted file mode 100644
index 512ee5c..0000000
--- a/include/lib/ArduinoJson/TypeTraits/IsConst.hpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-namespace ArduinoJson {
-namespace Internals {
-
-// A meta-function that return the type T without the const modifier
-template <typename T>
-struct IsConst {
- static const bool value = false;
-};
-
-template <typename T>
-struct IsConst<const T> {
- static const bool value = true;
-};
-}
-}
diff --git a/include/lib/ArduinoJson/TypeTraits/IsFloatingPoint.hpp b/include/lib/ArduinoJson/TypeTraits/IsFloatingPoint.hpp
deleted file mode 100644
index e41a682..0000000
--- a/include/lib/ArduinoJson/TypeTraits/IsFloatingPoint.hpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-#include "IsSame.hpp"
-
-namespace ArduinoJson {
-namespace Internals {
-
-// A meta-function that returns true if T is a floating point type
-template <typename T>
-struct IsFloatingPoint {
- static const bool value = IsSame<T, float>::value || IsSame<T, double>::value;
-};
-}
-}
diff --git a/include/lib/ArduinoJson/TypeTraits/IsIntegral.hpp b/include/lib/ArduinoJson/TypeTraits/IsIntegral.hpp
deleted file mode 100644
index 17ae5f2..0000000
--- a/include/lib/ArduinoJson/TypeTraits/IsIntegral.hpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-#include "IsSame.hpp"
-#include "IsSignedIntegral.hpp"
-#include "IsUnsignedIntegral.hpp"
-
-namespace ArduinoJson {
-namespace Internals {
-
-// A meta-function that returns true if T is an integral type.
-template <typename T>
-struct IsIntegral {
- static const bool value = IsSignedIntegral<T>::value ||
- IsUnsignedIntegral<T>::value ||
- IsSame<T, char>::value;
- // CAUTION: differs from std::is_integral as it doesn't include bool
-};
-
-template <typename T>
-struct IsIntegral<const T> : IsIntegral<T> {};
-}
-}
diff --git a/include/lib/ArduinoJson/TypeTraits/IsSame.hpp b/include/lib/ArduinoJson/TypeTraits/IsSame.hpp
deleted file mode 100644
index 06567c9..0000000
--- a/include/lib/ArduinoJson/TypeTraits/IsSame.hpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-namespace ArduinoJson {
-namespace Internals {
-
-// A meta-function that returns true if types T and U are the same.
-template <typename T, typename U>
-struct IsSame {
- static const bool value = false;
-};
-
-template <typename T>
-struct IsSame<T, T> {
- static const bool value = true;
-};
-}
-}
diff --git a/include/lib/ArduinoJson/TypeTraits/IsSignedIntegral.hpp b/include/lib/ArduinoJson/TypeTraits/IsSignedIntegral.hpp
deleted file mode 100644
index 7334eb9..0000000
--- a/include/lib/ArduinoJson/TypeTraits/IsSignedIntegral.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-#include "../Configuration.hpp"
-#include "IsSame.hpp"
-
-namespace ArduinoJson {
-namespace Internals {
-
-// A meta-function that returns true if T is an integral type.
-template <typename T>
-struct IsSignedIntegral {
- static const bool value =
- IsSame<T, signed char>::value || IsSame<T, signed short>::value ||
- IsSame<T, signed int>::value || IsSame<T, signed long>::value ||
-#if ARDUINOJSON_USE_LONG_LONG
- IsSame<T, signed long long>::value ||
-#endif
-#if ARDUINOJSON_USE_INT64
- IsSame<T, signed __int64>::value ||
-#endif
- false;
-};
-}
-}
diff --git a/include/lib/ArduinoJson/TypeTraits/IsUnsignedIntegral.hpp b/include/lib/ArduinoJson/TypeTraits/IsUnsignedIntegral.hpp
deleted file mode 100644
index 938423f..0000000
--- a/include/lib/ArduinoJson/TypeTraits/IsUnsignedIntegral.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-#include "../Configuration.hpp"
-#include "IsSame.hpp"
-
-namespace ArduinoJson {
-namespace Internals {
-
-// A meta-function that returns true if T is an integral type.
-template <typename T>
-struct IsUnsignedIntegral {
- static const bool value =
- IsSame<T, unsigned char>::value || IsSame<T, unsigned short>::value ||
- IsSame<T, unsigned int>::value || IsSame<T, unsigned long>::value ||
-#if ARDUINOJSON_USE_LONG_LONG
- IsSame<T, unsigned long long>::value ||
-#endif
-#if ARDUINOJSON_USE_INT64
- IsSame<T, unsigned __int64>::value ||
-#endif
- false;
-};
-}
-}
diff --git a/include/lib/ArduinoJson/TypeTraits/IsVariant.hpp b/include/lib/ArduinoJson/TypeTraits/IsVariant.hpp
deleted file mode 100644
index f8b299f..0000000
--- a/include/lib/ArduinoJson/TypeTraits/IsVariant.hpp
+++ /dev/null
@@ -1,17 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-#include "IsBaseOf.hpp"
-
-namespace ArduinoJson {
-namespace Internals {
-
-class JsonVariantTag {};
-
-template <typename T>
-struct IsVariant : IsBaseOf<JsonVariantTag, T> {};
-}
-}
diff --git a/include/lib/ArduinoJson/TypeTraits/RemoveConst.hpp b/include/lib/ArduinoJson/TypeTraits/RemoveConst.hpp
deleted file mode 100644
index 39d4cb5..0000000
--- a/include/lib/ArduinoJson/TypeTraits/RemoveConst.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-namespace ArduinoJson {
-namespace Internals {
-
-// A meta-function that return the type T without the const modifier
-template <typename T>
-struct RemoveConst {
- typedef T type;
-};
-template <typename T>
-struct RemoveConst<const T> {
- typedef T type;
-};
-}
-}
diff --git a/include/lib/ArduinoJson/TypeTraits/RemoveReference.hpp b/include/lib/ArduinoJson/TypeTraits/RemoveReference.hpp
deleted file mode 100644
index 395a128..0000000
--- a/include/lib/ArduinoJson/TypeTraits/RemoveReference.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// ArduinoJson - arduinojson.org
-// Copyright Benoit Blanchon 2014-2018
-// MIT License
-
-#pragma once
-
-namespace ArduinoJson {
-namespace Internals {
-
-// A meta-function that return the type T without the reference modifier.
-template <typename T>
-struct RemoveReference {
- typedef T type;
-};
-template <typename T>
-struct RemoveReference<T&> {
- typedef T type;
-};
-}
-}