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

Method asBool

ThirdParty/jsoncpp/vtkjsoncpp/jsoncpp.cpp:3242–3261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3240}
3241
3242bool Value::asBool() const {
3243 switch (type()) {
3244 case booleanValue:
3245 return value_.bool_;
3246 case nullValue:
3247 return false;
3248 case intValue:
3249 return value_.int_ != 0;
3250 case uintValue:
3251 return value_.uint_ != 0;
3252 case realValue: {
3253 // According to JavaScript language zero or NaN is regarded as false
3254 const auto value_classification = std::fpclassify(value_.real_);
3255 return value_classification != FP_ZERO && value_classification != FP_NAN;
3256 }
3257 default:
3258 break;
3259 }
3260 JSON_FAIL_MESSAGE("Value is not convertible to bool.");
3261}
3262
3263bool Value::isConvertibleTo(ValueType other) const {
3264 switch (other) {

Callers 9

GetBoolValueFunction · 0.80
SetAutoDetectFormatMethod · 0.80
SetMultiGridMethod · 0.80
SetBlankingMethod · 0.80
Set2DMethod · 0.80
newCharReaderMethod · 0.80
writeValueMethod · 0.80
newStreamWriterMethod · 0.80

Calls 1

typeEnum · 0.50

Tested by

no test coverage detected