mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:07:34 +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:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -127,7 +127,7 @@ MainWidget::MainWidget()
|
|||
m_editor->insert_at_cursor_or_replace_selection(substitute);
|
||||
} else {
|
||||
GUI::MessageBox::show(window(),
|
||||
DeprecatedString::formatted("Not found: \"{}\"", needle),
|
||||
ByteString::formatted("Not found: \"{}\"", needle),
|
||||
"Not found"sv,
|
||||
GUI::MessageBox::Type::Information);
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ MainWidget::MainWidget()
|
|||
}
|
||||
} else {
|
||||
GUI::MessageBox::show(window(),
|
||||
DeprecatedString::formatted("Not found: \"{}\"", needle),
|
||||
ByteString::formatted("Not found: \"{}\"", needle),
|
||||
"Not found"sv,
|
||||
GUI::MessageBox::Type::Information);
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ WebView::OutOfProcessWebView& MainWidget::ensure_web_view()
|
|||
m_page_view = web_view_container.add<WebView::OutOfProcessWebView>();
|
||||
m_page_view->on_link_hover = [this](auto& 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
|
||||
update_statusbar();
|
||||
};
|
||||
|
@ -354,7 +354,7 @@ WebView::OutOfProcessWebView& MainWidget::ensure_web_view()
|
|||
if (!Desktop::Launcher::open(url)) {
|
||||
GUI::MessageBox::show(
|
||||
window(),
|
||||
DeprecatedString::formatted("The link to '{}' could not be opened.", url),
|
||||
ByteString::formatted("The link to '{}' could not be opened.", url),
|
||||
"Failed to open link"sv,
|
||||
GUI::MessageBox::Type::Error);
|
||||
}
|
||||
|
@ -791,7 +791,7 @@ void MainWidget::update_title()
|
|||
else
|
||||
builder.append(m_path);
|
||||
builder.append("[*] - Text Editor"sv);
|
||||
window()->set_title(builder.to_deprecated_string());
|
||||
window()->set_title(builder.to_byte_string());
|
||||
}
|
||||
|
||||
ErrorOr<void> MainWidget::read_file(String const& filename, Core::File& file)
|
||||
|
@ -803,7 +803,7 @@ ErrorOr<void> MainWidget::read_file(String const& filename, Core::File& file)
|
|||
return {};
|
||||
}
|
||||
|
||||
void MainWidget::open_nonexistent_file(DeprecatedString const& path)
|
||||
void MainWidget::open_nonexistent_file(ByteString const& path)
|
||||
{
|
||||
m_editor->set_text({});
|
||||
set_path(path);
|
||||
|
@ -928,11 +928,11 @@ void MainWidget::update_statusbar()
|
|||
|
||||
StringBuilder builder;
|
||||
if (m_editor->has_selection()) {
|
||||
DeprecatedString selected_text = m_editor->selected_text();
|
||||
ByteString selected_text = m_editor->selected_text();
|
||||
auto word_count = m_editor->number_of_selected_words();
|
||||
builder.appendff("{:'d} {} ({:'d} {}) selected", selected_text.length(), selected_text.length() == 1 ? "character" : "characters", word_count, word_count != 1 ? "words" : "word");
|
||||
} else {
|
||||
DeprecatedString text = m_editor->text();
|
||||
ByteString text = m_editor->text();
|
||||
auto word_count = m_editor->number_of_words();
|
||||
builder.appendff("{:'d} {} ({:'d} {})", text.length(), text.length() == 1 ? "character" : "characters", word_count, word_count != 1 ? "words" : "word");
|
||||
}
|
||||
|
@ -959,7 +959,7 @@ void MainWidget::find_text(GUI::TextEditor::SearchDirection direction, ShowMessa
|
|||
|
||||
if (!result.is_valid() && show_message == ShowMessageIfNoResults::Yes) {
|
||||
GUI::MessageBox::show(window(),
|
||||
DeprecatedString::formatted("Not found: \"{}\"", needle),
|
||||
ByteString::formatted("Not found: \"{}\"", needle),
|
||||
"Not found"sv,
|
||||
GUI::MessageBox::Type::Information);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class MainWidget final : public GUI::Widget {
|
|||
public:
|
||||
virtual ~MainWidget() override = default;
|
||||
ErrorOr<void> read_file(String const& filename, Core::File&);
|
||||
void open_nonexistent_file(DeprecatedString const& path);
|
||||
void open_nonexistent_file(ByteString const& path);
|
||||
bool request_close();
|
||||
|
||||
GUI::TextEditor& editor() { return *m_editor; }
|
||||
|
@ -64,9 +64,9 @@ private:
|
|||
void find_text(GUI::TextEditor::SearchDirection, ShowMessageIfNoResults);
|
||||
|
||||
RefPtr<GUI::TextEditor> m_editor;
|
||||
DeprecatedString m_path;
|
||||
DeprecatedString m_name;
|
||||
DeprecatedString m_extension;
|
||||
ByteString m_path;
|
||||
ByteString m_name;
|
||||
ByteString m_extension;
|
||||
RefPtr<GUI::Action> m_new_action;
|
||||
RefPtr<GUI::Action> m_open_action;
|
||||
RefPtr<GUI::Action> m_save_action;
|
||||
|
|
|
@ -79,11 +79,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
FileArgument parsed_argument(filename);
|
||||
|
||||
FileSystemAccessClient::Client::the().set_silence_errors(FileSystemAccessClient::ErrorFlag::NoEntries);
|
||||
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window, parsed_argument.filename().to_deprecated_string());
|
||||
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window, parsed_argument.filename().to_byte_string());
|
||||
|
||||
if (response.is_error()) {
|
||||
if (response.error().code() == ENOENT)
|
||||
text_widget->open_nonexistent_file(parsed_argument.filename().to_deprecated_string());
|
||||
text_widget->open_nonexistent_file(parsed_argument.filename().to_byte_string());
|
||||
} else {
|
||||
TRY(text_widget->read_file(response.value().filename(), response.value().stream()));
|
||||
text_widget->editor().set_cursor_and_focus_line(parsed_argument.line().value_or(1) - 1, parsed_argument.column().value_or(0));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue