diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-11-17 16:17:13 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-11-18 12:21:57 +0000 |
commit | 5d61053276951e68f819d262de7b665b0751833c (patch) | |
tree | 18d7cc3e6d04b42ae816f26f9439f8623fd4238f /AK | |
parent | 13b18a182a13ecbfc703e4cef9175444b5519fcb (diff) | |
download | serenity-5d61053276951e68f819d262de7b665b0751833c.zip |
AK: Add mutable accessors for JsonValue's as_array and as_object
Diffstat (limited to 'AK')
-rw-r--r-- | AK/JsonValue.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/AK/JsonValue.h b/AK/JsonValue.h index 3d0f7e3c4a..a1a8f65be5 100644 --- a/AK/JsonValue.h +++ b/AK/JsonValue.h @@ -164,12 +164,24 @@ public: } #endif + JsonObject& as_object() + { + VERIFY(is_object()); + return *m_value.as_object; + } + JsonObject const& as_object() const { VERIFY(is_object()); return *m_value.as_object; } + JsonArray& as_array() + { + VERIFY(is_array()); + return *m_value.as_array; + } + JsonArray const& as_array() const { VERIFY(is_array()); |