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

Method asDouble

src/jsoncpp/jsoncpp.cpp:2151–2171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2149}
2150
2151double Value::asDouble() const {
2152 switch (type_) {
2153 case intValue:
2154 return static_cast<double>(value_.int_);
2155 case uintValue:
2156#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2157 return static_cast<double>(value_.uint_);
2158#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2159 return integerToDouble(value_.uint_);
2160#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2161 case realValue:
2162 return value_.real_;
2163 case nullValue:
2164 return 0.0;
2165 case booleanValue:
2166 return value_.bool_ ? 1.0 : 0.0;
2167 default:
2168 break;
2169 }
2170 JSON_FAIL_MESSAGE("Value is not convertible to double.");
2171}
2172
2173float Value::asFloat() const {
2174 switch (type_) {

Callers 2

writeValueMethod · 0.80
initMethod · 0.80

Calls 1

integerToDoubleFunction · 0.85

Tested by

no test coverage detected