| 3209 | } |
| 3210 | |
| 3211 | bool Value::asBool() const { |
| 3212 | switch (type()) { |
| 3213 | case booleanValue: |
| 3214 | return value_.bool_; |
| 3215 | case nullValue: |
| 3216 | return false; |
| 3217 | case intValue: |
| 3218 | return value_.int_ ? true : false; |
| 3219 | case uintValue: |
| 3220 | return value_.uint_ ? true : false; |
| 3221 | case realValue: |
| 3222 | // This is kind of strange. Not recommended. |
| 3223 | return (value_.real_ != 0.0) ? true : false; |
| 3224 | default: |
| 3225 | break; |
| 3226 | } |
| 3227 | JSON_FAIL_MESSAGE("Value is not convertible to bool."); |
| 3228 | } |
| 3229 | |
| 3230 | bool Value::isConvertibleTo(ValueType other) const { |
| 3231 | switch (other) { |
no outgoing calls
no test coverage detected