mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-05-18 19:37:35 +02:00
Merge pull request #553 from AlB80/master
Clarify code for value type return
This commit is contained in:
commit
a691cb19de
@ -1279,7 +1279,11 @@ bool Value::isBool() const { return type_ == booleanValue; }
|
|||||||
bool Value::isInt() const {
|
bool Value::isInt() const {
|
||||||
switch (type_) {
|
switch (type_) {
|
||||||
case intValue:
|
case intValue:
|
||||||
|
#if defined(JSON_HAS_INT64)
|
||||||
return value_.int_ >= minInt && value_.int_ <= maxInt;
|
return value_.int_ >= minInt && value_.int_ <= maxInt;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
case uintValue:
|
case uintValue:
|
||||||
return value_.uint_ <= UInt(maxInt);
|
return value_.uint_ <= UInt(maxInt);
|
||||||
case realValue:
|
case realValue:
|
||||||
@ -1294,9 +1298,17 @@ bool Value::isInt() const {
|
|||||||
bool Value::isUInt() const {
|
bool Value::isUInt() const {
|
||||||
switch (type_) {
|
switch (type_) {
|
||||||
case intValue:
|
case intValue:
|
||||||
|
#if defined(JSON_HAS_INT64)
|
||||||
return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt);
|
return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt);
|
||||||
|
#else
|
||||||
|
return value_.int_ >= 0;
|
||||||
|
#endif
|
||||||
case uintValue:
|
case uintValue:
|
||||||
|
#if defined(JSON_HAS_INT64)
|
||||||
return value_.uint_ <= maxUInt;
|
return value_.uint_ <= maxUInt;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
case realValue:
|
case realValue:
|
||||||
return value_.real_ >= 0 && value_.real_ <= maxUInt &&
|
return value_.real_ >= 0 && value_.real_ <= maxUInt &&
|
||||||
IsIntegral(value_.real_);
|
IsIntegral(value_.real_);
|
||||||
@ -1354,9 +1366,9 @@ bool Value::isIntegral() const {
|
|||||||
#endif
|
#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; }
|
bool Value::isString() const { return type_ == stringValue; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user