| 3626 | } |
| 3627 | |
| 3628 | bool as_bool() const |
| 3629 | { |
| 3630 | switch (storage_kind()) |
| 3631 | { |
| 3632 | case json_storage_kind::boolean: |
| 3633 | return cast<bool_storage>().value(); |
| 3634 | case json_storage_kind::int64: |
| 3635 | return cast<int64_storage>().value() != 0; |
| 3636 | case json_storage_kind::uint64: |
| 3637 | return cast<uint64_storage>().value() != 0; |
| 3638 | case json_storage_kind::const_json_ref: |
| 3639 | return cast<const_json_ref_storage>().value().as_bool(); |
| 3640 | case json_storage_kind::json_ref: |
| 3641 | return cast<json_ref_storage>().value().as_bool(); |
| 3642 | default: |
| 3643 | JSONCONS_THROW(json_runtime_error<std::domain_error>("Not a bool")); |
| 3644 | } |
| 3645 | } |
| 3646 | |
| 3647 | template <typename T> |
| 3648 | conversion_result<T> try_as_integer() const |
no test coverage detected