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

@ -15,7 +15,7 @@
#include <unistd.h>
static bool use_color = false;
static void print(StringView name, JsonValue const&, Vector<DeprecatedString>& trail);
static void print(StringView name, JsonValue const&, Vector<ByteString>& trail);
static StringView color_name = ""sv;
static StringView color_index = ""sv;
@ -71,12 +71,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
color_off = "\033[0m"sv;
}
Vector<DeprecatedString> trail;
Vector<ByteString> trail;
print("json"sv, json, trail);
return 0;
}
static void print(StringView name, JsonValue const& value, Vector<DeprecatedString>& trail)
static void print(StringView name, JsonValue const& value, Vector<ByteString>& trail)
{
for (size_t i = 0; i < trail.size(); ++i)
out("{}", trail[i]);
@ -85,16 +85,16 @@ static void print(StringView name, JsonValue const& value, Vector<DeprecatedStri
if (value.is_object()) {
outln("{}{{}}{};", color_brace, color_off);
trail.append(DeprecatedString::formatted("{}{}{}.", color_name, name, color_off));
trail.append(ByteString::formatted("{}{}{}.", color_name, name, color_off));
value.as_object().for_each_member([&](auto& on, auto& ov) { print(on, ov, trail); });
trail.take_last();
return;
}
if (value.is_array()) {
outln("{}[]{};", color_brace, color_off);
trail.append(DeprecatedString::formatted("{}{}{}", color_name, name, color_off));
trail.append(ByteString::formatted("{}{}{}", color_name, name, color_off));
for (size_t i = 0; i < value.as_array().size(); ++i) {
auto element_name = DeprecatedString::formatted("{}{}[{}{}{}{}{}]{}", color_off, color_brace, color_off, color_index, i, color_off, color_brace, color_off);
auto element_name = ByteString::formatted("{}{}[{}{}{}{}{}]{}", color_off, color_brace, color_off, color_index, i, color_off, color_brace, color_off);
print(element_name, value.as_array()[i], trail);
}
trail.take_last();