1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:18:12 +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,8 +27,10 @@
#pragma once
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/String.h>
#include <LibGUI/Forward.h>
#include <LibGfx/Forward.h>
namespace GUI {
@ -38,16 +40,19 @@ public:
ByteBuffer data() const { return data_and_type().data; }
String mime_type() const { return data_and_type().mime_type; }
void set_data(ReadonlyBytes, const String& mime_type = "text/plain");
void set_data(ReadonlyBytes, const String& mime_type = "text/plain", const HashMap<String, String>& metadata = {});
void set_plain_text(const String& text)
{
set_data(text.bytes());
}
void set_bitmap(const Gfx::Bitmap&);
struct DataAndType {
ByteBuffer data;
String mime_type;
HashMap<String, String> metadata;
};
DataAndType data_and_type() const;