LibWeb/MimeSniff: Add move/copy construct and assignment to MimeType

This change exists to avoid having to reparse a MIME type when we
need to move/copy elsewhere.
This commit is contained in:
Kemal Zebari 2023-11-14 09:58:24 -08:00 committed by Andrew Kaster
parent 96d44b1572
commit a2a61d6941
Notes: sideshowbarker 2024-07-17 21:11:12 +09:00
2 changed files with 12 additions and 0 deletions

View file

@ -64,6 +64,12 @@ MimeType::MimeType(String type, String subtype)
VERIFY(!m_subtype.is_empty() && contains_only_http_token_code_points(m_subtype));
}
MimeType::MimeType(MimeType const& other) = default;
MimeType& MimeType::operator=(MimeType const& other) = default;
MimeType::MimeType(MimeType&& other) = default;
MimeType& MimeType::operator=(MimeType&& other) = default;
MimeType::~MimeType() = default;
ErrorOr<MimeType> MimeType::create(String type, String subtype)

View file

@ -20,6 +20,12 @@ public:
static ErrorOr<MimeType> create(String type, String subtype);
static ErrorOr<Optional<MimeType>> parse(StringView);
MimeType(MimeType const&);
MimeType& operator=(MimeType const&);
MimeType(MimeType&&);
MimeType& operator=(MimeType&&);
~MimeType();
String const& type() const { return m_type; }