AK: Add JsonValue::to_bool().

This commit is contained in:
Andreas Kling 2019-07-08 14:06:03 +02:00
parent 56563cb305
commit 5b19911025
Notes: sideshowbarker 2024-07-19 13:22:10 +09:00

View file

@ -67,6 +67,13 @@ public:
return IPv4Address::from_string(as_string()); return IPv4Address::from_string(as_string());
} }
bool to_bool(bool default_value = false) const
{
if (!is_bool())
return default_value;
return as_bool();
}
int as_int() const int as_int() const
{ {
ASSERT(is_int()); ASSERT(is_int());