summaryrefslogtreecommitdiffstats
path: root/src/tools/ifcodegen/templates/common/interface.rep.jinja
blob: 376a78ac48c647cc029107c4f6fdfd2a185bb817 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{#
# Copyright (C) 2021 The Qt Company Ltd.
# Copyright (C) 2019 Luxoft Sweden AB
# Copyright (C) 2018 Pelagicore AG
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#}
{% import 'common/qtif_macros.jinja' as qtif %}
{% include "common/generated_comment.rep.jinja" %}
{% set class = '{0}'.format(interface) %}
{% set interface_zoned = interface.tags.config and interface.tags.config.zoned %}
{% if interface.module.tags.config.module %}
#include <{{interface.module.tags.config.module}}/{{module.module_name|lower}}.h>
{% else %}
#include "{{module.module_name|lower}}.h"
{% endif %}
{% for inc in interface|struct_includes %}
{{inc}}
{% endfor %}

class {{class}}
{
{% for property in interface.properties %}
{%   set propKeyword = '' %}
{%   if property.readonly %}
{%     set propKeyword = 'READONLY' %}
{%   endif %}
{%   if not property.is_model %}
{%     if interface_zoned %}
    SLOT({{property|return_type|replace(" *", "")}} {{property|getter_name}}(const QString &zone))
{%       if not property.readonly %}
    SLOT({{qtif.prop_setter(property, zoned=true)}})
{%       endif %}
    SIGNAL({{property}}Changed({{property|parameter_type}}, const QString &zone))

{%     else %}
    PROP({{property|return_type|replace(" *", "")}} {{property}} {{propKeyword}})
{%     endif %}
{%   endif %}
{% endfor %}

{% if interface_zoned %}
    SLOT(QStringList availableZones())
{% endif %}

{% for operation in interface.operations %}
    SLOT(QVariant {{operation}}({{qtif.join_params(operation, zoned = interface_zoned)}}))
{% endfor %}

    SIGNAL(pendingResultAvailable(quint64 id, bool isSuccess, const QVariant &value))
{% for signal in interface.signals %}
    SIGNAL({{signal}}({{qtif.join_params(signal, zoned = interface_zoned)}}))
{% endfor %}
};