Mana
Loading...
Searching...
No Matches
src
utils
copynpaste.cpp
Go to the documentation of this file.
1
/*
2
* Clipboard Interaction.
3
* Copyright (C) 2010-2024 The Mana Developers
4
*
5
* This file is part of The Mana Client.
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*/
20
21
#include "
utils/copynpaste.h
"
22
23
#include <SDL.h>
24
25
bool
insertFromClipboard
(std::string &text, std::string::size_type &pos)
26
{
27
char
*buf = SDL_GetClipboardText();
28
const
size_t
len = strlen(buf);
29
if
(len > 0) {
30
text.insert(pos, buf);
31
pos += len;
32
}
33
SDL_free(buf);
34
return
len > 0;
35
}
insertFromClipboard
bool insertFromClipboard(std::string &text, std::string::size_type &pos)
Attempts to retrieve text from the clipboard buffer and inserts it in text at position \pos.
Definition
copynpaste.cpp:25
copynpaste.h
Generated by
1.9.8