1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 07:17:35 +00:00

Presenter: Replace uses of JsonObject::get_deprecated()/get_ptr()

This commit is contained in:
Sam Atkins 2022-12-21 19:34:59 +00:00 committed by Tim Flynn
parent c36de98223
commit 74452ffc50
3 changed files with 18 additions and 18 deletions

View file

@ -18,13 +18,13 @@ Slide::Slide(NonnullRefPtrVector<SlideObject> slide_objects, DeprecatedString ti
ErrorOr<Slide> Slide::parse_slide(JsonObject const& slide_json)
{
// FIXME: Use the text with the "title" role for a title, if there is no title given.
auto title = slide_json.get_deprecated("title"sv).as_string_or("Untitled slide");
auto title = slide_json.get_deprecated_string("title"sv).value_or("Untitled slide");
auto const& maybe_slide_objects = slide_json.get_deprecated("objects"sv);
if (!maybe_slide_objects.is_array())
auto maybe_slide_objects = slide_json.get_array("objects"sv);
if (!maybe_slide_objects.has_value())
return Error::from_string_view("Slide objects must be an array"sv);
auto const& json_slide_objects = maybe_slide_objects.as_array();
auto const& json_slide_objects = maybe_slide_objects.value();
NonnullRefPtrVector<SlideObject> slide_objects;
for (auto const& maybe_slide_object_json : json_slide_objects.values()) {
if (!maybe_slide_object_json.is_object())