| 698 | #if defined(JSON_HAS_INT64) |
| 699 | |
| 700 | Value::Int64 Value::asInt64() const { |
| 701 | switch (type()) { |
| 702 | case intValue: |
| 703 | return Int64(value_.int_); |
| 704 | case uintValue: |
| 705 | JSON_ASSERT_MESSAGE(isInt64(), "LargestUInt out of Int64 range"); |
| 706 | return Int64(value_.uint_); |
| 707 | case realValue: |
| 708 | JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt64, maxInt64), |
| 709 | "double out of Int64 range"); |
| 710 | return Int64(value_.real_); |
| 711 | case nullValue: |
| 712 | return 0; |
| 713 | case booleanValue: |
| 714 | return value_.bool_ ? 1 : 0; |
| 715 | default: |
| 716 | break; |
| 717 | } |
| 718 | JSON_FAIL_MESSAGE("Value is not convertible to Int64."); |
| 719 | } |
| 720 | |
| 721 | Value::UInt64 Value::asUInt64() const { |
| 722 | switch (type()) { |
no test coverage detected