Commit f079ea69 authored by Wouter's avatar Wouter

Add basic implementation for RPC method calls

Performs all the QVariant conversions of parameters and triggers the
doCall() virtual method.
parent 9975d2c5
......@@ -54,12 +54,24 @@
{% case "RpcMethod" %}
{% if not member.isInline %}{% if not member.isPureVirtual %}
{{ member.returnType.signature }} {{ class.fullName }}::{{ member.name }}({% for param in member.parameters %}{% if not forloop.first %}, {% endif %}{{ param.type.signature }} {{ param.name }}{% endfor %}){% if member.isConst %} const{% endif %} {
QVariantMap data;
QVariantMap _rpcParameters;
{% for param in member.parameters %}
// data.insert("{{ param.name }}", {{param.name}}.toVariant());
// {{ param.type.type.metaType }}
{% switch param.type.type.metaType %}
{% case "array" %}
QVariantList {{param.name}}Variant;
Q_FOREACH(const {{param.type.type.itemType.signature}}& {{param.name}}Item, {{param.name}}) {
{{param.name}}Variant << {{param.name}}Item;
}
_rpcParameters.insert("{{ param.name }}", {{param.name}}Variant);
{% case "type" %}
_rpcParameters.insert("{{ param.name }}", {{param.name}});
{% default %}
_rpcParameters.insert("{{ param.name }}", {{param.name}}.toVariant());
{% endswitch %}
{% endfor %}
doCall("{{ member.name }}", data);
doCall("{{ member.name }}", _rpcParameters);
}
{% endif %}{% endif %}{# inline, pureVirtual #}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment