MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / asDouble

Method asDouble

Sources/Dependencies/jsoncpp/value.cpp:830–850  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

828 }
829
830 double Value::asDouble() const {
831 switch (type()) {
832 case intValue:
833 return static_cast<double>(value_.int_);
834 case uintValue:
835#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
836 return static_cast<double>(value_.uint_);
837#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
838 return integerToDouble(value_.uint_);
839#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
840 case realValue:
841 return value_.real_;
842 case nullValue:
843 return 0.0;
844 case booleanValue:
845 return value_.bool_ ? 1.0 : 0.0;
846 default:
847 break;
848 }
849 JSON_FAIL_MESSAGE("Value is not convertible to double.");
850 }
851
852 float Value::asFloat() const {
853 switch (type()) {

Callers 1

writeValueMethod · 0.80

Calls 2

typeClass · 0.85
integerToDoubleFunction · 0.85

Tested by

no test coverage detected