mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-08-02 20:24:42 +02:00
Fix function returns incomplete class type
on IAR (issue #2001)
Ported from 3e1be980d9
This commit is contained in:
@@ -56,9 +56,7 @@ class VariantRefBase : public VariantTag {
|
|||||||
// https://arduinojson.org/v7/api/jsonvariant/as/
|
// https://arduinojson.org/v7/api/jsonvariant/as/
|
||||||
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(getVariant());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T,
|
template <typename T,
|
||||||
typename = typename enable_if<!is_same<T, TDerived>::value>::type>
|
typename = typename enable_if<!is_same<T, TDerived>::value>::type>
|
||||||
@@ -88,9 +86,7 @@ class VariantRefBase : public VariantTag {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
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(getVariant());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if the value is of the specified type.
|
// Returns true if the value is of the specified type.
|
||||||
// https://arduinojson.org/v7/api/jsonvariant/is/
|
// https://arduinojson.org/v7/api/jsonvariant/is/
|
||||||
@@ -106,20 +102,12 @@ class VariantRefBase : public VariantTag {
|
|||||||
// Copies the specified value.
|
// Copies the specified value.
|
||||||
// https://arduinojson.org/v7/api/jsonvariant/set/
|
// https://arduinojson.org/v7/api/jsonvariant/set/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
FORCE_INLINE bool set(const T& value) const {
|
FORCE_INLINE bool set(const T& value) const;
|
||||||
Converter<T>::toJson(value, getOrCreateVariant());
|
|
||||||
auto resources = getResourceManager();
|
|
||||||
return resources && !resources->overflowed();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copies the specified value.
|
// Copies the specified value.
|
||||||
// https://arduinojson.org/v7/api/jsonvariant/set/
|
// https://arduinojson.org/v7/api/jsonvariant/set/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
FORCE_INLINE bool set(T* value) const {
|
FORCE_INLINE bool set(T* value) const;
|
||||||
Converter<T*>::toJson(value, getOrCreateVariant());
|
|
||||||
auto resources = getResourceManager();
|
|
||||||
return resources && !resources->overflowed();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the size of the array or object.
|
// Returns the size of the array or object.
|
||||||
// https://arduinojson.org/v7/api/jsonvariant/size/
|
// https://arduinojson.org/v7/api/jsonvariant/size/
|
||||||
|
@@ -15,6 +15,13 @@ inline JsonVariant VariantRefBase<TDerived>::add() const {
|
|||||||
return add<JsonVariant>();
|
return add<JsonVariant>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename TDerived>
|
||||||
|
template <typename T>
|
||||||
|
inline typename enable_if<ConverterNeedsWriteableRef<T>::value, T>::type
|
||||||
|
VariantRefBase<TDerived>::as() const {
|
||||||
|
return Converter<T>::fromJson(getVariant());
|
||||||
|
}
|
||||||
|
|
||||||
template <typename TDerived>
|
template <typename TDerived>
|
||||||
inline JsonArray VariantRefBase<TDerived>::createNestedArray() const {
|
inline JsonArray VariantRefBase<TDerived>::createNestedArray() const {
|
||||||
return add<JsonArray>();
|
return add<JsonArray>();
|
||||||
@@ -93,6 +100,13 @@ inline JsonVariant VariantRefBase<TDerived>::getOrCreateVariant() const {
|
|||||||
return JsonVariant(getOrCreateData(), getResourceManager());
|
return JsonVariant(getOrCreateData(), getResourceManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename TDerived>
|
||||||
|
template <typename T>
|
||||||
|
inline typename enable_if<ConverterNeedsWriteableRef<T>::value, bool>::type
|
||||||
|
VariantRefBase<TDerived>::is() const {
|
||||||
|
return Converter<T>::checkJson(getVariant());
|
||||||
|
}
|
||||||
|
|
||||||
template <typename TDerived>
|
template <typename TDerived>
|
||||||
inline ElementProxy<TDerived> VariantRefBase<TDerived>::operator[](
|
inline ElementProxy<TDerived> VariantRefBase<TDerived>::operator[](
|
||||||
size_t index) const {
|
size_t index) const {
|
||||||
@@ -115,6 +129,22 @@ VariantRefBase<TDerived>::operator[](const TString& key) const {
|
|||||||
return MemberProxy<TDerived, TString>(derived(), key);
|
return MemberProxy<TDerived, TString>(derived(), key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename TDerived>
|
||||||
|
template <typename T>
|
||||||
|
inline bool VariantRefBase<TDerived>::set(const T& value) const {
|
||||||
|
Converter<T>::toJson(value, getOrCreateVariant());
|
||||||
|
auto resources = getResourceManager();
|
||||||
|
return resources && !resources->overflowed();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename TDerived>
|
||||||
|
template <typename T>
|
||||||
|
inline bool VariantRefBase<TDerived>::set(T* value) const {
|
||||||
|
Converter<T*>::toJson(value, getOrCreateVariant());
|
||||||
|
auto resources = getResourceManager();
|
||||||
|
return resources && !resources->overflowed();
|
||||||
|
}
|
||||||
|
|
||||||
template <typename TDerived>
|
template <typename TDerived>
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline typename enable_if<is_same<T, JsonArray>::value, JsonArray>::type
|
inline typename enable_if<is_same<T, JsonArray>::value, JsonArray>::type
|
||||||
|
Reference in New Issue
Block a user