MCPcopy Create free account
hub / github.com/Illumina/hap.py / asInt

Method asInt

external/jsoncpp/jsoncpp.cpp:2126–2146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2124#endif
2125
2126Value::Int Value::asInt() const {
2127 switch (type_) {
2128 case intValue:
2129 JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range");
2130 return Int(value_.int_);
2131 case uintValue:
2132 JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range");
2133 return Int(value_.uint_);
2134 case realValue:
2135 JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt),
2136 "double out of Int range");
2137 return Int(value_.real_);
2138 case nullValue:
2139 return 0;
2140 case booleanValue:
2141 return value_.bool_ ? 1 : 0;
2142 default:
2143 break;
2144 }
2145 JSON_FAIL_MESSAGE("Value is not convertible to Int.");
2146}
2147
2148Value::UInt Value::asUInt() const {
2149 switch (type_) {

Callers 4

getInfoIntMethod · 0.80
putMethod · 0.80
runMethod · 0.80
mainFunction · 0.80

Calls 1

InRangeFunction · 0.85

Tested by

no test coverage detected