Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qqmltcoutputir_p.h
Go to the documentation of this file.
1
// Copyright (C) 2021 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
// Qt-Security score:significant
4
5
#
ifndef
QQMLTCOUTPUTIR_P_H
6
#
define
QQMLTCOUTPUTIR_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
<
QtCore
/
qstring
.
h
>
20
#
include
<
QtCore
/
qlist
.
h
>
21
#
include
<
QtCore
/
qstringlist
.
h
>
22
#
include
<
QtCore
/
qset
.
h
>
23
24
#
include
<
private
/
qqmljsmetatypes_p
.
h
>
25
26
#
include
<
optional
>
27
28
QT_BEGIN_NAMESPACE
29
30
namespace
QQmltc
{
31
32
// Below are the classes that represent compiled QML types in a string data
33
// form. These classes are used to generate C++ code.
34
35
// Represents C++ variable
36
struct
Variable
37
{
38
QString
cppType
;
// C++ type of a variable
39
QString
name
;
// variable name
40
QString
defaultValue
;
// optional initialization value
41
42
Variable
() =
default
;
43
// special ctor for QList's emplace back
44
Variable
(
const
QString &t,
const
QString &n,
const
QString &v = QString())
45
:
cppType
(
t
),
name
(
n
),
defaultValue
(
v
)
46
{
47
}
48
};
49
50
struct
Property
:
Variable
51
{
52
QString
containingClass
;
53
QString
signalName
;
54
55
Property
() =
default
;
56
Property
(
const
QString t,
const
QString &n,
const
QString &c,
const
QString &s)
57
:
Variable
(t, n),
containingClass
(
c
),
signalName
(
s
)
58
{
59
}
60
};
61
62
// Represents QML -> C++ compiled enumeration type
63
struct
Enum
64
{
65
QString
cppType
;
// C++ type of an enum
66
QStringList
keys
;
// enumerator keys
67
QStringList
values
;
// enumerator values
68
QString
ownMocLine
;
// special MOC line that follows enum declaration
69
70
Enum
() =
default
;
71
Enum
(
const
QString &t,
const
QStringList &ks,
const
QStringList &vs,
const
QString &l)
72
:
cppType
(
t
),
keys
(
ks
),
values
(
vs
),
ownMocLine
(
l
)
73
{
74
}
75
};
76
77
struct
MethodBase
78
{
79
QStringList
comments
;
// C++ comments
80
QString
name
;
// C++ function name
81
QList
<
Variable
>
parameterList
;
// C++ function parameter list
82
QStringList
body
;
// C++ function code
83
QQmlJSMetaMethod
::
Access
access
=
QQmlJSMetaMethod
::
Public
;
// access specifier
84
QStringList
declarationPrefixes
;
85
QStringList
modifiers
;
// cv-qualifiers, ref-qualifier, noexcept, attributes
86
};
87
88
// Represents QML -> C++ compiled function
89
struct
Method
:
MethodBase
90
{
91
QString
returnType
;
// C++ return type
92
QQmlJSMetaMethodType
type
=
QQmlJSMetaMethodType
::
Method
;
// Qt function type
93
94
// TODO: should be a better way to handle this
95
bool
userVisible
=
false
;
// tells if a function is prioritized during the output generation
96
};
97
98
// Represents C++ ctor of a type
99
struct
Ctor
:
MethodBase
100
{
101
QStringList
initializerList
;
// C++ ctor's initializer list
102
};
103
104
// Represents C++ dtor of a type
105
struct
Dtor
:
MethodBase
106
{
107
};
108
109
// Represents a generated class that knows how to set the public,
110
// writable properties of a compiled QML -> C++ type.
111
// This is generally intended to be available for the root of the
112
// document to allow the user to set the initial values for
113
// properties, when creating a component, with support for strong
114
// typing.
115
struct
PropertyInitializer
116
{
117
QString
name
;
118
119
Ctor
constructor
;
120
121
// A member containing a reference to the object for which the
122
// properties should be set.
123
Variable
component
;
124
125
// A member containing a cache of properties that were actually
126
// set that can be referenced later..
127
Variable
initializedCache
;
128
129
// Setter methods for each property.
130
QList
<
Method
>
propertySetters
;
131
};
132
133
// Represents a generated class that contains a bundle of values to
134
// initialize the required properties of a type.
135
//
136
// This is generally intended to be available for the root component
137
// of the document, where it will be used as a constructor argument to
138
// force the user to provide initial values for the required
139
// properties of the constructed type.
140
struct
RequiredPropertiesBundle
141
{
142
QString
name
;
143
144
QList
<
Variable
>
members
;
145
};
146
147
// Represents QML -> C++ compiled type
148
struct
Type
149
{
150
QString
cppType
;
// C++ type of the QML type
151
QStringList
baseClasses
;
// C++ type names of base classes
152
QStringList
mocCode
;
// Qt MOC code
153
QStringList
otherCode
;
// Random code that doesn't fit any category, e.g. friend declarations
154
155
// member types: enumerations and child types
156
QList
<
Enum
>
enums
;
157
QList
<
Type
>
children
;
// these are pretty much always empty
158
159
// special member functions:
160
Ctor
baselineCtor
{};
// does basic contruction
161
Ctor
externalCtor
{};
// calls basicCtor, calls init
162
Method
init
{};
// starts object initialization (context setup), calls finalize
163
Method
beginClass
{};
// calls QQmlParserStatus::classBegin()
164
Method
endInit
{};
// ends object initialization (with "simple" bindings setup)
165
Method
setComplexBindings
{};
// sets up "complex" (e.g. script) bindings
166
Method
completeComponent
{};
// calls QQmlParserStatus::componentComplete()
167
Method
finalizeComponent
{};
// calls QQmlFinalizerHook::componentFinalized()
168
Method
handleOnCompleted
{};
// calls Component.onCompleted
169
170
std
::optional<
Dtor
>
dtor
{};
171
172
// member functions: methods, signals and slots
173
QList
<
Method
>
functions
;
174
// member variables
175
QList
<
Variable
>
variables
;
176
QList
<
Property
>
properties
;
177
178
// QML document root specific:
179
std
::optional<
Method
>
typeCount
;
// the number of QML types defined in a document
180
181
// TODO: only needed for binding callables - should not be needed, generally
182
bool
ignoreInit
=
false
;
// specifies whether init and externalCtor should be ignored
183
184
// needed for singletons
185
std
::optional<
Method
>
staticCreate
{};
186
187
// A proxy class that provides a restricted interface that only
188
// allows setting the properties of the type.
189
PropertyInitializer
propertyInitializer
{};
190
191
std
::optional<
RequiredPropertiesBundle
>
requiredPropertiesBundle
{};
192
};
193
194
// Represents whole QML program, compiled to C++
195
struct
Program
196
{
197
QString
url
;
// QML file url
198
QString
cppPath
;
// C++ output .cpp path
199
QString
hPath
;
// C++ output .h path
200
QString
outNamespace
;
201
QString
exportMacro
;
// if not empty, the macro that should be used to export the generated
202
// classes
203
QSet
<
QString
>
includes
;
// non-default C++ include files
204
Method
urlMethod
;
// returns QUrl of the QML document
205
206
QList
<
Type
>
compiledTypes
;
// all QML types that are compiled to C++
207
};
208
209
}
// namespace QQmltc
210
211
QT_END_NAMESPACE
212
213
#
endif
// QQMLTCOUTPUTIR_P_H
QQmltc
Definition
qqmltccodewriter.cpp:19
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
QQmltc::Ctor
Definition
qqmltcoutputir_p.h:100
QQmltc::Ctor::initializerList
QStringList initializerList
Definition
qqmltcoutputir_p.h:101
QQmltc::Dtor
Definition
qqmltcoutputir_p.h:106
QQmltc::Enum
Definition
qqmltcoutputir_p.h:64
QQmltc::Enum::Enum
Enum()=default
QQmltc::Enum::values
QStringList values
Definition
qqmltcoutputir_p.h:67
QQmltc::Enum::ownMocLine
QString ownMocLine
Definition
qqmltcoutputir_p.h:68
QQmltc::Enum::cppType
QString cppType
Definition
qqmltcoutputir_p.h:65
QQmltc::Enum::Enum
Enum(const QString &t, const QStringList &ks, const QStringList &vs, const QString &l)
Definition
qqmltcoutputir_p.h:71
QQmltc::Enum::keys
QStringList keys
Definition
qqmltcoutputir_p.h:66
QQmltc::MethodBase
Definition
qqmltcoutputir_p.h:78
QQmltc::MethodBase::parameterList
QList< Variable > parameterList
Definition
qqmltcoutputir_p.h:81
QQmltc::MethodBase::declarationPrefixes
QStringList declarationPrefixes
Definition
qqmltcoutputir_p.h:84
QQmltc::MethodBase::body
QStringList body
Definition
qqmltcoutputir_p.h:82
QQmltc::MethodBase::name
QString name
Definition
qqmltcoutputir_p.h:80
QQmltc::MethodBase::access
QQmlJSMetaMethod::Access access
Definition
qqmltcoutputir_p.h:83
QQmltc::MethodBase::comments
QStringList comments
Definition
qqmltcoutputir_p.h:79
QQmltc::MethodBase::modifiers
QStringList modifiers
Definition
qqmltcoutputir_p.h:85
QQmltc::Method
Definition
qqmltcoutputir_p.h:90
QQmltc::Method::userVisible
bool userVisible
Definition
qqmltcoutputir_p.h:95
QQmltc::Method::returnType
QString returnType
Definition
qqmltcoutputir_p.h:91
QQmltc::Method::type
QQmlJSMetaMethodType type
Definition
qqmltcoutputir_p.h:92
QQmltc::Program
Definition
qqmltcoutputir_p.h:196
QQmltc::Program::cppPath
QString cppPath
Definition
qqmltcoutputir_p.h:198
QQmltc::Program::exportMacro
QString exportMacro
Definition
qqmltcoutputir_p.h:201
QQmltc::Program::urlMethod
Method urlMethod
Definition
qqmltcoutputir_p.h:204
QQmltc::Program::compiledTypes
QList< Type > compiledTypes
Definition
qqmltcoutputir_p.h:206
QQmltc::Program::hPath
QString hPath
Definition
qqmltcoutputir_p.h:199
QQmltc::Program::outNamespace
QString outNamespace
Definition
qqmltcoutputir_p.h:200
QQmltc::Program::includes
QSet< QString > includes
Definition
qqmltcoutputir_p.h:203
QQmltc::Program::url
QString url
Definition
qqmltcoutputir_p.h:197
QQmltc::PropertyInitializer
Definition
qqmltcoutputir_p.h:116
QQmltc::PropertyInitializer::component
Variable component
Definition
qqmltcoutputir_p.h:123
QQmltc::PropertyInitializer::constructor
Ctor constructor
Definition
qqmltcoutputir_p.h:119
QQmltc::PropertyInitializer::propertySetters
QList< Method > propertySetters
Definition
qqmltcoutputir_p.h:130
QQmltc::PropertyInitializer::initializedCache
Variable initializedCache
Definition
qqmltcoutputir_p.h:127
QQmltc::PropertyInitializer::name
QString name
Definition
qqmltcoutputir_p.h:117
QQmltc::Property
Definition
qqmltcoutputir_p.h:51
QQmltc::Property::Property
Property(const QString t, const QString &n, const QString &c, const QString &s)
Definition
qqmltcoutputir_p.h:56
QQmltc::Property::signalName
QString signalName
Definition
qqmltcoutputir_p.h:53
QQmltc::Property::containingClass
QString containingClass
Definition
qqmltcoutputir_p.h:52
QQmltc::Property::Property
Property()=default
QQmltc::RequiredPropertiesBundle
Definition
qqmltcoutputir_p.h:141
QQmltc::RequiredPropertiesBundle::members
QList< Variable > members
Definition
qqmltcoutputir_p.h:144
QQmltc::RequiredPropertiesBundle::name
QString name
Definition
qqmltcoutputir_p.h:142
QQmltc::Type
Definition
qqmltcoutputir_p.h:149
QQmltc::Type::beginClass
Method beginClass
Definition
qqmltcoutputir_p.h:163
QQmltc::Type::dtor
std::optional< Dtor > dtor
Definition
qqmltcoutputir_p.h:170
QQmltc::Type::endInit
Method endInit
Definition
qqmltcoutputir_p.h:164
QQmltc::Type::completeComponent
Method completeComponent
Definition
qqmltcoutputir_p.h:166
QQmltc::Type::setComplexBindings
Method setComplexBindings
Definition
qqmltcoutputir_p.h:165
QQmltc::Type::mocCode
QStringList mocCode
Definition
qqmltcoutputir_p.h:152
QQmltc::Type::baseClasses
QStringList baseClasses
Definition
qqmltcoutputir_p.h:151
QQmltc::Type::variables
QList< Variable > variables
Definition
qqmltcoutputir_p.h:175
QQmltc::Type::externalCtor
Ctor externalCtor
Definition
qqmltcoutputir_p.h:161
QQmltc::Type::init
Method init
Definition
qqmltcoutputir_p.h:162
QQmltc::Type::typeCount
std::optional< Method > typeCount
Definition
qqmltcoutputir_p.h:179
QQmltc::Type::enums
QList< Enum > enums
Definition
qqmltcoutputir_p.h:156
QQmltc::Type::staticCreate
std::optional< Method > staticCreate
Definition
qqmltcoutputir_p.h:185
QQmltc::Type::baselineCtor
Ctor baselineCtor
Definition
qqmltcoutputir_p.h:160
QQmltc::Type::handleOnCompleted
Method handleOnCompleted
Definition
qqmltcoutputir_p.h:168
QQmltc::Type::requiredPropertiesBundle
std::optional< RequiredPropertiesBundle > requiredPropertiesBundle
Definition
qqmltcoutputir_p.h:191
QQmltc::Type::children
QList< Type > children
Definition
qqmltcoutputir_p.h:157
QQmltc::Type::finalizeComponent
Method finalizeComponent
Definition
qqmltcoutputir_p.h:167
QQmltc::Type::properties
QList< Property > properties
Definition
qqmltcoutputir_p.h:176
QQmltc::Type::propertyInitializer
PropertyInitializer propertyInitializer
Definition
qqmltcoutputir_p.h:189
QQmltc::Type::otherCode
QStringList otherCode
Definition
qqmltcoutputir_p.h:153
QQmltc::Type::cppType
QString cppType
Definition
qqmltcoutputir_p.h:150
QQmltc::Type::functions
QList< Method > functions
Definition
qqmltcoutputir_p.h:173
QQmltc::Type::ignoreInit
bool ignoreInit
Definition
qqmltcoutputir_p.h:182
QQmltc::Variable
Definition
qqmltcoutputir_p.h:37
QQmltc::Variable::cppType
QString cppType
Definition
qqmltcoutputir_p.h:38
QQmltc::Variable::Variable
Variable()=default
QQmltc::Variable::name
QString name
Definition
qqmltcoutputir_p.h:39
QQmltc::Variable::Variable
Variable(const QString &t, const QString &n, const QString &v=QString())
Definition
qqmltcoutputir_p.h:44
QQmltc::Variable::defaultValue
QString defaultValue
Definition
qqmltcoutputir_p.h:40
qtdeclarative
src
qmltc
qqmltcoutputir_p.h
Generated on
for Qt by
1.18.0