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

@ -116,8 +116,8 @@ public:
m_status_items |= static_cast<unsigned>(type);
}
void set_mailbox(String&& mailbox) { m_mailbox = move(mailbox); }
String& mailbox() { return m_mailbox; }
void set_mailbox(DeprecatedString&& mailbox) { m_mailbox = move(mailbox); }
DeprecatedString& mailbox() { return m_mailbox; }
unsigned get(StatusItemType type) const
{
@ -166,60 +166,60 @@ private:
unsigned m_uid_next { 0 };
unsigned m_uid_validity { 0 };
unsigned m_unseen { 0 };
String m_mailbox;
DeprecatedString m_mailbox;
};
struct Address {
Optional<String> name;
Optional<String> source_route;
Optional<String> mailbox;
Optional<String> host;
Optional<DeprecatedString> name;
Optional<DeprecatedString> source_route;
Optional<DeprecatedString> mailbox;
Optional<DeprecatedString> host;
};
struct Envelope {
Optional<String> date; // Format of date not specified.
Optional<String> subject;
Optional<DeprecatedString> date; // Format of date not specified.
Optional<DeprecatedString> subject;
Optional<Vector<Address>> from;
Optional<Vector<Address>> sender;
Optional<Vector<Address>> reply_to;
Optional<Vector<Address>> to;
Optional<Vector<Address>> cc;
Optional<Vector<Address>> bcc;
Optional<String> in_reply_to;
Optional<String> message_id;
Optional<DeprecatedString> in_reply_to;
Optional<DeprecatedString> message_id;
};
class BodyStructure;
struct BodyExtension {
AK::Variant<Optional<String>, unsigned, Vector<OwnPtr<BodyExtension>>> data;
AK::Variant<Optional<DeprecatedString>, unsigned, Vector<OwnPtr<BodyExtension>>> data;
};
struct MultiPartBodyStructureData {
Optional<Tuple<String, HashMap<String, String>>> disposition;
Optional<Tuple<DeprecatedString, HashMap<DeprecatedString, DeprecatedString>>> disposition;
Vector<OwnPtr<BodyStructure>> bodies;
Vector<String> langs;
String media_type;
Optional<HashMap<String, String>> params;
Optional<String> location;
Vector<DeprecatedString> langs;
DeprecatedString media_type;
Optional<HashMap<DeprecatedString, DeprecatedString>> params;
Optional<DeprecatedString> location;
Optional<Vector<BodyExtension>> extensions;
};
struct BodyStructureData {
String type;
String subtype;
Optional<String> id {};
Optional<String> desc {};
String encoding;
HashMap<String, String> fields;
DeprecatedString type;
DeprecatedString subtype;
Optional<DeprecatedString> id {};
Optional<DeprecatedString> desc {};
DeprecatedString encoding;
HashMap<DeprecatedString, DeprecatedString> fields;
unsigned bytes { 0 };
unsigned lines { 0 };
Optional<Envelope> envelope;
Optional<String> md5 {};
Optional<Tuple<String, HashMap<String, String>>> disposition {};
Optional<Vector<String>> langs {};
Optional<String> location {};
Optional<DeprecatedString> md5 {};
Optional<Tuple<DeprecatedString, HashMap<DeprecatedString, DeprecatedString>>> disposition {};
Optional<Vector<DeprecatedString>> langs {};
Optional<DeprecatedString> location {};
Optional<Vector<BodyExtension>> extensions {};
};
@ -249,7 +249,7 @@ struct Sequence {
int start;
int end;
[[nodiscard]] String serialize() const;
[[nodiscard]] DeprecatedString serialize() const;
};
struct FetchCommand {
@ -277,9 +277,9 @@ struct FetchCommand {
Optional<Vector<unsigned>> parts {};
bool ends_with_mime {};
Optional<Vector<String>> headers {};
Optional<Vector<DeprecatedString>> headers {};
[[nodiscard]] String serialize() const;
[[nodiscard]] DeprecatedString serialize() const;
};
DataItemType type;
@ -289,19 +289,19 @@ struct FetchCommand {
int start { 0 };
int octets { 0 };
[[nodiscard]] String serialize() const;
[[nodiscard]] DeprecatedString serialize() const;
};
Vector<Sequence> sequence_set;
Vector<DataItem> data_items;
String serialize();
DeprecatedString serialize();
};
struct Command {
public:
CommandType type;
int tag;
Vector<String> args;
Vector<DeprecatedString> args;
};
enum class ResponseStatus {
@ -312,8 +312,8 @@ enum class ResponseStatus {
struct ListItem {
unsigned flags;
String reference;
String name;
DeprecatedString reference;
DeprecatedString name;
};
class FetchResponseData {
@ -333,13 +333,13 @@ public:
m_response_type |= static_cast<unsigned>(type);
}
void add_body_data(FetchCommand::DataItem&& data_item, Optional<String>&& body)
void add_body_data(FetchCommand::DataItem&& data_item, Optional<DeprecatedString>&& body)
{
add_response_type(FetchResponseType::Body);
m_bodies.append({ move(data_item), move(body) });
}
Vector<Tuple<FetchCommand::DataItem, Optional<String>>>& body_data()
Vector<Tuple<FetchCommand::DataItem, Optional<DeprecatedString>>>& body_data()
{
VERIFY(contains_response_type(FetchResponseType::Body));
return m_bodies;
@ -381,13 +381,13 @@ public:
return m_envelope;
}
void set_flags(Vector<String>&& flags)
void set_flags(Vector<DeprecatedString>&& flags)
{
add_response_type(FetchResponseType::Flags);
m_flags = move(flags);
}
Vector<String>& flags()
Vector<DeprecatedString>& flags()
{
VERIFY(contains_response_type(FetchResponseType::Flags));
return m_flags;
@ -411,8 +411,8 @@ public:
}
private:
Vector<String> m_flags;
Vector<Tuple<FetchCommand::DataItem, Optional<String>>> m_bodies;
Vector<DeprecatedString> m_flags;
Vector<Tuple<FetchCommand::DataItem, Optional<DeprecatedString>>> m_bodies;
Core::DateTime m_internal_date;
Envelope m_envelope;
unsigned m_uid { 0 };
@ -420,20 +420,20 @@ private:
BodyStructure m_body_structure;
};
String serialize_astring(StringView string);
DeprecatedString serialize_astring(StringView string);
struct SearchKey {
public:
// clang-format off
struct All { };
struct Answered { };
struct Bcc { String bcc; };
struct Cc { String cc; };
struct Bcc { DeprecatedString bcc; };
struct Cc { DeprecatedString cc; };
struct Deleted { };
struct Draft { };
struct From { String from; };
struct Header { String header; String value; };
struct Keyword { String keyword; };
struct From { DeprecatedString from; };
struct Header { DeprecatedString header; DeprecatedString value; };
struct Keyword { DeprecatedString keyword; };
struct Larger { unsigned number; };
struct New { };
struct Not { OwnPtr<SearchKey> operand; };
@ -449,14 +449,14 @@ public:
struct SequenceSet { Sequence sequence; };
struct Since { Core::DateTime date; };
struct Smaller { unsigned number; };
struct Subject { String subject; };
struct Text { String text; };
struct To { String to; };
struct Subject { DeprecatedString subject; };
struct Text { DeprecatedString text; };
struct To { DeprecatedString to; };
struct UID { unsigned uid; };
struct Unanswered { };
struct Undeleted { };
struct Undraft { };
struct Unkeyword { String flag_keyword; };
struct Unkeyword { DeprecatedString flag_keyword; };
struct Unseen { };
// clang-format on
@ -488,7 +488,7 @@ public:
return *this;
}
[[nodiscard]] String serialize() const;
[[nodiscard]] DeprecatedString serialize() const;
};
class ResponseData {
@ -518,13 +518,13 @@ public:
m_response_type = m_response_type | static_cast<unsigned>(response_type);
}
void add_capabilities(Vector<String>&& capabilities)
void add_capabilities(Vector<DeprecatedString>&& capabilities)
{
m_capabilities = move(capabilities);
add_response_type(ResponseType::Capability);
}
Vector<String>& capabilities()
Vector<DeprecatedString>& capabilities()
{
VERIFY(contains_response_type(ResponseType::Capability));
return m_capabilities;
@ -614,25 +614,25 @@ public:
return m_unseen;
}
void set_flags(Vector<String>&& flags)
void set_flags(Vector<DeprecatedString>&& flags)
{
m_response_type |= static_cast<unsigned>(ResponseType::Flags);
m_flags = move(flags);
}
Vector<String>& flags()
Vector<DeprecatedString>& flags()
{
VERIFY(contains_response_type(ResponseType::Flags));
return m_flags;
}
void set_permanent_flags(Vector<String>&& flags)
void set_permanent_flags(Vector<DeprecatedString>&& flags)
{
add_response_type(ResponseType::PermanentFlags);
m_permanent_flags = move(flags);
}
Vector<String>& permanent_flags()
Vector<DeprecatedString>& permanent_flags()
{
VERIFY(contains_response_type(ResponseType::PermanentFlags));
return m_permanent_flags;
@ -674,13 +674,13 @@ public:
return m_expunged;
}
void set_bye(Optional<String> message)
void set_bye(Optional<DeprecatedString> message)
{
add_response_type(ResponseType::Bye);
m_bye_message = move(message);
}
Optional<String>& bye_message()
Optional<DeprecatedString>& bye_message()
{
VERIFY(contains_response_type(ResponseType::Bye));
return m_bye_message;
@ -700,7 +700,7 @@ public:
private:
unsigned m_response_type;
Vector<String> m_capabilities;
Vector<DeprecatedString> m_capabilities;
Vector<ListItem> m_list_items;
Vector<ListItem> m_lsub_items;
Vector<unsigned> m_expunged;
@ -711,11 +711,11 @@ private:
unsigned m_uid_next {};
unsigned m_uid_validity {};
unsigned m_unseen {};
Vector<String> m_permanent_flags;
Vector<String> m_flags;
Vector<DeprecatedString> m_permanent_flags;
Vector<DeprecatedString> m_flags;
Vector<Tuple<unsigned, FetchResponseData>> m_fetch_responses;
Vector<unsigned> m_search_results;
Optional<String> m_bye_message;
Optional<DeprecatedString> m_bye_message;
StatusItem m_status_item;
};
@ -736,7 +736,7 @@ public:
ResponseData& data() { return m_data; }
String response_text() { return m_response_text; };
DeprecatedString response_text() { return m_response_text; };
SolidResponse()
: SolidResponse(ResponseStatus::Bad, -1)
@ -752,14 +752,14 @@ public:
private:
ResponseStatus m_status;
String m_response_text;
DeprecatedString m_response_text;
unsigned m_tag;
ResponseData m_data;
};
struct ContinueRequest {
String data;
DeprecatedString data;
};
using Response = Variant<SolidResponse, ContinueRequest>;
@ -768,5 +768,5 @@ using Response = Variant<SolidResponse, ContinueRequest>;
// An RFC 2822 message
// https://datatracker.ietf.org/doc/html/rfc2822
struct Message {
String data;
DeprecatedString data;
};