| 782 | } |
| 783 | |
| 784 | Value::UInt64 Value::asUInt64() const { |
| 785 | switch (type_) { |
| 786 | case intValue: |
| 787 | JSON_ASSERT_MESSAGE(isUInt64(), "LargestInt out of UInt64 range"); |
| 788 | return UInt64(value_.int_); |
| 789 | case uintValue: |
| 790 | return UInt64(value_.uint_); |
| 791 | case realValue: |
| 792 | JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt64), |
| 793 | "double out of UInt64 range"); |
| 794 | return UInt64(value_.real_); |
| 795 | case nullValue: |
| 796 | return 0; |
| 797 | case booleanValue: |
| 798 | return value_.bool_ ? 1 : 0; |
| 799 | default: |
| 800 | break; |
| 801 | } |
| 802 | JSON_FAIL_MESSAGE("Value is not convertible to UInt64."); |
| 803 | } |
| 804 | #endif // if defined(JSON_HAS_INT64) |
| 805 | |
| 806 | LargestInt Value::asLargestInt() const { |
no test coverage detected