| 2273 | } |
| 2274 | |
| 2275 | bool Value::asBool() const { |
| 2276 | switch (type_) { |
| 2277 | case booleanValue: |
| 2278 | return value_.bool_; |
| 2279 | case nullValue: |
| 2280 | return false; |
| 2281 | case intValue: |
| 2282 | return value_.int_ ? true : false; |
| 2283 | case uintValue: |
| 2284 | return value_.uint_ ? true : false; |
| 2285 | case realValue: |
| 2286 | return value_.real_ ? true : false; |
| 2287 | default: |
| 2288 | break; |
| 2289 | } |
| 2290 | JSON_FAIL_MESSAGE("Value is not convertible to bool."); |
| 2291 | } |
| 2292 | |
| 2293 | bool Value::isConvertibleTo(ValueType other) const { |
| 2294 | switch (other) { |
no outgoing calls
no test coverage detected