1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:47:46 +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

@ -9,18 +9,18 @@
namespace IMAP {
String Sequence::serialize() const
DeprecatedString Sequence::serialize() const
{
if (start == end) {
return AK::String::formatted("{}", start);
return AK::DeprecatedString::formatted("{}", start);
} else {
auto start_char = start != -1 ? String::formatted("{}", start) : "*";
auto end_char = end != -1 ? String::formatted("{}", end) : "*";
return String::formatted("{}:{}", start_char, end_char);
auto start_char = start != -1 ? DeprecatedString::formatted("{}", start) : "*";
auto end_char = end != -1 ? DeprecatedString::formatted("{}", end) : "*";
return DeprecatedString::formatted("{}:{}", start_char, end_char);
}
}
String FetchCommand::DataItem::Section::serialize() const
DeprecatedString FetchCommand::DataItem::Section::serialize() const
{
StringBuilder headers_builder;
switch (type) {
@ -62,7 +62,7 @@ String FetchCommand::DataItem::Section::serialize() const
}
VERIFY_NOT_REACHED();
}
String FetchCommand::DataItem::serialize() const
DeprecatedString FetchCommand::DataItem::serialize() const
{
switch (type) {
case DataItemType::Envelope:
@ -89,7 +89,7 @@ String FetchCommand::DataItem::serialize() const
}
VERIFY_NOT_REACHED();
}
String FetchCommand::serialize()
DeprecatedString FetchCommand::serialize()
{
StringBuilder sequence_builder;
bool first = true;
@ -111,9 +111,9 @@ String FetchCommand::serialize()
first = false;
}
return AK::String::formatted("{} ({})", sequence_builder.build(), data_items_builder.build());
return AK::DeprecatedString::formatted("{} ({})", sequence_builder.build(), data_items_builder.build());
}
String serialize_astring(StringView string)
DeprecatedString serialize_astring(StringView string)
{
// Try to send an atom
auto is_non_atom_char = [](char x) {
@ -129,31 +129,31 @@ String serialize_astring(StringView string)
auto can_be_quoted = !(string.contains('\n') || string.contains('\r'));
if (can_be_quoted) {
auto escaped_str = string.replace("\\"sv, "\\\\"sv, ReplaceMode::All).replace("\""sv, "\\\""sv, ReplaceMode::All);
return String::formatted("\"{}\"", escaped_str);
return DeprecatedString::formatted("\"{}\"", escaped_str);
}
// Just send a literal
return String::formatted("{{{}}}\r\n{}", string.length(), string);
return DeprecatedString::formatted("{{{}}}\r\n{}", string.length(), string);
}
String SearchKey::serialize() const
DeprecatedString SearchKey::serialize() const
{
return data.visit(
[&](All const&) { return String("ALL"); },
[&](Answered const&) { return String("ANSWERED"); },
[&](Bcc const& x) { return String::formatted("BCC {}", serialize_astring(x.bcc)); },
[&](Cc const& x) { return String::formatted("CC {}", serialize_astring(x.cc)); },
[&](Deleted const&) { return String("DELETED"); },
[&](Draft const&) { return String("DRAFT"); },
[&](From const& x) { return String::formatted("FROM {}", serialize_astring(x.from)); },
[&](Header const& x) { return String::formatted("HEADER {} {}", serialize_astring(x.header), serialize_astring(x.value)); },
[&](Keyword const& x) { return String::formatted("KEYWORD {}", x.keyword); },
[&](Larger const& x) { return String::formatted("LARGER {}", x.number); },
[&](New const&) { return String("NEW"); },
[&](Not const& x) { return String::formatted("NOT {}", x.operand->serialize()); },
[&](Old const&) { return String("OLD"); },
[&](On const& x) { return String::formatted("ON {}", x.date.to_string("%d-%b-%Y"sv)); },
[&](Or const& x) { return String::formatted("OR {} {}", x.lhs->serialize(), x.rhs->serialize()); },
[&](Recent const&) { return String("RECENT"); },
[&](All const&) { return DeprecatedString("ALL"); },
[&](Answered const&) { return DeprecatedString("ANSWERED"); },
[&](Bcc const& x) { return DeprecatedString::formatted("BCC {}", serialize_astring(x.bcc)); },
[&](Cc const& x) { return DeprecatedString::formatted("CC {}", serialize_astring(x.cc)); },
[&](Deleted const&) { return DeprecatedString("DELETED"); },
[&](Draft const&) { return DeprecatedString("DRAFT"); },
[&](From const& x) { return DeprecatedString::formatted("FROM {}", serialize_astring(x.from)); },
[&](Header const& x) { return DeprecatedString::formatted("HEADER {} {}", serialize_astring(x.header), serialize_astring(x.value)); },
[&](Keyword const& x) { return DeprecatedString::formatted("KEYWORD {}", x.keyword); },
[&](Larger const& x) { return DeprecatedString::formatted("LARGER {}", x.number); },
[&](New const&) { return DeprecatedString("NEW"); },
[&](Not const& x) { return DeprecatedString::formatted("NOT {}", x.operand->serialize()); },
[&](Old const&) { return DeprecatedString("OLD"); },
[&](On const& x) { return DeprecatedString::formatted("ON {}", x.date.to_string("%d-%b-%Y"sv)); },
[&](Or const& x) { return DeprecatedString::formatted("OR {} {}", x.lhs->serialize(), x.rhs->serialize()); },
[&](Recent const&) { return DeprecatedString("RECENT"); },
[&](SearchKeys const& x) {
StringBuilder sb;
sb.append('(');
@ -166,21 +166,21 @@ String SearchKey::serialize() const
}
return sb.build();
},
[&](Seen const&) { return String("SEEN"); },
[&](SentBefore const& x) { return String::formatted("SENTBEFORE {}", x.date.to_string("%d-%b-%Y"sv)); },
[&](SentOn const& x) { return String::formatted("SENTON {}", x.date.to_string("%d-%b-%Y"sv)); },
[&](SentSince const& x) { return String::formatted("SENTSINCE {}", x.date.to_string("%d-%b-%Y"sv)); },
[&](Seen const&) { return DeprecatedString("SEEN"); },
[&](SentBefore const& x) { return DeprecatedString::formatted("SENTBEFORE {}", x.date.to_string("%d-%b-%Y"sv)); },
[&](SentOn const& x) { return DeprecatedString::formatted("SENTON {}", x.date.to_string("%d-%b-%Y"sv)); },
[&](SentSince const& x) { return DeprecatedString::formatted("SENTSINCE {}", x.date.to_string("%d-%b-%Y"sv)); },
[&](SequenceSet const& x) { return x.sequence.serialize(); },
[&](Since const& x) { return String::formatted("SINCE {}", x.date.to_string("%d-%b-%Y"sv)); },
[&](Smaller const& x) { return String::formatted("SMALLER {}", x.number); },
[&](Subject const& x) { return String::formatted("SUBJECT {}", serialize_astring(x.subject)); },
[&](Text const& x) { return String::formatted("TEXT {}", serialize_astring(x.text)); },
[&](To const& x) { return String::formatted("TO {}", serialize_astring(x.to)); },
[&](UID const& x) { return String::formatted("UID {}", x.uid); },
[&](Unanswered const&) { return String("UNANSWERED"); },
[&](Undeleted const&) { return String("UNDELETED"); },
[&](Undraft const&) { return String("UNDRAFT"); },
[&](Unkeyword const& x) { return String::formatted("UNKEYWORD {}", serialize_astring(x.flag_keyword)); },
[&](Unseen const&) { return String("UNSEEN"); });
[&](Since const& x) { return DeprecatedString::formatted("SINCE {}", x.date.to_string("%d-%b-%Y"sv)); },
[&](Smaller const& x) { return DeprecatedString::formatted("SMALLER {}", x.number); },
[&](Subject const& x) { return DeprecatedString::formatted("SUBJECT {}", serialize_astring(x.subject)); },
[&](Text const& x) { return DeprecatedString::formatted("TEXT {}", serialize_astring(x.text)); },
[&](To const& x) { return DeprecatedString::formatted("TO {}", serialize_astring(x.to)); },
[&](UID const& x) { return DeprecatedString::formatted("UID {}", x.uid); },
[&](Unanswered const&) { return DeprecatedString("UNANSWERED"); },
[&](Undeleted const&) { return DeprecatedString("UNDELETED"); },
[&](Undraft const&) { return DeprecatedString("UNDRAFT"); },
[&](Unkeyword const& x) { return DeprecatedString::formatted("UNKEYWORD {}", serialize_astring(x.flag_keyword)); },
[&](Unseen const&) { return DeprecatedString("UNSEEN"); });
}
}