| 1386 | } |
| 1387 | |
| 1388 | bool Value::isIntegral() const { |
| 1389 | switch (type_) { |
| 1390 | case intValue: |
| 1391 | case uintValue: |
| 1392 | return true; |
| 1393 | case realValue: |
| 1394 | #if defined(JSON_HAS_INT64) |
| 1395 | // Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a |
| 1396 | // double, so double(maxUInt64) will be rounded up to 2^64. Therefore we |
| 1397 | // require the value to be strictly less than the limit. |
| 1398 | return value_.real_ >= double(minInt64) && value_.real_ < maxUInt64AsDouble && IsIntegral(value_.real_); |
| 1399 | #else |
| 1400 | return value_.real_ >= minInt && value_.real_ <= maxUInt && IsIntegral(value_.real_); |
| 1401 | #endif // JSON_HAS_INT64 |
| 1402 | default: |
| 1403 | break; |
| 1404 | } |
| 1405 | return false; |
| 1406 | } |
| 1407 | |
| 1408 | bool Value::isDouble() const { return type_ == intValue || type_ == uintValue || type_ == realValue; } |
| 1409 | |