VirtualBox

source: vbox/trunk/include/VBox/GuestHost/clipboard-helper.h@ 33983

Last change on this file since 33983 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property eol-style set to native
  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 3.6 KB
Line 
1/* $Id: clipboard-helper.h 28800 2010-04-27 08:22:32Z vboxsync $ */
2/** @file
3 * Shared Clipboard: Some helper function for converting between the various eol.
4 */
5
6/*
7 * Copyright (C) 2006-2008 Oracle Corporation
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 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef ___CLIPBOARD_HELPER_H
28#define ___CLIPBOARD_HELPER_H
29
30#include <iprt/string.h>
31
32/** Constants needed for string conversions done by the Linux/Mac clipboard code. */
33enum {
34 /** In Linux, lines end with a linefeed character. */
35 LINEFEED = 0xa,
36 /** In Windows, lines end with a carriage return and a linefeed character. */
37 CARRIAGERETURN = 0xd,
38 /** Little endian "real" Utf16 strings start with this marker. */
39 UTF16LEMARKER = 0xfeff,
40 /** Big endian "real" Utf16 strings start with this marker. */
41 UTF16BEMARKER = 0xfffe
42};
43
44/**
45 * Get the size of the buffer needed to hold a Utf16-LE zero terminated string with Windows EOLs
46 * converted from a Utf16 string with Linux EOLs.
47 *
48 * @returns RT error code
49 *
50 * @param pwszSrc The source Utf16 string
51 * @param cwSrc The length in 16 bit words of the source string
52 * @retval pcwDest The length of the destination string in 16 bit words
53 */
54int vboxClipboardUtf16GetWinSize(PRTUTF16 pwszSrc, size_t cwSrc, size_t *pcwDest);
55
56/**
57 * Convert a Utf16 text with Linux EOLs to null-terminated Utf16-LE with Windows EOLs. Does no
58 * checking for validity.
59 *
60 * @returns VBox status code
61 *
62 * @param pwszSrc Source Utf16 text to convert
63 * @param cwSrc Size of the source text in 16 bit words
64 * @retval pu16Dest Buffer to store the converted text to.
65 * @retval pcwDest Size of the buffer for the converted text in 16 bit words
66 */
67int vboxClipboardUtf16LinToWin(PRTUTF16 pwszSrc, size_t cwSrc, PRTUTF16 pu16Dest, size_t cwDest);
68
69/**
70 * Get the size of the buffer needed to hold a zero-terminated Utf16 string with Linux EOLs
71 * converted from a Utf16 string with Windows EOLs.
72 *
73 * @returns RT status code
74 *
75 * @param pwszSrc The source Utf16 string
76 * @param cwSrc The length in 16 bit words of the source string
77 * @retval pcwDest The length of the destination string in 16 bit words
78 */
79int vboxClipboardUtf16GetLinSize(PRTUTF16 pwszSrc, size_t cwSrc, size_t *pcwDest);
80
81/**
82 * Convert Utf16-LE text with Windows EOLs to zero-terminated Utf16 with Linux EOLs. This
83 * function does not verify that the Utf16 is valid.
84 *
85 * @returns VBox status code
86 *
87 * @param pwszSrc Text to convert
88 * @param cwSrc Size of the source text in 16 bit words
89 * @param pu16Dest The buffer to store the converted text to
90 * @param cwDest The size of the buffer for the destination text in 16 bit words
91 */
92int vboxClipboardUtf16WinToLin(PRTUTF16 pwszSrc, size_t cwSrc, PRTUTF16 pu16Dest, size_t cwDest);
93
94#endif
95
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