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