• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

ChangelogH A D29-Oct-202165 64

LICENSEH A D03-May-20221.5 KiB2620

README.mdH A D03-May-20222.1 KiB10763

maia.priH A D29-Oct-2021320 54

maia.proH A D29-Oct-2021572 3020

maiaFault.cppH A D03-May-20222.1 KiB5321

maiaFault.hH A D03-May-20221.7 KiB4714

maiaObject.cppH A D03-May-20229 KiB301199

maiaObject.hH A D03-May-20222.1 KiB5721

maiaXmlRpcClient.cppH A D03-May-20224.1 KiB12563

maiaXmlRpcClient.hH A D03-May-20222.4 KiB7128

maiaXmlRpcServer.cppH A D03-May-20223.4 KiB8649

maiaXmlRpcServer.hH A D03-May-20222.4 KiB6628

maiaXmlRpcServerConnection.cppH A D03-May-20228.3 KiB290209

maiaXmlRpcServerConnection.hH A D03-May-20223 KiB9955

README.md

1# libmaia
2
3libmaia is a easy-to-use XML-RCP library for Qt!
4
5
6# compiling libmaia
7
8	qmake
9	make
10
11
12
13# Qt Datatypes
14
15	Allowed types for Argument and Return Values:
16
17	C++/Qt-Types	XMLRPC-Types
18	----------------------------------------
19	* int           <int></int>
20	* bool          <bool></bool>
21	* double        <double></double>
22	* QString       <string></string>
23	* QDateTime     <datetime.iso8601></datetime.iso8601>
24	* ByteArray     <base64></base64>
25	* QVariantMap   <struct></struct>
26	* QVariantList  <array></array>
27
28
29
30# using libmaia
31
321. 	qmake: your Project file (.pro) should contain
33
34		INCLUDEPATH += /path/to/libmaia
35		LIBS += /path/to/libmaia/libmaia.a
36		QT   += xml network
37
382. in your header file include
39
40		#include "maiaXmlRpcClient.h"
41
42 	and / or
43
44		#include "maiaXmlRpcServer.h"
45
46
473. create object
48
49	server:
50
51		MaiaXmlRpcServer *server = new MaiaXmlRpcServer(8080, this);
52
53	client:
54
55		MaiaXmlRpcClient *client = new MaiaXmlRpcClient(QUrl("http://localhost:8080/RPC2"), this);
56
57
584. register a method
59
60	your method has to be a Qt Slot.
61
62
63		// example method:
64		QString MyClass::myMethod(int param1, QString param2) {
65			if(param1 > 5)
66				return param2;
67			else
68				return "not bigger than 5";
69		}
70
71		// register it:
72		// "example.methodName" <- used to identify the method over xml-rpc
73		// this <- pointer to the class which contains the method you would export
74		// "myMethod" the name of the method
75		server->addMethod("example.methodName", this, "myMethod");
76
77
785. call a method
79
80	when calling a method you need three things:
81
82	1. a Slot for the MethodResponse
83	2. a Slot for the FaultResponse
84	3. a QVariantList containig the arguments for the RPC-Method
85
86	example code:
87
88		void MyClientClass::myResponseMethod(QVariant &arg) {
89			// do something with the arg
90		}
91
92		void MyClientClass::myFaultResponse(int error, const QString &message) {
93			qDebug() << "An Error occoured, Code: " << error << " Message: " << message;
94		}
95
96		QVariantList args;
97		args << 5;
98		args << "second argument";
99
100		rpcClient->call("example.methodName", args,
101			this, SLOT(myResponseMethod(QVariant&)),
102			this, SLOT(myFaultResponse(int, const QString &)));
103
104
105
106
107