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

@ -6,7 +6,7 @@
*/
#include "NetworkSettingsWidget.h"
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/IPv4Address.h>
#include <AK/JsonObject.h>
#include <AK/JsonParser.h>
@ -78,7 +78,7 @@ ErrorOr<void> NetworkSettingsWidget::setup()
size_t index = 0;
proc_net_adapters_json.as_array().for_each([&](auto& value) {
auto& if_object = value.as_object();
auto adapter_name = if_object.get_deprecated_string("name"sv).value();
auto adapter_name = if_object.get_byte_string("name"sv).value();
if (adapter_name == "loop")
return;
@ -106,8 +106,8 @@ ErrorOr<void> NetworkSettingsWidget::setup()
::exit(1);
}
m_adapters_combobox->set_model(GUI::ItemListModel<DeprecatedString>::create(m_adapter_names));
m_adapters_combobox->on_change = [this](DeprecatedString const& text, GUI::ModelIndex const&) {
m_adapters_combobox->set_model(GUI::ItemListModel<ByteString>::create(m_adapter_names));
m_adapters_combobox->on_change = [this](ByteString const& text, GUI::ModelIndex const&) {
on_switch_adapter(text);
};
auto const& selected_adapter = selected_adapter_index;
@ -117,7 +117,7 @@ ErrorOr<void> NetworkSettingsWidget::setup()
return {};
}
void NetworkSettingsWidget::on_switch_adapter(DeprecatedString const& adapter)
void NetworkSettingsWidget::on_switch_adapter(ByteString const& adapter)
{
auto& adapter_data = m_network_adapters.get(adapter).value();
m_current_adapter_data = &adapter_data;
@ -198,7 +198,7 @@ ErrorOr<Optional<JsonObject>> NetworkSettingsWidget::create_settings_object()
adapter.set("Enabled", adapter_data.value.enabled);
adapter.set("DHCP", adapter_data.value.dhcp);
adapter.set("IPv4Address", adapter_data.value.ip_address);
adapter.set("IPv4Netmask", netmask.to_deprecated_string());
adapter.set("IPv4Netmask", netmask.to_byte_string());
adapter.set("IPv4Gateway", adapter_data.value.default_gateway);
json.set(adapter_data.key, move(adapter));
}
@ -206,7 +206,7 @@ ErrorOr<Optional<JsonObject>> NetworkSettingsWidget::create_settings_object()
return json;
}
void NetworkSettingsWidget::switch_adapter(DeprecatedString const& adapter)
void NetworkSettingsWidget::switch_adapter(ByteString const& adapter)
{
m_adapters_combobox->set_text(adapter, GUI::AllowCallback::No);
on_switch_adapter(adapter);