mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 04:22:28 +00:00
Userland: Store MIME keys as String in Core::MimeData
This commit is contained in:
parent
4f638d3af2
commit
2f35348104
Notes:
sideshowbarker
2024-07-17 22:41:14 +09:00
Author: https://github.com/krkk
Commit: 2f35348104
Pull-request: https://github.com/SerenityOS/serenity/pull/21179
Reviewed-by: https://github.com/AtkinsSJ ✅
13 changed files with 22 additions and 22 deletions
|
@ -21,7 +21,7 @@ public:
|
|||
virtual ~MimeData() = default;
|
||||
|
||||
ByteBuffer data(StringView mime_type) const { return m_data.get(mime_type).value_or({}); }
|
||||
void set_data(DeprecatedString const& mime_type, ByteBuffer&& data) { m_data.set(mime_type, move(data)); }
|
||||
void set_data(String const& mime_type, ByteBuffer&& data) { m_data.set(mime_type, move(data)); }
|
||||
|
||||
bool has_format(StringView mime_type) const { return m_data.contains(mime_type); }
|
||||
Vector<DeprecatedString> formats() const;
|
||||
|
@ -36,16 +36,16 @@ public:
|
|||
Vector<URL> urls() const;
|
||||
ErrorOr<void> set_urls(Vector<URL> const&);
|
||||
|
||||
HashMap<DeprecatedString, ByteBuffer> const& all_data() const { return m_data; }
|
||||
HashMap<String, ByteBuffer> const& all_data() const { return m_data; }
|
||||
|
||||
private:
|
||||
MimeData() = default;
|
||||
explicit MimeData(HashMap<DeprecatedString, ByteBuffer> const& data)
|
||||
explicit MimeData(HashMap<String, ByteBuffer> const& data)
|
||||
: m_data(data.clone().release_value_but_fixme_should_propagate_errors())
|
||||
{
|
||||
}
|
||||
|
||||
HashMap<DeprecatedString, ByteBuffer> m_data;
|
||||
HashMap<String, ByteBuffer> m_data;
|
||||
};
|
||||
|
||||
StringView guess_mime_type_based_on_filename(StringView);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue