blob: 6f5c1a62f219035d09dfe77099f2853531b3aa50 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include "qmldebug_global.h"
#include <qobject.h>
#include <qdatastream.h>
#include <qbuffer.h>
QT_BEGIN_NAMESPACE
class QIODevice;
QT_END_NAMESPACE
namespace QmlDebug {
class QPacketProtocolPrivate;
class QMLDEBUG_EXPORT QPacketProtocol : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QPacketProtocol)
public:
explicit QPacketProtocol(QIODevice *dev, QObject *parent = nullptr);
void send(const QByteArray &data);
qint64 packetsAvailable() const;
QByteArray read();
bool waitForReadyRead(int msecs = 3000);
signals:
void readyRead();
void protocolError();
private:
QPacketProtocolPrivate *d;
};
class QMLDEBUG_EXPORT QPacket : public QDataStream
{
public:
QPacket(int version);
explicit QPacket(int version, const QByteArray &ba);
QByteArray data() const;
private:
QBuffer buf;
};
} // QmlDebug
|