MCPcopy Create free account
hub / github.com/Kitware/CMake / asUInt

Method asUInt

Utilities/cmjsoncpp/src/lib_json/json_value.cpp:676–696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

674}
675
676Value::UInt Value::asUInt() const {
677 switch (type()) {
678 case intValue:
679 JSON_ASSERT_MESSAGE(isUInt(), "LargestInt out of UInt range");
680 return UInt(value_.int_);
681 case uintValue:
682 JSON_ASSERT_MESSAGE(isUInt(), "LargestUInt out of UInt range");
683 return UInt(value_.uint_);
684 case realValue:
685 JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt),
686 "double out of UInt range");
687 return UInt(value_.real_);
688 case nullValue:
689 return 0;
690 case booleanValue:
691 return value_.bool_ ? 1 : 0;
692 default:
693 break;
694 }
695 JSON_FAIL_MESSAGE("Value is not convertible to UInt.");
696}
697
698#if defined(JSON_HAS_INT64)
699

Callers 8

newCharReaderMethod · 0.80
newStreamWriterMethod · 0.80
UIntFunction · 0.80
LoadMethod · 0.80
GetUIntMethod · 0.80
ReadRequestVersionMethod · 0.80

Calls 3

UIntFunction · 0.85
InRangeFunction · 0.85
typeClass · 0.50

Tested by 1