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

Method asFloat

src/jsoncpp.cpp:3237–3259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

integerToDoubleFunction · 0.85

Tested by

no test coverage detected