diff --git a/lib/ArduinoJson/ArduinoJson.h b/lib/ArduinoJson/ArduinoJson.h index f9b781c7e..89d63b3e1 100644 --- a/lib/ArduinoJson/ArduinoJson.h +++ b/lib/ArduinoJson/ArduinoJson.h @@ -239,11 +239,11 @@ #define ARDUINOJSON_BIN2ALPHA_1111() P #define ARDUINOJSON_BIN2ALPHA_(A, B, C, D) ARDUINOJSON_BIN2ALPHA_##A##B##C##D() #define ARDUINOJSON_BIN2ALPHA(A, B, C, D) ARDUINOJSON_BIN2ALPHA_(A, B, C, D) -#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 #ifndef ARDUINOJSON_VERSION_NAMESPACE # define ARDUINOJSON_VERSION_NAMESPACE \ ARDUINOJSON_CONCAT5( \ @@ -323,15 +323,15 @@ template 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 using uint_t = typename uint_::type; @@ -417,11 +417,11 @@ class MemoryPool { }; template struct conditional { - typedef TrueType type; + using type = TrueType; }; template struct conditional { - typedef FalseType type; + using type = FalseType; }; template using conditional_t = @@ -430,7 +430,7 @@ template struct enable_if {}; template struct enable_if { - typedef T type; + using type = T; }; template using enable_if_t = typename enable_if::type; @@ -451,8 +451,10 @@ template struct integral_constant { static const T value = v; }; -typedef integral_constant true_type; -typedef integral_constant false_type; +template +using bool_constant = integral_constant; +using true_type = bool_constant; +using false_type = bool_constant; template struct is_array : false_type {}; template @@ -461,11 +463,11 @@ template struct is_array : true_type {}; template struct remove_reference { - typedef T type; + using type = T; }; template struct remove_reference { - typedef T type; + using type = T; }; template using remove_reference_t = typename remove_reference::type; @@ -509,7 +511,7 @@ struct is_convertible { protected: // <- to avoid GCC's "all member functions in class are private" static int probe(To); static char probe(...); - static From& from_; + static const From& from_; public: static const bool value = sizeof(probe(from_)) == sizeof(int); }; @@ -527,19 +529,19 @@ template struct is_same : true_type {}; template struct remove_cv { - typedef T type; + using type = T; }; template struct remove_cv { - typedef T type; + using type = T; }; template struct remove_cv { - typedef T type; + using type = T; }; template struct remove_cv { - typedef T type; + using type = T; }; template using remove_cv_t = typename remove_cv::type; @@ -592,7 +594,7 @@ struct is_unsigned : integral_constant, bool>::value> {}; template struct type_identity { - typedef T type; + using type = T; }; template struct make_unsigned; @@ -622,11 +624,11 @@ template using make_unsigned_t = typename make_unsigned::type; template struct remove_const { - typedef T type; + using type = T; }; template struct remove_const { - typedef T type; + using type = T; }; template using remove_const_t = typename remove_const::type; @@ -964,16 +966,6 @@ class ZeroTerminatedRamString { const char* data() const { 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; } @@ -982,14 +974,14 @@ class ZeroTerminatedRamString { }; template struct StringAdapter::value>> { - typedef ZeroTerminatedRamString AdaptedString; + using AdaptedString = ZeroTerminatedRamString; static AdaptedString adapt(const TChar* p) { return AdaptedString(reinterpret_cast(p)); } }; template struct StringAdapter::value>> { - typedef ZeroTerminatedRamString AdaptedString; + using AdaptedString = ZeroTerminatedRamString; static AdaptedString adapt(const TChar* p) { return AdaptedString(reinterpret_cast(p)); } @@ -1003,7 +995,7 @@ class StaticStringAdapter : public ZeroTerminatedRamString { }; template <> struct StringAdapter { - typedef StaticStringAdapter AdaptedString; + using AdaptedString = StaticStringAdapter; static AdaptedString adapt(const char* p) { return AdaptedString(p); } @@ -1035,7 +1027,7 @@ class SizedRamString { }; template struct SizedStringAdapter::value>> { - typedef SizedRamString AdaptedString; + using AdaptedString = SizedRamString; static AdaptedString adapt(const TChar* p, size_t n) { return AdaptedString(reinterpret_cast(p), n); } @@ -1107,7 +1099,7 @@ class JsonStringAdapter : public SizedRamString { }; template <> struct StringAdapter { - typedef JsonStringAdapter AdaptedString; + using AdaptedString = JsonStringAdapter; static AdaptedString adapt(const JsonString& s) { return AdaptedString(s); } @@ -1150,7 +1142,7 @@ struct StringAdapter< T, enable_if_t<(string_traits::has_cstr || string_traits::has_data) && (string_traits::has_length || string_traits::has_size)>> { - typedef SizedRamString AdaptedString; + using AdaptedString = SizedRamString; static AdaptedString adapt(const T& s) { return AdaptedString(get_data(s), get_size(s)); } @@ -1350,14 +1342,14 @@ class FlashString { }; template <> struct StringAdapter { - typedef FlashString AdaptedString; + using AdaptedString = FlashString; static AdaptedString adapt(const __FlashStringHelper* s) { return AdaptedString(s, s ? strlen_P(reinterpret_cast(s)) : 0); } }; template <> struct SizedStringAdapter { - typedef FlashString AdaptedString; + using AdaptedString = FlashString; static AdaptedString adapt(const __FlashStringHelper* s, size_t n) { return AdaptedString(s, n); } @@ -1616,11 +1608,11 @@ template struct FloatTraits {}; template struct FloatTraits { - 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 positiveBinaryPowersOfTen() { ARDUINOJSON_DEFINE_PROGMEM_ARRAY( // @@ -1686,11 +1678,11 @@ struct FloatTraits { }; template struct FloatTraits { - 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 positiveBinaryPowersOfTen() { ARDUINOJSON_DEFINE_PROGMEM_ARRAY(uint32_t, factors, @@ -1777,9 +1769,9 @@ inline TFloat make_float(TFloat m, TExponent e) { ARDUINOJSON_END_PRIVATE_NAMESPACE 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 ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE @@ -1996,11 +1988,11 @@ class ArrayData : public CollectionData { ARDUINOJSON_END_PRIVATE_NAMESPACE 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 #define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T) \ @@ -2675,15 +2667,15 @@ template struct VariantTo {}; template <> struct VariantTo { - typedef JsonArray type; + using type = JsonArray; }; template <> struct VariantTo { - typedef JsonObject type; + using type = JsonObject; }; template <> struct VariantTo { - typedef JsonVariant type; + using type = JsonVariant; }; class VariantAttorney { public: @@ -3008,7 +3000,7 @@ class JsonVariantConst : public detail::VariantTag, if (key.template is()) return operator[](key.template as()); else - return operator[](key.template as()); + return operator[](key.template as()); } template ARDUINOJSON_DEPRECATED("use var[key].is() instead") @@ -3155,7 +3147,7 @@ class VariantRefBase : public VariantTag { if (key.template is()) return operator[](key.template as()); else - return operator[](key.template as()); + return operator[](key.template as()); } ARDUINOJSON_DEPRECATED("use add() instead") JsonVariant add() const; @@ -3392,7 +3384,7 @@ class JsonArrayConst : public detail::VariantOperators { friend class JsonArray; friend class detail::VariantAttorney; public: - typedef JsonArrayConstIterator iterator; + using iterator = JsonArrayConstIterator; iterator begin() const { if (!data_) return iterator(); @@ -3468,7 +3460,7 @@ class JsonObject; class JsonArray : public detail::VariantOperators { friend class detail::VariantAttorney; public: - typedef JsonArrayIterator iterator; + using iterator = JsonArrayIterator; JsonArray() : data_(0), resources_(0) {} JsonArray(detail::ArrayData* data, detail::ResourceManager* resources) : data_(data), resources_(resources) {} @@ -3687,7 +3679,7 @@ class JsonObjectConst : public detail::VariantOperators { friend class JsonObject; friend class detail::VariantAttorney; public: - typedef JsonObjectConstIterator iterator; + using iterator = JsonObjectConstIterator; JsonObjectConst() : data_(0), resources_(0) {} JsonObjectConst(const detail::ObjectData* data, const detail::ResourceManager* resources) @@ -3751,8 +3743,8 @@ class JsonObjectConst : public detail::VariantOperators { template detail::enable_if_t::value, JsonVariantConst> operator[](const TVariant& key) const { - if (key.template is()) - return operator[](key.template as()); + if (key.template is()) + return operator[](key.template as()); else return JsonVariantConst(); } @@ -3835,7 +3827,7 @@ class JsonArray; class JsonObject : public detail::VariantOperators { friend class detail::VariantAttorney; public: - typedef JsonObjectIterator iterator; + using iterator = JsonObjectIterator; JsonObject() : data_(0), resources_(0) {} JsonObject(detail::ObjectData* data, detail::ResourceManager* resource) : data_(data), resources_(resource) {} @@ -3897,10 +3889,10 @@ class JsonObject : public detail::VariantOperators { } template detail::enable_if_t::value, - detail::MemberProxy> + detail::MemberProxy> operator[](const TVariant& key) const { - if (key.template is()) - return {*this, key.template as()}; + if (key.template is()) + return {*this, key.template as()}; else return {*this, nullptr}; } @@ -4059,6 +4051,10 @@ class JsonDocument : public detail::VariantOperators { const T& src) { return to().set(src); } + template + bool set(TChar* src) { + return to().set(src); + } template typename detail::VariantTo::type to() { clear(); @@ -4117,8 +4113,8 @@ class JsonDocument : public detail::VariantOperators { template detail::enable_if_t::value, JsonVariantConst> operator[](const TVariant& key) const { - if (key.template is()) - return operator[](key.template as()); + if (key.template is()) + return operator[](key.template as()); if (key.template is()) return operator[](key.template as()); return {}; @@ -4238,7 +4234,7 @@ ARDUINOJSON_END_PUBLIC_NAMESPACE ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE template struct VariantDataVisitor { - typedef TResult result_type; + using result_type = TResult; template TResult visit(const T&) { return TResult(); @@ -4246,7 +4242,7 @@ struct VariantDataVisitor { }; template struct JsonVariantVisitor { - typedef TResult result_type; + using result_type = TResult; template TResult visit(const T&) { return TResult(); @@ -4822,7 +4818,7 @@ struct FloatParts { }; template inline int16_t normalize(TFloat& value) { - typedef FloatTraits traits; + using traits = FloatTraits; int16_t powersOf10 = 0; int8_t index = sizeof(TFloat) == 8 ? 8 : 5; int bit = 1 << index; @@ -4965,7 +4961,7 @@ class TextFormatter { } template enable_if_t::value> writeInteger(T value) { - typedef make_unsigned_t unsigned_type; + using unsigned_type = make_unsigned_t; unsigned_type unsigned_value; if (value < 0) { writeRaw('-'); @@ -5703,7 +5699,7 @@ ARDUINOJSON_END_PUBLIC_NAMESPACE ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE class JsonVariantCopier { public: - typedef bool result_type; + using result_type = bool; JsonVariantCopier(JsonVariant dst) : dst_(dst) {} template bool visit(T src) { @@ -6325,13 +6321,10 @@ template struct first_or_void { using type = T; }; -template -struct is_deserialize_destination : false_type {}; template -struct is_deserialize_destination< - T, enable_if_t())), - ResourceManager*>::value>> : true_type {}; +using is_deserialize_destination = + bool_constant>::value || + IsVariant::value>; template inline void shrinkJsonDocument(TDestination&) { } @@ -6571,9 +6564,9 @@ class Number { #endif }; inline Number parseNumber(const char* s) { - typedef FloatTraits traits; - typedef largest_type mantissa_t; - typedef traits::exponent_type exponent_t; + using traits = FloatTraits; + using mantissa_t = largest_type; + using exponent_t = traits::exponent_type; ARDUINOJSON_ASSERT(s != 0); bool is_negative = false; switch (*s) { @@ -7212,7 +7205,7 @@ ARDUINOJSON_END_PUBLIC_NAMESPACE ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE template class PrettyJsonSerializer : public JsonSerializer { - typedef JsonSerializer base; + using base = JsonSerializer; public: PrettyJsonSerializer(TWriter writer, const ResourceManager* resources) : base(writer, resources), nesting_(0) {} diff --git a/lib/ArduinoJson/README.txt b/lib/ArduinoJson/README.txt index 7cb68365d..4a495381a 100644 --- a/lib/ArduinoJson/README.txt +++ b/lib/ArduinoJson/README.txt @@ -1,4 +1,4 @@ -Version 7.2.0 +Version 7.2.1 From https://github.com/bblanchon/ArduinoJson/releases