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
qpacketprotocol_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
4#ifndef QPACKETPROTOCOL_P_H
5#define QPACKETPROTOCOL_P_H
6
7#include <QtCore/qobject.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
21
22class QIODevice;
23
26{
28 Q_DECLARE_PRIVATE(QPacketProtocol)
29public:
30 explicit QPacketProtocol(QIODevice *dev, QObject *parent = nullptr);
31
32 void send(const QByteArray &data);
35 bool waitForReadyRead(int msecs = 3000);
36
38 void readyRead();
39 void error();
40
41private:
42 void bytesWritten(qint64 bytes);
43 void readyToRead();
44};
45
47
48#endif // QPACKETPROTOCOL_P_H
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore \reentrant
Definition qiodevice.h:34
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
The QPacketProtocol class encapsulates communicating discrete packets across fragmented IO channels,...
void send(const QByteArray &data)
Transmit the packet.
QPacketProtocol(QIODevice *dev, QObject *parent=nullptr)
Construct a QPacketProtocol instance that works on dev with the specified parent.
void readyRead()
Emitted whenever a new packet is received.
bool waitForReadyRead(int msecs=3000)
This function locks until a new packet is available for reading and the \l{QIODevice::}{readyRead()} ...
qint64 packetsAvailable() const
Returns the number of received packets yet to be read.
QByteArray read()
Return the next unread packet, or an empty QByteArray if no packets are available.
Combined button and popup list for selecting options.
GLenum GLsizei GLuint GLint * bytesWritten
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define Q_OBJECT
#define Q_SIGNALS
long long qint64
Definition qtypes.h:60