MCPcopy Create free account
hub / github.com/ValveSoftware/Proton / asDouble

Method asDouble

vrclient_x64/jsoncpp.cpp:3212–3234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3210}
3211
3212double Value::asDouble() const {
3213 switch (type_) {
3214 case intValue:
3215 return static_cast<double>(value_.int_);
3216 case uintValue:
3217#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3218 return static_cast<double>(value_.uint_);
3219#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3220 return integerToDouble(value_.uint_);
3221#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3222 case realValue:
3223 return value_.real_;
3224 case nullValue:
3225 return 0.0;
3226 case booleanValue:
3227 return value_.bool_ ? 1.0 : 0.0;
3228 default:
3229 if ( default_value_ )
3230 return default_value_->asDouble();
3231 else
3232 return 0.0;
3233 }
3234}
3235
3236float Value::asFloat() const {
3237 switch (type_) {

Callers 1

writeValueMethod · 0.80

Calls 1

integerToDoubleFunction · 0.85

Tested by

no test coverage detected