MCPcopy Create free account
hub / github.com/SOUI2/soui / asInt

Method asInt

third-part/jsoncpp/src/lib_json/json_value.cpp:732–752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

730#endif
731
732Value::Int Value::asInt() const {
733 switch (type_) {
734 case intValue:
735 JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range");
736 return Int(value_.int_);
737 case uintValue:
738 JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range");
739 return Int(value_.uint_);
740 case realValue:
741 JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt),
742 "double out of Int range");
743 return Int(value_.real_);
744 case nullValue:
745 return 0;
746 case booleanValue:
747 return value_.bool_ ? 1 : 0;
748 default:
749 break;
750 }
751 JSON_FAIL_MESSAGE("Value is not convertible to Int.");
752}
753
754Value::UInt Value::asUInt() const {
755 switch (type_) {

Callers 2

newCharReaderMethod · 0.80
JSONTEST_FIXTUREFunction · 0.80

Calls 1

InRangeFunction · 0.85

Tested by

no test coverage detected