ArnLib  4.0.x
Active Registry Network
ArnSapi.hpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2022 Michael Wiklund.
2 // All rights reserved.
3 // Contact: arnlib@wiklunden.se
4 //
5 // This file is part of the ArnLib - Active Registry Network.
6 // Parts of ArnLib depend on Qt and/or other libraries that have their own
7 // licenses. Usage of these other libraries is subject to their respective
8 // license agreements.
9 //
10 // GNU Lesser General Public License Usage
11 // This file may be used under the terms of the GNU Lesser General Public
12 // License version 2.1 as published by the Free Software Foundation and
13 // appearing in the file LICENSE_LGPL.txt included in the packaging of this
14 // file. In addition, as a special exception, you may use the rights described
15 // in the Nokia Qt LGPL Exception version 1.1, included in the file
16 // LGPL_EXCEPTION.txt in this package.
17 //
18 // GNU General Public License Usage
19 // Alternatively, this file may be used under the terms of the GNU General Public
20 // License version 3.0 as published by the Free Software Foundation and appearing
21 // in the file LICENSE_GPL.txt included in the packaging of this file.
22 //
23 // Other Usage
24 // Alternatively, this file may be used in accordance with the terms and conditions
25 // contained in a signed written agreement between you and Michael Wiklund.
26 //
27 // This program is distributed in the hope that it will be useful, but WITHOUT ANY
28 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
29 // PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
30 //
31 
32 #ifndef ARNSAPI_HPP
33 #define ARNSAPI_HPP
34 
35 #include "ArnLib_global.hpp"
36 #include "ArnRpc.hpp"
37 #include <QString>
38 #include <QByteArray>
39 #include <QObject>
40 
41 #if defined(__DATE__) && defined(Q_SIGNALS) // Handle QT Creator code completion
42 # define MQ_PUBLIC_ACCESS public:
43 #else
44 # define MQ_PUBLIC_ACCESS
45 #endif
46 
47 class ArnSapiPrivate;
48 
49 
51 
76 
81 
116 {
117  Q_OBJECT
118  Q_DECLARE_PRIVATE(ArnSapi)
119 
120 public:
121  explicit ArnSapi( QObject* parent = arnNullptr);
122 
124 
140  bool open( const QString& pipePath = QString(), Mode mode = Mode(),
141  const char* providerPrefix = arnNullptr, const char* requesterPrefix = arnNullptr);
142 
144 
161  void batchConnectTo( const QObject* receiver, const QString& prefix = QString(),
162  Mode mode = Mode());
163 
165 
178  void batchConnectFrom( const QObject* sender, const QString& prefix = QString(),
179  Mode mode = Mode());
180 
182 
184  QString defaultPath() const;
185 
186 protected:
187  ArnSapi( const QString& defaultPath, QObject* parent = arnNullptr);
188 
190 
195  void setDefaultPath( const QString& defaultPath);
196 
198  ArnSapi( ArnSapiPrivate& dd, QObject* parent);
200 
201 private:
203  void setPipe( ArnPipe* pipe);
204  void setReceiver( QObject* receiver);
205  bool setReceiver( QObject* receiver, bool useTrackRpcSender);
206  void setMethodPrefix( const QString& prefix);
207  void setIncludeSender( bool v);
208  void setMode( Mode mode);
209  void addSenderSignals( QObject* sender, const QString& prefix);
210  ArnRpc* rpcSender();
211  static ArnRpc* rpcSender( QObject* receiver);
212 };
213 
214 
215 #endif // ARNSAPI_HPP
void setMethodPrefix(const QString &prefix)
Definition: ArnRpc.cpp:337
bool setReceiver(QObject *receiver, bool useTrackRpcSender=true)
Definition: ArnRpc.cpp:300
void addSenderSignals(QObject *sender, const QString &prefix)
Definition: ArnRpc.cpp:440
void setIncludeSender(bool v)
Add sender as argument when calling a rpc method.
Definition: ArnRpc.cpp:370
Service API.
Definition: ArnSapi.hpp:115
Remote Procedure Call.
Definition: ArnRpc.hpp:156
ArnRpc * rpcSender()
Definition: ArnRpc.cpp:473
ArnItem specialized as a pipe.
Definition: ArnPipe.hpp:64
ArnRpcMode Mode
Definition: ArnRpc.hpp:162
#define ARNLIBSHARED_EXPORT
void setPipe(ArnPipe *pipe)
Set pipe for this Rpc.
Definition: ArnRpc.cpp:273
bool open(const QString &pipePath)
Definition: ArnRpc.cpp:236
void setMode(Mode mode)
Definition: ArnRpc.cpp:378