blob: 7f38c3d1db5e60977ccf7b897c05c5e6be425a86 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#pragma once
#include <AK/Function.h>
#include <AK/SharedBuffer.h>
#include <AK/String.h>
namespace Clipboard {
class Storage {
public:
static Storage& the();
~Storage();
bool has_data() const { return m_shared_buffer; }
const String& mime_type() const { return m_mime_type; }
const u8* data() const
{
if (!has_data())
return nullptr;
return static_cast<const u8*>(m_shared_buffer->data());
}
size_t data_size() const
{
if (has_data())
return m_data_size;
return 0;
}
void set_data(NonnullRefPtr<SharedBuffer>, size_t data_size, const String& mime_type);
Function<void()> on_content_change;
private:
Storage();
String m_mime_type;
RefPtr<SharedBuffer> m_shared_buffer;
size_t m_data_size { 0 };
};
}
|