MCPcopy Create free account
hub / github.com/ComodoSecurity/openedr / asDouble

Method asDouble

edrav2/eprj/jsoncpp/src/lib_json/json_value.cpp:822–842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

820}
821
822double Value::asDouble() const {
823 switch (type_) {
824 case intValue:
825 return static_cast<double>(value_.int_);
826 case uintValue:
827#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
828 return static_cast<double>(value_.uint_);
829#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
830 return integerToDouble(value_.uint_);
831#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
832 case realValue:
833 return value_.real_;
834 case nullValue:
835 return 0.0;
836 case booleanValue:
837 return value_.bool_ ? 1.0 : 0.0;
838 default:
839 break;
840 }
841 JSON_FAIL_MESSAGE("Value is not convertible to double.");
842}
843
844float Value::asFloat() const {
845 switch (type_) {

Callers 3

writeValueMethod · 0.80
printValueTreeFunction · 0.80
JSONTEST_FIXTUREFunction · 0.80

Calls 1

integerToDoubleFunction · 0.85

Tested by

no test coverage detected