MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / asInt64

Method asInt64

Sources/Dependencies/jsoncpp/value.cpp:748–771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

746 }
747
748 Value::Int64 Value::asInt64() const {
749 switch (type()) {
750 case intValue:
751 return Int64(value_.int_);
752 case uintValue:
753 JSON_ASSERT_MESSAGE(isInt64(), "LargestUInt out of Int64 range");
754 return Int64(value_.uint_);
755 case realValue:
756 // If the double value is in proximity to minInt64, it will be rounded to
757 // minInt64. The correct value in this scenario is indeterminable
758 JSON_ASSERT_MESSAGE(
759 value_.real_ != minInt64,
760 "Double value is minInt64, precise value cannot be determined");
761 JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt64, maxInt64), "double out of Int64 range");
762 return Int64(value_.real_);
763 case nullValue:
764 return 0;
765 case booleanValue:
766 return value_.bool_ ? 1 : 0;
767 default:
768 break;
769 }
770 JSON_FAIL_MESSAGE("Value is not convertible to Int64.");
771 }
772
773 Value::UInt64 Value::asUInt64() const {
774 switch (type()) {

Callers

nothing calls this directly

Calls 2

typeClass · 0.85
InRangeFunction · 0.85

Tested by

no test coverage detected