mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Added a deprecation warning for is<char>() and is<char*>()
This commit is contained in:
		| @@ -123,10 +123,28 @@ class VariantRef : public VariantRefBase<VariantData>, | ||||
|   } | ||||
|  | ||||
|   template <typename T> | ||||
|   FORCE_INLINE bool is() const { | ||||
|   FORCE_INLINE | ||||
|       typename enable_if<!is_same<T, char *>::value && !is_same<T, char>::value, | ||||
|                          bool>::type | ||||
|       is() const { | ||||
|     return Converter<T>::checkJson(*this); | ||||
|   } | ||||
|  | ||||
|   template <typename T> | ||||
|   FORCE_INLINE typename enable_if<is_same<T, char *>::value, bool>::type | ||||
|   ARDUINOJSON_DEPRECATED("Replace is<char*>() with is<const char*>()") | ||||
|       is() const { | ||||
|     return is<const char *>(); | ||||
|   } | ||||
|  | ||||
|   template <typename T> | ||||
|   FORCE_INLINE typename enable_if<is_same<T, char>::value, bool>::type | ||||
|   ARDUINOJSON_DEPRECATED( | ||||
|       "Support for char is deprecated, use int8_t or uint8_t instead") | ||||
|       is() const { | ||||
|     return is<signed char>(); | ||||
|   } | ||||
|  | ||||
|   template <typename T> | ||||
|   FORCE_INLINE operator T() const { | ||||
|     return as<T>(); | ||||
| @@ -251,10 +269,28 @@ class VariantConstRef : public VariantRefBase<const VariantData>, | ||||
|   } | ||||
|  | ||||
|   template <typename T> | ||||
|   FORCE_INLINE bool is() const { | ||||
|   FORCE_INLINE | ||||
|       typename enable_if<!is_same<T, char *>::value && !is_same<T, char>::value, | ||||
|                          bool>::type | ||||
|       is() const { | ||||
|     return Converter<T>::checkJson(*this); | ||||
|   } | ||||
|  | ||||
|   template <typename T> | ||||
|   FORCE_INLINE typename enable_if<is_same<T, char *>::value, bool>::type | ||||
|   ARDUINOJSON_DEPRECATED("Replace is<char*>() with is<const char*>()") | ||||
|       is() const { | ||||
|     return is<const char *>(); | ||||
|   } | ||||
|  | ||||
|   template <typename T> | ||||
|   FORCE_INLINE typename enable_if<is_same<T, char>::value, bool>::type | ||||
|   ARDUINOJSON_DEPRECATED( | ||||
|       "Support for char is deprecated, use int8_t or uint8_t instead") | ||||
|       is() const { | ||||
|     return is<signed char>(); | ||||
|   } | ||||
|  | ||||
|   template <typename T> | ||||
|   FORCE_INLINE operator T() const { | ||||
|     return as<T>(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user