| 761 | #if defined(JSON_HAS_INT64) |
| 762 | |
| 763 | Value::Int64 Value::asInt64() const { |
| 764 | switch (type_) { |
| 765 | case intValue: |
| 766 | return Int64(value_.int_); |
| 767 | case uintValue: |
| 768 | JSON_ASSERT_MESSAGE(isInt64(), "LargestUInt out of Int64 range"); |
| 769 | return Int64(value_.uint_); |
| 770 | case realValue: |
| 771 | JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt64, maxInt64), |
| 772 | "double out of Int64 range"); |
| 773 | return Int64(value_.real_); |
| 774 | case nullValue: |
| 775 | return 0; |
| 776 | case booleanValue: |
| 777 | return value_.bool_ ? 1 : 0; |
| 778 | default: |
| 779 | break; |
| 780 | } |
| 781 | JSON_FAIL_MESSAGE("Value is not convertible to Int64."); |
| 782 | } |
| 783 | |
| 784 | Value::UInt64 Value::asUInt64() const { |
| 785 | switch (type_) { |
no test coverage detected