1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:07:46 +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

@ -16,7 +16,7 @@ void History::push(StringView history_item)
m_current_history_item++;
}
DeprecatedString History::current()
ByteString History::current()
{
if (m_current_history_item == -1)
return {};

View file

@ -6,13 +6,13 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Vector.h>
class History final {
public:
void push(StringView history_item);
DeprecatedString current();
ByteString current();
void go_back();
void go_forward();
@ -23,6 +23,6 @@ public:
void clear();
private:
Vector<DeprecatedString> m_items;
Vector<ByteString> m_items;
int m_current_history_item { -1 };
};

View file

@ -132,7 +132,7 @@ ErrorOr<void> MainWidget::initialize_fallibles(GUI::Window& window)
return;
}
m_history.push(path.string());
auto string_path = String::from_deprecated_string(path.string());
auto string_path = String::from_byte_string(path.string());
if (string_path.is_error())
return;
open_page(string_path.value());
@ -156,7 +156,7 @@ ErrorOr<void> MainWidget::initialize_fallibles(GUI::Window& window)
};
m_web_view->on_link_hover = [this](URL const& url) {
if (url.is_valid())
m_statusbar->set_text(String::from_deprecated_string(url.to_deprecated_string()).release_value_but_fixme_should_propagate_errors());
m_statusbar->set_text(String::from_byte_string(url.to_byte_string()).release_value_but_fixme_should_propagate_errors());
else
m_statusbar->set_text({});
};
@ -166,12 +166,12 @@ ErrorOr<void> MainWidget::initialize_fallibles(GUI::Window& window)
m_go_back_action = GUI::CommonActions::make_go_back_action([this](auto&) {
m_history.go_back();
open_page(MUST(String::from_deprecated_string(m_history.current())));
open_page(MUST(String::from_byte_string(m_history.current())));
});
m_go_forward_action = GUI::CommonActions::make_go_forward_action([this](auto&) {
m_history.go_forward();
open_page(MUST(String::from_deprecated_string(m_history.current())));
open_page(MUST(String::from_byte_string(m_history.current())));
});
m_go_back_action->set_enabled(false);
@ -261,7 +261,7 @@ void MainWidget::open_url(URL const& url)
return;
auto title = String::formatted("{} - Help", page_and_section.value());
if (!title.is_error())
window()->set_title(title.release_value().to_deprecated_string());
window()->set_title(title.release_value().to_byte_string());
} else {
window()->set_title("Help");
}
@ -271,7 +271,7 @@ void MainWidget::open_url(URL const& url)
void MainWidget::open_external(URL const& url)
{
if (!Desktop::Launcher::open(url))
GUI::MessageBox::show(window(), DeprecatedString::formatted("The link to '{}' could not be opened.", url), "Failed to open link"sv, GUI::MessageBox::Type::Error);
GUI::MessageBox::show(window(), ByteString::formatted("The link to '{}' could not be opened.", url), "Failed to open link"sv, GUI::MessageBox::Type::Error);
}
void MainWidget::open_page(Optional<String> const& path)
@ -285,7 +285,7 @@ void MainWidget::open_page(Optional<String> const& path)
return;
}
dbgln("open page: {}", path.value());
open_url(URL::create_with_url_or_path(path.value().to_deprecated_string()));
open_url(URL::create_with_url_or_path(path.value().to_byte_string()));
}
}

View file

@ -183,8 +183,8 @@ GUI::Variant ManualModel::data(const GUI::ModelIndex& index, GUI::ModelRole role
return {};
if (auto path = page_path(index); path.has_value())
if (auto page = page_view(path.release_value()); !page.is_error())
// FIXME: We already provide String, but GUI::Variant still needs DeprecatedString.
return DeprecatedString(page.release_value());
// FIXME: We already provide String, but GUI::Variant still needs ByteString.
return ByteString(page.release_value());
return {};
case GUI::ModelRole::Display:
if (auto name = node->name(); !name.is_error())

View file

@ -31,8 +31,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::unveil("/tmp/session/%sid/portal/webcontent", "rw"));
TRY(Core::System::unveil(nullptr, nullptr));
DeprecatedString first_query_parameter;
DeprecatedString second_query_parameter;
ByteString first_query_parameter;
ByteString second_query_parameter;
Core::ArgsParser args_parser;
// The actual "page query" parsing happens when we set the main widget's start page.