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
27QT_BEGIN_NAMESPACE
28
29namespace QtRemoteObjects {
30
31static const int dataStreamVersion = QDataStream::Qt_6_2;
32static const QLatin1String protocolVersion("QtRO 2.0");
33
34}
35
36class QtROExternalIoDevice : public QtROIoDeviceBase
37{
38 Q_OBJECT
39
40public:
41 explicit QtROExternalIoDevice(QIODevice *device, QObject *parent=nullptr);
42 QIODevice *connection() const override;
43 bool isOpen() const override;
44
45protected:
46 void doClose() override;
47 QString deviceType() const override;
48private:
49 Q_DECLARE_PRIVATE(QtROExternalIoDevice)
50};
51
52class QtROIoDeviceBasePrivate : public QObjectPrivate
53{
54public:
55 QtROIoDeviceBasePrivate();
56
57 // TODO Remove stream()
58 QDataStream &stream() { return m_dataStream; }
59
60 bool m_isClosing = false;
61 quint32 m_curReadSize = 0;
62 QDataStream m_dataStream;
63 QSet<QString> m_remoteObjects;
64 QRemoteObjectPackets::CodecBase *m_codec { nullptr };
65 Q_DECLARE_PUBLIC(QtROIoDeviceBase)
66};
67
68class QtROClientIoDevicePrivate : public QtROIoDeviceBasePrivate
69{
70public:
71 QtROClientIoDevicePrivate() : QtROIoDeviceBasePrivate() { }
72 QUrl m_url;
73 Q_DECLARE_PUBLIC(QtROClientIoDevice)
74};
75
76class QtROExternalIoDevicePrivate : public QtROIoDeviceBasePrivate
77{
78public:
79 QtROExternalIoDevicePrivate(QIODevice *device) : QtROIoDeviceBasePrivate(), m_device(device) { }
80 QPointer<QIODevice> m_device;
81 Q_DECLARE_PUBLIC(QtROExternalIoDevice)
82};
83
84QT_END_NAMESPACE
85
86#endif
87

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