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 | QT_BEGIN_NAMESPACE |
28 | |
29 | namespace QtRemoteObjects { |
30 | |
31 | static const int dataStreamVersion = QDataStream::Qt_6_2; |
32 | static const QLatin1String protocolVersion("QtRO 2.0"); |
33 | |
34 | } |
35 | |
36 | class QtROExternalIoDevice : public QtROIoDeviceBase |
37 | { |
38 | Q_OBJECT |
39 | |
40 | public: |
41 | explicit QtROExternalIoDevice(QIODevice *device, QObject *parent=nullptr); |
42 | QIODevice *connection() const override; |
43 | bool isOpen() const override; |
44 | |
45 | protected: |
46 | void doClose() override; |
47 | QString deviceType() const override; |
48 | private: |
49 | Q_DECLARE_PRIVATE(QtROExternalIoDevice) |
50 | }; |
51 | |
52 | class QtROIoDeviceBasePrivate : public QObjectPrivate |
53 | { |
54 | public: |
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 | |
68 | class QtROClientIoDevicePrivate : public QtROIoDeviceBasePrivate |
69 | { |
70 | public: |
71 | QtROClientIoDevicePrivate() : QtROIoDeviceBasePrivate() { } |
72 | QUrl m_url; |
73 | Q_DECLARE_PUBLIC(QtROClientIoDevice) |
74 | }; |
75 | |
76 | class QtROExternalIoDevicePrivate : public QtROIoDeviceBasePrivate |
77 | { |
78 | public: |
79 | QtROExternalIoDevicePrivate(QIODevice *device) : QtROIoDeviceBasePrivate(), m_device(device) { } |
80 | QPointer<QIODevice> m_device; |
81 | Q_DECLARE_PUBLIC(QtROExternalIoDevice) |
82 | }; |
83 | |
84 | QT_END_NAMESPACE |
85 | |
86 | #endif |
87 |