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

@ -10,9 +10,9 @@
namespace Core {
Vector<String> MimeData::formats() const
Vector<DeprecatedString> MimeData::formats() const
{
Vector<String> mime_types;
Vector<DeprecatedString> mime_types;
mime_types.ensure_capacity(m_data.size());
for (auto& it : m_data)
mime_types.unchecked_append(it.key);
@ -41,17 +41,17 @@ void MimeData::set_urls(Vector<URL> const& urls)
set_data("text/uri-list", builder.to_byte_buffer());
}
String MimeData::text() const
DeprecatedString MimeData::text() const
{
return String::copy(m_data.get("text/plain").value_or({}));
return DeprecatedString::copy(m_data.get("text/plain").value_or({}));
}
void MimeData::set_text(String const& text)
void MimeData::set_text(DeprecatedString const& text)
{
set_data("text/plain", text.to_byte_buffer());
}
String guess_mime_type_based_on_filename(StringView path)
DeprecatedString guess_mime_type_based_on_filename(StringView path)
{
if (path.ends_with(".pbm"sv, CaseSensitivity::CaseInsensitive))
return "image/xportablebitmap";
@ -164,7 +164,7 @@ String guess_mime_type_based_on_filename(StringView path)
ENUMERATE_HEADER_CONTENTS
#undef __ENUMERATE_MIME_TYPE_HEADER
Optional<String> guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes bytes)
Optional<DeprecatedString> guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes bytes)
{
#define __ENUMERATE_MIME_TYPE_HEADER(var_name, mime_type, pattern_offset, pattern_size, ...) \
if (static_cast<ssize_t>(bytes.size()) >= pattern_offset && bytes.slice(pattern_offset).starts_with(var_name)) \