Update libs

This commit is contained in:
iranl
2024-12-03 12:20:47 +01:00
parent 8a23eb3d03
commit a14074fd6d
62 changed files with 561 additions and 190 deletions

View File

@@ -17,7 +17,7 @@ class JsonArray : public detail::VariantOperators<JsonArray> {
friend class detail::VariantAttorney;
public:
typedef JsonArrayIterator iterator;
using iterator = JsonArrayIterator;
// Constructs an unbound reference.
JsonArray() : data_(0), resources_(0) {}

View File

@@ -19,7 +19,7 @@ class JsonArrayConst : public detail::VariantOperators<JsonArrayConst> {
friend class detail::VariantAttorney;
public:
typedef JsonArrayConstIterator iterator;
using iterator = JsonArrayConstIterator;
// Returns an iterator to the first element of the array.
// https://arduinojson.org/v7/api/jsonarrayconst/begin/

View File

@@ -24,14 +24,10 @@ struct first_or_void<T, Rest...> {
// A meta-function that returns true if T is a valid destination type for
// deserialize()
template <class T, class = void>
struct is_deserialize_destination : false_type {};
template <class T>
struct is_deserialize_destination<
T, enable_if_t<is_same<decltype(VariantAttorney::getResourceManager(
detail::declval<T&>())),
ResourceManager*>::value>> : true_type {};
using is_deserialize_destination =
bool_constant<is_base_of<JsonDocument, remove_cv_t<T>>::value ||
IsVariant<T>::value>;
template <typename TDestination>
inline void shrinkJsonDocument(TDestination&) {

View File

@@ -142,6 +142,13 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
return to<JsonVariant>().set(src);
}
// Replaces the root with the specified value.
// https://arduinojson.org/v7/api/jsondocument/set/
template <typename TChar>
bool set(TChar* src) {
return to<JsonVariant>().set(src);
}
// Clears the document and converts it to the specified type.
// https://arduinojson.org/v7/api/jsondocument/to/
template <typename T>
@@ -232,8 +239,8 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
template <typename TVariant>
detail::enable_if_t<detail::IsVariant<TVariant>::value, JsonVariantConst>
operator[](const TVariant& key) const {
if (key.template is<const char*>())
return operator[](key.template as<const char*>());
if (key.template is<JsonString>())
return operator[](key.template as<JsonString>());
if (key.template is<size_t>())
return operator[](key.template as<size_t>());
return {};

View File

@@ -13,7 +13,7 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
template <typename TWriter>
class PrettyJsonSerializer : public JsonSerializer<TWriter> {
typedef JsonSerializer<TWriter> base;
using base = JsonSerializer<TWriter>;
public:
PrettyJsonSerializer(TWriter writer, const ResourceManager* resources)

View File

@@ -105,7 +105,7 @@ class TextFormatter {
template <typename T>
enable_if_t<is_signed<T>::value> writeInteger(T value) {
typedef make_unsigned_t<T> unsigned_type;
using unsigned_type = make_unsigned_t<T>;
unsigned_type unsigned_value;
if (value < 0) {
writeRaw('-');

View File

@@ -20,7 +20,7 @@ struct FloatParts {
template <typename TFloat>
inline int16_t normalize(TFloat& value) {
typedef FloatTraits<TFloat> traits;
using traits = FloatTraits<TFloat>;
int16_t powersOf10 = 0;
int8_t index = sizeof(TFloat) == 8 ? 8 : 5;

View File

@@ -21,12 +21,12 @@ struct FloatTraits {};
template <typename T>
struct FloatTraits<T, 8 /*64bits*/> {
typedef uint64_t mantissa_type;
using mantissa_type = uint64_t;
static const short mantissa_bits = 52;
static const mantissa_type mantissa_max =
(mantissa_type(1) << mantissa_bits) - 1;
typedef int16_t exponent_type;
using exponent_type = int16_t;
static const exponent_type exponent_max = 308;
static pgm_ptr<T> positiveBinaryPowersOfTen() {
@@ -105,12 +105,12 @@ struct FloatTraits<T, 8 /*64bits*/> {
template <typename T>
struct FloatTraits<T, 4 /*32bits*/> {
typedef uint32_t mantissa_type;
using mantissa_type = uint32_t;
static const short mantissa_bits = 23;
static const mantissa_type mantissa_max =
(mantissa_type(1) << mantissa_bits) - 1;
typedef int8_t exponent_type;
using exponent_type = int8_t;
static const exponent_type exponent_max = 38;
static pgm_ptr<T> positiveBinaryPowersOfTen() {

View File

@@ -10,9 +10,9 @@
ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE
#if ARDUINOJSON_USE_DOUBLE
typedef double JsonFloat;
using JsonFloat = double;
#else
typedef float JsonFloat;
using JsonFloat = float;
#endif
ARDUINOJSON_END_PUBLIC_NAMESPACE

View File

@@ -12,11 +12,11 @@
ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE
#if ARDUINOJSON_USE_LONG_LONG
typedef int64_t JsonInteger;
typedef uint64_t JsonUInt;
using JsonInteger = int64_t;
using JsonUInt = uint64_t;
#else
typedef long JsonInteger;
typedef unsigned long JsonUInt;
using JsonInteger = long;
using JsonUInt = unsigned long;
#endif
ARDUINOJSON_END_PUBLIC_NAMESPACE

View File

@@ -103,9 +103,9 @@ class Number {
};
inline Number parseNumber(const char* s) {
typedef FloatTraits<JsonFloat> traits;
typedef largest_type<traits::mantissa_type, JsonUInt> mantissa_t;
typedef traits::exponent_type exponent_t;
using traits = FloatTraits<JsonFloat>;
using mantissa_t = largest_type<traits::mantissa_type, JsonUInt>;
using exponent_t = traits::exponent_type;
ARDUINOJSON_ASSERT(s != 0);

View File

@@ -17,7 +17,7 @@ class JsonObject : public detail::VariantOperators<JsonObject> {
friend class detail::VariantAttorney;
public:
typedef JsonObjectIterator iterator;
using iterator = JsonObjectIterator;
// Creates an unbound reference.
JsonObject() : data_(0), resources_(0) {}
@@ -121,10 +121,10 @@ class JsonObject : public detail::VariantOperators<JsonObject> {
// https://arduinojson.org/v7/api/jsonobject/subscript/
template <typename TVariant>
detail::enable_if_t<detail::IsVariant<TVariant>::value,
detail::MemberProxy<JsonObject, const char*>>
detail::MemberProxy<JsonObject, JsonString>>
operator[](const TVariant& key) const {
if (key.template is<const char*>())
return {*this, key.template as<const char*>()};
if (key.template is<JsonString>())
return {*this, key.template as<JsonString>()};
else
return {*this, nullptr};
}

View File

@@ -16,7 +16,7 @@ class JsonObjectConst : public detail::VariantOperators<JsonObjectConst> {
friend class detail::VariantAttorney;
public:
typedef JsonObjectConstIterator iterator;
using iterator = JsonObjectConstIterator;
// Creates an unbound reference.
JsonObjectConst() : data_(0), resources_(0) {}
@@ -121,8 +121,8 @@ class JsonObjectConst : public detail::VariantOperators<JsonObjectConst> {
template <typename TVariant>
detail::enable_if_t<detail::IsVariant<TVariant>::value, JsonVariantConst>
operator[](const TVariant& key) const {
if (key.template is<const char*>())
return operator[](key.template as<const char*>());
if (key.template is<JsonString>())
return operator[](key.template as<JsonString>());
else
return JsonVariantConst();
}

View File

@@ -15,17 +15,17 @@ struct uint_;
template <>
struct uint_<8> {
typedef uint8_t type;
using type = uint8_t;
};
template <>
struct uint_<16> {
typedef uint16_t type;
using type = uint16_t;
};
template <>
struct uint_<32> {
typedef uint32_t type;
using type = uint32_t;
};
template <int Bits>

View File

@@ -10,12 +10,12 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
template <bool Condition, class TrueType, class FalseType>
struct conditional {
typedef TrueType type;
using type = TrueType;
};
template <class TrueType, class FalseType>
struct conditional<false, TrueType, FalseType> {
typedef FalseType type;
using type = FalseType;
};
template <bool Condition, class TrueType, class FalseType>

View File

@@ -14,7 +14,7 @@ struct enable_if {};
template <typename T>
struct enable_if<true, T> {
typedef T type;
using type = T;
};
template <bool Condition, typename T = void>

View File

@@ -13,7 +13,10 @@ struct integral_constant {
static const T value = v;
};
typedef integral_constant<bool, true> true_type;
typedef integral_constant<bool, false> false_type;
template <bool B>
using bool_constant = integral_constant<bool, B>;
using true_type = bool_constant<true>;
using false_type = bool_constant<false>;
ARDUINOJSON_END_PRIVATE_NAMESPACE

View File

@@ -27,7 +27,7 @@ struct is_convertible {
static int probe(To);
static char probe(...);
static From& from_;
static const From& from_;
public:
static const bool value = sizeof(probe(from_)) == sizeof(int);

View File

@@ -11,11 +11,11 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
// A meta-function that return the type T without the const modifier
template <typename T>
struct remove_const {
typedef T type;
using type = T;
};
template <typename T>
struct remove_const<const T> {
typedef T type;
using type = T;
};
template <typename T>

View File

@@ -10,19 +10,19 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
template <typename T>
struct remove_cv {
typedef T type;
using type = T;
};
template <typename T>
struct remove_cv<const T> {
typedef T type;
using type = T;
};
template <typename T>
struct remove_cv<volatile T> {
typedef T type;
using type = T;
};
template <typename T>
struct remove_cv<const volatile T> {
typedef T type;
using type = T;
};
template <typename T>

View File

@@ -11,11 +11,11 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
// A meta-function that return the type T without the reference modifier.
template <typename T>
struct remove_reference {
typedef T type;
using type = T;
};
template <typename T>
struct remove_reference<T&> {
typedef T type;
using type = T;
};
template <typename T>

View File

@@ -10,7 +10,7 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
template <typename T>
struct type_identity {
typedef T type;
using type = T;
};
ARDUINOJSON_END_PRIVATE_NAMESPACE

View File

@@ -74,7 +74,7 @@ class FlashString {
template <>
struct StringAdapter<const __FlashStringHelper*, void> {
typedef FlashString AdaptedString;
using AdaptedString = FlashString;
static AdaptedString adapt(const __FlashStringHelper* s) {
return AdaptedString(s, s ? strlen_P(reinterpret_cast<const char*>(s)) : 0);
@@ -83,7 +83,7 @@ struct StringAdapter<const __FlashStringHelper*, void> {
template <>
struct SizedStringAdapter<const __FlashStringHelper*, void> {
typedef FlashString AdaptedString;
using AdaptedString = FlashString;
static AdaptedString adapt(const __FlashStringHelper* s, size_t n) {
return AdaptedString(s, n);

View File

@@ -25,7 +25,7 @@ class JsonStringAdapter : public SizedRamString {
template <>
struct StringAdapter<JsonString> {
typedef JsonStringAdapter AdaptedString;
using AdaptedString = JsonStringAdapter;
static AdaptedString adapt(const JsonString& s) {
return AdaptedString(s);

View File

@@ -41,18 +41,6 @@ class ZeroTerminatedRamString {
return str_;
}
friend int stringCompare(ZeroTerminatedRamString a,
ZeroTerminatedRamString b) {
ARDUINOJSON_ASSERT(!a.isNull());
ARDUINOJSON_ASSERT(!b.isNull());
return ::strcmp(a.str_, b.str_);
}
friend bool stringEquals(ZeroTerminatedRamString a,
ZeroTerminatedRamString b) {
return stringCompare(a, b) == 0;
}
bool isLinked() const {
return false;
}
@@ -63,7 +51,7 @@ class ZeroTerminatedRamString {
template <typename TChar>
struct StringAdapter<TChar*, enable_if_t<IsChar<TChar>::value>> {
typedef ZeroTerminatedRamString AdaptedString;
using AdaptedString = ZeroTerminatedRamString;
static AdaptedString adapt(const TChar* p) {
return AdaptedString(reinterpret_cast<const char*>(p));
@@ -72,7 +60,7 @@ struct StringAdapter<TChar*, enable_if_t<IsChar<TChar>::value>> {
template <typename TChar, size_t N>
struct StringAdapter<TChar[N], enable_if_t<IsChar<TChar>::value>> {
typedef ZeroTerminatedRamString AdaptedString;
using AdaptedString = ZeroTerminatedRamString;
static AdaptedString adapt(const TChar* p) {
return AdaptedString(reinterpret_cast<const char*>(p));
@@ -90,7 +78,7 @@ class StaticStringAdapter : public ZeroTerminatedRamString {
template <>
struct StringAdapter<const char*, void> {
typedef StaticStringAdapter AdaptedString;
using AdaptedString = StaticStringAdapter;
static AdaptedString adapt(const char* p) {
return AdaptedString(p);
@@ -132,7 +120,7 @@ class SizedRamString {
template <typename TChar>
struct SizedStringAdapter<TChar*, enable_if_t<IsChar<TChar>::value>> {
typedef SizedRamString AdaptedString;
using AdaptedString = SizedRamString;
static AdaptedString adapt(const TChar* p, size_t n) {
return AdaptedString(reinterpret_cast<const char*>(p), n);

View File

@@ -15,7 +15,7 @@ struct StringAdapter<
T,
enable_if_t<(string_traits<T>::has_cstr || string_traits<T>::has_data) &&
(string_traits<T>::has_length || string_traits<T>::has_size)>> {
typedef SizedRamString AdaptedString;
using AdaptedString = SizedRamString;
static AdaptedString adapt(const T& s) {
return AdaptedString(get_data(s), get_size(s));

View File

@@ -136,7 +136,7 @@ class JsonVariantConst : public detail::VariantTag,
if (key.template is<size_t>())
return operator[](key.template as<size_t>());
else
return operator[](key.template as<const char*>());
return operator[](key.template as<JsonString>());
}
// DEPRECATED: use obj[key].is<T>() instead

View File

@@ -11,7 +11,7 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
class JsonVariantCopier {
public:
typedef bool result_type;
using result_type = bool;
JsonVariantCopier(JsonVariant dst) : dst_(dst) {}

View File

@@ -13,7 +13,7 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
template <typename TResult>
struct JsonVariantVisitor {
typedef TResult result_type;
using result_type = TResult;
template <typename T>
TResult visit(const T&) {

View File

@@ -13,7 +13,7 @@ ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
template <typename TResult>
struct VariantDataVisitor {
typedef TResult result_type;
using result_type = TResult;
template <typename T>
TResult visit(const T&) {

View File

@@ -207,7 +207,7 @@ class VariantRefBase : public VariantTag {
if (key.template is<size_t>())
return operator[](key.template as<size_t>());
else
return operator[](key.template as<const char*>());
return operator[](key.template as<JsonString>());
}
// DEPRECATED: use add<JsonVariant>() instead

View File

@@ -20,15 +20,15 @@ struct VariantTo {};
template <>
struct VariantTo<JsonArray> {
typedef JsonArray type;
using type = JsonArray;
};
template <>
struct VariantTo<JsonObject> {
typedef JsonObject type;
using type = JsonObject;
};
template <>
struct VariantTo<JsonVariant> {
typedef JsonVariant type;
using type = JsonVariant;
};
ARDUINOJSON_END_PRIVATE_NAMESPACE

View File

@@ -4,8 +4,8 @@
#pragma once
#define ARDUINOJSON_VERSION "7.2.0"
#define ARDUINOJSON_VERSION "7.2.1"
#define ARDUINOJSON_VERSION_MAJOR 7
#define ARDUINOJSON_VERSION_MINOR 2
#define ARDUINOJSON_VERSION_REVISION 0
#define ARDUINOJSON_VERSION_MACRO V720
#define ARDUINOJSON_VERSION_REVISION 1
#define ARDUINOJSON_VERSION_MACRO V721