| 3349 | } |
| 3350 | |
| 3351 | bool Value::asBool() const { |
| 3352 | switch (type_) { |
| 3353 | case booleanValue: |
| 3354 | return value_.bool_; |
| 3355 | case nullValue: |
| 3356 | return false; |
| 3357 | case intValue: |
| 3358 | return value_.int_ ? true : false; |
| 3359 | case uintValue: |
| 3360 | return value_.uint_ ? true : false; |
| 3361 | case realValue: |
| 3362 | // This is kind of strange. Not recommended. |
| 3363 | return (value_.real_ != 0.0) ? true : false; |
| 3364 | default: |
| 3365 | break; |
| 3366 | } |
| 3367 | JSON_FAIL_MESSAGE("Value is not convertible to bool."); |
| 3368 | } |
| 3369 | |
| 3370 | bool Value::isConvertibleTo(ValueType other) const { |
| 3371 | switch (other) { |
no outgoing calls
no test coverage detected