diff options
author | Linus Groh <mail@linusgroh.de> | 2022-12-04 18:02:33 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-06 08:54:33 +0100 |
commit | 6e19ab2bbce0b113b628e6f8e9b5c0640053933e (patch) | |
tree | 372d21b2f5dcff112f5d0089559c6af5798680d4 /Userland/Libraries/LibWeb/MimeSniff | |
parent | f74251606d74b504a1379ebb893fdb5529054ea5 (diff) | |
download | serenity-6e19ab2bbce0b113b628e6f8e9b5c0640053933e.zip |
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 :^)
Diffstat (limited to 'Userland/Libraries/LibWeb/MimeSniff')
-rw-r--r-- | Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp | 16 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/MimeSniff/MimeType.h | 24 |
2 files changed, 20 insertions, 20 deletions
diff --git a/Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp b/Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp index 9b60cc440c..4bdb6b0850 100644 --- a/Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp +++ b/Userland/Libraries/LibWeb/MimeSniff/MimeType.cpp @@ -15,7 +15,7 @@ namespace Web::MimeSniff { // https://mimesniff.spec.whatwg.org/#javascript-mime-type-essence-match -bool is_javascript_mime_type_essence_match(String const& string) +bool is_javascript_mime_type_essence_match(DeprecatedString const& string) { // NOTE: The mime type parser automatically lowercases the essence. auto type = MimeType::from_string(string); @@ -37,7 +37,7 @@ static bool contains_only_http_quoted_string_token_code_points(StringView string return true; } -MimeType::MimeType(String type, String subtype) +MimeType::MimeType(DeprecatedString type, DeprecatedString subtype) : m_type(move(type)) , m_subtype(move(subtype)) { @@ -131,7 +131,7 @@ Optional<MimeType> MimeType::from_string(StringView string) break; // 7. Let parameterValue be null. - String parameter_value; + DeprecatedString parameter_value; // 8. If the code point at position within input is U+0022 ("), then: if (lexer.peek() == '"') { @@ -177,15 +177,15 @@ Optional<MimeType> MimeType::from_string(StringView string) } // https://mimesniff.spec.whatwg.org/#mime-type-essence -String MimeType::essence() const +DeprecatedString MimeType::essence() const { // The essence of a MIME type mimeType is mimeType’s type, followed by U+002F (/), followed by mimeType’s subtype. // FIXME: I believe this can easily be cached as I don't think anything directly changes the type and subtype. - return String::formatted("{}/{}", m_type, m_subtype); + return DeprecatedString::formatted("{}/{}", m_type, m_subtype); } // https://mimesniff.spec.whatwg.org/#serialize-a-mime-type -String MimeType::serialized() const +DeprecatedString MimeType::serialized() const { // 1. Let serialization be the concatenation of mimeType’s type, U+002F (/), and mimeType’s subtype. StringBuilder serialization; @@ -212,7 +212,7 @@ String MimeType::serialized() const // 2. Prepend U+0022 (") to value. // 3. Append U+0022 (") to value. - value = String::formatted("\"{}\"", value); + value = DeprecatedString::formatted("\"{}\"", value); } // 5. Append value to serialization. @@ -223,7 +223,7 @@ String MimeType::serialized() const return serialization.to_string(); } -void MimeType::set_parameter(String const& name, String const& value) +void MimeType::set_parameter(DeprecatedString const& name, DeprecatedString const& value) { // https://mimesniff.spec.whatwg.org/#parameters // A MIME type’s parameters is an ordered map whose keys are ASCII strings and values are strings limited to HTTP quoted-string token code points. diff --git a/Userland/Libraries/LibWeb/MimeSniff/MimeType.h b/Userland/Libraries/LibWeb/MimeSniff/MimeType.h index be48ccfea9..9163c4e2a5 100644 --- a/Userland/Libraries/LibWeb/MimeSniff/MimeType.h +++ b/Userland/Libraries/LibWeb/MimeSniff/MimeType.h @@ -7,44 +7,44 @@ #pragma once +#include <AK/DeprecatedString.h> #include <AK/HashMap.h> -#include <AK/String.h> namespace Web::MimeSniff { -bool is_javascript_mime_type_essence_match(String const&); +bool is_javascript_mime_type_essence_match(DeprecatedString const&); // https://mimesniff.spec.whatwg.org/#mime-type class MimeType { public: static Optional<MimeType> from_string(StringView); - MimeType(String type, String subtype); + MimeType(DeprecatedString type, DeprecatedString subtype); ~MimeType(); - String const& type() const { return m_type; } - String const& subtype() const { return m_subtype; } - OrderedHashMap<String, String> const& parameters() const { return m_parameters; } + DeprecatedString const& type() const { return m_type; } + DeprecatedString const& subtype() const { return m_subtype; } + OrderedHashMap<DeprecatedString, DeprecatedString> const& parameters() const { return m_parameters; } bool is_javascript() const; - void set_parameter(String const& name, String const& value); + void set_parameter(DeprecatedString const& name, DeprecatedString const& value); - String essence() const; - String serialized() const; + DeprecatedString essence() const; + DeprecatedString serialized() const; private: // https://mimesniff.spec.whatwg.org/#type // A MIME type’s type is a non-empty ASCII string. - String m_type; + DeprecatedString m_type; // https://mimesniff.spec.whatwg.org/#subtype // A MIME type’s subtype is a non-empty ASCII string. - String m_subtype; + DeprecatedString m_subtype; // https://mimesniff.spec.whatwg.org/#parameters // A MIME type’s parameters is an ordered map whose keys are ASCII strings and values are strings limited to HTTP quoted-string token code points. It is initially empty. - OrderedHashMap<String, String> m_parameters; + OrderedHashMap<DeprecatedString, DeprecatedString> m_parameters; }; } |