MCPcopy Create free account
hub / github.com/Samsung/ONE / asBool

Method asBool

runtime/3rdparty/jsoncpp/jsoncpp.cpp:3485–3507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3483}
3484
3485bool Value::asBool() const
3486{
3487 switch (type())
3488 {
3489 case booleanValue:
3490 return value_.bool_;
3491 case nullValue:
3492 return false;
3493 case intValue:
3494 return value_.int_ != 0;
3495 case uintValue:
3496 return value_.uint_ != 0;
3497 case realValue:
3498 {
3499 // According to JavaScript language zero or NaN is regarded as false
3500 const auto value_classification = std::fpclassify(value_.real_);
3501 return value_classification != FP_ZERO && value_classification != FP_NAN;
3502 }
3503 default:
3504 break;
3505 }
3506 JSON_FAIL_MESSAGE("Value is not convertible to bool.");
3507}
3508
3509bool Value::isConvertibleTo(ValueType other) const
3510{

Callers 5

newCharReaderMethod · 0.45
writeValueMethod · 0.45
newStreamWriterMethod · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 2

fpclassifyFunction · 0.85
typeFunction · 0.50

Tested by 1

mainFunction · 0.36