Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindowspipewriter_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
5#ifndef QWINDOWSPIPEWRITER_P_H
6#define QWINDOWSPIPEWRITER_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 <qobject.h>
20#include <qmutex.h>
21#include <private/qringbuffer_p.h>
22
23#include <qt_windows.h>
24
26
27class Q_CORE_EXPORT QWindowsPipeWriter : public QObject
28{
30public:
31 explicit QWindowsPipeWriter(HANDLE pipeWriteEnd, QObject *parent = nullptr);
33
34 void setHandle(HANDLE hPipeWriteEnd);
35 void write(const QByteArray &ba);
36 void write(const char *data, qint64 size);
37 void stop();
38 bool checkForWrite() { return consumePendingAndEmit(false); }
39 qint64 bytesToWrite() const;
40 bool isWriteOperationActive() const;
41 HANDLE syncEvent() const { return syncHandle; }
42
44 void bytesWritten(qint64 bytes);
46
47protected:
48 bool event(QEvent *e) override;
49
50private:
51 enum CompletionState { NoError, ErrorDetected, WriteDisabled };
52
53 template <typename... Args>
54 inline void writeImpl(Args... args);
55
56 void startAsyncWriteHelper(QMutexLocker<QMutex> *locker);
57 void startAsyncWriteLocked();
58 static void CALLBACK waitCallback(PTP_CALLBACK_INSTANCE instance, PVOID context,
59 PTP_WAIT wait, TP_WAIT_RESULT waitResult);
60 bool writeCompleted(DWORD errorCode, DWORD numberOfBytesWritten);
61 void notifyCompleted(QMutexLocker<QMutex> *locker);
62 bool consumePendingAndEmit(bool allowWinActPosting);
63
64 HANDLE handle;
65 HANDLE eventHandle;
66 HANDLE syncHandle;
67 PTP_WAIT waitObject;
68 OVERLAPPED overlapped;
70 qint64 pendingBytesWrittenValue;
71 mutable QMutex mutex;
72 DWORD lastError;
73
75 bool stopped;
76 bool writeSequenceStarted;
77 bool bytesWrittenPending;
78 bool winEventActPosted;
79};
80
82
83#endif // QWINDOWSPIPEWRITER_P_H
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
Definition qcoreevent.h:45
\inmodule QtCore
Definition qmutex.h:281
\inmodule QtCore
Definition qobject.h:103
void bytesWritten(qint64 bytes)
Combined button and popup list for selecting options.
static void * context
GLuint64 GLenum void * handle
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
struct _cl_event * event
GLuint writeBuffer
@ NoError
Definition main.cpp:34
#define Q_OBJECT
#define Q_SIGNALS
long long qint64
Definition qtypes.h:60
static CompletionState completionState(StatementList *list)
CompletionState
QByteArray ba
[0]
gzip write("uncompressed data")
QMutex mutex
[2]
QJSValueList args