MCPcopy Create free account
hub / github.com/Illumina/hap.py / asFloat

Method asFloat

external/jsoncpp/jsoncpp.cpp:2253–2273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2251}
2252
2253float Value::asFloat() const {
2254 switch (type_) {
2255 case intValue:
2256 return static_cast<float>(value_.int_);
2257 case uintValue:
2258#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2259 return static_cast<float>(value_.uint_);
2260#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2261 return integerToDouble(value_.uint_);
2262#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2263 case realValue:
2264 return static_cast<float>(value_.real_);
2265 case nullValue:
2266 return 0.0;
2267 case booleanValue:
2268 return value_.bool_ ? 1.0f : 0.0f;
2269 default:
2270 break;
2271 }
2272 JSON_FAIL_MESSAGE("Value is not convertible to float.");
2273}
2274
2275bool Value::asBool() const {
2276 switch (type_) {

Callers 4

getInfoFloatMethod · 0.80
putMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
mainFunction · 0.80

Calls 1

integerToDoubleFunction · 0.85

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.64