mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:17:34 +00:00
AK: Add new failable JsonArray::{append/set}
functions
Move all old usages to the more explicit `JsonArray:must_{append/set}`
This commit is contained in:
parent
3b00636288
commit
8134dccdc7
14 changed files with 28 additions and 25 deletions
|
@ -177,7 +177,7 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
|
|||
sb.append_code_point(values[i]);
|
||||
|
||||
JsonValue val(sb.to_deprecated_string());
|
||||
items.append(move(val));
|
||||
items.must_append(move(val));
|
||||
}
|
||||
map_json.set(name, move(items));
|
||||
};
|
||||
|
|
|
@ -202,7 +202,7 @@ ErrorOr<void> ExportDialog::make_and_run_for(StringView mime, Core::File& file,
|
|||
auto export_worksheet = [&]() -> ErrorOr<void> {
|
||||
JsonArray array;
|
||||
for (auto& sheet : workbook.sheets())
|
||||
array.append(sheet->to_json());
|
||||
array.must_append(sheet->to_json());
|
||||
|
||||
auto file_content = array.to_deprecated_string();
|
||||
return file.write_until_depleted(file_content.bytes());
|
||||
|
|
|
@ -542,7 +542,7 @@ JsonObject Sheet::to_json() const
|
|||
if (!columns_are_standard()) {
|
||||
auto columns = JsonArray();
|
||||
for (auto& column : m_columns)
|
||||
columns.append(column);
|
||||
columns.must_append(column);
|
||||
object.set("columns", move(columns));
|
||||
}
|
||||
object.set("rows", bottom_right.row + 1);
|
||||
|
@ -587,7 +587,7 @@ JsonObject Sheet::to_json() const
|
|||
fmt_object.set("condition", fmt.condition);
|
||||
save_format(fmt, fmt_object);
|
||||
|
||||
conditional_formats.append(move(fmt_object));
|
||||
conditional_formats.must_append(move(fmt_object));
|
||||
}
|
||||
|
||||
data.set("conditional_formats", move(conditional_formats));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue