blob: 86f358c46681f447368995245c4c2409891ca6f0 (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
{# Copyright (c) Pelagicore AB 2016 #}
{% set class = 'Qml{0}'.format(struct) %}
{% set ampersand = joiner(" &&") %}
/****************************************************************************
** This is an auto-generated file.
** Do not edit! All changes made to it will be lost.
****************************************************************************/
#include "{{class|lower}}.h"
class {{class}}Data : public QSharedData
{
public:
{{class}}Data()
: QSharedData()
{% for field in struct.fields %}
, {{field}}({{field|defaultValue}})
{% endfor %}
{
}
{{class}}Data(const {{class}}Data &other)
: QSharedData(other)
{% for field in struct.fields %}
, {{field}}(other.{{field}})
{% endfor %}
{
}
public:
{% for field in struct.fields %}
{{field|returnType}} {{field}};
{% endfor %}
};
// Class
/*!
\qmltype {{struct}}
\inqmlmodule {{module}}
{% with doc = struct.comment|parse_doc %}
\brief {{doc.brief}}
\note This is a none creatable data object
Use the module factory method \l {{module.module_name}}Module::create{{struct}} to create
an instance.
{{doc.description}}
{% endwith %}
*/
{{class}}::{{class}}()
: d(new {{class}}Data)
{
}
{{class}}::{{class}}(const {{class}} &other)
: d(other.d)
{
}
{{class}}::~{{class}}()
{
}
{% for field in struct.fields %}
/*!
\qmlproperty {{field.type}} {{struct}}::{{field}} (field)
{% with doc = field.comment|parse_doc %}
\brief {{doc.brief}}
\note A none notifiable property
{{doc.description}}
{% endwith %}
*/
void {{class}}::set{{field|upperfirst}}({{field|parameterType}})
{
d->{{field}} = {{field}};
}
{{field|returnType}} {{class}}::{{field}}() const
{
return d->{{field}};
}
{% endfor %}
{{class}} {{class}}::clone()
{
{{class}} other(*this);
other.d.detach();
return other;
}
bool {{class}}::operator==(const {{class}} &other) const
{
return (
{%- for field in struct.fields %}{{ ampersand() }}
{{field}}() == other.{{field}}()
{%- endfor %}
);
}
{{class}} &{{class}}::operator=(const {{class}} &other)
{
d = other.d;
return *this;
}
|