VirtualBox

source: vbox/trunk/include/VBox/GuestHost/mime-type-converter.h@ 104429

Last change on this file since 104429 was 101674, checked in by vboxsync, 11 months ago

GuestHost: Shared Clipboard and DnD: Add common code for mime-types conversion, bugref:10194.

  • Property eol-style set to native
  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 4.4 KB
Line 
1/* $Id: mime-type-converter.h 101674 2023-10-31 10:30:36Z vboxsync $ */
2/** @file
3 * Mime-type converter for Shared Clipboard and Drag-and-Drop code.
4 */
5
6/*
7 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * The contents of this file may alternatively be used under the terms
26 * of the Common Development and Distribution License Version 1.0
27 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28 * in the VirtualBox distribution, in which case the provisions of the
29 * CDDL are applicable instead of those of the GPL.
30 *
31 * You may elect to license modified versions of this file under the
32 * terms and conditions of either the GPL or the CDDL or both.
33 *
34 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35 */
36
37#ifndef VBOX_INCLUDED_GuestHost_mime_type_converter_h
38#define VBOX_INCLUDED_GuestHost_mime_type_converter_h
39#ifndef RT_WITHOUT_PRAGMA_ONCE
40# pragma once
41#endif
42
43#include <iprt/cdefs.h>
44#include <VBox/GuestHost/clipboard-helper.h>
45
46/**
47 * Mime-type enumeration callback function.
48 *
49 * Primarily used by VBoxMimeConvEnumerateMimeById when it
50 * goes through the list of supported mime-types and passes
51 * each of them one by one to this callback.
52 *
53 * @param pcszMimeType String representation of a mime-type.
54 * @param pvData User data.
55 */
56typedef DECLCALLBACKTYPE(void, FNVBFMTCONVMIMEBYID, (const char *pcszMimeType, void *pvData));
57/** Pointer to a FNVBFMTCONVMIMEBYID. */
58typedef FNVBFMTCONVMIMEBYID *PFNVBFMTCONVMIMEBYID;
59
60/**
61 * Enumerate list of mime-types by ID mask.
62 *
63 * This function goes through the list of supported mime-types and
64 * triggers given callback function for each of them.
65 *
66 * @param uFmtVBox Formats bitmask in VBox representation.
67 * @param pfnCb A callback to trigger.
68 * @param pvData User data.
69 */
70extern RTDECL(void) VBoxMimeConvEnumerateMimeById(const SHCLFORMAT uFmtVBox, PFNVBFMTCONVMIMEBYID pfnCb,
71 void *pvData);
72
73/**
74 * Find first matching mime-type by given VBox formats ID.
75 *
76 * @returns Mime-type as a string or NULL if not found.
77 * @param uFmtVBox Formats bitmask in VBox representation.
78 */
79extern RTDECL(const char *) VBoxMimeConvGetMimeById(const SHCLFORMAT uFmtVBox);
80
81/**
82 * Find VBox format ID by given mime-type.
83 *
84 * @returns Format ID in VBox representation.
85 * @param pcszMimeType Mime-type in string representation.
86 */
87extern RTDECL(SHCLFORMAT) VBoxMimeConvGetIdByMime(const char *pcszMimeType);
88
89/**
90 * Converts data from VBox internal representation into native format.
91 *
92 * @returns IPRT status code.
93 * @param pcszMimeType Mime-type in string representation.
94 * @param pvBufIn Input buffer which contains image data in VBox format.
95 * @param cbBufIn Size of input buffer in bytes.
96 * @param ppvBufOut Newly allocated output buffer which will contain BMP image data (must be freed by caller).
97 * @param pcbBufOut Size of output buffer.
98 */
99extern RTDECL(int) VBoxMimeConvVBoxToNative(const char *pcszMimeType, void *pvBufIn, int cbBufIn,
100 void **ppvBufOut, size_t *pcbBufOut);
101
102/**
103 * Converts data from native format into VBox internal representation.
104 *
105 * @returns IPRT status code.
106 * @param pcszMimeType Mime-type in string representation.
107 * @param pvBufIn Input buffer which contains image data in VBox format.
108 * @param cbBufIn Size of input buffer in bytes.
109 * @param ppvBufOut Newly allocated output buffer which will contain BMP image data (must be freed by caller).
110 * @param pcbBufOut Size of output buffer.
111 */
112extern RTDECL(int) VBoxMimeConvNativeToVBox(const char *pcszMimeType, void *pvBufIn, int cbBufIn,
113 void **ppvBufOut, size_t *pcbBufOut);
114
115#endif /* !VBOX_INCLUDED_GuestHost_mime_type_converter_h */
116
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