1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 18:17:44 +00:00

Clipboard: Add a key-value map alongside the clipboard storage

A clipping now consists of three things:

- The raw clip data
- A MIME type
- A key-value map (String, String) for anything you like
This commit is contained in:
Andreas Kling 2020-09-05 16:26:22 +02:00
parent 51146e3075
commit 2e6d59b7b2
7 changed files with 34 additions and 11 deletions

View file

@ -27,6 +27,7 @@
#pragma once
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/SharedBuffer.h>
#include <AK/String.h>
@ -40,6 +41,7 @@ public:
bool has_data() const { return m_shared_buffer; }
const String& mime_type() const { return m_mime_type; }
const HashMap<String, String>& metadata() const { return m_metadata; }
const u8* data() const
{
@ -55,7 +57,7 @@ public:
return 0;
}
void set_data(NonnullRefPtr<SharedBuffer>, size_t data_size, const String& mime_type);
void set_data(NonnullRefPtr<SharedBuffer>, size_t data_size, const String& mime_type, const HashMap<String, String>& metadata);
Function<void()> on_content_change;
@ -65,6 +67,7 @@ private:
String m_mime_type;
RefPtr<SharedBuffer> m_shared_buffer;
size_t m_data_size { 0 };
HashMap<String, String> m_metadata;
};
}