1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48: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

@ -51,7 +51,7 @@ void KeyboardMapperWidget::create_frame()
auto& tmp_button = main_widget.add<KeyButton>();
tmp_button.set_relative_rect(rect);
tmp_button.set_text(String::from_deprecated_string(keys[i].name).release_value_but_fixme_should_propagate_errors());
tmp_button.set_text(String::from_byte_string(keys[i].name).release_value_but_fixme_should_propagate_errors());
tmp_button.set_enabled(keys[i].enabled);
tmp_button.on_click = [this, &tmp_button]() {
@ -125,7 +125,7 @@ u32* KeyboardMapperWidget::map_from_name(const StringView map_name)
return map;
}
ErrorOr<void> KeyboardMapperWidget::load_map_from_file(DeprecatedString const& filename)
ErrorOr<void> KeyboardMapperWidget::load_map_from_file(ByteString const& filename)
{
auto character_map = TRY(Keyboard::CharacterMapFile::load_from_file(filename));
@ -147,7 +147,7 @@ ErrorOr<void> KeyboardMapperWidget::load_map_from_system()
{
auto character_map = TRY(Keyboard::CharacterMap::fetch_system_map());
m_filename = DeprecatedString::formatted("/res/keymaps/{}.json", character_map.character_map_name());
m_filename = ByteString::formatted("/res/keymaps/{}.json", character_map.character_map_name());
m_character_map = character_map.character_map_data();
set_current_map("map");
@ -169,14 +169,14 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
{
JsonObject map_json;
auto add_array = [&](DeprecatedString name, u32* values) {
auto add_array = [&](ByteString name, u32* values) {
JsonArray items;
for (int i = 0; i < 90; i++) {
StringBuilder sb;
if (values[i])
sb.append_code_point(values[i]);
JsonValue val(sb.to_deprecated_string());
JsonValue val(sb.to_byte_string());
items.must_append(move(val));
}
map_json.set(name, move(items));
@ -189,7 +189,7 @@ ErrorOr<void> KeyboardMapperWidget::save_to_file(StringView filename)
add_array("shift_altgr_map", m_character_map.shift_altgr_map);
// Write to file.
DeprecatedString file_content = map_json.to_deprecated_string();
ByteString file_content = map_json.to_byte_string();
auto file = TRY(Core::File::open(filename, Core::File::OpenMode::Write));
TRY(file->write_until_depleted(file_content.bytes()));
file->close();
@ -234,7 +234,7 @@ void KeyboardMapperWidget::keyup_event(GUI::KeyEvent& event)
}
}
void KeyboardMapperWidget::set_current_map(const DeprecatedString current_map)
void KeyboardMapperWidget::set_current_map(const ByteString current_map)
{
m_current_map_name = current_map;
u32* map = map_from_name(m_current_map_name);
@ -259,7 +259,7 @@ void KeyboardMapperWidget::update_window_title()
sb.append(m_filename);
sb.append("[*] - Keyboard Mapper"sv);
window()->set_title(sb.to_deprecated_string());
window()->set_title(sb.to_byte_string());
}
void KeyboardMapperWidget::show_error_to_user(Error error)