| 719 | } |
| 720 | |
| 721 | Value::UInt64 Value::asUInt64() const { |
| 722 | switch (type()) { |
| 723 | case intValue: |
| 724 | JSON_ASSERT_MESSAGE(isUInt64(), "LargestInt out of UInt64 range"); |
| 725 | return UInt64(value_.int_); |
| 726 | case uintValue: |
| 727 | return UInt64(value_.uint_); |
| 728 | case realValue: |
| 729 | JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt64), |
| 730 | "double out of UInt64 range"); |
| 731 | return UInt64(value_.real_); |
| 732 | case nullValue: |
| 733 | return 0; |
| 734 | case booleanValue: |
| 735 | return value_.bool_ ? 1 : 0; |
| 736 | default: |
| 737 | break; |
| 738 | } |
| 739 | JSON_FAIL_MESSAGE("Value is not convertible to UInt64."); |
| 740 | } |
| 741 | #endif // if defined(JSON_HAS_INT64) |
| 742 | |
| 743 | LargestInt Value::asLargestInt() const { |
no test coverage detected