MCPcopy Create free account
hub / github.com/EQEmu/EQEmu / asDouble

Method asDouble

common/json/jsoncpp.cpp:3261–3281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3259}
3260
3261double Value::asDouble() const {
3262 switch (type_) {
3263 case intValue:
3264 return static_cast<double>(value_.int_);
3265 case uintValue:
3266#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3267 return static_cast<double>(value_.uint_);
3268#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3269 return integerToDouble(value_.uint_);
3270#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3271 case realValue:
3272 return value_.real_;
3273 case nullValue:
3274 return 0.0;
3275 case booleanValue:
3276 return value_.bool_ ? 1.0 : 0.0;
3277 default:
3278 break;
3279 }
3280 JSON_FAIL_MESSAGE("Value is not convertible to double.");
3281}
3282
3283float Value::asFloat() const {
3284 switch (type_) {

Callers 2

GetVariableDoubleMethod · 0.80
writeValueMethod · 0.80

Calls 1

integerToDoubleFunction · 0.85

Tested by

no test coverage detected