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
20QT_BEGIN_NAMESPACE
21
22class QIODevice;
23
24class QPacketProtocolPrivate;
25class QPacketProtocol : public QObject
26{
27 Q_OBJECT
28 Q_DECLARE_PRIVATE(QPacketProtocol)
29public:
30 explicit QPacketProtocol(QIODevice *dev, QObject *parent = nullptr);
31
32 void send(const QByteArray &data);
33 qint64 packetsAvailable() const;
34 QByteArray read();
35 bool waitForReadyRead(int msecs = 3000);
36
37Q_SIGNALS:
38 void readyRead();
39 void error();
40
41private:
42 void bytesWritten(qint64 bytes);
43 void readyToRead();
44};
45
46QT_END_NAMESPACE
47
48#endif // QPACKETPROTOCOL_P_H
49

source code of qtdeclarative/src/plugins/qmltooling/packetprotocol/qpacketprotocol_p.h