diff options
author | Kai Koehne <[email protected]> | 2011-08-05 10:18:32 +0200 |
---|---|---|
committer | Kai Koehne <[email protected]> | 2011-08-05 12:17:16 +0200 |
commit | bb41109b0e3602542d504c334e63f158488fd758 (patch) | |
tree | 4e99a9f429c9d4763a98ee73a791c949d7259cbb /src/libs/qmljsdebugclient/qpacketprotocol.h | |
parent | ca7d5942a2fdec9ea96f151589da3ffc863fc9d1 (diff) |
QmlJSDebugClient: Fix style & indentation
Change-Id: I87bdb465816fc68f83f6c5e097c9d9b853614b94
Reviewed-on: http://codereview.qt.nokia.com/2672
Reviewed-by: Christiaan Janssen <[email protected]>
Diffstat (limited to 'src/libs/qmljsdebugclient/qpacketprotocol.h')
-rw-r--r-- | src/libs/qmljsdebugclient/qpacketprotocol.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/src/libs/qmljsdebugclient/qpacketprotocol.h b/src/libs/qmljsdebugclient/qpacketprotocol.h new file mode 100644 index 00000000000..05bc28f8003 --- /dev/null +++ b/src/libs/qmljsdebugclient/qpacketprotocol.h @@ -0,0 +1,111 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation ([email protected]) +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at [email protected]. +** +**************************************************************************/ + +#ifndef QPACKETPROTOCOL_H +#define QPACKETPROTOCOL_H + +#include <QtCore/qobject.h> +#include <QtCore/qdatastream.h> + +QT_BEGIN_NAMESPACE +class QIODevice; +class QBuffer; +QT_END_NAMESPACE + +namespace QmlJsDebugClient { + +class QPacket; +class QPacketAutoSend; + +class QPacketProtocolPrivate; + +class QPacketProtocol : public QObject +{ + Q_OBJECT + +public: + explicit QPacketProtocol(QIODevice *dev, QObject *parent = 0); + virtual ~QPacketProtocol(); + + qint32 maximumPacketSize() const; + qint32 setMaximumPacketSize(qint32); + + QPacketAutoSend send(); + void send(const QPacket &); + + qint64 packetsAvailable() const; + QPacket read(); + + void clear(); + + QIODevice *device(); + +Q_SIGNALS: + void readyRead(); + void invalidPacket(); + void packetWritten(); + +private: + QPacketProtocolPrivate *d; +}; + + +class QPacket : public QDataStream +{ +public: + QPacket(); + QPacket(const QPacket &); + virtual ~QPacket(); + + void clear(); + bool isEmpty() const; + +protected: + friend class QPacketProtocol; + QPacket(const QByteArray &ba); + QByteArray b; + QBuffer *buf; +}; + +class QPacketAutoSend : public QPacket +{ +public: + virtual ~QPacketAutoSend(); + +private: + friend class QPacketProtocol; + QPacketAutoSend(QPacketProtocol *); + QPacketProtocol *p; +}; + +} // QmlJsDebugClient + +#endif |