The Battle for Wesnoth
1.21.0-dev
Loading...
Searching...
No Matches
desktop
clipboard.cpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2003 - 2025
3
by David White <dave@whitevine.net>
4
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY.
12
13
See the COPYING file for more details.
14
*/
15
16
#include "
desktop/clipboard.hpp
"
17
18
#include <SDL3/SDL_clipboard.h>
19
20
namespace
desktop
{
21
22
namespace
clipboard {
23
24
void
copy_to_clipboard
(
const
std::string& text)
25
{
26
SDL_SetClipboardText(text.c_str());
27
}
28
29
std::string
copy_from_clipboard
()
30
{
31
char
* clipboard = SDL_GetClipboardText();
32
if
(!clipboard) {
33
return
std::string();
34
}
35
36
const
std::string result(clipboard);
37
SDL_free(clipboard);
38
return
result;
39
}
40
41
}
// end namespace clipboard
42
43
}
// end namespace desktop
clipboard.hpp
desktop::clipboard::copy_to_clipboard
void copy_to_clipboard(const std::string &text)
Copies text to the clipboard.
Definition
clipboard.cpp:24
desktop::clipboard::copy_from_clipboard
std::string copy_from_clipboard()
Copies text from the clipboard.
Definition
clipboard.cpp:29
desktop
Definition
apple_battery_info.hpp:20
Generated by
1.9.8