mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:17:44 +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
1615 changed files with 10257 additions and 10257 deletions
|
@ -10,8 +10,8 @@
|
|||
#include "RegexOptions.h"
|
||||
#include <AK/Error.h>
|
||||
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/DeprecatedFlyString.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/MemMem.h>
|
||||
#include <AK/RedBlackTree.h>
|
||||
|
@ -158,7 +158,7 @@ class RegexStringView {
|
|||
public:
|
||||
RegexStringView() = default;
|
||||
|
||||
RegexStringView(DeprecatedString const& string)
|
||||
RegexStringView(ByteString const& string)
|
||||
: m_view(string.view())
|
||||
{
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
explicit RegexStringView(DeprecatedString&&) = delete;
|
||||
explicit RegexStringView(ByteString&&) = delete;
|
||||
|
||||
bool is_string_view() const
|
||||
{
|
||||
|
@ -277,14 +277,14 @@ public:
|
|||
return view;
|
||||
}
|
||||
|
||||
RegexStringView construct_as_same(Span<u32> data, Optional<DeprecatedString>& optional_string_storage, Utf16Data& optional_utf16_storage) const
|
||||
RegexStringView construct_as_same(Span<u32> data, Optional<ByteString>& optional_string_storage, Utf16Data& optional_utf16_storage) const
|
||||
{
|
||||
auto view = m_view.visit(
|
||||
[&]<typename T>(T const&) {
|
||||
StringBuilder builder;
|
||||
for (auto ch : data)
|
||||
builder.append(ch); // Note: The type conversion is intentional.
|
||||
optional_string_storage = builder.to_deprecated_string();
|
||||
optional_string_storage = builder.to_byte_string();
|
||||
return RegexStringView { T { *optional_string_storage } };
|
||||
},
|
||||
[&](Utf32View) {
|
||||
|
@ -392,16 +392,16 @@ public:
|
|||
return view;
|
||||
}
|
||||
|
||||
DeprecatedString to_deprecated_string() const
|
||||
ByteString to_byte_string() const
|
||||
{
|
||||
return m_view.visit(
|
||||
[](StringView view) { return view.to_deprecated_string(); },
|
||||
[](Utf16View view) { return view.to_deprecated_string(Utf16View::AllowInvalidCodeUnits::Yes).release_value_but_fixme_should_propagate_errors(); },
|
||||
[](StringView view) { return view.to_byte_string(); },
|
||||
[](Utf16View view) { return view.to_byte_string(Utf16View::AllowInvalidCodeUnits::Yes).release_value_but_fixme_should_propagate_errors(); },
|
||||
[](auto& view) {
|
||||
StringBuilder builder;
|
||||
for (auto it = view.begin(); it != view.end(); ++it)
|
||||
builder.append_code_point(*it);
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -481,17 +481,17 @@ public:
|
|||
bool operator==(char const* cstring) const
|
||||
{
|
||||
return m_view.visit(
|
||||
[&](Utf32View) { return to_deprecated_string() == cstring; },
|
||||
[&](Utf16View) { return to_deprecated_string() == cstring; },
|
||||
[&](Utf32View) { return to_byte_string() == cstring; },
|
||||
[&](Utf16View) { return to_byte_string() == cstring; },
|
||||
[&](Utf8View const& view) { return view.as_string() == cstring; },
|
||||
[&](StringView view) { return view == cstring; });
|
||||
}
|
||||
|
||||
bool operator==(DeprecatedString const& string) const
|
||||
bool operator==(ByteString const& string) const
|
||||
{
|
||||
return m_view.visit(
|
||||
[&](Utf32View) { return to_deprecated_string() == string; },
|
||||
[&](Utf16View) { return to_deprecated_string() == string; },
|
||||
[&](Utf32View) { return to_byte_string() == string; },
|
||||
[&](Utf16View) { return to_byte_string() == string; },
|
||||
[&](Utf8View const& view) { return view.as_string() == string; },
|
||||
[&](StringView view) { return view == string; });
|
||||
}
|
||||
|
@ -499,8 +499,8 @@ public:
|
|||
bool operator==(StringView string) const
|
||||
{
|
||||
return m_view.visit(
|
||||
[&](Utf32View) { return to_deprecated_string() == string; },
|
||||
[&](Utf16View) { return to_deprecated_string() == string; },
|
||||
[&](Utf32View) { return to_byte_string() == string; },
|
||||
[&](Utf16View) { return to_byte_string() == string; },
|
||||
[&](Utf8View const& view) { return view.as_string() == string; },
|
||||
[&](StringView view) { return view == string; });
|
||||
}
|
||||
|
@ -511,25 +511,25 @@ public:
|
|||
[&](Utf32View view) {
|
||||
return view.length() == other.length() && __builtin_memcmp(view.code_points(), other.code_points(), view.length() * sizeof(u32)) == 0;
|
||||
},
|
||||
[&](Utf16View) { return to_deprecated_string() == RegexStringView { other }.to_deprecated_string(); },
|
||||
[&](Utf8View const& view) { return view.as_string() == RegexStringView { other }.to_deprecated_string(); },
|
||||
[&](StringView view) { return view == RegexStringView { other }.to_deprecated_string(); });
|
||||
[&](Utf16View) { return to_byte_string() == RegexStringView { other }.to_byte_string(); },
|
||||
[&](Utf8View const& view) { return view.as_string() == RegexStringView { other }.to_byte_string(); },
|
||||
[&](StringView view) { return view == RegexStringView { other }.to_byte_string(); });
|
||||
}
|
||||
|
||||
bool operator==(Utf16View const& other) const
|
||||
{
|
||||
return m_view.visit(
|
||||
[&](Utf32View) { return to_deprecated_string() == RegexStringView { other }.to_deprecated_string(); },
|
||||
[&](Utf32View) { return to_byte_string() == RegexStringView { other }.to_byte_string(); },
|
||||
[&](Utf16View const& view) { return view == other; },
|
||||
[&](Utf8View const& view) { return view.as_string() == RegexStringView { other }.to_deprecated_string(); },
|
||||
[&](StringView view) { return view == RegexStringView { other }.to_deprecated_string(); });
|
||||
[&](Utf8View const& view) { return view.as_string() == RegexStringView { other }.to_byte_string(); },
|
||||
[&](StringView view) { return view == RegexStringView { other }.to_byte_string(); });
|
||||
}
|
||||
|
||||
bool operator==(Utf8View const& other) const
|
||||
{
|
||||
return m_view.visit(
|
||||
[&](Utf32View) { return to_deprecated_string() == other.as_string(); },
|
||||
[&](Utf16View) { return to_deprecated_string() == other.as_string(); },
|
||||
[&](Utf32View) { return to_byte_string() == other.as_string(); },
|
||||
[&](Utf16View) { return to_byte_string() == other.as_string(); },
|
||||
[&](Utf8View const& view) { return view.as_string() == other.as_string(); },
|
||||
[&](StringView view) { return other.as_string() == view; });
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
Match(DeprecatedString string_, size_t const line_, size_t const column_, size_t const global_offset_)
|
||||
Match(ByteString string_, size_t const line_, size_t const column_, size_t const global_offset_)
|
||||
: string(move(string_))
|
||||
, view(string.value().view())
|
||||
, line(line_)
|
||||
|
@ -700,7 +700,7 @@ template<>
|
|||
struct AK::Formatter<regex::RegexStringView> : Formatter<StringView> {
|
||||
ErrorOr<void> format(FormatBuilder& builder, regex::RegexStringView value)
|
||||
{
|
||||
auto string = value.to_deprecated_string();
|
||||
auto string = value.to_byte_string();
|
||||
return Formatter<StringView>::format(builder, string);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue