mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-22 11:02:53 +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:
parent
38d62563b3
commit
5e1499d104
Notes:
sideshowbarker
2024-07-16 23:38:54 +09:00
Author: https://github.com/alimpfard
Commit: 5e1499d104
Pull-request: https://github.com/SerenityOS/serenity/pull/22325
1615 changed files with 10257 additions and 10257 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "GeneratorUtil.h"
|
||||
#include <AK/AnyOf.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/SourceGenerator.h>
|
||||
#include <AK/StringUtils.h>
|
||||
|
@ -20,11 +20,11 @@ struct Emoji {
|
|||
size_t name { 0 };
|
||||
Optional<size_t> image_path;
|
||||
Unicode::EmojiGroup group;
|
||||
DeprecatedString subgroup;
|
||||
ByteString subgroup;
|
||||
u32 display_order { 0 };
|
||||
Vector<u32> code_points;
|
||||
DeprecatedString encoded_code_points;
|
||||
DeprecatedString status;
|
||||
ByteString encoded_code_points;
|
||||
ByteString status;
|
||||
size_t code_point_array_index { 0 };
|
||||
};
|
||||
|
||||
|
@ -45,8 +45,8 @@ static void set_image_path_for_emoji(StringView emoji_resource_path, EmojiData&
|
|||
builder.appendff("U+{:X}", code_point);
|
||||
}
|
||||
|
||||
auto file = DeprecatedString::formatted("{}.png", builder.to_deprecated_string());
|
||||
auto path = DeprecatedString::formatted("{}/{}", emoji_resource_path, file);
|
||||
auto file = ByteString::formatted("{}.png", builder.to_byte_string());
|
||||
auto path = ByteString::formatted("{}/{}", emoji_resource_path, file);
|
||||
if (!FileSystem::exists(path))
|
||||
return;
|
||||
|
||||
|
@ -61,7 +61,7 @@ static ErrorOr<void> parse_emoji_test_data(Core::InputBufferedFile& file, EmojiD
|
|||
Array<u8, 1024> buffer;
|
||||
|
||||
Unicode::EmojiGroup group;
|
||||
DeprecatedString subgroup;
|
||||
ByteString subgroup;
|
||||
u32 display_order { 0 };
|
||||
|
||||
while (TRY(file.can_read_line())) {
|
||||
|
@ -157,7 +157,7 @@ static ErrorOr<void> parse_emoji_serenity_data(Core::InputBufferedFile& file, Em
|
|||
return {};
|
||||
}));
|
||||
|
||||
auto name = builder.to_deprecated_string();
|
||||
auto name = builder.to_byte_string();
|
||||
if (!any_of(name, is_ascii_lower_alpha))
|
||||
name = name.to_titlecase();
|
||||
|
||||
|
@ -218,7 +218,7 @@ static ErrorOr<void> generate_emoji_data_implementation(Core::InputBufferedFile&
|
|||
SourceGenerator generator { builder };
|
||||
|
||||
generator.set("string_index_type"sv, emoji_data.unique_strings.type_that_fits());
|
||||
generator.set("emojis_size"sv, DeprecatedString::number(emoji_data.emojis.size()));
|
||||
generator.set("emojis_size"sv, ByteString::number(emoji_data.emojis.size()));
|
||||
|
||||
generator.append(R"~~~(
|
||||
#include <AK/Array.h>
|
||||
|
@ -238,7 +238,7 @@ namespace Unicode {
|
|||
for (auto const& emoji : emoji_data.emojis) {
|
||||
total_code_point_count += emoji.code_points.size();
|
||||
}
|
||||
generator.set("total_code_point_count", DeprecatedString::number(total_code_point_count));
|
||||
generator.set("total_code_point_count", ByteString::number(total_code_point_count));
|
||||
|
||||
generator.append(R"~~~(
|
||||
static constexpr Array<u32, @total_code_point_count@> s_emoji_code_points { {)~~~");
|
||||
|
@ -247,7 +247,7 @@ static constexpr Array<u32, @total_code_point_count@> s_emoji_code_points { {)~~
|
|||
for (auto const& emoji : emoji_data.emojis) {
|
||||
for (auto code_point : emoji.code_points) {
|
||||
generator.append(first ? " "sv : ", "sv);
|
||||
generator.append(DeprecatedString::formatted("{:#x}", code_point));
|
||||
generator.append(ByteString::formatted("{:#x}", code_point));
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
@ -288,12 +288,12 @@ struct EmojiData {
|
|||
static constexpr Array<EmojiData, @emojis_size@> s_emojis { {)~~~");
|
||||
|
||||
for (auto const& emoji : emoji_data.emojis) {
|
||||
generator.set("name"sv, DeprecatedString::number(emoji.name));
|
||||
generator.set("image_path"sv, DeprecatedString::number(emoji.image_path.value_or(0)));
|
||||
generator.set("group"sv, DeprecatedString::number(to_underlying(emoji.group)));
|
||||
generator.set("display_order"sv, DeprecatedString::number(emoji.display_order));
|
||||
generator.set("code_point_start"sv, DeprecatedString::number(emoji.code_point_array_index));
|
||||
generator.set("code_point_count"sv, DeprecatedString::number(emoji.code_points.size()));
|
||||
generator.set("name"sv, ByteString::number(emoji.name));
|
||||
generator.set("image_path"sv, ByteString::number(emoji.image_path.value_or(0)));
|
||||
generator.set("group"sv, ByteString::number(to_underlying(emoji.group)));
|
||||
generator.set("display_order"sv, ByteString::number(emoji.display_order));
|
||||
generator.set("code_point_start"sv, ByteString::number(emoji.code_point_array_index));
|
||||
generator.set("code_point_count"sv, ByteString::number(emoji.code_points.size()));
|
||||
|
||||
generator.append(R"~~~(
|
||||
{ @name@, @image_path@, @group@, @display_order@, @code_point_start@, @code_point_count@ },)~~~");
|
||||
|
@ -370,7 +370,7 @@ static ErrorOr<void> generate_emoji_installation(Core::InputBufferedFile& file,
|
|||
|
||||
generator.append("@emoji@"sv);
|
||||
generator.append(" - "sv);
|
||||
generator.append(DeprecatedString::join(" "sv, emoji.code_points, "U+{:X}"sv));
|
||||
generator.append(ByteString::join(" "sv, emoji.code_points, "U+{:X}"sv));
|
||||
generator.append(" @name@ (@status@)\n"sv);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue