1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -38,7 +38,7 @@ public:
return {};
}
DeprecatedString key(const GUI::ModelIndex& index) const { return m_keys[index.row()]; }
ByteString key(const GUI::ModelIndex& index) const { return m_keys[index.row()]; }
void set_from(JsonObject const& object)
{
@ -55,7 +55,7 @@ private:
{
}
Vector<DeprecatedString> m_keys;
Vector<ByteString> m_keys;
};
RefPtr<HelpWindow> HelpWindow::s_the { nullptr };
@ -90,7 +90,7 @@ HelpWindow::HelpWindow(GUI::Window* parent)
auto entry = LexicalPath::basename(example_path);
auto doc_option = m_docs.get_object(entry);
if (!doc_option.has_value()) {
GUI::MessageBox::show_error(this, DeprecatedString::formatted("No documentation entry found for '{}'", example_path));
GUI::MessageBox::show_error(this, ByteString::formatted("No documentation entry found for '{}'", example_path));
return;
}
auto& doc = doc_option.value();
@ -98,13 +98,13 @@ HelpWindow::HelpWindow(GUI::Window* parent)
auto maybe_example_data = doc.get_object("example_data"sv);
if (!maybe_example_data.has_value()) {
GUI::MessageBox::show_error(this, DeprecatedString::formatted("No example data found for '{}'", example_path));
GUI::MessageBox::show_error(this, ByteString::formatted("No example data found for '{}'", example_path));
return;
}
auto& example_data = maybe_example_data.value();
if (!example_data.has_object(name)) {
GUI::MessageBox::show_error(this, DeprecatedString::formatted("Example '{}' not found for '{}'", name, example_path));
GUI::MessageBox::show_error(this, ByteString::formatted("Example '{}' not found for '{}'", name, example_path));
return;
}
auto& value = example_data.get_object(name).value();
@ -112,13 +112,13 @@ HelpWindow::HelpWindow(GUI::Window* parent)
auto window = GUI::Window::construct(this);
window->resize(size());
window->set_icon(icon());
window->set_title(DeprecatedString::formatted("Spreadsheet Help - Example {} for {}", name, entry));
window->set_title(ByteString::formatted("Spreadsheet Help - Example {} for {}", name, entry));
window->on_close = [window = window.ptr()] { window->remove_from_parent(); };
auto widget = window->set_main_widget<SpreadsheetWidget>(window, Vector<NonnullRefPtr<Sheet>> {}, false);
auto sheet = Sheet::from_json(value, widget->workbook());
if (!sheet) {
GUI::MessageBox::show_error(this, DeprecatedString::formatted("Corrupted example '{}' in '{}'", name, example_path));
GUI::MessageBox::show_error(this, ByteString::formatted("Corrupted example '{}' in '{}'", name, example_path));
return;
}
@ -141,17 +141,17 @@ HelpWindow::HelpWindow(GUI::Window* parent)
};
}
DeprecatedString HelpWindow::render(StringView key)
ByteString HelpWindow::render(StringView key)
{
VERIFY(m_docs.has_object(key));
auto& doc = m_docs.get_object(key).value();
auto name = doc.get_deprecated_string("name"sv).value_or({});
auto name = doc.get_byte_string("name"sv).value_or({});
auto argc = doc.get_u32("argc"sv).value_or(0);
VERIFY(doc.has_array("argnames"sv));
auto& argnames = doc.get_array("argnames"sv).value();
auto docstring = doc.get_deprecated_string("doc"sv).value_or({});
auto docstring = doc.get_byte_string("doc"sv).value_or({});
StringBuilder markdown_builder;
@ -166,7 +166,7 @@ DeprecatedString HelpWindow::render(StringView key)
markdown_builder.append("No required arguments.\n"sv);
for (size_t i = 0; i < argc; ++i)
markdown_builder.appendff("- `{}`\n", argnames.at(i).to_deprecated_string());
markdown_builder.appendff("- `{}`\n", argnames.at(i).to_byte_string());
if (argc > 0)
markdown_builder.append("\n"sv);
@ -175,7 +175,7 @@ DeprecatedString HelpWindow::render(StringView key)
auto opt_count = argnames.size() - argc;
markdown_builder.appendff("{} optional argument(s):\n", opt_count);
for (size_t i = argc; i < (size_t)argnames.size(); ++i)
markdown_builder.appendff("- `{}`\n", argnames.at(i).to_deprecated_string());
markdown_builder.appendff("- `{}`\n", argnames.at(i).to_byte_string());
markdown_builder.append("\n"sv);
}
@ -188,8 +188,8 @@ DeprecatedString HelpWindow::render(StringView key)
VERIFY(examples.has_value());
markdown_builder.append("# EXAMPLES\n"sv);
examples->for_each_member([&](auto& text, auto& description_value) {
dbgln("```js\n{}\n```\n\n- {}\n", text, description_value.to_deprecated_string());
markdown_builder.appendff("```js\n{}\n```\n\n- {}\n", text, description_value.to_deprecated_string());
dbgln("```js\n{}\n```\n\n- {}\n", text, description_value.to_byte_string());
markdown_builder.appendff("```js\n{}\n```\n\n- {}\n", text, description_value.to_byte_string());
});
}