MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / asDouble

Method asDouble

Source/JSON/jsoncpp.cpp:2899–2919  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2897}
2898
2899double Value::asDouble() const {
2900 switch (type_) {
2901 case intValue:
2902 return static_cast<double>(value_.int_);
2903 case uintValue:
2904#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2905 return static_cast<double>(value_.uint_);
2906#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2907 return integerToDouble(value_.uint_);
2908#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
2909 case realValue:
2910 return value_.real_;
2911 case nullValue:
2912 return 0.0;
2913 case booleanValue:
2914 return value_.bool_ ? 1.0 : 0.0;
2915 default:
2916 break;
2917 }
2918 JSON_FAIL_MESSAGE("Value is not convertible to double.");
2919}
2920
2921float Value::asFloat() const {
2922 switch (type_) {

Callers 4

ParseBodyDefMethod · 0.45
ParseDrawShapeDefMethod · 0.45
ParseJointMethod · 0.45
writeValueMethod · 0.45

Calls 1

integerToDoubleFunction · 0.70

Tested by

no test coverage detected