1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 15:07:45 +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:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -30,30 +30,30 @@ public:
if (!entry.has_string("quote"sv) || !entry.has_string("author"sv) || !entry.has_u64("utc_time"sv) || !entry.has_string("url"sv))
return {};
// From here on, trust that it's probably fine.
q.m_quote = entry.get_deprecated_string("quote"sv).value();
q.m_author = entry.get_deprecated_string("author"sv).value();
q.m_quote = entry.get_byte_string("quote"sv).value();
q.m_author = entry.get_byte_string("author"sv).value();
q.m_utc_time = entry.get_u64("utc_time"sv).value();
q.m_url = entry.get_deprecated_string("url"sv).value();
q.m_url = entry.get_byte_string("url"sv).value();
if (entry.has("context"sv))
q.m_context = entry.get_deprecated_string("context"sv).value();
q.m_context = entry.get_byte_string("context"sv).value();
return q;
}
DeprecatedString const& quote() const { return m_quote; }
DeprecatedString const& author() const { return m_author; }
ByteString const& quote() const { return m_quote; }
ByteString const& author() const { return m_author; }
u64 const& utc_time() const { return m_utc_time; }
DeprecatedString const& url() const { return m_url; }
Optional<DeprecatedString> const& context() const { return m_context; }
ByteString const& url() const { return m_url; }
Optional<ByteString> const& context() const { return m_context; }
private:
Quote() = default;
DeprecatedString m_quote;
DeprecatedString m_author;
ByteString m_quote;
ByteString m_author;
u64 m_utc_time;
DeprecatedString m_url;
Optional<DeprecatedString> m_context;
ByteString m_url;
Optional<ByteString> m_context;
};
static Vector<Quote> parse_all(JsonArray const& array)
@ -131,11 +131,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
if (show_color) {
out("\033[34m({})\033[m", datetime.to_deprecated_string());
out("\033[34m({})\033[m", datetime.to_byte_string());
out(" \033[34;1m<{}>\033[m", chosen_quote.author());
out(" \033[32m{}\033[m", chosen_quote.quote());
} else {
out("({})", datetime.to_deprecated_string());
out("({})", datetime.to_byte_string());
out(" <{}>", chosen_quote.author());
out(" {}", chosen_quote.quote());
}