1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:37:34 +00:00

AK+Everywhere: Rename String to DeprecatedString

We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
This commit is contained in:
Linus Groh 2022-12-04 18:02:33 +00:00 committed by Andreas Kling
parent f74251606d
commit 6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions

View file

@ -11,7 +11,7 @@
namespace TextEditor {
FileArgument::FileArgument(String file_argument)
FileArgument::FileArgument(DeprecatedString file_argument)
{
m_line = {};
m_column = {};

View file

@ -7,21 +7,21 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
namespace TextEditor {
class FileArgument final {
public:
explicit FileArgument(String);
explicit FileArgument(DeprecatedString);
~FileArgument() = default;
String filename() { return m_filename; }
DeprecatedString filename() { return m_filename; }
Optional<size_t> line() { return m_line; }
Optional<size_t> column() { return m_column; }
private:
String m_filename;
DeprecatedString m_filename;
Optional<size_t> m_line;
Optional<size_t> m_column;
};

View file

@ -127,7 +127,7 @@ MainWidget::MainWidget()
m_editor->insert_at_cursor_or_replace_selection(substitute);
} else {
GUI::MessageBox::show(window(),
String::formatted("Not found: \"{}\"", needle),
DeprecatedString::formatted("Not found: \"{}\"", needle),
"Not found"sv,
GUI::MessageBox::Type::Information);
}
@ -152,7 +152,7 @@ MainWidget::MainWidget()
}
} else {
GUI::MessageBox::show(window(),
String::formatted("Not found: \"{}\"", needle),
DeprecatedString::formatted("Not found: \"{}\"", needle),
"Not found"sv,
GUI::MessageBox::Type::Information);
}
@ -339,7 +339,7 @@ WebView::OutOfProcessWebView& MainWidget::ensure_web_view()
if (!Desktop::Launcher::open(url)) {
GUI::MessageBox::show(
window(),
String::formatted("The link to '{}' could not be opened.", url),
DeprecatedString::formatted("The link to '{}' could not be opened.", url),
"Failed to open link"sv,
GUI::MessageBox::Type::Error);
}
@ -722,7 +722,7 @@ bool MainWidget::read_file(Core::File& file)
return true;
}
void MainWidget::open_nonexistent_file(String const& path)
void MainWidget::open_nonexistent_file(DeprecatedString const& path)
{
m_editor->set_text({});
set_path(path);
@ -847,11 +847,11 @@ void MainWidget::update_statusbar()
StringBuilder builder;
if (m_editor->has_selection()) {
String selected_text = m_editor->selected_text();
DeprecatedString selected_text = m_editor->selected_text();
auto word_count = m_editor->number_of_selected_words();
builder.appendff("{} {} ({} {}) selected", selected_text.length(), selected_text.length() == 1 ? "character" : "characters", word_count, word_count != 1 ? "words" : "word");
} else {
String text = m_editor->text();
DeprecatedString text = m_editor->text();
auto word_count = m_editor->number_of_words();
builder.appendff("{} {} ({} {})", text.length(), text.length() == 1 ? "character" : "characters", word_count, word_count != 1 ? "words" : "word");
}
@ -861,7 +861,7 @@ void MainWidget::update_statusbar()
auto language = m_editor->syntax_highlighter()->language();
m_statusbar->set_text(1, m_editor->syntax_highlighter()->language_string(language));
}
m_statusbar->set_text(2, String::formatted("Ln {}, Col {}", m_editor->cursor().line() + 1, m_editor->cursor().column()));
m_statusbar->set_text(2, DeprecatedString::formatted("Ln {}, Col {}", m_editor->cursor().line() + 1, m_editor->cursor().column()));
}
void MainWidget::find_text(GUI::TextEditor::SearchDirection direction, ShowMessageIfNoResults show_message)
@ -878,7 +878,7 @@ void MainWidget::find_text(GUI::TextEditor::SearchDirection direction, ShowMessa
if (!result.is_valid() && show_message == ShowMessageIfNoResults::Yes) {
GUI::MessageBox::show(window(),
String::formatted("Not found: \"{}\"", needle),
DeprecatedString::formatted("Not found: \"{}\"", needle),
"Not found"sv,
GUI::MessageBox::Type::Information);
}

View file

@ -26,7 +26,7 @@ class MainWidget final : public GUI::Widget {
public:
virtual ~MainWidget() override = default;
bool read_file(Core::File&);
void open_nonexistent_file(String const& path);
void open_nonexistent_file(DeprecatedString 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;
String m_path;
String m_name;
String m_extension;
DeprecatedString m_path;
DeprecatedString m_name;
DeprecatedString m_extension;
RefPtr<GUI::Action> m_new_action;
RefPtr<GUI::Action> m_open_action;
RefPtr<GUI::Action> m_save_action;