Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
quniquehandle_types_p.h
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
#
ifndef
QUNIQUEHANDLE_TYPES_P_H
6
#
define
QUNIQUEHANDLE_TYPES_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
<
QtCore
/
qnamespace
.
h
>
20
#
include
<
QtCore
/
private
/
quniquehandle_p
.
h
>
21
22
#
include
<
cstdio
>
23
24
QT_BEGIN_NAMESPACE
25
26
namespace
QtUniqueHandleTraits
{
27
28
#
ifdef
Q_OS_WIN
29
30
struct
InvalidHandleTraits
31
{
32
using
Type
=
Qt
::
HANDLE
;
33
static
Type
invalidValue
()
noexcept
34
{
35
return
Qt
::
HANDLE
(-1);
// AKA INVALID_HANDLE_VALUE
36
}
37
Q_CORE_EXPORT
static
bool
close
(
Type
handle
)
noexcept
;
38
};
39
40
struct
NullHandleTraits
41
{
42
using
Type
=
Qt
::
HANDLE
;
43
static
Type
invalidValue
()
noexcept
{
return
nullptr
; }
44
Q_CORE_EXPORT
static
bool
close
(
Type
handle
)
noexcept
;
45
};
46
47
#
endif
48
49
struct
FileDescriptorHandleTraits
50
{
51
using
Type
=
int
;
52
static
constexpr
Type
invalidValue
()
noexcept
{
return
-1; }
53
Q_CORE_EXPORT
static
bool
close
(
Type
handle);
54
};
55
56
struct
FILEHandleTraits
57
{
58
using
Type
= FILE *;
59
static
constexpr
Type
invalidValue
()
noexcept
{
return
nullptr
; }
60
Q_CORE_EXPORT
static
bool
close
(
Type
handle);
61
};
62
63
}
// namespace QtUniqueHandleTraits
64
65
#
ifdef
Q_OS_WIN
66
67
using
QUniqueWin32Handle = QUniqueHandle<QtUniqueHandleTraits::InvalidHandleTraits>;
68
using
QUniqueWin32NullHandle = QUniqueHandle<QtUniqueHandleTraits::NullHandleTraits>;
69
70
#
endif
71
72
using
QUniqueFileDescriptorHandle = QUniqueHandle<QtUniqueHandleTraits::FileDescriptorHandleTraits>;
73
using
QUniqueFILEHandle = QUniqueHandle<QtUniqueHandleTraits::FILEHandleTraits>;
74
75
QT_END_NAMESPACE
76
77
#
endif
QtUniqueHandleTraits
Definition
quniquehandle_types_windows.cpp:9
QtUniqueHandleTraits::FILEHandleTraits
Definition
quniquehandle_types_p.h:57
QtUniqueHandleTraits::FILEHandleTraits::close
static Q_CORE_EXPORT bool close(Type handle)
Definition
quniquehandle_types.cpp:41
QtUniqueHandleTraits::FILEHandleTraits::invalidValue
static constexpr Type invalidValue() noexcept
Definition
quniquehandle_types_p.h:59
QtUniqueHandleTraits::FILEHandleTraits::Type
FILE * Type
Definition
quniquehandle_types_p.h:58
QtUniqueHandleTraits::FileDescriptorHandleTraits
Definition
quniquehandle_types_p.h:50
QtUniqueHandleTraits::FileDescriptorHandleTraits::close
static Q_CORE_EXPORT bool close(Type handle)
Definition
quniquehandle_types.cpp:35
QtUniqueHandleTraits::FileDescriptorHandleTraits::invalidValue
static constexpr Type invalidValue() noexcept
Definition
quniquehandle_types_p.h:52
QtUniqueHandleTraits::FileDescriptorHandleTraits::Type
int Type
Definition
quniquehandle_types_p.h:51
qtbase
src
corelib
tools
quniquehandle_types_p.h
Generated on
for Qt by
1.18.0