mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-31 19:24:48 +02:00
Remove Visitable
This commit is contained in:
@@ -177,6 +177,24 @@ TEST_CASE("Polyfills/type_traits") {
|
|||||||
CHECK((is_convertible<EmptyEnum, int>::value == true));
|
CHECK((is_convertible<EmptyEnum, int>::value == true));
|
||||||
CHECK((is_convertible<int*, int>::value == false));
|
CHECK((is_convertible<int*, int>::value == false));
|
||||||
CHECK((is_convertible<EmptyClass, int>::value == false));
|
CHECK((is_convertible<EmptyClass, int>::value == false));
|
||||||
|
|
||||||
|
CHECK((is_convertible<DeserializationError, JsonVariantConst>::value ==
|
||||||
|
false));
|
||||||
|
CHECK((is_convertible<JsonPair, JsonVariantConst>::value == false));
|
||||||
|
CHECK((is_convertible<VariantRef, JsonVariantConst>::value == true));
|
||||||
|
CHECK((is_convertible<VariantConstRef, JsonVariantConst>::value == true));
|
||||||
|
CHECK((is_convertible<ArrayRef, JsonVariantConst>::value == true));
|
||||||
|
CHECK((is_convertible<ElementProxy<ArrayRef>, JsonVariantConst>::value ==
|
||||||
|
true));
|
||||||
|
CHECK((is_convertible<ArrayConstRef, JsonVariantConst>::value == true));
|
||||||
|
CHECK((is_convertible<ObjectRef, JsonVariantConst>::value == true));
|
||||||
|
CHECK((is_convertible<MemberProxy<ObjectRef, const char*>,
|
||||||
|
JsonVariantConst>::value == true));
|
||||||
|
CHECK((is_convertible<ObjectConstRef, JsonVariantConst>::value == true));
|
||||||
|
CHECK(
|
||||||
|
(is_convertible<DynamicJsonDocument, JsonVariantConst>::value == true));
|
||||||
|
CHECK((is_convertible<StaticJsonDocument<10>, JsonVariantConst>::value ==
|
||||||
|
true));
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("is_class") {
|
SECTION("is_class") {
|
||||||
@@ -194,19 +212,4 @@ TEST_CASE("Polyfills/type_traits") {
|
|||||||
CHECK(is_enum<bool>::value == false);
|
CHECK(is_enum<bool>::value == false);
|
||||||
CHECK(is_enum<double>::value == false);
|
CHECK(is_enum<double>::value == false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("IsVisitable") {
|
|
||||||
CHECK(IsVisitable<DeserializationError>::value == false);
|
|
||||||
CHECK(IsVisitable<JsonPair>::value == false);
|
|
||||||
CHECK(IsVisitable<VariantRef>::value == true);
|
|
||||||
CHECK(IsVisitable<VariantConstRef>::value == true);
|
|
||||||
CHECK(IsVisitable<ArrayRef>::value == true);
|
|
||||||
CHECK(IsVisitable<ElementProxy<ArrayRef> >::value == true);
|
|
||||||
CHECK(IsVisitable<ArrayConstRef>::value == true);
|
|
||||||
CHECK(IsVisitable<ObjectRef>::value == true);
|
|
||||||
CHECK((IsVisitable<MemberProxy<ObjectRef, const char*> >::value == true));
|
|
||||||
CHECK(IsVisitable<ObjectConstRef>::value == true);
|
|
||||||
CHECK(IsVisitable<DynamicJsonDocument>::value == true);
|
|
||||||
CHECK(IsVisitable<StaticJsonDocument<10> >::value == true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -62,8 +62,7 @@ class ArrayRefBase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class ArrayConstRef : public ArrayRefBase<const CollectionData>,
|
class ArrayConstRef : public ArrayRefBase<const CollectionData>,
|
||||||
public VariantOperators<ArrayConstRef>,
|
public VariantOperators<ArrayConstRef> {
|
||||||
public Visitable {
|
|
||||||
friend class ArrayRef;
|
friend class ArrayRef;
|
||||||
typedef ArrayRefBase<const CollectionData> base_type;
|
typedef ArrayRefBase<const CollectionData> base_type;
|
||||||
|
|
||||||
@@ -117,8 +116,7 @@ class ArrayConstRef : public ArrayRefBase<const CollectionData>,
|
|||||||
|
|
||||||
class ArrayRef : public ArrayRefBase<CollectionData>,
|
class ArrayRef : public ArrayRefBase<CollectionData>,
|
||||||
public ArrayShortcuts<ArrayRef>,
|
public ArrayShortcuts<ArrayRef>,
|
||||||
public VariantOperators<ArrayRef>,
|
public VariantOperators<ArrayRef> {
|
||||||
public Visitable {
|
|
||||||
typedef ArrayRefBase<CollectionData> base_type;
|
typedef ArrayRefBase<CollectionData> base_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@@ -19,13 +19,10 @@ namespace ARDUINOJSON_NAMESPACE {
|
|||||||
template <typename TArray>
|
template <typename TArray>
|
||||||
class ElementProxy : public VariantOperators<ElementProxy<TArray> >,
|
class ElementProxy : public VariantOperators<ElementProxy<TArray> >,
|
||||||
public VariantShortcuts<ElementProxy<TArray> >,
|
public VariantShortcuts<ElementProxy<TArray> >,
|
||||||
public Visitable,
|
|
||||||
public VariantTag {
|
public VariantTag {
|
||||||
typedef ElementProxy<TArray> this_type;
|
typedef ElementProxy<TArray> this_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef VariantRef variant_type;
|
|
||||||
|
|
||||||
FORCE_INLINE ElementProxy(TArray array, size_t index)
|
FORCE_INLINE ElementProxy(TArray array, size_t index)
|
||||||
: _array(array), _index(index) {}
|
: _array(array), _index(index) {}
|
||||||
|
|
||||||
|
@@ -14,8 +14,7 @@
|
|||||||
|
|
||||||
namespace ARDUINOJSON_NAMESPACE {
|
namespace ARDUINOJSON_NAMESPACE {
|
||||||
|
|
||||||
class JsonDocument : public Visitable,
|
class JsonDocument : public VariantOperators<const JsonDocument&> {
|
||||||
public VariantOperators<const JsonDocument&> {
|
|
||||||
public:
|
public:
|
||||||
template <typename TVisitor>
|
template <typename TVisitor>
|
||||||
typename TVisitor::result_type accept(TVisitor& visitor) const {
|
typename TVisitor::result_type accept(TVisitor& visitor) const {
|
||||||
|
@@ -22,8 +22,9 @@ class StaticJsonDocument : public JsonDocument {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
StaticJsonDocument(const T& src,
|
StaticJsonDocument(
|
||||||
typename enable_if<IsVisitable<T>::value>::type* = 0)
|
const T& src,
|
||||||
|
typename enable_if<is_convertible<T, VariantConstRef>::value>::type* = 0)
|
||||||
: JsonDocument(_buffer, _capacity) {
|
: JsonDocument(_buffer, _capacity) {
|
||||||
set(src);
|
set(src);
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ArduinoJson/Json/TextFormatter.hpp>
|
#include <ArduinoJson/Json/TextFormatter.hpp>
|
||||||
#include <ArduinoJson/Misc/Visitable.hpp>
|
|
||||||
#include <ArduinoJson/Serialization/measure.hpp>
|
#include <ArduinoJson/Serialization/measure.hpp>
|
||||||
#include <ArduinoJson/Serialization/serialize.hpp>
|
#include <ArduinoJson/Serialization/serialize.hpp>
|
||||||
#include <ArduinoJson/Variant/Visitor.hpp>
|
#include <ArduinoJson/Variant/Visitor.hpp>
|
||||||
@@ -132,7 +131,8 @@ inline size_t measureJson(VariantConstRef source) {
|
|||||||
|
|
||||||
#if ARDUINOJSON_ENABLE_STD_STREAM
|
#if ARDUINOJSON_ENABLE_STD_STREAM
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline typename enable_if<IsVisitable<T>::value, std::ostream &>::type
|
inline typename enable_if<is_convertible<T, VariantConstRef>::value,
|
||||||
|
std::ostream &>::type
|
||||||
operator<<(std::ostream &os, const T &source) {
|
operator<<(std::ostream &os, const T &source) {
|
||||||
serializeJson(source, os);
|
serializeJson(source, os);
|
||||||
return os;
|
return os;
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
// ArduinoJson - https://arduinojson.org
|
|
||||||
// Copyright © 2014-2022, Benoit BLANCHON
|
|
||||||
// MIT License
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
|
||||||
|
|
||||||
namespace ARDUINOJSON_NAMESPACE {
|
|
||||||
|
|
||||||
struct Visitable {
|
|
||||||
// template<Visitor>
|
|
||||||
// void accept(Visitor&) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct IsVisitable : is_base_of<Visitable, T> {};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct IsVisitable<T &> : IsVisitable<T> {};
|
|
||||||
} // namespace ARDUINOJSON_NAMESPACE
|
|
@@ -22,13 +22,10 @@ namespace ARDUINOJSON_NAMESPACE {
|
|||||||
template <typename TObject, typename TStringRef>
|
template <typename TObject, typename TStringRef>
|
||||||
class MemberProxy : public VariantOperators<MemberProxy<TObject, TStringRef> >,
|
class MemberProxy : public VariantOperators<MemberProxy<TObject, TStringRef> >,
|
||||||
public VariantShortcuts<MemberProxy<TObject, TStringRef> >,
|
public VariantShortcuts<MemberProxy<TObject, TStringRef> >,
|
||||||
public Visitable,
|
|
||||||
public VariantTag {
|
public VariantTag {
|
||||||
typedef MemberProxy<TObject, TStringRef> this_type;
|
typedef MemberProxy<TObject, TStringRef> this_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef VariantRef variant_type;
|
|
||||||
|
|
||||||
FORCE_INLINE MemberProxy(TObject variant, TStringRef key)
|
FORCE_INLINE MemberProxy(TObject variant, TStringRef key)
|
||||||
: _object(variant), _key(key) {}
|
: _object(variant), _key(key) {}
|
||||||
|
|
||||||
|
@@ -57,8 +57,7 @@ class ObjectRefBase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class ObjectConstRef : public ObjectRefBase<const CollectionData>,
|
class ObjectConstRef : public ObjectRefBase<const CollectionData>,
|
||||||
public VariantOperators<ObjectConstRef>,
|
public VariantOperators<ObjectConstRef> {
|
||||||
public Visitable {
|
|
||||||
friend class ObjectRef;
|
friend class ObjectRef;
|
||||||
typedef ObjectRefBase<const CollectionData> base_type;
|
typedef ObjectRefBase<const CollectionData> base_type;
|
||||||
|
|
||||||
@@ -148,8 +147,7 @@ class ObjectConstRef : public ObjectRefBase<const CollectionData>,
|
|||||||
|
|
||||||
class ObjectRef : public ObjectRefBase<CollectionData>,
|
class ObjectRef : public ObjectRefBase<CollectionData>,
|
||||||
public ObjectShortcuts<ObjectRef>,
|
public ObjectShortcuts<ObjectRef>,
|
||||||
public VariantOperators<ObjectRef>,
|
public VariantOperators<ObjectRef> {
|
||||||
public Visitable {
|
|
||||||
typedef ObjectRefBase<CollectionData> base_type;
|
typedef ObjectRefBase<CollectionData> base_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@@ -30,8 +30,10 @@ struct is_convertible {
|
|||||||
static Yes &probe(To);
|
static Yes &probe(To);
|
||||||
static No &probe(...);
|
static No &probe(...);
|
||||||
|
|
||||||
|
static From &_from;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const bool value = sizeof(probe(declval<From>())) == sizeof(Yes);
|
static const bool value = sizeof(probe(_from)) == sizeof(Yes);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ARDUINOJSON_NAMESPACE
|
} // namespace ARDUINOJSON_NAMESPACE
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ArduinoJson/Configuration.hpp>
|
#include <ArduinoJson/Configuration.hpp>
|
||||||
#include <ArduinoJson/Misc/Visitable.hpp>
|
|
||||||
#include <ArduinoJson/Numbers/arithmeticCompare.hpp>
|
#include <ArduinoJson/Numbers/arithmeticCompare.hpp>
|
||||||
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
||||||
#include <ArduinoJson/Strings/StringAdapters.hpp>
|
#include <ArduinoJson/Strings/StringAdapters.hpp>
|
||||||
@@ -128,12 +127,10 @@ struct RawComparer : ComparerBase {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
struct VariantComparer : ComparerBase {
|
||||||
struct Comparer<T, typename enable_if<IsVisitable<T>::value>::type>
|
VariantConstRef rhs;
|
||||||
: ComparerBase {
|
|
||||||
const T *rhs; // TODO: should be a VariantConstRef
|
|
||||||
|
|
||||||
explicit Comparer(const T &value) : rhs(&value) {}
|
explicit VariantComparer(VariantConstRef value) : rhs(value) {}
|
||||||
|
|
||||||
CompareResult visitArray(const CollectionData &lhs) {
|
CompareResult visitArray(const CollectionData &lhs) {
|
||||||
ArrayComparer comparer(lhs);
|
ArrayComparer comparer(lhs);
|
||||||
@@ -183,7 +180,7 @@ struct Comparer<T, typename enable_if<IsVisitable<T>::value>::type>
|
|||||||
private:
|
private:
|
||||||
template <typename TComparer>
|
template <typename TComparer>
|
||||||
CompareResult accept(TComparer &comparer) {
|
CompareResult accept(TComparer &comparer) {
|
||||||
CompareResult reversedResult = rhs->accept(comparer);
|
CompareResult reversedResult = rhs.accept(comparer);
|
||||||
switch (reversedResult) {
|
switch (reversedResult) {
|
||||||
case COMPARE_RESULT_GREATER:
|
case COMPARE_RESULT_GREATER:
|
||||||
return COMPARE_RESULT_LESS;
|
return COMPARE_RESULT_LESS;
|
||||||
@@ -195,9 +192,17 @@ struct Comparer<T, typename enable_if<IsVisitable<T>::value>::type>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T1, typename T2>
|
template <typename T>
|
||||||
CompareResult compare(const T1 &lhs, const T2 &rhs) {
|
struct Comparer<
|
||||||
Comparer<T2> comparer(rhs);
|
T, typename enable_if<is_convertible<T, VariantConstRef>::value>::type>
|
||||||
|
: VariantComparer {
|
||||||
|
explicit Comparer(const T &value)
|
||||||
|
: VariantComparer(value.operator VariantConstRef()) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
CompareResult compare(VariantConstRef lhs, const T &rhs) {
|
||||||
|
Comparer<T> comparer(rhs);
|
||||||
return lhs.accept(comparer);
|
return lhs.accept(comparer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -124,11 +124,6 @@ VariantRef::to() const {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline VariantConstRef operator|(VariantConstRef preferedValue,
|
|
||||||
VariantConstRef defaultValue) {
|
|
||||||
return preferedValue ? preferedValue : defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Out of class definition to avoid #1560
|
// Out of class definition to avoid #1560
|
||||||
inline bool VariantRef::set(char value) const {
|
inline bool VariantRef::set(char value) const {
|
||||||
return set(static_cast<signed char>(value));
|
return set(static_cast<signed char>(value));
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ArduinoJson/Misc/Visitable.hpp>
|
|
||||||
#include <ArduinoJson/Numbers/arithmeticCompare.hpp>
|
#include <ArduinoJson/Numbers/arithmeticCompare.hpp>
|
||||||
#include <ArduinoJson/Polyfills/attributes.hpp>
|
#include <ArduinoJson/Polyfills/attributes.hpp>
|
||||||
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
||||||
@@ -12,11 +11,16 @@
|
|||||||
|
|
||||||
namespace ARDUINOJSON_NAMESPACE {
|
namespace ARDUINOJSON_NAMESPACE {
|
||||||
|
|
||||||
template <typename T1, typename T2>
|
class VariantConstRef;
|
||||||
CompareResult compare(const T1 &lhs, const T2 &rhs); // VariantCompare.cpp
|
|
||||||
|
template <typename T>
|
||||||
|
CompareResult compare(VariantConstRef lhs,
|
||||||
|
const T &rhs); // VariantCompare.cpp
|
||||||
|
|
||||||
|
struct VariantOperatorTag {};
|
||||||
|
|
||||||
template <typename TVariant>
|
template <typename TVariant>
|
||||||
struct VariantOperators {
|
struct VariantOperators : VariantOperatorTag {
|
||||||
// Returns the default value if the VariantRef is unbound or incompatible
|
// Returns the default value if the VariantRef is unbound or incompatible
|
||||||
//
|
//
|
||||||
// int operator|(JsonVariant, int)
|
// int operator|(JsonVariant, int)
|
||||||
@@ -43,7 +47,7 @@ struct VariantOperators {
|
|||||||
//
|
//
|
||||||
// JsonVariant operator|(JsonVariant, JsonVariant)
|
// JsonVariant operator|(JsonVariant, JsonVariant)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
friend typename enable_if<IsVariant<T>::value, typename T::variant_type>::type
|
friend typename enable_if<IsVariant<T>::value, VariantConstRef>::type
|
||||||
operator|(const TVariant &variant, T defaultValue) {
|
operator|(const TVariant &variant, T defaultValue) {
|
||||||
if (variant)
|
if (variant)
|
||||||
return variant;
|
return variant;
|
||||||
@@ -67,8 +71,9 @@ struct VariantOperators {
|
|||||||
return compare(lhs, rhs) == COMPARE_RESULT_EQUAL;
|
return compare(lhs, rhs) == COMPARE_RESULT_EQUAL;
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
friend typename enable_if<!IsVisitable<T>::value, bool>::type operator==(
|
friend
|
||||||
TVariant lhs, const T &rhs) {
|
typename enable_if<!is_base_of<VariantOperatorTag, T>::value, bool>::type
|
||||||
|
operator==(TVariant lhs, const T &rhs) {
|
||||||
return compare(lhs, rhs) == COMPARE_RESULT_EQUAL;
|
return compare(lhs, rhs) == COMPARE_RESULT_EQUAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,8 +93,9 @@ struct VariantOperators {
|
|||||||
return compare(lhs, rhs) != COMPARE_RESULT_EQUAL;
|
return compare(lhs, rhs) != COMPARE_RESULT_EQUAL;
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
friend typename enable_if<!IsVisitable<T>::value, bool>::type operator!=(
|
friend
|
||||||
TVariant lhs, const T &rhs) {
|
typename enable_if<!is_base_of<VariantOperatorTag, T>::value, bool>::type
|
||||||
|
operator!=(TVariant lhs, const T &rhs) {
|
||||||
return compare(lhs, rhs) != COMPARE_RESULT_EQUAL;
|
return compare(lhs, rhs) != COMPARE_RESULT_EQUAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,8 +115,9 @@ struct VariantOperators {
|
|||||||
return compare(lhs, rhs) == COMPARE_RESULT_LESS;
|
return compare(lhs, rhs) == COMPARE_RESULT_LESS;
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
friend typename enable_if<!IsVisitable<T>::value, bool>::type operator<(
|
friend
|
||||||
TVariant lhs, const T &rhs) {
|
typename enable_if<!is_base_of<VariantOperatorTag, T>::value, bool>::type
|
||||||
|
operator<(TVariant lhs, const T &rhs) {
|
||||||
return compare(lhs, rhs) == COMPARE_RESULT_LESS;
|
return compare(lhs, rhs) == COMPARE_RESULT_LESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,8 +137,9 @@ struct VariantOperators {
|
|||||||
return (compare(lhs, rhs) & COMPARE_RESULT_LESS_OR_EQUAL) != 0;
|
return (compare(lhs, rhs) & COMPARE_RESULT_LESS_OR_EQUAL) != 0;
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
friend typename enable_if<!IsVisitable<T>::value, bool>::type operator<=(
|
friend
|
||||||
TVariant lhs, const T &rhs) {
|
typename enable_if<!is_base_of<VariantOperatorTag, T>::value, bool>::type
|
||||||
|
operator<=(TVariant lhs, const T &rhs) {
|
||||||
return (compare(lhs, rhs) & COMPARE_RESULT_LESS_OR_EQUAL) != 0;
|
return (compare(lhs, rhs) & COMPARE_RESULT_LESS_OR_EQUAL) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,8 +159,9 @@ struct VariantOperators {
|
|||||||
return compare(lhs, rhs) == COMPARE_RESULT_GREATER;
|
return compare(lhs, rhs) == COMPARE_RESULT_GREATER;
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
friend typename enable_if<!IsVisitable<T>::value, bool>::type operator>(
|
friend
|
||||||
TVariant lhs, const T &rhs) {
|
typename enable_if<!is_base_of<VariantOperatorTag, T>::value, bool>::type
|
||||||
|
operator>(TVariant lhs, const T &rhs) {
|
||||||
return compare(lhs, rhs) == COMPARE_RESULT_GREATER;
|
return compare(lhs, rhs) == COMPARE_RESULT_GREATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,8 +181,9 @@ struct VariantOperators {
|
|||||||
return (compare(lhs, rhs) & COMPARE_RESULT_GREATER_OR_EQUAL) != 0;
|
return (compare(lhs, rhs) & COMPARE_RESULT_GREATER_OR_EQUAL) != 0;
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
friend typename enable_if<!IsVisitable<T>::value, bool>::type operator>=(
|
friend
|
||||||
TVariant lhs, const T &rhs) {
|
typename enable_if<!is_base_of<VariantOperatorTag, T>::value, bool>::type
|
||||||
|
operator>=(TVariant lhs, const T &rhs) {
|
||||||
return (compare(lhs, rhs) & COMPARE_RESULT_GREATER_OR_EQUAL) != 0;
|
return (compare(lhs, rhs) & COMPARE_RESULT_GREATER_OR_EQUAL) != 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
#include <stdint.h> // for uint8_t
|
#include <stdint.h> // for uint8_t
|
||||||
|
|
||||||
#include <ArduinoJson/Memory/MemoryPool.hpp>
|
#include <ArduinoJson/Memory/MemoryPool.hpp>
|
||||||
#include <ArduinoJson/Misc/Visitable.hpp>
|
|
||||||
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
#include <ArduinoJson/Polyfills/type_traits.hpp>
|
||||||
#include <ArduinoJson/Strings/StringAdapters.hpp>
|
#include <ArduinoJson/Strings/StringAdapters.hpp>
|
||||||
#include <ArduinoJson/Variant/Converter.hpp>
|
#include <ArduinoJson/Variant/Converter.hpp>
|
||||||
@@ -66,8 +65,7 @@ class VariantRefBase : public VariantTag {
|
|||||||
|
|
||||||
class VariantConstRef : public VariantRefBase<const VariantData>,
|
class VariantConstRef : public VariantRefBase<const VariantData>,
|
||||||
public VariantOperators<VariantConstRef>,
|
public VariantOperators<VariantConstRef>,
|
||||||
public VariantShortcuts<VariantConstRef>,
|
public VariantShortcuts<VariantConstRef> {
|
||||||
public Visitable {
|
|
||||||
typedef VariantRefBase<const VariantData> base_type;
|
typedef VariantRefBase<const VariantData> base_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -180,8 +178,7 @@ class VariantConstRef : public VariantRefBase<const VariantData>,
|
|||||||
// - a reference to a ArrayRef or ObjectRef
|
// - a reference to a ArrayRef or ObjectRef
|
||||||
class VariantRef : public VariantRefBase<VariantData>,
|
class VariantRef : public VariantRefBase<VariantData>,
|
||||||
public VariantOperators<VariantRef>,
|
public VariantOperators<VariantRef>,
|
||||||
public VariantShortcuts<VariantRef>,
|
public VariantShortcuts<VariantRef> {
|
||||||
public Visitable {
|
|
||||||
typedef VariantRefBase<VariantData> base_type;
|
typedef VariantRefBase<VariantData> base_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user