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

Method asFloat

vrclient_x64/jsoncpp.cpp:3236–3258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3234}
3235
3236float Value::asFloat() const {
3237 switch (type_) {
3238 case intValue:
3239 return static_cast<float>(value_.int_);
3240 case uintValue:
3241#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3242 return static_cast<float>(value_.uint_);
3243#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3244 return integerToDouble(value_.uint_);
3245#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3246 case realValue:
3247 return static_cast<float>(value_.real_);
3248 case nullValue:
3249 return 0.0;
3250 case booleanValue:
3251 return value_.bool_ ? 1.0f : 0.0f;
3252 default:
3253 if ( default_value_ )
3254 return default_value_->asFloat();
3255 else
3256 return 0.0f;
3257 }
3258}
3259
3260bool Value::asBool() const {
3261 switch (type_) {

Callers

nothing calls this directly

Calls 1

integerToDoubleFunction · 0.85

Tested by

no test coverage detected