MCPcopy Create free account
hub / github.com/Samsung/UTopia / asDouble

Method asDouble

external/jsoncpp/jsoncpp.cpp:3166–3186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3164}
3165
3166double Value::asDouble() const {
3167 switch (type()) {
3168 case intValue:
3169 return static_cast<double>(value_.int_);
3170 case uintValue:
3171#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3172 return static_cast<double>(value_.uint_);
3173#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3174 return integerToDouble(value_.uint_);
3175#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3176 case realValue:
3177 return value_.real_;
3178 case nullValue:
3179 return 0.0;
3180 case booleanValue:
3181 return value_.bool_ ? 1.0 : 0.0;
3182 default:
3183 break;
3184 }
3185 JSON_FAIL_MESSAGE("Value is not convertible to double.");
3186}
3187
3188float Value::asFloat() const {
3189 switch (type()) {

Callers 1

writeValueMethod · 0.80

Calls 1

integerToDoubleFunction · 0.85

Tested by

no test coverage detected