forked from bblanchon/ArduinoJson
Fixed JsonVariant::is<String>()
(closes #763)
This commit is contained in:
@ -6,6 +6,7 @@ HEAD
|
|||||||
|
|
||||||
* Improved float serialization when `-fsingle-precision-constant` is used
|
* Improved float serialization when `-fsingle-precision-constant` is used
|
||||||
* Fixed `JsonVariant::is<int>()` that returned true for empty strings
|
* Fixed `JsonVariant::is<int>()` that returned true for empty strings
|
||||||
|
* Fixed `JsonVariant::is<String>()` (closes #763)
|
||||||
|
|
||||||
v5.13.2
|
v5.13.2
|
||||||
-------
|
-------
|
||||||
|
@ -274,9 +274,11 @@ class JsonVariant : public Internals::JsonVariantBase<JsonVariant> {
|
|||||||
//
|
//
|
||||||
// bool is<const char*>() const;
|
// bool is<const char*>() const;
|
||||||
// bool is<char*>() const;
|
// bool is<char*>() const;
|
||||||
|
// bool is<std::string>() const;
|
||||||
template <typename T>
|
template <typename T>
|
||||||
typename Internals::EnableIf<Internals::IsSame<T, const char *>::value ||
|
typename Internals::EnableIf<Internals::IsSame<T, const char *>::value ||
|
||||||
Internals::IsSame<T, char *>::value,
|
Internals::IsSame<T, char *>::value ||
|
||||||
|
Internals::StringTraits<T>::has_append,
|
||||||
bool>::type
|
bool>::type
|
||||||
is() const {
|
is() const {
|
||||||
return variantIsString();
|
return variantIsString();
|
||||||
@ -352,4 +354,4 @@ DEPRECATED("Decimal places are ignored, use the double value instead")
|
|||||||
inline JsonVariant double_with_n_digits(double value, uint8_t) {
|
inline JsonVariant double_with_n_digits(double value, uint8_t) {
|
||||||
return JsonVariant(value);
|
return JsonVariant(value);
|
||||||
}
|
}
|
||||||
}
|
} // namespace ArduinoJson
|
||||||
|
@ -58,6 +58,7 @@ void checkIsInteger(JsonVariant var) {
|
|||||||
|
|
||||||
void checkIsString(JsonVariant var) {
|
void checkIsString(JsonVariant var) {
|
||||||
REQUIRE(var.is<const char*>());
|
REQUIRE(var.is<const char*>());
|
||||||
|
REQUIRE(var.is<std::string>());
|
||||||
|
|
||||||
REQUIRE_FALSE(var.is<bool>());
|
REQUIRE_FALSE(var.is<bool>());
|
||||||
REQUIRE_FALSE(var.is<int>());
|
REQUIRE_FALSE(var.is<int>());
|
||||||
|
Reference in New Issue
Block a user