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

Method asInt

Sources/Dependencies/jsoncpp/value.cpp:674–693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

typeClass · 0.85
InRangeFunction · 0.85

Tested by

no test coverage detected