| 280 | return kind_ == Kind::Bool; |
| 281 | } |
| 282 | |
| 283 | bool Value::is_number() const noexcept { |
| 284 | return kind_ == Kind::Number; |
| 285 | } |
| 286 | |
| 287 | bool Value::is_string() const noexcept { |
| 288 | return kind_ == Kind::String; |
| 289 | } |
| 290 | |
| 291 | bool Value::is_array() const noexcept { |
| 292 | return kind_ == Kind::Array; |
| 293 | } |
| 294 | |
| 295 | bool Value::is_object() const noexcept { |
| 296 | return kind_ == Kind::Object; |
| 297 | } |
| 298 | |
| 299 | bool Value::as_bool() const { |
| 300 | if (!is_bool()) { |
| 301 | throw std::runtime_error("json value is not a bool"); |
| 302 | } |
| 303 | return bool_value_; |
| 304 | } |
| 305 | |
| 306 | double Value::as_number() const { |
| 307 | if (!is_number()) { |
no test coverage detected