1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:47:34 +00:00

Everywhere: Rename to_{string => deprecated_string}() where applicable

This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
This commit is contained in:
Linus Groh 2022-12-06 01:12:49 +00:00 committed by Andreas Kling
parent 6e19ab2bbc
commit 57dc179b1f
597 changed files with 1973 additions and 1972 deletions

View file

@ -23,7 +23,7 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role)
if (!cell)
return DeprecatedString::empty();
Function<DeprecatedString(JS::Value)> to_string_as_exception = [&](JS::Value value) {
Function<DeprecatedString(JS::Value)> to_deprecated_string_as_exception = [&](JS::Value value) {
auto& vm = cell->sheet().global_object().vm();
StringBuilder builder;
builder.append("Error: "sv);
@ -36,32 +36,32 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role)
builder.append(message.to_string_without_side_effects());
else
builder.append(error.release_value());
return builder.to_string();
return builder.to_deprecated_string();
}
}
auto error_message = value.to_string(vm);
if (error_message.is_throw_completion())
return to_string_as_exception(*error_message.release_error().value());
return to_deprecated_string_as_exception(*error_message.release_error().value());
builder.append(error_message.release_value());
return builder.to_string();
return builder.to_deprecated_string();
};
if (cell->kind() == Spreadsheet::Cell::Formula) {
if (auto opt_throw_value = cell->thrown_value(); opt_throw_value.has_value())
return to_string_as_exception(*opt_throw_value);
return to_deprecated_string_as_exception(*opt_throw_value);
}
auto display = cell->typed_display();
if (display.is_error())
return to_string_as_exception(*display.release_error().value());
return to_deprecated_string_as_exception(*display.release_error().value());
return display.release_value();
}
if (role == GUI::ModelRole::MimeData)
return Position { (size_t)index.column(), (size_t)index.row() }.to_url(m_sheet).to_string();
return Position { (size_t)index.column(), (size_t)index.row() }.to_url(m_sheet).to_deprecated_string();
if (role == GUI::ModelRole::TextAlignment) {
auto const* cell = m_sheet->at({ (size_t)index.column(), (size_t)index.row() });
@ -131,7 +131,7 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role)
builder.appendff(" in cell '{}', at line {}, column {}\n", frame.source_range.filename().substring_view(5), frame.source_range.start.line, frame.source_range.start.column);
}
}
return builder.to_string();
return builder.to_deprecated_string();
}
return {};
@ -155,7 +155,7 @@ RefPtr<Core::MimeData> SheetModel::mime_data(const GUI::ModelSelection& selectio
Position cursor_position { (size_t)cursor->column(), (size_t)cursor->row() };
auto mime_data_buffer = mime_data->data("text/x-spreadsheet-data");
auto new_data = DeprecatedString::formatted("{}\n{}",
cursor_position.to_url(m_sheet).to_string(),
cursor_position.to_url(m_sheet).to_deprecated_string(),
StringView(mime_data_buffer));
mime_data->set_data("text/x-spreadsheet-data", new_data.to_byte_buffer());
@ -185,7 +185,7 @@ void SheetModel::set_data(const GUI::ModelIndex& index, const GUI::Variant& valu
auto& cell = m_sheet->ensure({ (size_t)index.column(), (size_t)index.row() });
auto previous_data = cell.data();
cell.set_data(value.to_string());
cell.set_data(value.to_deprecated_string());
if (on_cell_data_change)
on_cell_data_change(cell, previous_data);
did_update(UpdateFlag::DontInvalidateIndices);