MCPcopy Create free account
hub / github.com/cinder/Cinder / asFloat

Method asFloat

src/jsoncpp/jsoncpp.cpp:2173–2193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2171}
2172
2173float Value::asFloat() const {
2174 switch (type_) {
2175 case intValue:
2176 return static_cast<float>(value_.int_);
2177 case uintValue:
2178#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2179 return static_cast<float>(value_.uint_);
2180#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2181 return integerToDouble(value_.uint_);
2182#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2183 case realValue:
2184 return static_cast<float>(value_.real_);
2185 case nullValue:
2186 return 0.0;
2187 case booleanValue:
2188 return value_.bool_ ? 1.0f : 0.0f;
2189 default:
2190 break;
2191 }
2192 JSON_FAIL_MESSAGE("Value is not convertible to float.");
2193}
2194
2195bool Value::asBool() const {
2196 switch (type_) {

Callers

nothing calls this directly

Calls 1

integerToDoubleFunction · 0.85

Tested by

no test coverage detected