1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +00:00

AK+Everywhere: Rename String to DeprecatedString

We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
This commit is contained in:
Linus Groh 2022-12-04 18:02:33 +00:00 committed by Andreas Kling
parent f74251606d
commit 6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions

View file

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