1 | /* $Id: DnDMIME.cpp 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DnD - Path list class.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2014-2022 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 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 |
|
---|
29 | /*********************************************************************************************************************************
|
---|
30 | * Header Files *
|
---|
31 | *********************************************************************************************************************************/
|
---|
32 | #define LOG_GROUP LOG_GROUP_GUEST_DND
|
---|
33 | #include <VBox/GuestHost/DragAndDrop.h>
|
---|
34 |
|
---|
35 | #include <iprt/string.h>
|
---|
36 |
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Returns whether a given MIME format contains file URLs we can work with or not.
|
---|
40 | *
|
---|
41 | * @returns \c true if the format contains file URLs, \c false if not.
|
---|
42 | * @param pcszFormat MIME format to check.
|
---|
43 | * @param cchFormatMax Maximum characters of MIME format to check.
|
---|
44 | */
|
---|
45 | bool DnDMIMEHasFileURLs(const char *pcszFormat, size_t cchFormatMax)
|
---|
46 | {
|
---|
47 | /** @todo "text/uri" also an official variant? */
|
---|
48 | return ( RTStrNICmp(pcszFormat, "text/uri-list", cchFormatMax) == 0
|
---|
49 | || RTStrNICmp(pcszFormat, "x-special/gnome-icon-list", cchFormatMax) == 0);
|
---|
50 | }
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * Returns whether a given MIME format needs an own "Dropped Files" directory or not.
|
---|
54 | *
|
---|
55 | * @returns \c true if the format needs an own "Dropped Files" directory, \c false if not.
|
---|
56 | * @param pcszFormat MIME format to check.
|
---|
57 | * @param cchFormatMax Maximum characters of MIME format to check.
|
---|
58 | */
|
---|
59 | bool DnDMIMENeedsDropDir(const char *pcszFormat, size_t cchFormatMax)
|
---|
60 | {
|
---|
61 | return DnDMIMEHasFileURLs(pcszFormat, cchFormatMax);
|
---|
62 | }
|
---|
63 |
|
---|