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

Method asDouble

runtime/3rdparty/jsoncpp/jsoncpp.cpp:3436–3458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3434}
3435
3436double Value::asDouble() const
3437{
3438 switch (type())
3439 {
3440 case intValue:
3441 return static_cast<double>(value_.int_);
3442 case uintValue:
3443#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3444 return static_cast<double>(value_.uint_);
3445#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3446 return integerToDouble(value_.uint_);
3447#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3448 case realValue:
3449 return value_.real_;
3450 case nullValue:
3451 return 0.0;
3452 case booleanValue:
3453 return value_.bool_ ? 1.0 : 0.0;
3454 default:
3455 break;
3456 }
3457 JSON_FAIL_MESSAGE("Value is not convertible to double.");
3458}
3459
3460float Value::asFloat() const
3461{

Callers 1

writeValueMethod · 0.80

Calls 2

integerToDoubleFunction · 0.85
typeFunction · 0.50

Tested by

no test coverage detected