MCPcopy Create free account
hub / github.com/Illumina/paragraph / asInt

Method asInt

external/jsoncpp/jsoncpp.cpp:3201–3221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3199#endif
3200
3201Value::Int Value::asInt() const {
3202 switch (type_) {
3203 case intValue:
3204 JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range");
3205 return Int(value_.int_);
3206 case uintValue:
3207 JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range");
3208 return Int(value_.uint_);
3209 case realValue:
3210 JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt),
3211 "double out of Int range");
3212 return Int(value_.real_);
3213 case nullValue:
3214 return 0;
3215 case booleanValue:
3216 return value_.bool_ ? 1 : 0;
3217 default:
3218 break;
3219 }
3220 JSON_FAIL_MESSAGE("Value is not convertible to Int.");
3221}
3222
3223Value::UInt Value::asUInt() const {
3224 switch (type_) {

Callers 4

addCountsMethod · 0.80
loadManifestFunction · 0.80
setFromJsonMethod · 0.80
newCharReaderMethod · 0.80

Calls 1

InRangeFunction · 0.85

Tested by

no test coverage detected