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

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

synergy v1.3.1 sources (zip).

File size: 1.3 KB
Line 
1/*
2 * synergy -- mouse and keyboard sharing utility
3 * Copyright (C) 2002 Chris Schoeneman
4 *
5 * This package is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * found in the file COPYING that should have accompanied this file.
8 *
9 * This package is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include "CMSWindowsClipboardTextConverter.h"
16#include "CUnicode.h"
17
18//
19// CMSWindowsClipboardTextConverter
20//
21
22CMSWindowsClipboardTextConverter::CMSWindowsClipboardTextConverter()
23{
24 // do nothing
25}
26
27CMSWindowsClipboardTextConverter::~CMSWindowsClipboardTextConverter()
28{
29 // do nothing
30}
31
32UINT
33CMSWindowsClipboardTextConverter::getWin32Format() const
34{
35 return CF_TEXT;
36}
37
38CString
39CMSWindowsClipboardTextConverter::doFromIClipboard(const CString& data) const
40{
41 // convert and add nul terminator
42 return CUnicode::UTF8ToText(data) += '\0';
43}
44
45CString
46CMSWindowsClipboardTextConverter::doToIClipboard(const CString& data) const
47{
48 // convert and truncate at first nul terminator
49 CString dst = CUnicode::textToUTF8(data);
50 CString::size_type n = dst.find('\0');
51 if (n != CString::npos) {
52 dst.erase(n);
53 }
54 return dst;
55}
Note: See TracBrowser for help on using the repository browser.