| 3126 | } |
| 3127 | |
| 3128 | Value::UInt64 Value::asUInt64() const { |
| 3129 | switch (type()) { |
| 3130 | case intValue: |
| 3131 | JSON_ASSERT_MESSAGE(isUInt64(), "LargestInt out of UInt64 range"); |
| 3132 | return UInt64(value_.int_); |
| 3133 | case uintValue: |
| 3134 | return UInt64(value_.uint_); |
| 3135 | case realValue: |
| 3136 | JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt64), |
| 3137 | "double out of UInt64 range"); |
| 3138 | return UInt64(value_.real_); |
| 3139 | case nullValue: |
| 3140 | return 0; |
| 3141 | case booleanValue: |
| 3142 | return value_.bool_ ? 1 : 0; |
| 3143 | default: |
| 3144 | break; |
| 3145 | } |
| 3146 | JSON_FAIL_MESSAGE("Value is not convertible to UInt64."); |
| 3147 | } |
| 3148 | #endif // if defined(JSON_HAS_INT64) |
| 3149 | |
| 3150 | LargestInt Value::asLargestInt() const { |
no test coverage detected