| 3306 | } |
| 3307 | |
| 3308 | bool Value::asBool() const { |
| 3309 | switch (type_) { |
| 3310 | case booleanValue: |
| 3311 | return value_.bool_; |
| 3312 | case nullValue: |
| 3313 | return false; |
| 3314 | case intValue: |
| 3315 | return value_.int_ ? true : false; |
| 3316 | case uintValue: |
| 3317 | return value_.uint_ ? true : false; |
| 3318 | case realValue: |
| 3319 | // This is kind of strange. Not recommended. |
| 3320 | return (value_.real_ != 0.0) ? true : false; |
| 3321 | default: |
| 3322 | break; |
| 3323 | } |
| 3324 | JSON_FAIL_MESSAGE("Value is not convertible to bool."); |
| 3325 | } |
| 3326 | |
| 3327 | bool Value::isConvertibleTo(ValueType other) const { |
| 3328 | switch (other) { |
no outgoing calls
no test coverage detected