mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:07:34 +00:00
Userland: Take StringView in MimeData::data() and has_{format,text,urls}
This commit is contained in:
parent
d054116012
commit
4f638d3af2
4 changed files with 9 additions and 9 deletions
|
@ -20,19 +20,19 @@ class MimeData : public EventReceiver {
|
|||
public:
|
||||
virtual ~MimeData() = default;
|
||||
|
||||
ByteBuffer data(DeprecatedString const& mime_type) const { return m_data.get(mime_type).value_or({}); }
|
||||
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)); }
|
||||
|
||||
bool has_format(DeprecatedString const& mime_type) const { return m_data.contains(mime_type); }
|
||||
bool has_format(StringView mime_type) const { return m_data.contains(mime_type); }
|
||||
Vector<DeprecatedString> formats() const;
|
||||
|
||||
// Convenience helpers for "text/plain"
|
||||
bool has_text() const { return has_format("text/plain"); }
|
||||
bool has_text() const { return has_format("text/plain"sv); }
|
||||
DeprecatedString text() const;
|
||||
void set_text(DeprecatedString const&);
|
||||
|
||||
// Convenience helpers for "text/uri-list"
|
||||
bool has_urls() const { return has_format("text/uri-list"); }
|
||||
bool has_urls() const { return has_format("text/uri-list"sv); }
|
||||
Vector<URL> urls() const;
|
||||
ErrorOr<void> set_urls(Vector<URL> const&);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue