| 1438 | } |
| 1439 | |
| 1440 | bool Value::isIntegral() const { |
| 1441 | switch (type_) { |
| 1442 | case intValue: |
| 1443 | case uintValue: |
| 1444 | return true; |
| 1445 | case realValue: |
| 1446 | #if defined(JSON_HAS_INT64) |
| 1447 | // Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a |
| 1448 | // double, so double(maxUInt64) will be rounded up to 2^64. Therefore we |
| 1449 | // require the value to be strictly less than the limit. |
| 1450 | return value_.real_ >= double(minInt64) && |
| 1451 | value_.real_ < maxUInt64AsDouble && IsIntegral(value_.real_); |
| 1452 | #else |
| 1453 | return value_.real_ >= minInt && value_.real_ <= maxUInt && |
| 1454 | IsIntegral(value_.real_); |
| 1455 | #endif // JSON_HAS_INT64 |
| 1456 | default: |
| 1457 | break; |
| 1458 | } |
| 1459 | return false; |
| 1460 | } |
| 1461 | |
| 1462 | bool Value::isDouble() const { |
| 1463 | return type_ == intValue || type_ == uintValue || type_ == realValue; |
no test coverage detected