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

Method asUInt

external/jsoncpp/jsoncpp.cpp:3223–3243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3221}
3222
3223Value::UInt Value::asUInt() const {
3224 switch (type_) {
3225 case intValue:
3226 JSON_ASSERT_MESSAGE(isUInt(), "LargestInt out of UInt range");
3227 return UInt(value_.int_);
3228 case uintValue:
3229 JSON_ASSERT_MESSAGE(isUInt(), "LargestUInt out of UInt range");
3230 return UInt(value_.uint_);
3231 case realValue:
3232 JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt),
3233 "double out of UInt range");
3234 return UInt(value_.real_);
3235 case nullValue:
3236 return 0;
3237 case booleanValue:
3238 return value_.bool_ ? 1 : 0;
3239 default:
3240 break;
3241 }
3242 JSON_FAIL_MESSAGE("Value is not convertible to UInt.");
3243}
3244
3245#if defined(JSON_HAS_INT64)
3246

Callers 2

setFromJsonMethod · 0.80
newStreamWriterMethod · 0.80

Calls 1

InRangeFunction · 0.85

Tested by

no test coverage detected