1// Copyright (C) 2017-2015 Ford Motor Company
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 QCONNECTIONFACTORIES_P_H
5#define QCONNECTIONFACTORIES_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qdatastream.h>
19#include <QtCore/qiodevice.h>
20#include <QtCore/qpointer.h>
21#include <QtCore/private/qobject_p.h>
22
23#include <QtRemoteObjects/qtremoteobjectglobal.h>
24#include <QtRemoteObjects/qconnectionfactories.h>
25#include "qremoteobjectpacket_p.h"
26
27#include <memory>
28
29QT_BEGIN_NAMESPACE
30
31namespace QtRemoteObjects {
32
33static const int dataStreamVersion = QDataStream::Qt_6_2;
34static const QLatin1String protocolVersion("QtRO 2.0");
35
36}
37
38class QtROExternalIoDevice : public QtROIoDeviceBase
39{
40 Q_OBJECT
41
42public:
43 explicit QtROExternalIoDevice(QIODevice *device, QObject *parent=nullptr);
44 QIODevice *connection() const override;
45 bool isOpen() const override;
46
47protected:
48 void doClose() override;
49 QString deviceType() const override;
50private:
51 Q_DECLARE_PRIVATE(QtROExternalIoDevice)
52};
53
54class QtROIoDeviceBasePrivate : public QObjectPrivate
55{
56public:
57 QtROIoDeviceBasePrivate();
58
59 // TODO Remove stream()
60 QDataStream &stream() { return m_dataStream; }
61
62 bool m_isClosing = false;
63 quint32 m_curReadSize = 0;
64 QDataStream m_dataStream;
65 QSet<QString> m_remoteObjects;
66 std::unique_ptr<QRemoteObjectPackets::CodecBase> m_codec { nullptr };
67 Q_DECLARE_PUBLIC(QtROIoDeviceBase)
68};
69
70class QtROClientIoDevicePrivate : public QtROIoDeviceBasePrivate
71{
72public:
73 QtROClientIoDevicePrivate() : QtROIoDeviceBasePrivate() { }
74 QUrl m_url;
75 Q_DECLARE_PUBLIC(QtROClientIoDevice)
76};
77
78class QtROExternalIoDevicePrivate : public QtROIoDeviceBasePrivate
79{
80public:
81 QtROExternalIoDevicePrivate(QIODevice *device) : QtROIoDeviceBasePrivate(), m_device(device) { }
82 QPointer<QIODevice> m_device;
83 Q_DECLARE_PUBLIC(QtROExternalIoDevice)
84};
85
86QT_END_NAMESPACE
87
88#endif
89

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of qtremoteobjects/src/remoteobjects/qconnectionfactories_p.h