mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
remove TODO
This commit is contained in:
@@ -20,11 +20,12 @@ template <typename T, typename Enable = void>
|
|||||||
struct Comparer;
|
struct Comparer;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct Comparer<T, typename enable_if<IsString<T>::value>::type>
|
struct Comparer<T, typename enable_if<IsString<T>::value>::type> : ComparerBase {
|
||||||
: ComparerBase {
|
T rhs;
|
||||||
T rhs; // TODO: store adapted string?
|
|
||||||
|
|
||||||
explicit Comparer(T value) : rhs(value) {}
|
explicit Comparer(T value)
|
||||||
|
: rhs(value) {
|
||||||
|
}
|
||||||
|
|
||||||
CompareResult visitString(const char * lhs, size_t n) {
|
CompareResult visitString(const char * lhs, size_t n) {
|
||||||
int i = stringCompare(adaptString(rhs), adaptString(lhs, n));
|
int i = stringCompare(adaptString(rhs), adaptString(lhs, n));
|
||||||
@@ -45,12 +46,12 @@ struct Comparer<T, typename enable_if<IsString<T>::value>::type>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct Comparer<T, typename enable_if<is_integral<T>::value ||
|
struct Comparer<T, typename enable_if<is_integral<T>::value || is_floating_point<T>::value>::type> : ComparerBase {
|
||||||
is_floating_point<T>::value>::type>
|
|
||||||
: ComparerBase {
|
|
||||||
T rhs;
|
T rhs;
|
||||||
|
|
||||||
explicit Comparer(T value) : rhs(value) {}
|
explicit Comparer(T value)
|
||||||
|
: rhs(value) {
|
||||||
|
}
|
||||||
|
|
||||||
CompareResult visitFloat(JsonFloat lhs) {
|
CompareResult visitFloat(JsonFloat lhs) {
|
||||||
return arithmeticCompare(lhs, rhs);
|
return arithmeticCompare(lhs, rhs);
|
||||||
@@ -78,14 +79,18 @@ struct NullComparer : ComparerBase {
|
|||||||
#if ARDUINOJSON_HAS_NULLPTR
|
#if ARDUINOJSON_HAS_NULLPTR
|
||||||
template <>
|
template <>
|
||||||
struct Comparer<decltype(nullptr), void> : NullComparer {
|
struct Comparer<decltype(nullptr), void> : NullComparer {
|
||||||
explicit Comparer(decltype(nullptr)) : NullComparer() {}
|
explicit Comparer(decltype(nullptr))
|
||||||
|
: NullComparer() {
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct ArrayComparer : ComparerBase {
|
struct ArrayComparer : ComparerBase {
|
||||||
const CollectionData * _rhs;
|
const CollectionData * _rhs;
|
||||||
|
|
||||||
explicit ArrayComparer(const CollectionData& rhs) : _rhs(&rhs) {}
|
explicit ArrayComparer(const CollectionData & rhs)
|
||||||
|
: _rhs(&rhs) {
|
||||||
|
}
|
||||||
|
|
||||||
CompareResult visitArray(const CollectionData & lhs) {
|
CompareResult visitArray(const CollectionData & lhs) {
|
||||||
if (JsonArrayConst(&lhs) == JsonArrayConst(_rhs))
|
if (JsonArrayConst(&lhs) == JsonArrayConst(_rhs))
|
||||||
@@ -98,7 +103,9 @@ struct ArrayComparer : ComparerBase {
|
|||||||
struct ObjectComparer : ComparerBase {
|
struct ObjectComparer : ComparerBase {
|
||||||
const CollectionData * _rhs;
|
const CollectionData * _rhs;
|
||||||
|
|
||||||
explicit ObjectComparer(const CollectionData& rhs) : _rhs(&rhs) {}
|
explicit ObjectComparer(const CollectionData & rhs)
|
||||||
|
: _rhs(&rhs) {
|
||||||
|
}
|
||||||
|
|
||||||
CompareResult visitObject(const CollectionData & lhs) {
|
CompareResult visitObject(const CollectionData & lhs) {
|
||||||
if (JsonObjectConst(&lhs) == JsonObjectConst(_rhs))
|
if (JsonObjectConst(&lhs) == JsonObjectConst(_rhs))
|
||||||
@@ -113,7 +120,9 @@ struct RawComparer : ComparerBase {
|
|||||||
size_t _rhsSize;
|
size_t _rhsSize;
|
||||||
|
|
||||||
explicit RawComparer(const char * rhsData, size_t rhsSize)
|
explicit RawComparer(const char * rhsData, size_t rhsSize)
|
||||||
: _rhsData(rhsData), _rhsSize(rhsSize) {}
|
: _rhsData(rhsData)
|
||||||
|
, _rhsSize(rhsSize) {
|
||||||
|
}
|
||||||
|
|
||||||
CompareResult visitRawJson(const char * lhsData, size_t lhsSize) {
|
CompareResult visitRawJson(const char * lhsData, size_t lhsSize) {
|
||||||
size_t size = _rhsSize < lhsSize ? _rhsSize : lhsSize;
|
size_t size = _rhsSize < lhsSize ? _rhsSize : lhsSize;
|
||||||
@@ -130,7 +139,9 @@ struct RawComparer : ComparerBase {
|
|||||||
struct VariantComparer : ComparerBase {
|
struct VariantComparer : ComparerBase {
|
||||||
const VariantData * rhs;
|
const VariantData * rhs;
|
||||||
|
|
||||||
explicit VariantComparer(const VariantData* value) : rhs(value) {}
|
explicit VariantComparer(const VariantData * value)
|
||||||
|
: rhs(value) {
|
||||||
|
}
|
||||||
|
|
||||||
CompareResult visitArray(const CollectionData & lhs) {
|
CompareResult visitArray(const CollectionData & lhs) {
|
||||||
ArrayComparer comparer(lhs);
|
ArrayComparer comparer(lhs);
|
||||||
@@ -193,11 +204,10 @@ struct VariantComparer : ComparerBase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct Comparer<
|
struct Comparer<T, typename enable_if<is_convertible<T, JsonVariantConst>::value>::type> : VariantComparer {
|
||||||
T, typename enable_if<is_convertible<T, JsonVariantConst>::value>::type>
|
|
||||||
: VariantComparer {
|
|
||||||
explicit Comparer(const T & value)
|
explicit Comparer(const T & value)
|
||||||
: VariantComparer(VariantAttorney::getData(value)) {}
|
: VariantComparer(VariantAttorney::getData(value)) {
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|||||||
Reference in New Issue
Block a user