2020-01-18 09:38:21 +01:00
|
|
|
/*
|
2020-05-14 22:51:15 +02:00
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
2020-01-18 09:38:21 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
2020-05-14 22:51:15 +02:00
|
|
|
#include <Clipboard/Storage.h>
|
2019-03-08 13:27:19 +01:00
|
|
|
|
2020-05-14 22:51:15 +02:00
|
|
|
namespace Clipboard {
|
2019-03-08 13:27:19 +01:00
|
|
|
|
2020-05-14 22:51:15 +02:00
|
|
|
Storage& Storage::the()
|
|
|
|
{
|
|
|
|
static Storage* s_the;
|
|
|
|
if (!s_the)
|
|
|
|
s_the = new Storage;
|
|
|
|
return *s_the;
|
|
|
|
}
|
2019-03-08 13:27:19 +01:00
|
|
|
|
2020-05-14 22:51:15 +02:00
|
|
|
Storage::Storage()
|
|
|
|
{
|
|
|
|
}
|
2019-09-14 09:19:05 +02:00
|
|
|
|
2020-05-14 22:51:15 +02:00
|
|
|
Storage::~Storage()
|
|
|
|
{
|
|
|
|
}
|
2019-03-08 13:27:19 +01:00
|
|
|
|
2021-01-17 00:14:37 +01:00
|
|
|
void Storage::set_data(Core::AnonymousBuffer data, const String& mime_type, const HashMap<String, String>& metadata)
|
2020-05-14 22:51:15 +02:00
|
|
|
{
|
2021-01-17 00:14:37 +01:00
|
|
|
m_buffer = move(data);
|
|
|
|
m_data_size = data.size();
|
2020-05-14 22:51:15 +02:00
|
|
|
m_mime_type = mime_type;
|
2020-09-05 16:26:22 +02:00
|
|
|
m_metadata = metadata;
|
2019-03-08 13:27:19 +01:00
|
|
|
|
2020-05-14 22:51:15 +02:00
|
|
|
if (on_content_change)
|
|
|
|
on_content_change();
|
|
|
|
}
|
2020-02-06 20:03:37 +01:00
|
|
|
|
|
|
|
}
|