Fixed JsonVariant::is<bool>() that was incorrectly returning false (issue #214)

This commit is contained in:
Benoit Blanchon
2016-01-31 21:56:04 +01:00
parent 01924618bd
commit 6a608d4b49
5 changed files with 49 additions and 4 deletions

View File

@ -86,6 +86,16 @@ String JsonVariant::as<String>() const {
return s;
}
template <>
bool JsonVariant::is<bool>() const {
if (_type == JSON_BOOLEAN) return true;
if (_type != JSON_UNPARSED || _content.asString == NULL) return false;
return !strcmp(_content.asString, "true") ||
!strcmp(_content.asString, "false");
}
template <>
bool JsonVariant::is<signed long>() const {
if (_type == JSON_INTEGER) return true;