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

Method asInt

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

Source from the content-addressed store, hash-verified

652}
653
654Value::Int Value::asInt() const {
655 switch (type()) {
656 case intValue:
657 JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range");
658 return Int(value_.int_);
659 case uintValue:
660 JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range");
661 return Int(value_.uint_);
662 case realValue:
663 JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt),
664 "double out of Int range");
665 return Int(value_.real_);
666 case nullValue:
667 return 0;
668 case booleanValue:
669 return value_.bool_ ? 1 : 0;
670 default:
671 break;
672 }
673 JSON_FAIL_MESSAGE("Value is not convertible to Int.");
674}
675
676Value::UInt Value::asUInt() const {
677 switch (type()) {

Callers 5

mainFunction · 0.80
VersionHelperFunction · 0.80
IntFunction · 0.80
ParseRootFunction · 0.80
HandleCDashUploadFileMethod · 0.80

Calls 3

IntFunction · 0.85
InRangeFunction · 0.85
typeClass · 0.50

Tested by 1

HandleCDashUploadFileMethod · 0.64