1 /*
2  * barrier -- mouse and keyboard sharing utility
3  * Copyright (C) 2012-2016 Symless Ltd.
4  * Copyright (C) 2004 Chris Schoeneman
5  *
6  * This package is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * found in the file LICENSE that should have accompanied this file.
9  *
10  * This package is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #include "platform/XWindowsClipboardHTMLConverter.h"
20 
21 #include "base/Unicode.h"
22 
23 //
24 // XWindowsClipboardHTMLConverter
25 //
26 
XWindowsClipboardHTMLConverter(Display * display,const char * name)27 XWindowsClipboardHTMLConverter::XWindowsClipboardHTMLConverter(
28                 Display* display, const char* name) :
29     m_atom(XInternAtom(display, name, False))
30 {
31     // do nothing
32 }
33 
~XWindowsClipboardHTMLConverter()34 XWindowsClipboardHTMLConverter::~XWindowsClipboardHTMLConverter()
35 {
36     // do nothing
37 }
38 
39 IClipboard::EFormat
getFormat() const40 XWindowsClipboardHTMLConverter::getFormat() const
41 {
42     return IClipboard::kHTML;
43 }
44 
45 Atom
getAtom() const46 XWindowsClipboardHTMLConverter::getAtom() const
47 {
48     return m_atom;
49 }
50 
51 int
getDataSize() const52 XWindowsClipboardHTMLConverter::getDataSize() const
53 {
54     return 8;
55 }
56 
fromIClipboard(const std::string & data) const57 std::string XWindowsClipboardHTMLConverter::fromIClipboard(const std::string& data) const
58 {
59     return Unicode::UTF8ToUTF16(data);
60 }
61 
toIClipboard(const std::string & data) const62 std::string XWindowsClipboardHTMLConverter::toIClipboard(const std::string& data) const
63 {
64     return Unicode::UTF16ToUTF8(data);
65 }
66