mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 00:38:27 +01:00
Fixed enums serialized as booleans (fixes #1197)
This commit is contained in:
@@ -153,7 +153,9 @@ class VariantRef : public VariantRefBase<VariantData>,
|
||||
}
|
||||
|
||||
// set(bool value)
|
||||
FORCE_INLINE bool set(bool value) const {
|
||||
template <typename T>
|
||||
FORCE_INLINE bool set(
|
||||
T value, typename enable_if<is_same<T, bool>::value>::type * = 0) const {
|
||||
return variantSetBoolean(_data, value);
|
||||
}
|
||||
|
||||
@@ -237,6 +239,13 @@ class VariantRef : public VariantRefBase<VariantData>,
|
||||
typename enable_if<IsVisitable<TVariant>::value, bool>::type set(
|
||||
const TVariant &value) const;
|
||||
|
||||
// set(enum value)
|
||||
template <typename T>
|
||||
FORCE_INLINE bool set(
|
||||
T value, typename enable_if<is_enum<T>::value>::type * = 0) const {
|
||||
return variantSetSignedInteger(_data, static_cast<Integer>(value));
|
||||
}
|
||||
|
||||
// Get the variant as the specified type.
|
||||
//
|
||||
// std::string as<std::string>() const;
|
||||
|
||||
Reference in New Issue
Block a user