Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
quniquehandle_types.cpp
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
<
QtCore
/
private
/
quniquehandle_types_p
.
h
>
6
7
#
include
"qplatformdefs.h"
// For QT_CLOSE
8
9
#
ifdef
Q_OS_WIN
10
#
include
<
QtCore
/
qt_windows
.
h
>
11
#
endif
12
13
#
ifdef
Q_OS_UNIX
14
#
include
<
QtCore
/
private
/
qcore_unix_p
.
h
>
// for qt_safe_close
15
#
endif
16
17
QT_BEGIN_NAMESPACE
18
19
namespace
QtUniqueHandleTraits
{
20
21
#
ifdef
Q_OS_WIN
22
23
bool
InvalidHandleTraits
::
close
(
Type
handle
)
noexcept
24
{
25
return
::
CloseHandle
(
handle
);
26
}
27
28
bool
NullHandleTraits
::
close
(
Type
handle
)
noexcept
29
{
30
return
::
CloseHandle
(
handle
);
31
}
32
33
#
endif
34
35
bool
FileDescriptorHandleTraits
::
close
(
Type
handle
)
36
{
37
// not noexcept because close() is a POSIX cancellation point
38
return
QT_CLOSE
(
handle
) == 0;
39
}
40
41
bool
FILEHandleTraits
::
close
(
Type
handle
)
42
{
43
// not noexcept because fclose() is a POSIX cancellation point
44
return
::
fclose
(
handle
);
45
}
46
47
}
// namespace QtUniqueHandleTraits
48
49
#
ifdef
Q_OS_UNIX
50
51
using
QUniqueFileDescriptorHandle = QUniqueHandle<QtUniqueHandleTraits::FileDescriptorHandleTraits>;
52
53
#
endif
54
55
QT_END_NAMESPACE
QtUniqueHandleTraits
Definition
quniquehandle_types_windows.cpp:8
qtbase
src
corelib
tools
quniquehandle_types.cpp
Generated on
for Qt by
1.16.1