mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-30 02:37:35 +02:00
Fix some getVariant()
that were accidentally renamed to getSlot()
This commit is contained in:
@ -80,14 +80,14 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
|
|||||||
// https://arduinojson.org/v6/api/jsondocument/as/
|
// https://arduinojson.org/v6/api/jsondocument/as/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T as() {
|
T as() {
|
||||||
return getSlot().template as<T>();
|
return getVariant().template as<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Casts the root to the specified type.
|
// Casts the root to the specified type.
|
||||||
// https://arduinojson.org/v6/api/jsondocument/as/
|
// https://arduinojson.org/v6/api/jsondocument/as/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T as() const {
|
T as() const {
|
||||||
return getSlot().template as<T>();
|
return getVariant().template as<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empties the document and resets the memory pool
|
// Empties the document and resets the memory pool
|
||||||
@ -101,20 +101,20 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
|
|||||||
// https://arduinojson.org/v6/api/jsondocument/is/
|
// https://arduinojson.org/v6/api/jsondocument/is/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool is() {
|
bool is() {
|
||||||
return getSlot().template is<T>();
|
return getVariant().template is<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the root is of the specified type.
|
// Returns true if the root is of the specified type.
|
||||||
// https://arduinojson.org/v6/api/jsondocument/is/
|
// https://arduinojson.org/v6/api/jsondocument/is/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool is() const {
|
bool is() const {
|
||||||
return getSlot().template is<T>();
|
return getVariant().template is<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the root is null.
|
// Returns true if the root is null.
|
||||||
// https://arduinojson.org/v6/api/jsondocument/isnull/
|
// https://arduinojson.org/v6/api/jsondocument/isnull/
|
||||||
bool isNull() const {
|
bool isNull() const {
|
||||||
return getSlot().isNull();
|
return getVariant().isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns trues if the memory pool was too small.
|
// Returns trues if the memory pool was too small.
|
||||||
@ -155,7 +155,7 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
typename detail::VariantTo<T>::type to() {
|
typename detail::VariantTo<T>::type to() {
|
||||||
clear();
|
clear();
|
||||||
return getSlot().template to<T>();
|
return getVariant().template to<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates an array and appends it to the root array.
|
// Creates an array and appends it to the root array.
|
||||||
@ -314,11 +314,11 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE operator JsonVariant() {
|
FORCE_INLINE operator JsonVariant() {
|
||||||
return getSlot();
|
return getVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE operator JsonVariantConst() const {
|
FORCE_INLINE operator JsonVariantConst() const {
|
||||||
return getSlot();
|
return getVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
friend void swap(JsonDocument& a, JsonDocument& b) {
|
friend void swap(JsonDocument& a, JsonDocument& b) {
|
||||||
@ -327,11 +327,11 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JsonVariant getSlot() {
|
JsonVariant getVariant() {
|
||||||
return JsonVariant(&data_, &resources_);
|
return JsonVariant(&data_, &resources_);
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonVariantConst getSlot() const {
|
JsonVariantConst getVariant() const {
|
||||||
return JsonVariantConst(&data_, &resources_);
|
return JsonVariantConst(&data_, &resources_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ inline JsonVariant VariantRefBase<TDerived>::add() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename TDerived>
|
template <typename TDerived>
|
||||||
inline JsonVariant VariantRefBase<TDerived>::getSlot() const {
|
inline JsonVariant VariantRefBase<TDerived>::getVariant() const {
|
||||||
return JsonVariant(getData(), getResourceManager());
|
return JsonVariant(getData(), getResourceManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class VariantRefBase : public VariantTag {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
FORCE_INLINE typename enable_if<ConverterNeedsWriteableRef<T>::value, T>::type
|
FORCE_INLINE typename enable_if<ConverterNeedsWriteableRef<T>::value, T>::type
|
||||||
as() const {
|
as() const {
|
||||||
return Converter<T>::fromJson(getSlot());
|
return Converter<T>::fromJson(getVariant());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -92,7 +92,7 @@ class VariantRefBase : public VariantTag {
|
|||||||
FORCE_INLINE
|
FORCE_INLINE
|
||||||
typename enable_if<ConverterNeedsWriteableRef<T>::value, bool>::type
|
typename enable_if<ConverterNeedsWriteableRef<T>::value, bool>::type
|
||||||
is() const {
|
is() const {
|
||||||
return Converter<T>::checkJson(getSlot());
|
return Converter<T>::checkJson(getVariant());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the value is of the specified type.
|
// Returns true if the value is of the specified type.
|
||||||
@ -262,7 +262,7 @@ class VariantRefBase : public VariantTag {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FORCE_INLINE ArduinoJson::JsonVariant getSlot() const;
|
FORCE_INLINE ArduinoJson::JsonVariant getVariant() const;
|
||||||
|
|
||||||
FORCE_INLINE ArduinoJson::JsonVariantConst getVariantConst() const {
|
FORCE_INLINE ArduinoJson::JsonVariantConst getVariantConst() const {
|
||||||
return ArduinoJson::JsonVariantConst(getData(), getResourceManager());
|
return ArduinoJson::JsonVariantConst(getData(), getResourceManager());
|
||||||
|
Reference in New Issue
Block a user