mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
JsonValue: Add as_array() and as_object().
This commit is contained in:
parent
dd36f797d5
commit
8392c549a3
1 changed files with 14 additions and 3 deletions
|
@ -46,9 +46,20 @@ public:
|
||||||
|
|
||||||
String as_string() const
|
String as_string() const
|
||||||
{
|
{
|
||||||
if (m_type == Type::String)
|
ASSERT(is_string());
|
||||||
return *m_value.as_string;
|
return *m_value.as_string;
|
||||||
return { };
|
}
|
||||||
|
|
||||||
|
const JsonObject& as_object() const
|
||||||
|
{
|
||||||
|
ASSERT(is_object());
|
||||||
|
return *m_value.as_object;
|
||||||
|
}
|
||||||
|
|
||||||
|
const JsonArray& as_array() const
|
||||||
|
{
|
||||||
|
ASSERT(is_array());
|
||||||
|
return *m_value.as_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
Type type() const { return m_type; }
|
Type type() const { return m_type; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue