1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:58:10 +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

@ -55,7 +55,7 @@ int VariablesModel::row_count(const GUI::ModelIndex& index) const
return node->members.size();
}
static DeprecatedString variable_value_as_string(Debug::DebugInfo::VariableInfo const& variable)
static ByteString variable_value_as_string(Debug::DebugInfo::VariableInfo const& variable)
{
if (variable.location_type != Debug::DebugInfo::VariableInfo::LocationType::Address)
return "N/A";
@ -69,20 +69,20 @@ static DeprecatedString variable_value_as_string(Debug::DebugInfo::VariableInfo
return enumerator->constant_data.as_u32 == enumerator_value;
});
if (it.is_end())
return DeprecatedString::formatted("Unknown ({})", value.value());
return DeprecatedString::formatted("{}::{}", variable.type_name, (*it)->name);
return ByteString::formatted("Unknown ({})", value.value());
return ByteString::formatted("{}::{}", variable.type_name, (*it)->name);
}
if (variable.type_name == "int") {
auto value = Debugger::the().session()->peek(variable_address);
VERIFY(value.has_value());
return DeprecatedString::formatted("{}", static_cast<int>(value.value()));
return ByteString::formatted("{}", static_cast<int>(value.value()));
}
if (variable.type_name == "char") {
auto value = Debugger::the().session()->peek(variable_address);
VERIFY(value.has_value());
return DeprecatedString::formatted("'{0:c}'", (char)value.value());
return ByteString::formatted("'{0:c}'", (char)value.value());
}
if (variable.type_name == "bool") {
@ -91,13 +91,13 @@ static DeprecatedString variable_value_as_string(Debug::DebugInfo::VariableInfo
return (value.value() & 1) ? "true" : "false";
}
return DeprecatedString::formatted("type: {} @ {:p}, ", variable.type_name, variable_address);
return ByteString::formatted("type: {} @ {:p}, ", variable.type_name, variable_address);
}
static Optional<u32> string_to_variable_value(StringView string_value, Debug::DebugInfo::VariableInfo const& variable)
{
if (variable.is_enum_type()) {
auto prefix_string = DeprecatedString::formatted("{}::", variable.type_name);
auto prefix_string = ByteString::formatted("{}::", variable.type_name);
auto string_to_use = string_value;
if (string_value.starts_with(prefix_string))
string_to_use = string_value.substring_view(prefix_string.length(), string_value.length() - prefix_string.length());
@ -143,7 +143,7 @@ void VariablesModel::set_variable_value(const GUI::ModelIndex& index, StringView
GUI::MessageBox::show(
parent_window,
DeprecatedString::formatted("String value \"{}\" could not be converted to a value of type {}.", string_value, variable->type_name),
ByteString::formatted("String value \"{}\" could not be converted to a value of type {}.", string_value, variable->type_name),
"Set value failed"sv,
GUI::MessageBox::Type::Error);
}
@ -154,7 +154,7 @@ GUI::Variant VariablesModel::data(const GUI::ModelIndex& index, GUI::ModelRole r
switch (role) {
case GUI::ModelRole::Display: {
auto value_as_string = variable_value_as_string(*variable);
return DeprecatedString::formatted("{}: {}", variable->name, value_as_string);
return ByteString::formatted("{}: {}", variable->name, value_as_string);
}
case GUI::ModelRole::Icon:
return m_variable_icon;