Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wiedi/libmaia
XML-RPC lib for Qt
https://github.com/wiedi/libmaia
Last synced: about 2 months ago
JSON representation
XML-RPC lib for Qt
- Host: GitHub
- URL: https://github.com/wiedi/libmaia
- Owner: wiedi
- License: other
- Created: 2010-01-02T21:56:12.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2023-06-23T09:05:04.000Z (over 1 year ago)
- Last Synced: 2024-08-03T18:10:58.574Z (5 months ago)
- Language: C++
- Homepage:
- Size: 78.1 KB
- Stars: 66
- Watchers: 10
- Forks: 27
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog
- License: LICENSE
Awesome Lists containing this project
README
# libmaia
libmaia is a easy-to-use XML-RPC library for Qt!
# compiling libmaia
qmake
make# Qt Datatypes
Allowed types for Argument and Return Values:
C++/Qt-Types XMLRPC-Types
----------------------------------------
* int
* qint64 (non standard)
* bool
* double
* QString
* QDateTime
* ByteArray
* QVariant (non standard)
* QVariantMap
* QVariantList# using libmaia
1. qmake: your Project file (.pro) should contain
INCLUDEPATH += /path/to/libmaia
LIBS += /path/to/libmaia/libmaia.a
QT += xml network2. in your header file include
#include "maiaXmlRpcClient.h"
and / or
#include "maiaXmlRpcServer.h"3. create object
server:
MaiaXmlRpcServer *server = new MaiaXmlRpcServer(8080, this);client:
MaiaXmlRpcClient *client = new MaiaXmlRpcClient(QUrl("http://localhost:8080/RPC2"), this);4. register a method
your method has to be a Qt Slot.
// example method:
QString MyClass::myMethod(int param1, QString param2) {
if(param1 > 5)
return param2;
else
return "not bigger than 5";
}// register it:
// "example.methodName" <- used to identify the method over xml-rpc
// this <- pointer to the class which contains the method you would export
// "myMethod" the name of the method
server->addMethod("example.methodName", this, "myMethod");5. call a method
when calling a method you need three things:
1. a Slot for the MethodResponse
2. a Slot for the FaultResponse
3. a QVariantList containig the arguments for the RPC-Methodexample code:
void MyClientClass::myResponseMethod(QVariant &arg) {
// do something with the arg
}
void MyClientClass::myFaultResponse(int error, const QString &message) {
qDebug() << "An Error occoured, Code: " << error << " Message: " << message;
}QVariantList args;
args << 5;
args << "second argument";rpcClient->call("example.methodName", args,
this, SLOT(myResponseMethod(QVariant&)),
this, SLOT(myFaultResponse(int, const QString &)));