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
qcfsocketnotifier_p.h
Go to the documentation of this file.
1
// Copyright (C) 2016 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
QCFSOCKETNOTIFIER_P_H
6
#
define
QCFSOCKETNOTIFIER_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
/
private
/
qglobal_p
.
h
>
20
#
include
<
QtCore
/
qabstracteventdispatcher
.
h
>
21
#
include
<
QtCore
/
qhash
.
h
>
22
23
#
include
<
CoreFoundation
/
CoreFoundation
.
h
>
24
25
QT_BEGIN_NAMESPACE
26
27
struct
MacSocketInfo {
28
MacSocketInfo() : socket(0), runloop(0), readNotifier(0), writeNotifier(0),
29
readEnabled(
false
), writeEnabled(
false
) {}
30
CFSocketRef socket;
31
CFRunLoopSourceRef runloop;
32
QObject *readNotifier;
33
QObject *writeNotifier;
34
bool
readEnabled;
35
bool
writeEnabled;
36
};
37
typedef
QHash
<
int
,
MacSocketInfo
*>
MacSocketHash
;
38
39
typedef
void
(*
MaybeCancelWaitForMoreEventsFn
)(QAbstractEventDispatcher *hostEventDispacher);
40
41
// The CoreFoundationSocketNotifier class implements socket notifiers support using
42
// CFSocket for event dispatchers running on top of the Core Foundation run loop system.
43
// (currently Mac and iOS)
44
//
45
// The principal functions are registerSocketNotifier() and unregisterSocketNotifier().
46
//
47
// setHostEventDispatcher() should be called at startup.
48
// removeSocketNotifiers() should be called at shutdown.
49
//
50
class
Q_CORE_EXPORT
QCFSocketNotifier
51
{
52
public
:
53
QCFSocketNotifier();
54
~QCFSocketNotifier();
55
void
setHostEventDispatcher(QAbstractEventDispatcher *hostEventDispacher);
56
void
setMaybeCancelWaitForMoreEventsCallback(MaybeCancelWaitForMoreEventsFn callBack);
57
void
registerSocketNotifier(QSocketNotifier *notifier);
58
void
unregisterSocketNotifier(QSocketNotifier *notifier);
59
void
removeSocketNotifiers();
60
61
private
:
62
void
destroyRunLoopObserver();
63
64
static
void
unregisterSocketInfo(MacSocketInfo *socketInfo);
65
static
void
enableSocketNotifiers(CFRunLoopObserverRef ref, CFRunLoopActivity activity,
void
*info);
66
67
MacSocketHash macSockets;
68
QAbstractEventDispatcher *eventDispatcher;
69
MaybeCancelWaitForMoreEventsFn maybeCancelWaitForMoreEvents;
70
CFRunLoopObserverRef enableNotifiersObserver;
71
72
friend
void
qt_mac_socket_callback(CFSocketRef, CFSocketCallBackType, CFDataRef,
const
void
*,
void
*);
73
};
74
75
QT_END_NAMESPACE
76
77
#
endif
QCFSocketNotifier
Definition
qcfsocketnotifier_p.h:51
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qt_mac_add_socket_to_runloop
CFRunLoopSourceRef qt_mac_add_socket_to_runloop(const CFSocketRef socket)
Definition
qcfsocketnotifier.cpp:48
qt_mac_socket_callback
QT_BEGIN_NAMESPACE void qt_mac_socket_callback(CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef, const void *, void *info)
Definition
qcfsocketnotifier.cpp:15
qt_mac_remove_socket_from_runloop
void qt_mac_remove_socket_from_runloop(const CFSocketRef socket, CFRunLoopSourceRef runloop)
Definition
qcfsocketnotifier.cpp:61
MaybeCancelWaitForMoreEventsFn
void(*) MaybeCancelWaitForMoreEventsFn(QAbstractEventDispatcher *hostEventDispacher)
Definition
qcfsocketnotifier_p.h:39
MacSocketHash
QHash< int, MacSocketInfo * > MacSocketHash
Definition
qcfsocketnotifier_p.h:37
qtbase
src
corelib
kernel
qcfsocketnotifier_p.h
Generated on
for Qt by
1.18.0