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

Method asUInt

Sources/Dependencies/jsoncpp/value.cpp:695–714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

693 }
694
695 Value::UInt Value::asUInt() const {
696 switch (type()) {
697 case intValue:
698 JSON_ASSERT_MESSAGE(isUInt(), "LargestInt out of UInt range");
699 return UInt(value_.int_);
700 case uintValue:
701 JSON_ASSERT_MESSAGE(isUInt(), "LargestUInt out of UInt range");
702 return UInt(value_.uint_);
703 case realValue:
704 JSON_ASSERT_MESSAGE(InRange(value_.real_, 0u, maxUInt), "double out of UInt range");
705 return UInt(value_.real_);
706 case nullValue:
707 return 0;
708 case booleanValue:
709 return value_.bool_ ? 1 : 0;
710 default:
711 break;
712 }
713 JSON_FAIL_MESSAGE("Value is not convertible to UInt.");
714 }
715
716#if defined(JSON_HAS_INT64)
717

Callers 2

newStreamWriterMethod · 0.80
newCharReaderMethod · 0.80

Calls 2

typeClass · 0.85
InRangeFunction · 0.85

Tested by

no test coverage detected