| 3393 | } |
| 3394 | |
| 3395 | Value::UInt64 Value::asUInt64() const |
| 3396 | { |
| 3397 | switch (type()) |
| 3398 | { |
| 3399 | case intValue: |
| 3400 | JSON_ASSERT_MESSAGE(isUInt64(), "LargestInt out of UInt64 range"); |
| 3401 | return UInt64(value_.int_); |
| 3402 | case uintValue: |
| 3403 | return UInt64(value_.uint_); |
| 3404 | case realValue: |
| 3405 | JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt64), "double out of UInt64 range"); |
| 3406 | return UInt64(value_.real_); |
| 3407 | case nullValue: |
| 3408 | return 0; |
| 3409 | case booleanValue: |
| 3410 | return value_.bool_ ? 1 : 0; |
| 3411 | default: |
| 3412 | break; |
| 3413 | } |
| 3414 | JSON_FAIL_MESSAGE("Value is not convertible to UInt64."); |
| 3415 | } |
| 3416 | #endif // if defined(JSON_HAS_INT64) |
| 3417 | |
| 3418 | LargestInt Value::asLargestInt() const |
no test coverage detected