Merge pull request #553 from AlB80/master

Clarify code for value type return
This commit is contained in:
Christopher Dunn 2016-11-20 18:53:23 -06:00 committed by GitHub
commit a691cb19de

View File

@ -1279,7 +1279,11 @@ bool Value::isBool() const { return type_ == booleanValue; }
bool Value::isInt() const {
switch (type_) {
case intValue:
#if defined(JSON_HAS_INT64)
return value_.int_ >= minInt && value_.int_ <= maxInt;
#else
return true;
#endif
case uintValue:
return value_.uint_ <= UInt(maxInt);
case realValue:
@ -1294,9 +1298,17 @@ bool Value::isInt() const {
bool Value::isUInt() const {
switch (type_) {
case intValue:
#if defined(JSON_HAS_INT64)
return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt);
#else
return value_.int_ >= 0;
#endif
case uintValue:
#if defined(JSON_HAS_INT64)
return value_.uint_ <= maxUInt;
#else
return true;
#endif
case realValue:
return value_.real_ >= 0 && value_.real_ <= maxUInt &&
IsIntegral(value_.real_);
@ -1354,9 +1366,9 @@ bool Value::isIntegral() const {
#endif
}
bool Value::isDouble() const { return type_ == realValue || isIntegral(); }
bool Value::isDouble() const { return type_ == intValue || type_ == uintValue || type_ == realValue; }
bool Value::isNumeric() const { return isIntegral() || isDouble(); }
bool Value::isNumeric() const { return isDouble(); }
bool Value::isString() const { return type_ == stringValue; }