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

Method asDouble

src/jsoncpp.cpp:3213–3235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

writeValueMethod · 0.80

Calls 1

integerToDoubleFunction · 0.85

Tested by

no test coverage detected