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
qwindowspipereader_p.h
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// Copyright (C) 2021 Alex Trotsenko <alex1973tr@gmail.com>
3
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
// Qt-Security score:significant reason:default
5
6
#
ifndef
QWINDOWSPIPEREADER_P_H
7
#
define
QWINDOWSPIPEREADER_P_H
8
9
//
10
// W A R N I N G
11
// -------------
12
//
13
// This file is not part of the Qt API. It exists purely as an
14
// implementation detail. This header file may change from version to
15
// version without notice, or even be removed.
16
//
17
// We mean it.
18
//
19
20
#
include
<
qobject
.
h
>
21
#
include
<
qmutex
.
h
>
22
#
include
<
private
/
qringbuffer_p
.
h
>
23
24
#
include
<
qt_windows
.
h
>
25
26
QT_BEGIN_NAMESPACE
27
28
class
Q_CORE_EXPORT
QWindowsPipeReader
:
public
QObject
29
{
30
Q_OBJECT
31
public
:
32
explicit
QWindowsPipeReader(QObject *parent =
nullptr
);
33
~QWindowsPipeReader();
34
35
void
setHandle(HANDLE hPipeReadEnd);
36
void
startAsyncRead();
37
void
stop();
38
void
drainAndStop();
39
void
stopAndClear();
40
41
void
setMaxReadBufferSize(qint64 size);
42
qint64 maxReadBufferSize()
const
{
return
readBufferMaxSize; }
43
44
bool
isPipeClosed()
const
{
return
pipeBroken; }
45
qint64 bytesAvailable()
const
;
46
qint64 read(
char
*data, qint64 maxlen);
47
qint64 readLine(
char
*data, qint64 maxlen);
48
qint64 skip(qint64 maxlen);
49
bool
canReadLine()
const
;
50
DWORD checkPipeState();
51
bool
checkForReadyRead() {
return
consumePendingAndEmit(
false
); }
52
53
bool
isReadOperationActive()
const
;
54
HANDLE syncEvent()
const
{
return
syncHandle; }
55
56
Q_SIGNALS:
57
void
winError(ulong,
const
QString &);
58
void
readyRead();
59
void
pipeClosed();
60
61
protected
:
62
bool
event(QEvent *e) override;
63
64
private
:
65
enum
State { Stopped, Running, Draining };
66
67
void
startAsyncReadHelper(QMutexLocker<QMutex> *locker);
68
void
startAsyncReadLocked();
69
void
cancelAsyncRead(State newState);
70
static
void
CALLBACK waitCallback(PTP_CALLBACK_INSTANCE instance, PVOID context,
71
PTP_WAIT wait, TP_WAIT_RESULT waitResult);
72
bool
readCompleted(DWORD errorCode, DWORD numberOfBytesRead);
73
bool
waitForNotification();
74
bool
consumePendingAndEmit(
bool
allowWinActPosting);
75
bool
consumePending();
76
77
HANDLE handle;
78
HANDLE eventHandle;
79
HANDLE syncHandle;
80
PTP_WAIT waitObject;
81
OVERLAPPED overlapped;
82
qint64 readBufferMaxSize;
83
QRingBuffer readBuffer;
84
qint64 actualReadBufferSize;
85
qint64 pendingReadBytes;
86
mutable
QMutex mutex;
87
DWORD lastError;
88
89
State state;
90
bool
readSequenceStarted;
91
bool
pipeBroken;
92
bool
readyReadPending;
93
bool
winEventActPosted;
94
};
95
96
QT_END_NAMESPACE
97
98
#
endif
// QWINDOWSPIPEREADER_P_H
QWindowsPipeReader
\inmodule QtCore
Definition
qwindowspipereader_p.h:29
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
KillProcessExitCode
QT_BEGIN_NAMESPACE constexpr UINT KillProcessExitCode
Definition
qprocess_win.cpp:32
qtbase
src
corelib
io
qwindowspipereader_p.h
Generated on
for Qt by
1.18.0