MCPcopy Create free account
hub / github.com/PlayFab/gsdk / asDouble

Method asDouble

cpp/cppsdk/jsoncpp.cpp:3260–3280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

writeValueMethod · 0.80
FromJsonUtilPFunction · 0.80

Calls 1

integerToDoubleFunction · 0.85

Tested by

no test coverage detected