| 3259 | } |
| 3260 | |
| 3261 | bool Value::asBool() const { |
| 3262 | switch (type_) { |
| 3263 | case booleanValue: |
| 3264 | return value_.bool_; |
| 3265 | case nullValue: |
| 3266 | return false; |
| 3267 | case intValue: |
| 3268 | return value_.int_ ? true : false; |
| 3269 | case uintValue: |
| 3270 | return value_.uint_ ? true : false; |
| 3271 | case realValue: |
| 3272 | // This is kind of strange. Not recommended. |
| 3273 | return (value_.real_ != 0.0) ? true : false; |
| 3274 | default: |
| 3275 | if ( default_value_ ) |
| 3276 | return default_value_->asBool(); |
| 3277 | else |
| 3278 | return false; |
| 3279 | } |
| 3280 | } |
| 3281 | |
| 3282 | bool Value::isConvertibleTo(ValueType other) const { |
| 3283 | switch (other) { |
no outgoing calls
no test coverage detected