MCPcopy Create free account
hub / github.com/Kitware/VTK / asDouble

Method asDouble

ThirdParty/jsoncpp/vtkjsoncpp/jsoncpp.cpp:3197–3217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3195}
3196
3197double Value::asDouble() const {
3198 switch (type()) {
3199 case intValue:
3200 return static_cast<double>(value_.int_);
3201 case uintValue:
3202#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3203 return static_cast<double>(value_.uint_);
3204#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3205 return integerToDouble(value_.uint_);
3206#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
3207 case realValue:
3208 return value_.real_;
3209 case nullValue:
3210 return 0.0;
3211 case booleanValue:
3212 return value_.bool_ ? 1.0 : 0.0;
3213 default:
3214 break;
3215 }
3216 JSON_FAIL_MESSAGE("Value is not convertible to double.");
3217}
3218
3219float Value::asFloat() const {
3220 switch (type()) {

Callers 12

GetPointFromJSONFunction · 0.45
GetDoubleValueFunction · 0.45
GetFloatArrayFunction · 0.45
GetDoubleArrayFunction · 0.45
CreatePointMethod · 0.45
ExtractGeoJSONFeatureMethod · 0.45
SetRMethod · 0.45
SetGammaMethod · 0.45
SetFileNamesMethod · 0.45
writeValueMethod · 0.45
InternalParseJSONMethod · 0.45

Calls 2

integerToDoubleFunction · 0.85
typeEnum · 0.50

Tested by

no test coverage detected