VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedClipboard/clipboard-helper.h@ 8083

Last change on this file since 8083 was 7117, checked in by vboxsync, 17 years ago

r=bird: subversion attributes. some hungarian fixes. do not pass stuff by reference unless its normal C++ code and very convenient (because it makes it totally unreadable otherwise). A couple of questions. (hope it still compiles)

  • Property eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 3.1 KB
Line 
1/* $Id: clipboard-helper.h 7117 2008-02-25 15:54:42Z vboxsync $ */
2/** @file
3 * Shared Clipboard: Some helper function for converting between the various eol.
4 */
5
6/*
7 * Copyright (C) 2006-2008 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___CLIPBOARD_HELPER_H
19#define ___CLIPBOARD_HELPER_H
20
21#include <iprt/string.h>
22
23/** Constants needed for string conversions done by the Linux/Mac clipboard code. */
24enum {
25 /** In Linux, lines end with a linefeed character. */
26 LINEFEED = 0xa,
27 /** In Windows, lines end with a carriage return and a linefeed character. */
28 CARRIAGERETURN = 0xd,
29 /** Little endian "real" Utf16 strings start with this marker. */
30 UTF16LEMARKER = 0xfeff,
31 /** Big endian "real" Utf16 strings start with this marker. */
32 UTF16BEMARKER = 0xfffe
33};
34
35/**
36 * Get the size of the buffer needed to hold a Utf16-LE zero terminated string with Windows EOLs
37 * converted from a Utf16 string with Linux EOLs.
38 *
39 * @returns RT error code
40 *
41 * @param pwszSrc The source Utf16 string
42 * @param cwSrc The length in 16 bit words of the source string
43 * @retval pcwDest The length of the destination string in 16 bit words
44 */
45int vboxClipboardUtf16GetWinSize(PRTUTF16 pwszSrc, size_t cwSrc, size_t *pcwDest);
46
47/**
48 * Convert a Utf16 text with Linux EOLs to null-terminated Utf16-LE with Windows EOLs. Does no
49 * checking for validity.
50 *
51 * @returns VBox status code
52 *
53 * @param pwszSrc Source Utf16 text to convert
54 * @param cwSrc Size of the source text in 16 bit words
55 * @retval pu16Dest Buffer to store the converted text to.
56 * @retval pcwDest Size of the buffer for the converted text in 16 bit words
57 */
58int vboxClipboardUtf16LinToWin(PRTUTF16 pwszSrc, size_t cwSrc, PRTUTF16 pu16Dest, size_t cwDest);
59
60/**
61 * Get the size of the buffer needed to hold a zero-terminated Utf16 string with Linux EOLs
62 * converted from a Utf16 string with Windows EOLs.
63 *
64 * @returns RT status code
65 *
66 * @param pwszSrc The source Utf16 string
67 * @param cwSrc The length in 16 bit words of the source string
68 * @retval pcwDest The length of the destination string in 16 bit words
69 */
70int vboxClipboardUtf16GetLinSize(PRTUTF16 pwszSrc, size_t cwSrc, size_t *pcwDest);
71
72/**
73 * Convert Utf16-LE text with Windows EOLs to zero-terminated Utf16 with Linux EOLs. This
74 * function does not verify that the Utf16 is valid.
75 *
76 * @returns VBox status code
77 *
78 * @param pwszSrc Text to convert
79 * @param cwSrc Size of the source text in 16 bit words
80 * @param pu16Dest The buffer to store the converted text to
81 * @param cwDest The size of the buffer for the destination text in 16 bit words
82 */
83int vboxClipboardUtf16WinToLin(PRTUTF16 pwszSrc, size_t cwSrc, PRTUTF16 pu16Dest, size_t cwDest);
84
85#endif
86
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette