source: trunk/synergy/lib/platform/CPMClipboardTextConverter.cpp

Last change on this file was 2752, checked in by bird, 19 years ago

Two classes (CPMScreen and CPMKeyState) + the hook dll left (and debugging of course).

File size: 1.3 KB
Line 
1/*
2 * synergy -- mouse and keyboard sharing utility
3 * Copyright (C) 2002 Chris Schoeneman
4 * Copyright (C) 2006 Knut St. Osmundsen
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 COPYING 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
16#include "CPMClipboardTextConverter.h"
17#include "CUnicode.h"
18
19//
20// CPMClipboardTextConverter
21//
22
23CPMClipboardTextConverter::CPMClipboardTextConverter()
24{
25 // do nothing
26}
27
28CPMClipboardTextConverter::~CPMClipboardTextConverter()
29{
30 // do nothing
31}
32
33ULONG
34CPMClipboardTextConverter::getPMFormat() const
35{
36 return CF_TEXT;
37}
38
39CString
40CPMClipboardTextConverter::doFromIClipboard(const CString& data) const
41{
42 // convert and add nul terminator
43 return CUnicode::UTF8ToText(data) += '\0';
44}
45
46CString
47CPMClipboardTextConverter::doToIClipboard(const CString& data) const
48{
49 // convert and truncate at first nul terminator
50 CString dst = CUnicode::textToUTF8(data);
51 CString::size_type n = dst.find('\0');
52 if (n != CString::npos) {
53 dst.erase(n);
54 }
55 return dst;
56}
Note: See TracBrowser for help on using the repository browser.