1// qremoteobjectnode.sip generated by MetaSIP
2//
3// This file is part of the QtRemoteObjects Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23%If (Qt_5_12_0 -)
24
25class QRemoteObjectAbstractPersistedStore : QObject
26{
27%TypeHeaderCode
28#include <qremoteobjectnode.h>
29%End
30
31public:
32    QRemoteObjectAbstractPersistedStore(QObject *parent /TransferThis/ = 0);
33    virtual ~QRemoteObjectAbstractPersistedStore();
34    virtual void saveProperties(const QString &repName, const QByteArray &repSig, const QVariantList &values) = 0;
35    virtual QVariantList restoreProperties(const QString &repName, const QByteArray &repSig) = 0;
36};
37
38%End
39%If (Qt_5_12_0 -)
40
41class QRemoteObjectNode : QObject
42{
43%TypeHeaderCode
44#include <qremoteobjectnode.h>
45%End
46
47%ConvertToSubClassCode
48    static struct class_graph {
49        const char *name;
50        sipTypeDef **type;
51        int yes, no;
52    } graph[] = {
53        {sipName_QAbstractItemModelReplica, &sipType_QAbstractItemModelReplica, -1, 1},
54        {sipName_QRemoteObjectAbstractPersistedStore, &sipType_QRemoteObjectAbstractPersistedStore, -1, 2},
55        {sipName_QRemoteObjectReplica, &sipType_QRemoteObjectReplica, 4, 3},
56        {sipName_QRemoteObjectNode, &sipType_QRemoteObjectNode, 6, -1},
57        {sipName_QRemoteObjectDynamicReplica, &sipType_QRemoteObjectDynamicReplica, -1, 5},
58        {sipName_QRemoteObjectRegistry, &sipType_QRemoteObjectRegistry, -1, -1},
59        {sipName_QRemoteObjectHostBase, &sipType_QRemoteObjectHostBase, 7, -1},
60        {sipName_QRemoteObjectHost, &sipType_QRemoteObjectHost, -1, 8},
61        {sipName_QRemoteObjectRegistryHost, &sipType_QRemoteObjectRegistryHost, -1, -1},
62    };
63
64    int i = 0;
65
66    sipType = NULL;
67
68    do
69    {
70        struct class_graph *cg = &graph[i];
71
72        if (cg->name != NULL && sipCpp->inherits(cg->name))
73        {
74            sipType = *cg->type;
75            i = cg->yes;
76        }
77        else
78            i = cg->no;
79    }
80    while (i >= 0);
81%End
82
83public:
84    enum ErrorCode
85    {
86        NoError,
87        RegistryNotAcquired,
88        RegistryAlreadyHosted,
89        NodeIsNoServer,
90        ServerAlreadyCreated,
91        UnintendedRegistryHosting,
92        OperationNotValidOnClientNode,
93        SourceNotRegistered,
94        MissingObjectName,
95        HostUrlInvalid,
96        ProtocolMismatch,
97        ListenFailed,
98    };
99
100    QRemoteObjectNode(QObject *parent /TransferThis/ = 0);
101    QRemoteObjectNode(const QUrl &registryAddress, QObject *parent /TransferThis/ = 0);
102    virtual ~QRemoteObjectNode();
103    bool connectToNode(const QUrl &address);
104    void addClientSideConnection(QIODevice *ioDevice);
105    virtual void setName(const QString &name);
106    QStringList instances(const QString &typeName) const;
107    QRemoteObjectDynamicReplica *acquireDynamic(const QString &name) /Factory/;
108    QAbstractItemModelReplica *acquireModel(const QString &name, QtRemoteObjects::InitialAction action = QtRemoteObjects::FetchRootSize, const QVector<int> &rolesHint = {}) /Factory/;
109    QUrl registryUrl() const;
110    virtual bool setRegistryUrl(const QUrl &registryAddress);
111    bool waitForRegistry(int timeout = 30000) /ReleaseGIL/;
112    const QRemoteObjectRegistry *registry() const;
113    QRemoteObjectAbstractPersistedStore *persistedStore() const;
114    void setPersistedStore(QRemoteObjectAbstractPersistedStore *persistedStore);
115    QRemoteObjectNode::ErrorCode lastError() const;
116    int heartbeatInterval() const;
117    void setHeartbeatInterval(int interval);
118
119signals:
120    void remoteObjectAdded(const QRemoteObjectSourceLocation &);
121    void remoteObjectRemoved(const QRemoteObjectSourceLocation &);
122    void error(QRemoteObjectNode::ErrorCode errorCode);
123    void heartbeatIntervalChanged(int heartbeatInterval);
124
125protected:
126    virtual void timerEvent(QTimerEvent *);
127};
128
129%End
130%If (Qt_5_12_0 -)
131
132class QRemoteObjectHostBase : QRemoteObjectNode /NoDefaultCtors/
133{
134%TypeHeaderCode
135#include <qremoteobjectnode.h>
136%End
137
138public:
139    enum AllowedSchemas
140    {
141        BuiltInSchemasOnly,
142        AllowExternalRegistration,
143    };
144
145    virtual ~QRemoteObjectHostBase();
146    virtual void setName(const QString &name);
147    bool enableRemoting(QObject *object, const QString &name = QString());
148    bool enableRemoting(QAbstractItemModel *model, const QString &name, const QVector<int> roles, QItemSelectionModel *selectionModel = 0);
149    bool disableRemoting(QObject *remoteObject);
150    void addHostSideConnection(QIODevice *ioDevice);
151    bool proxy(const QUrl &registryUrl, const QUrl &hostUrl /TypeHintValue="QUrl()"/ = {});
152    bool reverseProxy();
153};
154
155%End
156%If (Qt_5_12_0 -)
157
158class QRemoteObjectHost : QRemoteObjectHostBase
159{
160%TypeHeaderCode
161#include <qremoteobjectnode.h>
162%End
163
164public:
165    QRemoteObjectHost(QObject *parent /TransferThis/ = 0);
166    QRemoteObjectHost(const QUrl &address, const QUrl &registryAddress = QUrl(), QRemoteObjectHostBase::AllowedSchemas allowedSchemas = QRemoteObjectHostBase::BuiltInSchemasOnly, QObject *parent /TransferThis/ = 0);
167    QRemoteObjectHost(const QUrl &address, QObject *parent /TransferThis/);
168    virtual ~QRemoteObjectHost();
169    virtual QUrl hostUrl() const;
170    virtual bool setHostUrl(const QUrl &hostAddress, QRemoteObjectHostBase::AllowedSchemas allowedSchemas = QRemoteObjectHostBase::BuiltInSchemasOnly);
171
172signals:
173%If (Qt_5_15_0 -)
174    void hostUrlChanged();
175%End
176};
177
178%End
179%If (Qt_5_12_0 -)
180
181class QRemoteObjectRegistryHost : QRemoteObjectHostBase
182{
183%TypeHeaderCode
184#include <qremoteobjectnode.h>
185%End
186
187public:
188    QRemoteObjectRegistryHost(const QUrl &registryAddress = QUrl(), QObject *parent /TransferThis/ = 0);
189    virtual ~QRemoteObjectRegistryHost();
190    virtual bool setRegistryUrl(const QUrl &registryUrl);
191};
192
193%End
194