mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 07:37:35 +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
|
@ -142,7 +142,7 @@ FindDialog::FindDialog(NonnullRefPtr<HexEditor::FindWidget> find_widget)
|
|||
};
|
||||
|
||||
m_find_button->on_click = [this](auto) {
|
||||
auto text = String::from_deprecated_string(m_text_editor->text()).release_value_but_fixme_should_propagate_errors();
|
||||
auto text = String::from_byte_string(m_text_editor->text()).release_value_but_fixme_should_propagate_errors();
|
||||
if (!text.is_empty()) {
|
||||
m_text_value = text;
|
||||
done(ExecResult::OK);
|
||||
|
|
|
@ -51,14 +51,14 @@ GUI::Dialog::ExecResult GoToOffsetDialog::show(GUI::Window* parent_window, int&
|
|||
|
||||
int GoToOffsetDialog::process_input()
|
||||
{
|
||||
auto input_offset = String::from_deprecated_string(m_text_editor->text().trim_whitespace()).release_value_but_fixme_should_propagate_errors();
|
||||
auto input_offset = String::from_byte_string(m_text_editor->text().trim_whitespace()).release_value_but_fixme_should_propagate_errors();
|
||||
int offset;
|
||||
auto type = m_offset_type_box->text().trim_whitespace();
|
||||
if (type == "Decimal") {
|
||||
offset = input_offset.to_number<int>().value_or(0);
|
||||
} else if (type == "Hexadecimal") {
|
||||
// FIXME: Find a better way of parsing hex to a number that doesn't require a zero terminated string
|
||||
offset = strtol(input_offset.to_deprecated_string().characters(), nullptr, 16);
|
||||
offset = strtol(input_offset.to_byte_string().characters(), nullptr, 16);
|
||||
} else {
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
|
||||
virtual void undo() override;
|
||||
virtual void redo() override;
|
||||
virtual DeprecatedString action_text() const override { return "Update cell"; }
|
||||
virtual ByteString action_text() const override { return "Update cell"; }
|
||||
|
||||
virtual bool merge_with(GUI::Command const& other) override;
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#include "HexEditor.h"
|
||||
#include "SearchResultsModel.h"
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Format.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
|
@ -180,7 +180,7 @@ bool HexEditor::copy_selected_hex_to_clipboard()
|
|||
for (size_t i = m_selection_start; i < m_selection_end; i++)
|
||||
output_string_builder.appendff("{:02X} ", m_document->get(i).value);
|
||||
|
||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_byte_string());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ bool HexEditor::copy_selected_text_to_clipboard()
|
|||
for (size_t i = m_selection_start; i < m_selection_end; i++)
|
||||
output_string_builder.append(isprint(m_document->get(i).value) ? m_document->get(i).value : '.');
|
||||
|
||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_byte_string());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ bool HexEditor::copy_selected_hex_to_clipboard_as_c_code()
|
|||
}
|
||||
output_string_builder.append("\n};\n"sv);
|
||||
|
||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_deprecated_string());
|
||||
GUI::Clipboard::the().set_plain_text(output_string_builder.to_byte_string());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ void HexEditor::keydown_event(GUI::KeyEvent& event)
|
|||
result = text_mode_keydown_event(event);
|
||||
}
|
||||
if (result.is_error())
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("{}", result.error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("{}", result.error()));
|
||||
}
|
||||
|
||||
event.ignore();
|
||||
|
|
|
@ -112,7 +112,7 @@ ErrorOr<void> HexEditorWidget::setup()
|
|||
}
|
||||
|
||||
if (auto error = m_editor->open_new_file(file_size.value()); error.is_error()) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Unable to open new file: {}"sv, error.error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Unable to open new file: {}"sv, error.error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ ErrorOr<void> HexEditorWidget::setup()
|
|||
return m_save_as_action->activate();
|
||||
|
||||
if (auto result = m_editor->save(); result.is_error()) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Unable to save file: {}\n"sv, result.error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Unable to save file: {}\n"sv, result.error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
} else {
|
||||
window()->set_modified(false);
|
||||
m_editor->update();
|
||||
|
@ -151,7 +151,7 @@ ErrorOr<void> HexEditorWidget::setup()
|
|||
return;
|
||||
auto file = response.release_value();
|
||||
if (auto result = m_editor->save_as(file.release_stream()); result.is_error()) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Unable to save file: {}\n"sv, result.error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Unable to save file: {}\n"sv, result.error()), "Error"sv, GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -180,11 +180,11 @@ ErrorOr<void> HexEditorWidget::setup()
|
|||
m_search_results->update();
|
||||
|
||||
if (matches.is_empty()) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not Found"sv, GUI::MessageBox::Type::Warning);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not Found"sv, GUI::MessageBox::Type::Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Found {} matches for \"{}\" in this file", matches.size(), m_search_text), DeprecatedString::formatted("{} Matches", matches.size()), GUI::MessageBox::Type::Warning);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Found {} matches for \"{}\" in this file", matches.size(), m_search_text), ByteString::formatted("{} Matches", matches.size()), GUI::MessageBox::Type::Warning);
|
||||
set_search_results_visible(true);
|
||||
} else {
|
||||
bool same_buffers = false;
|
||||
|
@ -196,7 +196,7 @@ ErrorOr<void> HexEditorWidget::setup()
|
|||
auto result = m_editor->find_and_highlight(m_search_buffer, same_buffers ? last_found_index() : 0);
|
||||
|
||||
if (!result.has_value()) {
|
||||
GUI::MessageBox::show(window(), DeprecatedString::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not Found"sv, GUI::MessageBox::Type::Warning);
|
||||
GUI::MessageBox::show(window(), ByteString::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not Found"sv, GUI::MessageBox::Type::Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ ErrorOr<void> HexEditorWidget::setup()
|
|||
auto fill_byte = strtol(value.bytes_as_string_view().characters_without_null_termination(), nullptr, 16);
|
||||
auto result = m_editor->fill_selection(fill_byte);
|
||||
if (result.is_error())
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("{}", result.error()));
|
||||
GUI::MessageBox::show_error(window(), ByteString::formatted("{}", result.error()));
|
||||
}
|
||||
});
|
||||
m_fill_selection_action->set_enabled(false);
|
||||
|
@ -464,7 +464,7 @@ ErrorOr<void> HexEditorWidget::initialize_menubar(GUI::Window& window)
|
|||
|
||||
auto result = m_editor->find_and_highlight(m_search_buffer, last_found_index());
|
||||
if (!result.has_value()) {
|
||||
GUI::MessageBox::show(&window, DeprecatedString::formatted("No more matches for \"{}\" found in this file", m_search_text), "Not Found"sv, GUI::MessageBox::Type::Warning);
|
||||
GUI::MessageBox::show(&window, ByteString::formatted("No more matches for \"{}\" found in this file", m_search_text), "Not Found"sv, GUI::MessageBox::Type::Warning);
|
||||
return;
|
||||
}
|
||||
m_editor->update();
|
||||
|
@ -512,7 +512,7 @@ ErrorOr<void> HexEditorWidget::initialize_menubar(GUI::Window& window)
|
|||
m_bytes_per_row_actions.set_exclusive(true);
|
||||
auto bytes_per_row_menu = view_menu->add_submenu("Bytes per &Row"_string);
|
||||
for (int i = 8; i <= 32; i += 8) {
|
||||
auto action = GUI::Action::create_checkable(DeprecatedString::number(i), [this, i](auto&) {
|
||||
auto action = GUI::Action::create_checkable(ByteString::number(i), [this, i](auto&) {
|
||||
m_editor->set_bytes_per_row(i);
|
||||
m_editor->update();
|
||||
Config::write_i32("HexEditor"sv, "Layout"sv, "BytesPerRow"sv, i);
|
||||
|
@ -582,14 +582,14 @@ void HexEditorWidget::update_title()
|
|||
else
|
||||
builder.append(m_path);
|
||||
builder.append("[*] - Hex Editor"sv);
|
||||
window()->set_title(builder.to_deprecated_string());
|
||||
window()->set_title(builder.to_byte_string());
|
||||
}
|
||||
|
||||
void HexEditorWidget::open_file(String const& filename, NonnullOwnPtr<Core::File> file)
|
||||
{
|
||||
window()->set_modified(false);
|
||||
m_editor->open_file(move(file));
|
||||
set_path(filename.to_deprecated_string());
|
||||
set_path(filename.to_byte_string());
|
||||
GUI::Application::the()->set_most_recently_open_file(filename);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,9 +46,9 @@ private:
|
|||
virtual void drop_event(GUI::DropEvent&) override;
|
||||
|
||||
RefPtr<HexEditor> m_editor;
|
||||
DeprecatedString m_path;
|
||||
DeprecatedString m_name;
|
||||
DeprecatedString m_extension;
|
||||
ByteString m_path;
|
||||
ByteString m_name;
|
||||
ByteString m_extension;
|
||||
|
||||
int m_goto_history { 0 };
|
||||
String m_search_text;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Hex.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/Utf8View.h>
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
auto& match = m_matches.at(index.row());
|
||||
switch (index.column()) {
|
||||
case Column::Offset:
|
||||
return DeprecatedString::formatted("{:#08X}", match.offset);
|
||||
return ByteString::formatted("{:#08X}", match.offset);
|
||||
case Column::Value: {
|
||||
Utf8View utf8_view(match.value);
|
||||
if (!utf8_view.validate())
|
||||
|
|
|
@ -121,7 +121,7 @@ public:
|
|||
if (role == GUI::ModelRole::Display) {
|
||||
switch (index.column()) {
|
||||
case Column::Type:
|
||||
return inspector_value_type_to_string(static_cast<ValueType>(index.row())).to_deprecated_string();
|
||||
return inspector_value_type_to_string(static_cast<ValueType>(index.row())).to_byte_string();
|
||||
case Column::Value:
|
||||
return m_values.at(index.row());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue