MCPcopy Create free account
hub / github.com/Samsung/ONE / asInt

Method asInt

runtime/3rdparty/jsoncpp/jsoncpp.cpp:3325–3346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3323}
3324
3325Value::Int Value::asInt() const
3326{
3327 switch (type())
3328 {
3329 case intValue:
3330 JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range");
3331 return Int(value_.int_);
3332 case uintValue:
3333 JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range");
3334 return Int(value_.uint_);
3335 case realValue:
3336 JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt), "double out of Int range");
3337 return Int(value_.real_);
3338 case nullValue:
3339 return 0;
3340 case booleanValue:
3341 return value_.bool_ ? 1 : 0;
3342 default:
3343 break;
3344 }
3345 JSON_FAIL_MESSAGE("Value is not convertible to Int.");
3346}
3347
3348Value::UInt Value::asUInt() const
3349{

Callers

nothing calls this directly

Calls 3

IntFunction · 0.85
InRangeFunction · 0.85
typeFunction · 0.50

Tested by

no test coverage detected