Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/kernel/qmetaobjectbuilder.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||||||||
2 | ** | - | ||||||||||||||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||||||||
4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||
5 | ** | - | ||||||||||||||||||
6 | ** This file is part of the QtCore module of the Qt Toolkit. | - | ||||||||||||||||||
7 | ** | - | ||||||||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||
9 | ** Commercial License Usage | - | ||||||||||||||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||
14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||
15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||||||||
16 | ** | - | ||||||||||||||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||
19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||||||||
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||
22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||
25 | ** | - | ||||||||||||||||||
26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||
29 | ** | - | ||||||||||||||||||
30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||
31 | ** | - | ||||||||||||||||||
32 | ****************************************************************************/ | - | ||||||||||||||||||
33 | - | |||||||||||||||||||
34 | #include "qmetaobjectbuilder_p.h" | - | ||||||||||||||||||
35 | - | |||||||||||||||||||
36 | #include "qobject_p.h" | - | ||||||||||||||||||
37 | #include "qmetaobject_p.h" | - | ||||||||||||||||||
38 | - | |||||||||||||||||||
39 | #include <stdlib.h> | - | ||||||||||||||||||
40 | - | |||||||||||||||||||
41 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
42 | - | |||||||||||||||||||
43 | /*! | - | ||||||||||||||||||
44 | \class QMetaObjectBuilder | - | ||||||||||||||||||
45 | \inmodule QtCore | - | ||||||||||||||||||
46 | \internal | - | ||||||||||||||||||
47 | \brief The QMetaObjectBuilder class supports building QMetaObject objects at runtime. | - | ||||||||||||||||||
48 | - | |||||||||||||||||||
49 | */ | - | ||||||||||||||||||
50 | - | |||||||||||||||||||
51 | /*! | - | ||||||||||||||||||
52 | \enum QMetaObjectBuilder::AddMember | - | ||||||||||||||||||
53 | This enum defines which members of QMetaObject should be copied by QMetaObjectBuilder::addMetaObject() | - | ||||||||||||||||||
54 | - | |||||||||||||||||||
55 | \value ClassName Add the class name. | - | ||||||||||||||||||
56 | \value SuperClass Add the super class. | - | ||||||||||||||||||
57 | \value Methods Add methods that aren't signals or slots. | - | ||||||||||||||||||
58 | \value Signals Add signals. | - | ||||||||||||||||||
59 | \value Slots Add slots. | - | ||||||||||||||||||
60 | \value Constructors Add constructors. | - | ||||||||||||||||||
61 | \value Properties Add properties. | - | ||||||||||||||||||
62 | \value Enumerators Add enumerators. | - | ||||||||||||||||||
63 | \value ClassInfos Add items of class information. | - | ||||||||||||||||||
64 | \value RelatedMetaObjects Add related meta objects. | - | ||||||||||||||||||
65 | \value StaticMetacall Add the static metacall function. | - | ||||||||||||||||||
66 | \value PublicMethods Add public methods (ignored for signals). | - | ||||||||||||||||||
67 | \value ProtectedMethods Add protected methods (ignored for signals). | - | ||||||||||||||||||
68 | \value PrivateMethods All private methods (ignored for signals). | - | ||||||||||||||||||
69 | \value AllMembers Add all members. | - | ||||||||||||||||||
70 | \value AllPrimaryMembers Add everything except the class name, super class, and static metacall function. | - | ||||||||||||||||||
71 | */ | - | ||||||||||||||||||
72 | - | |||||||||||||||||||
73 | // copied from moc's generator.cpp | - | ||||||||||||||||||
74 | namespace QtPrivate { | - | ||||||||||||||||||
75 | Q_CORE_EXPORT bool isBuiltinType(const QByteArray &type) | - | ||||||||||||||||||
76 | { | - | ||||||||||||||||||
77 | int id = QMetaType::type(type); | - | ||||||||||||||||||
78 | if (!id && !type.isEmpty() && type != "void")
| 0-496 | ||||||||||||||||||
79 | return false; executed 48 times by 1 test: return false; Executed by:
| 48 | ||||||||||||||||||
80 | return (id < QMetaType::User); executed 544 times by 1 test: return (id < QMetaType::User); Executed by:
| 544 | ||||||||||||||||||
81 | } | - | ||||||||||||||||||
82 | } // namespace QtPrivate | - | ||||||||||||||||||
83 | - | |||||||||||||||||||
84 | // copied from qmetaobject.cpp | - | ||||||||||||||||||
85 | static inline Q_DECL_UNUSED const QMetaObjectPrivate *priv(const uint* data) | - | ||||||||||||||||||
86 | { executed 10 times by 1 test: return reinterpret_cast<const QMetaObjectPrivate*>(data); }return reinterpret_cast<const QMetaObjectPrivate*>(data); Executed by:
executed 10 times by 1 test: return reinterpret_cast<const QMetaObjectPrivate*>(data); Executed by:
| 10 | ||||||||||||||||||
87 | - | |||||||||||||||||||
88 | class QMetaMethodBuilderPrivate | - | ||||||||||||||||||
89 | { | - | ||||||||||||||||||
90 | public: | - | ||||||||||||||||||
91 | QMetaMethodBuilderPrivate() {} // for QVector, don't use | - | ||||||||||||||||||
92 | QMetaMethodBuilderPrivate | - | ||||||||||||||||||
93 | (QMetaMethod::MethodType _methodType, | - | ||||||||||||||||||
94 | const QByteArray& _signature, | - | ||||||||||||||||||
95 | const QByteArray& _returnType = QByteArray("void"), | - | ||||||||||||||||||
96 | QMetaMethod::Access _access = QMetaMethod::Public, | - | ||||||||||||||||||
97 | int _revision = 0) | - | ||||||||||||||||||
98 | : signature(QMetaObject::normalizedSignature(_signature.constData())), | - | ||||||||||||||||||
99 | returnType(QMetaObject::normalizedType(_returnType)), | - | ||||||||||||||||||
100 | attributes(((int)_access) | (((int)_methodType) << 2)), | - | ||||||||||||||||||
101 | revision(_revision) | - | ||||||||||||||||||
102 | { | - | ||||||||||||||||||
103 | Q_ASSERT((_methodType == QMetaMethod::Constructor) == returnType.isNull()); | - | ||||||||||||||||||
104 | } executed 140 times by 1 test: end of block Executed by:
| 140 | ||||||||||||||||||
105 | - | |||||||||||||||||||
106 | QByteArray signature; | - | ||||||||||||||||||
107 | QByteArray returnType; | - | ||||||||||||||||||
108 | QList<QByteArray> parameterNames; | - | ||||||||||||||||||
109 | QByteArray tag; | - | ||||||||||||||||||
110 | int attributes; | - | ||||||||||||||||||
111 | int revision; | - | ||||||||||||||||||
112 | - | |||||||||||||||||||
113 | QMetaMethod::MethodType methodType() const | - | ||||||||||||||||||
114 | { | - | ||||||||||||||||||
115 | return (QMetaMethod::MethodType)((attributes & MethodTypeMask) >> 2); executed 213 times by 1 test: return (QMetaMethod::MethodType)((attributes & MethodTypeMask) >> 2); Executed by:
| 213 | ||||||||||||||||||
116 | } | - | ||||||||||||||||||
117 | - | |||||||||||||||||||
118 | QMetaMethod::Access access() const | - | ||||||||||||||||||
119 | { | - | ||||||||||||||||||
120 | return (QMetaMethod::Access)(attributes & AccessMask); executed 19 times by 1 test: return (QMetaMethod::Access)(attributes & AccessMask); Executed by:
| 19 | ||||||||||||||||||
121 | } | - | ||||||||||||||||||
122 | - | |||||||||||||||||||
123 | void setAccess(QMetaMethod::Access value) | - | ||||||||||||||||||
124 | { | - | ||||||||||||||||||
125 | attributes = ((attributes & ~AccessMask) | (int)value); | - | ||||||||||||||||||
126 | } executed 60 times by 1 test: end of block Executed by:
| 60 | ||||||||||||||||||
127 | - | |||||||||||||||||||
128 | QList<QByteArray> parameterTypes() const | - | ||||||||||||||||||
129 | { | - | ||||||||||||||||||
130 | return QMetaObjectPrivate::parameterTypeNamesFromSignature(signature); executed 793 times by 1 test: return QMetaObjectPrivate::parameterTypeNamesFromSignature(signature); Executed by:
| 793 | ||||||||||||||||||
131 | } | - | ||||||||||||||||||
132 | - | |||||||||||||||||||
133 | int parameterCount() const | - | ||||||||||||||||||
134 | { | - | ||||||||||||||||||
135 | return parameterTypes().size(); executed 516 times by 1 test: return parameterTypes().size(); Executed by:
| 516 | ||||||||||||||||||
136 | } | - | ||||||||||||||||||
137 | - | |||||||||||||||||||
138 | QByteArray name() const | - | ||||||||||||||||||
139 | { | - | ||||||||||||||||||
140 | return signature.left(qMax(signature.indexOf('('), 0)); executed 258 times by 1 test: return signature.left(qMax(signature.indexOf('('), 0)); Executed by:
| 258 | ||||||||||||||||||
141 | } | - | ||||||||||||||||||
142 | }; | - | ||||||||||||||||||
143 | Q_DECLARE_TYPEINFO(QMetaMethodBuilderPrivate, Q_MOVABLE_TYPE); | - | ||||||||||||||||||
144 | - | |||||||||||||||||||
145 | class QMetaPropertyBuilderPrivate | - | ||||||||||||||||||
146 | { | - | ||||||||||||||||||
147 | public: | - | ||||||||||||||||||
148 | QMetaPropertyBuilderPrivate() {} // for QVector, don't use | - | ||||||||||||||||||
149 | QMetaPropertyBuilderPrivate | - | ||||||||||||||||||
150 | (const QByteArray& _name, const QByteArray& _type, int notifierIdx=-1, | - | ||||||||||||||||||
151 | int _revision = 0) | - | ||||||||||||||||||
152 | : name(_name), | - | ||||||||||||||||||
153 | type(QMetaObject::normalizedType(_type.constData())), | - | ||||||||||||||||||
154 | flags(Readable | Writable | Scriptable), notifySignal(-1), | - | ||||||||||||||||||
155 | revision(_revision) | - | ||||||||||||||||||
156 | { | - | ||||||||||||||||||
157 | if (notifierIdx >= 0) {
| 0-43 | ||||||||||||||||||
158 | flags |= Notify; | - | ||||||||||||||||||
159 | notifySignal = notifierIdx; | - | ||||||||||||||||||
160 | } never executed: end of block | 0 | ||||||||||||||||||
161 | } executed 43 times by 1 test: end of block Executed by:
| 43 | ||||||||||||||||||
162 | - | |||||||||||||||||||
163 | QByteArray name; | - | ||||||||||||||||||
164 | QByteArray type; | - | ||||||||||||||||||
165 | int flags; | - | ||||||||||||||||||
166 | int notifySignal; | - | ||||||||||||||||||
167 | int revision; | - | ||||||||||||||||||
168 | - | |||||||||||||||||||
169 | bool flag(int f) const | - | ||||||||||||||||||
170 | { | - | ||||||||||||||||||
171 | return ((flags & f) != 0); executed 368 times by 1 test: return ((flags & f) != 0); Executed by:
| 368 | ||||||||||||||||||
172 | } | - | ||||||||||||||||||
173 | - | |||||||||||||||||||
174 | void setFlag(int f, bool value) | - | ||||||||||||||||||
175 | { | - | ||||||||||||||||||
176 | if (value)
| 148-302 | ||||||||||||||||||
177 | flags |= f; executed 148 times by 1 test: flags |= f; Executed by:
| 148 | ||||||||||||||||||
178 | else | - | ||||||||||||||||||
179 | flags &= ~f; executed 302 times by 1 test: flags &= ~f; Executed by:
| 302 | ||||||||||||||||||
180 | } | - | ||||||||||||||||||
181 | }; | - | ||||||||||||||||||
182 | Q_DECLARE_TYPEINFO(QMetaPropertyBuilderPrivate, Q_MOVABLE_TYPE); | - | ||||||||||||||||||
183 | - | |||||||||||||||||||
184 | class QMetaEnumBuilderPrivate | - | ||||||||||||||||||
185 | { | - | ||||||||||||||||||
186 | public: | - | ||||||||||||||||||
187 | QMetaEnumBuilderPrivate() {} // for QVector, don't use | - | ||||||||||||||||||
188 | QMetaEnumBuilderPrivate(const QByteArray& _name) | - | ||||||||||||||||||
189 | : name(_name), isFlag(false) | - | ||||||||||||||||||
190 | { | - | ||||||||||||||||||
191 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||
192 | - | |||||||||||||||||||
193 | QByteArray name; | - | ||||||||||||||||||
194 | bool isFlag; | - | ||||||||||||||||||
195 | QList<QByteArray> keys; | - | ||||||||||||||||||
196 | QVector<int> values; | - | ||||||||||||||||||
197 | }; | - | ||||||||||||||||||
198 | Q_DECLARE_TYPEINFO(QMetaEnumBuilderPrivate, Q_MOVABLE_TYPE); | - | ||||||||||||||||||
199 | - | |||||||||||||||||||
200 | class QMetaObjectBuilderPrivate | - | ||||||||||||||||||
201 | { | - | ||||||||||||||||||
202 | public: | - | ||||||||||||||||||
203 | QMetaObjectBuilderPrivate() | - | ||||||||||||||||||
204 | : flags(0) | - | ||||||||||||||||||
205 | { | - | ||||||||||||||||||
206 | superClass = &QObject::staticMetaObject; | - | ||||||||||||||||||
207 | staticMetacallFunction = 0; | - | ||||||||||||||||||
208 | } executed 35 times by 1 test: end of block Executed by:
| 35 | ||||||||||||||||||
209 | - | |||||||||||||||||||
210 | bool hasRevisionedProperties() const; | - | ||||||||||||||||||
211 | bool hasRevisionedMethods() const; | - | ||||||||||||||||||
212 | - | |||||||||||||||||||
213 | QByteArray className; | - | ||||||||||||||||||
214 | const QMetaObject *superClass; | - | ||||||||||||||||||
215 | QMetaObjectBuilder::StaticMetacallFunction staticMetacallFunction; | - | ||||||||||||||||||
216 | QVector<QMetaMethodBuilderPrivate> methods; | - | ||||||||||||||||||
217 | QVector<QMetaMethodBuilderPrivate> constructors; | - | ||||||||||||||||||
218 | QVector<QMetaPropertyBuilderPrivate> properties; | - | ||||||||||||||||||
219 | QList<QByteArray> classInfoNames; | - | ||||||||||||||||||
220 | QList<QByteArray> classInfoValues; | - | ||||||||||||||||||
221 | QVector<QMetaEnumBuilderPrivate> enumerators; | - | ||||||||||||||||||
222 | QList<const QMetaObject *> relatedMetaObjects; | - | ||||||||||||||||||
223 | int flags; | - | ||||||||||||||||||
224 | }; | - | ||||||||||||||||||
225 | - | |||||||||||||||||||
226 | bool QMetaObjectBuilderPrivate::hasRevisionedProperties() const | - | ||||||||||||||||||
227 | { | - | ||||||||||||||||||
228 | for (int i = 0; i < properties.size(); ++i) {
| 28-50 | ||||||||||||||||||
229 | if (properties.at(i).revision)
| 8-42 | ||||||||||||||||||
230 | return true; executed 8 times by 1 test: return true; Executed by:
| 8 | ||||||||||||||||||
231 | } executed 42 times by 1 test: end of block Executed by:
| 42 | ||||||||||||||||||
232 | return false; executed 28 times by 1 test: return false; Executed by:
| 28 | ||||||||||||||||||
233 | } | - | ||||||||||||||||||
234 | - | |||||||||||||||||||
235 | bool QMetaObjectBuilderPrivate::hasRevisionedMethods() const | - | ||||||||||||||||||
236 | { | - | ||||||||||||||||||
237 | for (int i = 0; i < methods.size(); ++i) {
| 28-178 | ||||||||||||||||||
238 | if (methods.at(i).revision)
| 8-170 | ||||||||||||||||||
239 | return true; executed 8 times by 1 test: return true; Executed by:
| 8 | ||||||||||||||||||
240 | } executed 170 times by 1 test: end of block Executed by:
| 170 | ||||||||||||||||||
241 | return false; executed 28 times by 1 test: return false; Executed by:
| 28 | ||||||||||||||||||
242 | } | - | ||||||||||||||||||
243 | - | |||||||||||||||||||
244 | /*! | - | ||||||||||||||||||
245 | Constructs a new QMetaObjectBuilder. | - | ||||||||||||||||||
246 | */ | - | ||||||||||||||||||
247 | QMetaObjectBuilder::QMetaObjectBuilder() | - | ||||||||||||||||||
248 | { | - | ||||||||||||||||||
249 | d = new QMetaObjectBuilderPrivate(); | - | ||||||||||||||||||
250 | } executed 31 times by 1 test: end of block Executed by:
| 31 | ||||||||||||||||||
251 | - | |||||||||||||||||||
252 | /*! | - | ||||||||||||||||||
253 | Constructs a new QMetaObjectBuilder which is a copy of the | - | ||||||||||||||||||
254 | meta object information in \a prototype. Note: the super class | - | ||||||||||||||||||
255 | contents for \a prototype are not copied, only the immediate | - | ||||||||||||||||||
256 | class that is defined by \a prototype. | - | ||||||||||||||||||
257 | - | |||||||||||||||||||
258 | The \a members parameter indicates which members of \a prototype | - | ||||||||||||||||||
259 | should be added. The default is AllMembers. | - | ||||||||||||||||||
260 | - | |||||||||||||||||||
261 | \sa addMetaObject() | - | ||||||||||||||||||
262 | */ | - | ||||||||||||||||||
263 | QMetaObjectBuilder::QMetaObjectBuilder | - | ||||||||||||||||||
264 | (const QMetaObject *prototype, QMetaObjectBuilder::AddMembers members) | - | ||||||||||||||||||
265 | { | - | ||||||||||||||||||
266 | d = new QMetaObjectBuilderPrivate(); | - | ||||||||||||||||||
267 | addMetaObject(prototype, members); | - | ||||||||||||||||||
268 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
269 | - | |||||||||||||||||||
270 | /*! | - | ||||||||||||||||||
271 | Destroys this meta object builder. | - | ||||||||||||||||||
272 | */ | - | ||||||||||||||||||
273 | QMetaObjectBuilder::~QMetaObjectBuilder() | - | ||||||||||||||||||
274 | { | - | ||||||||||||||||||
275 | delete d; | - | ||||||||||||||||||
276 | } executed 35 times by 1 test: end of block Executed by:
| 35 | ||||||||||||||||||
277 | - | |||||||||||||||||||
278 | /*! | - | ||||||||||||||||||
279 | Returns the name of the class being constructed by this | - | ||||||||||||||||||
280 | meta object builder. The default value is an empty QByteArray. | - | ||||||||||||||||||
281 | - | |||||||||||||||||||
282 | \sa setClassName(), superClass() | - | ||||||||||||||||||
283 | */ | - | ||||||||||||||||||
284 | QByteArray QMetaObjectBuilder::className() const | - | ||||||||||||||||||
285 | { | - | ||||||||||||||||||
286 | return d->className; | - | ||||||||||||||||||
287 | } | - | ||||||||||||||||||
288 | - | |||||||||||||||||||
289 | /*! | - | ||||||||||||||||||
290 | Sets the \a name of the class being constructed by this | - | ||||||||||||||||||
291 | meta object builder. | - | ||||||||||||||||||
292 | - | |||||||||||||||||||
293 | \sa className(), setSuperClass() | - | ||||||||||||||||||
294 | */ | - | ||||||||||||||||||
295 | void QMetaObjectBuilder::setClassName(const QByteArray& name) | - | ||||||||||||||||||
296 | { | - | ||||||||||||||||||
297 | d->className = name; | - | ||||||||||||||||||
298 | } executed 14 times by 1 test: end of block Executed by:
| 14 | ||||||||||||||||||
299 | - | |||||||||||||||||||
300 | /*! | - | ||||||||||||||||||
301 | Returns the superclass meta object of the class being constructed | - | ||||||||||||||||||
302 | by this meta object builder. The default value is the meta object | - | ||||||||||||||||||
303 | for QObject. | - | ||||||||||||||||||
304 | - | |||||||||||||||||||
305 | \sa setSuperClass(), className() | - | ||||||||||||||||||
306 | */ | - | ||||||||||||||||||
307 | const QMetaObject *QMetaObjectBuilder::superClass() const | - | ||||||||||||||||||
308 | { | - | ||||||||||||||||||
309 | return d->superClass; executed 18 times by 1 test: return d->superClass; Executed by:
| 18 | ||||||||||||||||||
310 | } | - | ||||||||||||||||||
311 | - | |||||||||||||||||||
312 | /*! | - | ||||||||||||||||||
313 | Sets the superclass meta object of the class being constructed | - | ||||||||||||||||||
314 | by this meta object builder to \a meta. The \a meta parameter | - | ||||||||||||||||||
315 | must not be null. | - | ||||||||||||||||||
316 | - | |||||||||||||||||||
317 | \sa superClass(), setClassName() | - | ||||||||||||||||||
318 | */ | - | ||||||||||||||||||
319 | void QMetaObjectBuilder::setSuperClass(const QMetaObject *meta) | - | ||||||||||||||||||
320 | { | - | ||||||||||||||||||
321 | Q_ASSERT(meta); | - | ||||||||||||||||||
322 | d->superClass = meta; | - | ||||||||||||||||||
323 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
324 | - | |||||||||||||||||||
325 | /*! | - | ||||||||||||||||||
326 | Returns the flags of the class being constructed by this meta object | - | ||||||||||||||||||
327 | builder. | - | ||||||||||||||||||
328 | - | |||||||||||||||||||
329 | \sa setFlags() | - | ||||||||||||||||||
330 | */ | - | ||||||||||||||||||
331 | QMetaObjectBuilder::MetaObjectFlags QMetaObjectBuilder::flags() const | - | ||||||||||||||||||
332 | { | - | ||||||||||||||||||
333 | return (QMetaObjectBuilder::MetaObjectFlags)d->flags; executed 2 times by 1 test: return (QMetaObjectBuilder::MetaObjectFlags)d->flags; Executed by:
| 2 | ||||||||||||||||||
334 | } | - | ||||||||||||||||||
335 | - | |||||||||||||||||||
336 | /*! | - | ||||||||||||||||||
337 | Sets the \a flags of the class being constructed by this meta object | - | ||||||||||||||||||
338 | builder. | - | ||||||||||||||||||
339 | - | |||||||||||||||||||
340 | \sa flags() | - | ||||||||||||||||||
341 | */ | - | ||||||||||||||||||
342 | void QMetaObjectBuilder::setFlags(MetaObjectFlags flags) | - | ||||||||||||||||||
343 | { | - | ||||||||||||||||||
344 | d->flags = flags; | - | ||||||||||||||||||
345 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
346 | - | |||||||||||||||||||
347 | /*! | - | ||||||||||||||||||
348 | Returns the number of methods in this class, excluding the number | - | ||||||||||||||||||
349 | of methods in the base class. These include signals and slots | - | ||||||||||||||||||
350 | as well as normal member functions. | - | ||||||||||||||||||
351 | - | |||||||||||||||||||
352 | \sa addMethod(), method(), removeMethod(), indexOfMethod() | - | ||||||||||||||||||
353 | */ | - | ||||||||||||||||||
354 | int QMetaObjectBuilder::methodCount() const | - | ||||||||||||||||||
355 | { | - | ||||||||||||||||||
356 | return d->methods.size(); executed 20 times by 1 test: return d->methods.size(); Executed by:
| 20 | ||||||||||||||||||
357 | } | - | ||||||||||||||||||
358 | - | |||||||||||||||||||
359 | /*! | - | ||||||||||||||||||
360 | Returns the number of constructors in this class. | - | ||||||||||||||||||
361 | - | |||||||||||||||||||
362 | \sa addConstructor(), constructor(), removeConstructor(), indexOfConstructor() | - | ||||||||||||||||||
363 | */ | - | ||||||||||||||||||
364 | int QMetaObjectBuilder::constructorCount() const | - | ||||||||||||||||||
365 | { | - | ||||||||||||||||||
366 | return d->constructors.size(); executed 18 times by 1 test: return d->constructors.size(); Executed by:
| 18 | ||||||||||||||||||
367 | } | - | ||||||||||||||||||
368 | - | |||||||||||||||||||
369 | /*! | - | ||||||||||||||||||
370 | Returns the number of properties in this class, excluding the number | - | ||||||||||||||||||
371 | of properties in the base class. | - | ||||||||||||||||||
372 | - | |||||||||||||||||||
373 | \sa addProperty(), property(), removeProperty(), indexOfProperty() | - | ||||||||||||||||||
374 | */ | - | ||||||||||||||||||
375 | int QMetaObjectBuilder::propertyCount() const | - | ||||||||||||||||||
376 | { | - | ||||||||||||||||||
377 | return d->properties.size(); executed 17 times by 1 test: return d->properties.size(); Executed by:
| 17 | ||||||||||||||||||
378 | } | - | ||||||||||||||||||
379 | - | |||||||||||||||||||
380 | /*! | - | ||||||||||||||||||
381 | Returns the number of enumerators in this class, excluding the | - | ||||||||||||||||||
382 | number of enumerators in the base class. | - | ||||||||||||||||||
383 | - | |||||||||||||||||||
384 | \sa addEnumerator(), enumerator(), removeEnumerator() | - | ||||||||||||||||||
385 | \sa indexOfEnumerator() | - | ||||||||||||||||||
386 | */ | - | ||||||||||||||||||
387 | int QMetaObjectBuilder::enumeratorCount() const | - | ||||||||||||||||||
388 | { | - | ||||||||||||||||||
389 | return d->enumerators.size(); executed 15 times by 1 test: return d->enumerators.size(); Executed by:
| 15 | ||||||||||||||||||
390 | } | - | ||||||||||||||||||
391 | - | |||||||||||||||||||
392 | /*! | - | ||||||||||||||||||
393 | Returns the number of items of class information in this class, | - | ||||||||||||||||||
394 | exclusing the number of items of class information in the base class. | - | ||||||||||||||||||
395 | - | |||||||||||||||||||
396 | \sa addClassInfo(), classInfoName(), classInfoValue(), removeClassInfo() | - | ||||||||||||||||||
397 | \sa indexOfClassInfo() | - | ||||||||||||||||||
398 | */ | - | ||||||||||||||||||
399 | int QMetaObjectBuilder::classInfoCount() const | - | ||||||||||||||||||
400 | { | - | ||||||||||||||||||
401 | return d->classInfoNames.size(); executed 14 times by 1 test: return d->classInfoNames.size(); Executed by:
| 14 | ||||||||||||||||||
402 | } | - | ||||||||||||||||||
403 | - | |||||||||||||||||||
404 | /*! | - | ||||||||||||||||||
405 | Returns the number of related meta objects that are associated | - | ||||||||||||||||||
406 | with this class. | - | ||||||||||||||||||
407 | - | |||||||||||||||||||
408 | Related meta objects are used when resolving the enumerated type | - | ||||||||||||||||||
409 | associated with a property, where the enumerated type is in a | - | ||||||||||||||||||
410 | different class from the property. | - | ||||||||||||||||||
411 | - | |||||||||||||||||||
412 | \sa addRelatedMetaObject(), relatedMetaObject() | - | ||||||||||||||||||
413 | \sa removeRelatedMetaObject() | - | ||||||||||||||||||
414 | */ | - | ||||||||||||||||||
415 | int QMetaObjectBuilder::relatedMetaObjectCount() const | - | ||||||||||||||||||
416 | { | - | ||||||||||||||||||
417 | return d->relatedMetaObjects.size(); executed 14 times by 1 test: return d->relatedMetaObjects.size(); Executed by:
| 14 | ||||||||||||||||||
418 | } | - | ||||||||||||||||||
419 | - | |||||||||||||||||||
420 | /*! | - | ||||||||||||||||||
421 | Adds a new public method to this class with the specified \a signature. | - | ||||||||||||||||||
422 | Returns an object that can be used to adjust the other attributes | - | ||||||||||||||||||
423 | of the method. The \a signature will be normalized before it is | - | ||||||||||||||||||
424 | added to the class. | - | ||||||||||||||||||
425 | - | |||||||||||||||||||
426 | \sa method(), methodCount(), removeMethod(), indexOfMethod() | - | ||||||||||||||||||
427 | */ | - | ||||||||||||||||||
428 | QMetaMethodBuilder QMetaObjectBuilder::addMethod(const QByteArray& signature) | - | ||||||||||||||||||
429 | { | - | ||||||||||||||||||
430 | int index = d->methods.size(); | - | ||||||||||||||||||
431 | d->methods.append(QMetaMethodBuilderPrivate(QMetaMethod::Method, signature)); | - | ||||||||||||||||||
432 | return QMetaMethodBuilder(this, index); executed 24 times by 1 test: return QMetaMethodBuilder(this, index); Executed by:
| 24 | ||||||||||||||||||
433 | } | - | ||||||||||||||||||
434 | - | |||||||||||||||||||
435 | /*! | - | ||||||||||||||||||
436 | Adds a new public method to this class with the specified | - | ||||||||||||||||||
437 | \a signature and \a returnType. Returns an object that can be | - | ||||||||||||||||||
438 | used to adjust the other attributes of the method. The \a signature | - | ||||||||||||||||||
439 | and \a returnType will be normalized before they are added to | - | ||||||||||||||||||
440 | the class. | - | ||||||||||||||||||
441 | - | |||||||||||||||||||
442 | \sa method(), methodCount(), removeMethod(), indexOfMethod() | - | ||||||||||||||||||
443 | */ | - | ||||||||||||||||||
444 | QMetaMethodBuilder QMetaObjectBuilder::addMethod | - | ||||||||||||||||||
445 | (const QByteArray& signature, const QByteArray& returnType) | - | ||||||||||||||||||
446 | { | - | ||||||||||||||||||
447 | int index = d->methods.size(); | - | ||||||||||||||||||
448 | d->methods.append(QMetaMethodBuilderPrivate | - | ||||||||||||||||||
449 | (QMetaMethod::Method, signature, returnType)); | - | ||||||||||||||||||
450 | return QMetaMethodBuilder(this, index); executed 1 time by 1 test: return QMetaMethodBuilder(this, index); Executed by:
| 1 | ||||||||||||||||||
451 | } | - | ||||||||||||||||||
452 | - | |||||||||||||||||||
453 | /*! | - | ||||||||||||||||||
454 | Adds a new public method to this class that has the same information as | - | ||||||||||||||||||
455 | \a prototype. This is used to clone the methods of an existing | - | ||||||||||||||||||
456 | QMetaObject. Returns an object that can be used to adjust the | - | ||||||||||||||||||
457 | attributes of the method. | - | ||||||||||||||||||
458 | - | |||||||||||||||||||
459 | This function will detect if \a prototype is an ordinary method, | - | ||||||||||||||||||
460 | signal, slot, or constructor and act accordingly. | - | ||||||||||||||||||
461 | - | |||||||||||||||||||
462 | \sa method(), methodCount(), removeMethod(), indexOfMethod() | - | ||||||||||||||||||
463 | */ | - | ||||||||||||||||||
464 | QMetaMethodBuilder QMetaObjectBuilder::addMethod(const QMetaMethod& prototype) | - | ||||||||||||||||||
465 | { | - | ||||||||||||||||||
466 | QMetaMethodBuilder method; | - | ||||||||||||||||||
467 | if (prototype.methodType() == QMetaMethod::Method)
| 3-61 | ||||||||||||||||||
468 | method = addMethod(prototype.methodSignature()); executed 3 times by 1 test: method = addMethod(prototype.methodSignature()); Executed by:
| 3 | ||||||||||||||||||
469 | else if (prototype.methodType() == QMetaMethod::Signal)
| 13-48 | ||||||||||||||||||
470 | method = addSignal(prototype.methodSignature()); executed 13 times by 1 test: method = addSignal(prototype.methodSignature()); Executed by:
| 13 | ||||||||||||||||||
471 | else if (prototype.methodType() == QMetaMethod::Slot)
| 1-47 | ||||||||||||||||||
472 | method = addSlot(prototype.methodSignature()); executed 47 times by 1 test: method = addSlot(prototype.methodSignature()); Executed by:
| 47 | ||||||||||||||||||
473 | else if (prototype.methodType() == QMetaMethod::Constructor)
| 0-1 | ||||||||||||||||||
474 | method = addConstructor(prototype.methodSignature()); executed 1 time by 1 test: method = addConstructor(prototype.methodSignature()); Executed by:
| 1 | ||||||||||||||||||
475 | method.setReturnType(prototype.typeName()); | - | ||||||||||||||||||
476 | method.setParameterNames(prototype.parameterNames()); | - | ||||||||||||||||||
477 | method.setTag(prototype.tag()); | - | ||||||||||||||||||
478 | method.setAccess(prototype.access()); | - | ||||||||||||||||||
479 | method.setAttributes(prototype.attributes()); | - | ||||||||||||||||||
480 | method.setRevision(prototype.revision()); | - | ||||||||||||||||||
481 | return method; executed 64 times by 1 test: return method; Executed by:
| 64 | ||||||||||||||||||
482 | } | - | ||||||||||||||||||
483 | - | |||||||||||||||||||
484 | /*! | - | ||||||||||||||||||
485 | Adds a new public slot to this class with the specified \a signature. | - | ||||||||||||||||||
486 | Returns an object that can be used to adjust the other attributes | - | ||||||||||||||||||
487 | of the slot. The \a signature will be normalized before it is | - | ||||||||||||||||||
488 | added to the class. | - | ||||||||||||||||||
489 | - | |||||||||||||||||||
490 | \sa addMethod(), addSignal(), indexOfSlot() | - | ||||||||||||||||||
491 | */ | - | ||||||||||||||||||
492 | QMetaMethodBuilder QMetaObjectBuilder::addSlot(const QByteArray& signature) | - | ||||||||||||||||||
493 | { | - | ||||||||||||||||||
494 | int index = d->methods.size(); | - | ||||||||||||||||||
495 | d->methods.append(QMetaMethodBuilderPrivate(QMetaMethod::Slot, signature)); | - | ||||||||||||||||||
496 | return QMetaMethodBuilder(this, index); executed 60 times by 1 test: return QMetaMethodBuilder(this, index); Executed by:
| 60 | ||||||||||||||||||
497 | } | - | ||||||||||||||||||
498 | - | |||||||||||||||||||
499 | /*! | - | ||||||||||||||||||
500 | Adds a new signal to this class with the specified \a signature. | - | ||||||||||||||||||
501 | Returns an object that can be used to adjust the other attributes | - | ||||||||||||||||||
502 | of the signal. The \a signature will be normalized before it is | - | ||||||||||||||||||
503 | added to the class. | - | ||||||||||||||||||
504 | - | |||||||||||||||||||
505 | \sa addMethod(), addSlot(), indexOfSignal() | - | ||||||||||||||||||
506 | */ | - | ||||||||||||||||||
507 | QMetaMethodBuilder QMetaObjectBuilder::addSignal(const QByteArray& signature) | - | ||||||||||||||||||
508 | { | - | ||||||||||||||||||
509 | int index = d->methods.size(); | - | ||||||||||||||||||
510 | d->methods.append(QMetaMethodBuilderPrivate | - | ||||||||||||||||||
511 | (QMetaMethod::Signal, signature, QByteArray("void"), QMetaMethod::Public)); | - | ||||||||||||||||||
512 | return QMetaMethodBuilder(this, index); executed 28 times by 1 test: return QMetaMethodBuilder(this, index); Executed by:
| 28 | ||||||||||||||||||
513 | } | - | ||||||||||||||||||
514 | - | |||||||||||||||||||
515 | /*! | - | ||||||||||||||||||
516 | Adds a new constructor to this class with the specified \a signature. | - | ||||||||||||||||||
517 | Returns an object that can be used to adjust the other attributes | - | ||||||||||||||||||
518 | of the constructor. The \a signature will be normalized before it is | - | ||||||||||||||||||
519 | added to the class. | - | ||||||||||||||||||
520 | - | |||||||||||||||||||
521 | \sa constructor(), constructorCount(), removeConstructor() | - | ||||||||||||||||||
522 | \sa indexOfConstructor() | - | ||||||||||||||||||
523 | */ | - | ||||||||||||||||||
524 | QMetaMethodBuilder QMetaObjectBuilder::addConstructor(const QByteArray& signature) | - | ||||||||||||||||||
525 | { | - | ||||||||||||||||||
526 | int index = d->constructors.size(); | - | ||||||||||||||||||
527 | d->constructors.append(QMetaMethodBuilderPrivate(QMetaMethod::Constructor, signature, | - | ||||||||||||||||||
528 | /*returnType=*/QByteArray())); | - | ||||||||||||||||||
529 | return QMetaMethodBuilder(this, -(index + 1)); executed 27 times by 1 test: return QMetaMethodBuilder(this, -(index + 1)); Executed by:
| 27 | ||||||||||||||||||
530 | } | - | ||||||||||||||||||
531 | - | |||||||||||||||||||
532 | /*! | - | ||||||||||||||||||
533 | Adds a new constructor to this class that has the same information as | - | ||||||||||||||||||
534 | \a prototype. This is used to clone the constructors of an existing | - | ||||||||||||||||||
535 | QMetaObject. Returns an object that can be used to adjust the | - | ||||||||||||||||||
536 | attributes of the constructor. | - | ||||||||||||||||||
537 | - | |||||||||||||||||||
538 | This function requires that \a prototype be a constructor. | - | ||||||||||||||||||
539 | - | |||||||||||||||||||
540 | \sa constructor(), constructorCount(), removeConstructor() | - | ||||||||||||||||||
541 | \sa indexOfConstructor() | - | ||||||||||||||||||
542 | */ | - | ||||||||||||||||||
543 | QMetaMethodBuilder QMetaObjectBuilder::addConstructor(const QMetaMethod& prototype) | - | ||||||||||||||||||
544 | { | - | ||||||||||||||||||
545 | Q_ASSERT(prototype.methodType() == QMetaMethod::Constructor); | - | ||||||||||||||||||
546 | QMetaMethodBuilder ctor = addConstructor(prototype.methodSignature()); | - | ||||||||||||||||||
547 | ctor.setReturnType(prototype.typeName()); | - | ||||||||||||||||||
548 | ctor.setParameterNames(prototype.parameterNames()); | - | ||||||||||||||||||
549 | ctor.setTag(prototype.tag()); | - | ||||||||||||||||||
550 | ctor.setAccess(prototype.access()); | - | ||||||||||||||||||
551 | ctor.setAttributes(prototype.attributes()); | - | ||||||||||||||||||
552 | return ctor; executed 5 times by 1 test: return ctor; Executed by:
| 5 | ||||||||||||||||||
553 | } | - | ||||||||||||||||||
554 | - | |||||||||||||||||||
555 | /*! | - | ||||||||||||||||||
556 | Adds a new readable/writable property to this class with the | - | ||||||||||||||||||
557 | specified \a name and \a type. Returns an object that can be used | - | ||||||||||||||||||
558 | to adjust the other attributes of the property. The \a type will | - | ||||||||||||||||||
559 | be normalized before it is added to the class. \a notifierId will | - | ||||||||||||||||||
560 | be registered as the property's \e notify signal. | - | ||||||||||||||||||
561 | - | |||||||||||||||||||
562 | \sa property(), propertyCount(), removeProperty(), indexOfProperty() | - | ||||||||||||||||||
563 | */ | - | ||||||||||||||||||
564 | QMetaPropertyBuilder QMetaObjectBuilder::addProperty | - | ||||||||||||||||||
565 | (const QByteArray& name, const QByteArray& type, int notifierId) | - | ||||||||||||||||||
566 | { | - | ||||||||||||||||||
567 | int index = d->properties.size(); | - | ||||||||||||||||||
568 | d->properties.append(QMetaPropertyBuilderPrivate(name, type, notifierId)); | - | ||||||||||||||||||
569 | return QMetaPropertyBuilder(this, index); executed 43 times by 1 test: return QMetaPropertyBuilder(this, index); Executed by:
| 43 | ||||||||||||||||||
570 | } | - | ||||||||||||||||||
571 | - | |||||||||||||||||||
572 | /*! | - | ||||||||||||||||||
573 | Adds a new property to this class that has the same information as | - | ||||||||||||||||||
574 | \a prototype. This is used to clone the properties of an existing | - | ||||||||||||||||||
575 | QMetaObject. Returns an object that can be used to adjust the | - | ||||||||||||||||||
576 | attributes of the property. | - | ||||||||||||||||||
577 | - | |||||||||||||||||||
578 | \sa property(), propertyCount(), removeProperty(), indexOfProperty() | - | ||||||||||||||||||
579 | */ | - | ||||||||||||||||||
580 | QMetaPropertyBuilder QMetaObjectBuilder::addProperty(const QMetaProperty& prototype) | - | ||||||||||||||||||
581 | { | - | ||||||||||||||||||
582 | QMetaPropertyBuilder property = addProperty(prototype.name(), prototype.typeName()); | - | ||||||||||||||||||
583 | property.setReadable(prototype.isReadable()); | - | ||||||||||||||||||
584 | property.setWritable(prototype.isWritable()); | - | ||||||||||||||||||
585 | property.setResettable(prototype.isResettable()); | - | ||||||||||||||||||
586 | property.setDesignable(prototype.isDesignable()); | - | ||||||||||||||||||
587 | property.setScriptable(prototype.isScriptable()); | - | ||||||||||||||||||
588 | property.setStored(prototype.isStored()); | - | ||||||||||||||||||
589 | property.setEditable(prototype.isEditable()); | - | ||||||||||||||||||
590 | property.setUser(prototype.isUser()); | - | ||||||||||||||||||
591 | property.setStdCppSet(prototype.hasStdCppSet()); | - | ||||||||||||||||||
592 | property.setEnumOrFlag(prototype.isEnumType()); | - | ||||||||||||||||||
593 | property.setConstant(prototype.isConstant()); | - | ||||||||||||||||||
594 | property.setFinal(prototype.isFinal()); | - | ||||||||||||||||||
595 | property.setRevision(prototype.revision()); | - | ||||||||||||||||||
596 | if (prototype.hasNotifySignal()) {
| 5-15 | ||||||||||||||||||
597 | // Find an existing method for the notify signal, or add a new one. | - | ||||||||||||||||||
598 | QMetaMethod method = prototype.notifySignal(); | - | ||||||||||||||||||
599 | int index = indexOfMethod(method.methodSignature()); | - | ||||||||||||||||||
600 | if (index == -1)
| 1-4 | ||||||||||||||||||
601 | index = addMethod(method).index(); executed 1 time by 1 test: index = addMethod(method).index(); Executed by:
| 1 | ||||||||||||||||||
602 | d->properties[property._index].notifySignal = index; | - | ||||||||||||||||||
603 | d->properties[property._index].setFlag(Notify, true); | - | ||||||||||||||||||
604 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
605 | return property; executed 20 times by 1 test: return property; Executed by:
| 20 | ||||||||||||||||||
606 | } | - | ||||||||||||||||||
607 | - | |||||||||||||||||||
608 | /*! | - | ||||||||||||||||||
609 | Adds a new enumerator to this class with the specified | - | ||||||||||||||||||
610 | \a name. Returns an object that can be used to adjust | - | ||||||||||||||||||
611 | the other attributes of the enumerator. | - | ||||||||||||||||||
612 | - | |||||||||||||||||||
613 | \sa enumerator(), enumeratorCount(), removeEnumerator() | - | ||||||||||||||||||
614 | \sa indexOfEnumerator() | - | ||||||||||||||||||
615 | */ | - | ||||||||||||||||||
616 | QMetaEnumBuilder QMetaObjectBuilder::addEnumerator(const QByteArray& name) | - | ||||||||||||||||||
617 | { | - | ||||||||||||||||||
618 | int index = d->enumerators.size(); | - | ||||||||||||||||||
619 | d->enumerators.append(QMetaEnumBuilderPrivate(name)); | - | ||||||||||||||||||
620 | return QMetaEnumBuilder(this, index); executed 10 times by 1 test: return QMetaEnumBuilder(this, index); Executed by:
| 10 | ||||||||||||||||||
621 | } | - | ||||||||||||||||||
622 | - | |||||||||||||||||||
623 | /*! | - | ||||||||||||||||||
624 | Adds a new enumerator to this class that has the same information as | - | ||||||||||||||||||
625 | \a prototype. This is used to clone the enumerators of an existing | - | ||||||||||||||||||
626 | QMetaObject. Returns an object that can be used to adjust the | - | ||||||||||||||||||
627 | attributes of the enumerator. | - | ||||||||||||||||||
628 | - | |||||||||||||||||||
629 | \sa enumerator(), enumeratorCount(), removeEnumerator() | - | ||||||||||||||||||
630 | \sa indexOfEnumerator() | - | ||||||||||||||||||
631 | */ | - | ||||||||||||||||||
632 | QMetaEnumBuilder QMetaObjectBuilder::addEnumerator(const QMetaEnum& prototype) | - | ||||||||||||||||||
633 | { | - | ||||||||||||||||||
634 | QMetaEnumBuilder en = addEnumerator(prototype.name()); | - | ||||||||||||||||||
635 | en.setIsFlag(prototype.isFlag()); | - | ||||||||||||||||||
636 | int count = prototype.keyCount(); | - | ||||||||||||||||||
637 | for (int index = 0; index < count; ++index)
| 6-12 | ||||||||||||||||||
638 | en.addKey(prototype.key(index), prototype.value(index)); executed 12 times by 1 test: en.addKey(prototype.key(index), prototype.value(index)); Executed by:
| 12 | ||||||||||||||||||
639 | return en; executed 6 times by 1 test: return en; Executed by:
| 6 | ||||||||||||||||||
640 | } | - | ||||||||||||||||||
641 | - | |||||||||||||||||||
642 | /*! | - | ||||||||||||||||||
643 | Adds \a name and \a value as an item of class information to this class. | - | ||||||||||||||||||
644 | Returns the index of the new item of class information. | - | ||||||||||||||||||
645 | - | |||||||||||||||||||
646 | \sa classInfoCount(), classInfoName(), classInfoValue(), removeClassInfo() | - | ||||||||||||||||||
647 | \sa indexOfClassInfo() | - | ||||||||||||||||||
648 | */ | - | ||||||||||||||||||
649 | int QMetaObjectBuilder::addClassInfo(const QByteArray& name, const QByteArray& value) | - | ||||||||||||||||||
650 | { | - | ||||||||||||||||||
651 | int index = d->classInfoNames.size(); | - | ||||||||||||||||||
652 | d->classInfoNames += name; | - | ||||||||||||||||||
653 | d->classInfoValues += value; | - | ||||||||||||||||||
654 | return index; executed 10 times by 1 test: return index; Executed by:
| 10 | ||||||||||||||||||
655 | } | - | ||||||||||||||||||
656 | - | |||||||||||||||||||
657 | /*! | - | ||||||||||||||||||
658 | Adds \a meta to this class as a related meta object. Returns | - | ||||||||||||||||||
659 | the index of the new related meta object entry. | - | ||||||||||||||||||
660 | - | |||||||||||||||||||
661 | Related meta objects are used when resolving the enumerated type | - | ||||||||||||||||||
662 | associated with a property, where the enumerated type is in a | - | ||||||||||||||||||
663 | different class from the property. | - | ||||||||||||||||||
664 | - | |||||||||||||||||||
665 | \sa relatedMetaObjectCount(), relatedMetaObject() | - | ||||||||||||||||||
666 | \sa removeRelatedMetaObject() | - | ||||||||||||||||||
667 | */ | - | ||||||||||||||||||
668 | int QMetaObjectBuilder::addRelatedMetaObject(const QMetaObject *meta) | - | ||||||||||||||||||
669 | { | - | ||||||||||||||||||
670 | Q_ASSERT(meta); | - | ||||||||||||||||||
671 | int index = d->relatedMetaObjects.size(); | - | ||||||||||||||||||
672 | d->relatedMetaObjects.append(meta); | - | ||||||||||||||||||
673 | return index; executed 6 times by 1 test: return index; Executed by:
| 6 | ||||||||||||||||||
674 | } | - | ||||||||||||||||||
675 | - | |||||||||||||||||||
676 | /*! | - | ||||||||||||||||||
677 | Adds the contents of \a prototype to this meta object builder. | - | ||||||||||||||||||
678 | This function is useful for cloning the contents of an existing QMetaObject. | - | ||||||||||||||||||
679 | - | |||||||||||||||||||
680 | The \a members parameter indicates which members of \a prototype | - | ||||||||||||||||||
681 | should be added. The default is AllMembers. | - | ||||||||||||||||||
682 | */ | - | ||||||||||||||||||
683 | void QMetaObjectBuilder::addMetaObject | - | ||||||||||||||||||
684 | (const QMetaObject *prototype, QMetaObjectBuilder::AddMembers members) | - | ||||||||||||||||||
685 | { | - | ||||||||||||||||||
686 | Q_ASSERT(prototype); | - | ||||||||||||||||||
687 | int index; | - | ||||||||||||||||||
688 | - | |||||||||||||||||||
689 | if ((members & ClassName) != 0)
| 2-6 | ||||||||||||||||||
690 | d->className = prototype->className(); executed 6 times by 1 test: d->className = prototype->className(); Executed by:
| 6 | ||||||||||||||||||
691 | - | |||||||||||||||||||
692 | if ((members & SuperClass) != 0)
| 1-7 | ||||||||||||||||||
693 | d->superClass = prototype->superClass(); executed 7 times by 1 test: d->superClass = prototype->superClass(); Executed by:
| 7 | ||||||||||||||||||
694 | - | |||||||||||||||||||
695 | if ((members & (Methods | Signals | Slots)) != 0) {
| 3-5 | ||||||||||||||||||
696 | for (index = prototype->methodOffset(); index < prototype->methodCount(); ++index) {
| 5-62 | ||||||||||||||||||
697 | QMetaMethod method = prototype->method(index); | - | ||||||||||||||||||
698 | if (method.methodType() != QMetaMethod::Signal) {
| 12-50 | ||||||||||||||||||
699 | if (method.access() == QMetaMethod::Public && (members & PublicMethods) == 0)
| 0-37 | ||||||||||||||||||
700 | continue; never executed: continue; | 0 | ||||||||||||||||||
701 | if (method.access() == QMetaMethod::Private && (members & PrivateMethods) == 0)
| 0-31 | ||||||||||||||||||
702 | continue; never executed: continue; | 0 | ||||||||||||||||||
703 | if (method.access() == QMetaMethod::Protected && (members & ProtectedMethods) == 0)
| 0-44 | ||||||||||||||||||
704 | continue; never executed: continue; | 0 | ||||||||||||||||||
705 | } executed 50 times by 1 test: end of block Executed by:
| 50 | ||||||||||||||||||
706 | if (method.methodType() == QMetaMethod::Method && (members & Methods) != 0) {
| 0-59 | ||||||||||||||||||
707 | addMethod(method); | - | ||||||||||||||||||
708 | } else if (method.methodType() == QMetaMethod::Signal && executed 3 times by 1 test: end of block Executed by:
| 3-47 | ||||||||||||||||||
709 | (members & Signals) != 0) {
| 0-12 | ||||||||||||||||||
710 | addMethod(method); | - | ||||||||||||||||||
711 | } else if (method.methodType() == QMetaMethod::Slot && executed 12 times by 1 test: end of block Executed by:
| 0-47 | ||||||||||||||||||
712 | (members & Slots) != 0) {
| 0-47 | ||||||||||||||||||
713 | addMethod(method); | - | ||||||||||||||||||
714 | } executed 47 times by 1 test: end of block Executed by:
| 47 | ||||||||||||||||||
715 | } executed 62 times by 1 test: end of block Executed by:
| 62 | ||||||||||||||||||
716 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
717 | - | |||||||||||||||||||
718 | if ((members & Constructors) != 0) {
| 3-5 | ||||||||||||||||||
719 | for (index = 0; index < prototype->constructorCount(); ++index)
| 5 | ||||||||||||||||||
720 | addConstructor(prototype->constructor(index)); executed 5 times by 1 test: addConstructor(prototype->constructor(index)); Executed by:
| 5 | ||||||||||||||||||
721 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
722 | - | |||||||||||||||||||
723 | if ((members & Properties) != 0) {
| 3-5 | ||||||||||||||||||
724 | for (index = prototype->propertyOffset(); index < prototype->propertyCount(); ++index)
| 5-19 | ||||||||||||||||||
725 | addProperty(prototype->property(index)); executed 19 times by 1 test: addProperty(prototype->property(index)); Executed by:
| 19 | ||||||||||||||||||
726 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
727 | - | |||||||||||||||||||
728 | if ((members & Enumerators) != 0) {
| 3-5 | ||||||||||||||||||
729 | for (index = prototype->enumeratorOffset(); index < prototype->enumeratorCount(); ++index)
| 5-6 | ||||||||||||||||||
730 | addEnumerator(prototype->enumerator(index)); executed 6 times by 1 test: addEnumerator(prototype->enumerator(index)); Executed by:
| 6 | ||||||||||||||||||
731 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
732 | - | |||||||||||||||||||
733 | if ((members & ClassInfos) != 0) {
| 3-5 | ||||||||||||||||||
734 | for (index = prototype->classInfoOffset(); index < prototype->classInfoCount(); ++index) {
| 5-6 | ||||||||||||||||||
735 | QMetaClassInfo ci = prototype->classInfo(index); | - | ||||||||||||||||||
736 | addClassInfo(ci.name(), ci.value()); | - | ||||||||||||||||||
737 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||
738 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
739 | - | |||||||||||||||||||
740 | if ((members & RelatedMetaObjects) != 0) {
| 3-5 | ||||||||||||||||||
741 | Q_ASSERT(priv(prototype->d.data)->revision >= 2); | - | ||||||||||||||||||
742 | const QMetaObject * const *objects = prototype->d.relatedMetaObjects; | - | ||||||||||||||||||
743 | if (objects) {
| 2-3 | ||||||||||||||||||
744 | while (*objects != 0) {
| 3 | ||||||||||||||||||
745 | addRelatedMetaObject(*objects); | - | ||||||||||||||||||
746 | ++objects; | - | ||||||||||||||||||
747 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||
748 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||
749 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
750 | - | |||||||||||||||||||
751 | if ((members & StaticMetacall) != 0) {
| 3-5 | ||||||||||||||||||
752 | Q_ASSERT(priv(prototype->d.data)->revision >= 6); | - | ||||||||||||||||||
753 | if (prototype->d.static_metacall)
| 0-5 | ||||||||||||||||||
754 | setStaticMetacallFunction(prototype->d.static_metacall); executed 5 times by 1 test: setStaticMetacallFunction(prototype->d.static_metacall); Executed by:
| 5 | ||||||||||||||||||
755 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
756 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
757 | - | |||||||||||||||||||
758 | /*! | - | ||||||||||||||||||
759 | Returns the method at \a index in this class. | - | ||||||||||||||||||
760 | - | |||||||||||||||||||
761 | \sa methodCount(), addMethod(), removeMethod(), indexOfMethod() | - | ||||||||||||||||||
762 | */ | - | ||||||||||||||||||
763 | QMetaMethodBuilder QMetaObjectBuilder::method(int index) const | - | ||||||||||||||||||
764 | { | - | ||||||||||||||||||
765 | if (index >= 0 && index < d->methods.size())
| 0-4 | ||||||||||||||||||
766 | return QMetaMethodBuilder(this, index); executed 3 times by 1 test: return QMetaMethodBuilder(this, index); Executed by:
| 3 | ||||||||||||||||||
767 | else | - | ||||||||||||||||||
768 | return QMetaMethodBuilder(); executed 1 time by 1 test: return QMetaMethodBuilder(); Executed by:
| 1 | ||||||||||||||||||
769 | } | - | ||||||||||||||||||
770 | - | |||||||||||||||||||
771 | /*! | - | ||||||||||||||||||
772 | Returns the constructor at \a index in this class. | - | ||||||||||||||||||
773 | - | |||||||||||||||||||
774 | \sa methodCount(), addMethod(), removeMethod(), indexOfConstructor() | - | ||||||||||||||||||
775 | */ | - | ||||||||||||||||||
776 | QMetaMethodBuilder QMetaObjectBuilder::constructor(int index) const | - | ||||||||||||||||||
777 | { | - | ||||||||||||||||||
778 | if (index >= 0 && index < d->constructors.size())
| 0-3 | ||||||||||||||||||
779 | return QMetaMethodBuilder(this, -(index + 1)); executed 2 times by 1 test: return QMetaMethodBuilder(this, -(index + 1)); Executed by:
| 2 | ||||||||||||||||||
780 | else | - | ||||||||||||||||||
781 | return QMetaMethodBuilder(); executed 1 time by 1 test: return QMetaMethodBuilder(); Executed by:
| 1 | ||||||||||||||||||
782 | } | - | ||||||||||||||||||
783 | - | |||||||||||||||||||
784 | /*! | - | ||||||||||||||||||
785 | Returns the property at \a index in this class. | - | ||||||||||||||||||
786 | - | |||||||||||||||||||
787 | \sa methodCount(), addMethod(), removeMethod(), indexOfProperty() | - | ||||||||||||||||||
788 | */ | - | ||||||||||||||||||
789 | QMetaPropertyBuilder QMetaObjectBuilder::property(int index) const | - | ||||||||||||||||||
790 | { | - | ||||||||||||||||||
791 | if (index >= 0 && index < d->properties.size())
| 0-7 | ||||||||||||||||||
792 | return QMetaPropertyBuilder(this, index); executed 6 times by 1 test: return QMetaPropertyBuilder(this, index); Executed by:
| 6 | ||||||||||||||||||
793 | else | - | ||||||||||||||||||
794 | return QMetaPropertyBuilder(); executed 1 time by 1 test: return QMetaPropertyBuilder(); Executed by:
| 1 | ||||||||||||||||||
795 | } | - | ||||||||||||||||||
796 | - | |||||||||||||||||||
797 | /*! | - | ||||||||||||||||||
798 | Returns the enumerator at \a index in this class. | - | ||||||||||||||||||
799 | - | |||||||||||||||||||
800 | \sa enumeratorCount(), addEnumerator(), removeEnumerator() | - | ||||||||||||||||||
801 | \sa indexOfEnumerator() | - | ||||||||||||||||||
802 | */ | - | ||||||||||||||||||
803 | QMetaEnumBuilder QMetaObjectBuilder::enumerator(int index) const | - | ||||||||||||||||||
804 | { | - | ||||||||||||||||||
805 | if (index >= 0 && index < d->enumerators.size())
| 0-3 | ||||||||||||||||||
806 | return QMetaEnumBuilder(this, index); executed 2 times by 1 test: return QMetaEnumBuilder(this, index); Executed by:
| 2 | ||||||||||||||||||
807 | else | - | ||||||||||||||||||
808 | return QMetaEnumBuilder(); executed 1 time by 1 test: return QMetaEnumBuilder(); Executed by:
| 1 | ||||||||||||||||||
809 | } | - | ||||||||||||||||||
810 | - | |||||||||||||||||||
811 | /*! | - | ||||||||||||||||||
812 | Returns the related meta object at \a index in this class. | - | ||||||||||||||||||
813 | - | |||||||||||||||||||
814 | Related meta objects are used when resolving the enumerated type | - | ||||||||||||||||||
815 | associated with a property, where the enumerated type is in a | - | ||||||||||||||||||
816 | different class from the property. | - | ||||||||||||||||||
817 | - | |||||||||||||||||||
818 | \sa relatedMetaObjectCount(), addRelatedMetaObject() | - | ||||||||||||||||||
819 | \sa removeRelatedMetaObject() | - | ||||||||||||||||||
820 | */ | - | ||||||||||||||||||
821 | const QMetaObject *QMetaObjectBuilder::relatedMetaObject(int index) const | - | ||||||||||||||||||
822 | { | - | ||||||||||||||||||
823 | if (index >= 0 && index < d->relatedMetaObjects.size())
| 0-3 | ||||||||||||||||||
824 | return d->relatedMetaObjects[index]; executed 3 times by 1 test: return d->relatedMetaObjects[index]; Executed by:
| 3 | ||||||||||||||||||
825 | else | - | ||||||||||||||||||
826 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
827 | } | - | ||||||||||||||||||
828 | - | |||||||||||||||||||
829 | /*! | - | ||||||||||||||||||
830 | Returns the name of the item of class information at \a index | - | ||||||||||||||||||
831 | in this class. | - | ||||||||||||||||||
832 | - | |||||||||||||||||||
833 | \sa classInfoCount(), addClassInfo(), classInfoValue(), removeClassInfo() | - | ||||||||||||||||||
834 | \sa indexOfClassInfo() | - | ||||||||||||||||||
835 | */ | - | ||||||||||||||||||
836 | QByteArray QMetaObjectBuilder::classInfoName(int index) const | - | ||||||||||||||||||
837 | { | - | ||||||||||||||||||
838 | if (index >= 0 && index < d->classInfoNames.size())
| 0-4 | ||||||||||||||||||
839 | return d->classInfoNames[index]; executed 3 times by 1 test: return d->classInfoNames[index]; Executed by:
| 3 | ||||||||||||||||||
840 | else | - | ||||||||||||||||||
841 | return QByteArray(); executed 1 time by 1 test: return QByteArray(); Executed by:
| 1 | ||||||||||||||||||
842 | } | - | ||||||||||||||||||
843 | - | |||||||||||||||||||
844 | /*! | - | ||||||||||||||||||
845 | Returns the value of the item of class information at \a index | - | ||||||||||||||||||
846 | in this class. | - | ||||||||||||||||||
847 | - | |||||||||||||||||||
848 | \sa classInfoCount(), addClassInfo(), classInfoName(), removeClassInfo() | - | ||||||||||||||||||
849 | \sa indexOfClassInfo() | - | ||||||||||||||||||
850 | */ | - | ||||||||||||||||||
851 | QByteArray QMetaObjectBuilder::classInfoValue(int index) const | - | ||||||||||||||||||
852 | { | - | ||||||||||||||||||
853 | if (index >= 0 && index < d->classInfoValues.size())
| 0-4 | ||||||||||||||||||
854 | return d->classInfoValues[index]; executed 3 times by 1 test: return d->classInfoValues[index]; Executed by:
| 3 | ||||||||||||||||||
855 | else | - | ||||||||||||||||||
856 | return QByteArray(); executed 1 time by 1 test: return QByteArray(); Executed by:
| 1 | ||||||||||||||||||
857 | } | - | ||||||||||||||||||
858 | - | |||||||||||||||||||
859 | /*! | - | ||||||||||||||||||
860 | Removes the method at \a index from this class. The indices of | - | ||||||||||||||||||
861 | all following methods will be adjusted downwards by 1. If the | - | ||||||||||||||||||
862 | method is registered as a notify signal on a property, then the | - | ||||||||||||||||||
863 | notify signal will be removed from the property. | - | ||||||||||||||||||
864 | - | |||||||||||||||||||
865 | \sa methodCount(), addMethod(), method(), indexOfMethod() | - | ||||||||||||||||||
866 | */ | - | ||||||||||||||||||
867 | void QMetaObjectBuilder::removeMethod(int index) | - | ||||||||||||||||||
868 | { | - | ||||||||||||||||||
869 | if (index >= 0 && index < d->methods.size()) {
| 0-3 | ||||||||||||||||||
870 | d->methods.removeAt(index); | - | ||||||||||||||||||
871 | for (int prop = 0; prop < d->properties.size(); ++prop) {
| 2-3 | ||||||||||||||||||
872 | // Adjust the indices of property notify signal references. | - | ||||||||||||||||||
873 | if (d->properties[prop].notifySignal == index) {
| 1 | ||||||||||||||||||
874 | d->properties[prop].notifySignal = -1; | - | ||||||||||||||||||
875 | d->properties[prop].setFlag(Notify, false); | - | ||||||||||||||||||
876 | } else if (d->properties[prop].notifySignal > index) executed 1 time by 1 test: end of block Executed by:
| 0-1 | ||||||||||||||||||
877 | (d->properties[prop].notifySignal)--; executed 1 time by 1 test: (d->properties[prop].notifySignal)--; Executed by:
| 1 | ||||||||||||||||||
878 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
879 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||
880 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||
881 | - | |||||||||||||||||||
882 | /*! | - | ||||||||||||||||||
883 | Removes the constructor at \a index from this class. The indices of | - | ||||||||||||||||||
884 | all following constructors will be adjusted downwards by 1. | - | ||||||||||||||||||
885 | - | |||||||||||||||||||
886 | \sa constructorCount(), addConstructor(), constructor() | - | ||||||||||||||||||
887 | \sa indexOfConstructor() | - | ||||||||||||||||||
888 | */ | - | ||||||||||||||||||
889 | void QMetaObjectBuilder::removeConstructor(int index) | - | ||||||||||||||||||
890 | { | - | ||||||||||||||||||
891 | if (index >= 0 && index < d->constructors.size())
| 0-1 | ||||||||||||||||||
892 | d->constructors.removeAt(index); executed 1 time by 1 test: d->constructors.removeAt(index); Executed by:
| 1 | ||||||||||||||||||
893 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
894 | - | |||||||||||||||||||
895 | /*! | - | ||||||||||||||||||
896 | Removes the property at \a index from this class. The indices of | - | ||||||||||||||||||
897 | all following properties will be adjusted downwards by 1. | - | ||||||||||||||||||
898 | - | |||||||||||||||||||
899 | \sa propertyCount(), addProperty(), property(), indexOfProperty() | - | ||||||||||||||||||
900 | */ | - | ||||||||||||||||||
901 | void QMetaObjectBuilder::removeProperty(int index) | - | ||||||||||||||||||
902 | { | - | ||||||||||||||||||
903 | if (index >= 0 && index < d->properties.size())
| 0-1 | ||||||||||||||||||
904 | d->properties.removeAt(index); executed 1 time by 1 test: d->properties.removeAt(index); Executed by:
| 1 | ||||||||||||||||||
905 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
906 | - | |||||||||||||||||||
907 | /*! | - | ||||||||||||||||||
908 | Removes the enumerator at \a index from this class. The indices of | - | ||||||||||||||||||
909 | all following enumerators will be adjusted downwards by 1. | - | ||||||||||||||||||
910 | - | |||||||||||||||||||
911 | \sa enumertorCount(), addEnumerator(), enumerator() | - | ||||||||||||||||||
912 | \sa indexOfEnumerator() | - | ||||||||||||||||||
913 | */ | - | ||||||||||||||||||
914 | void QMetaObjectBuilder::removeEnumerator(int index) | - | ||||||||||||||||||
915 | { | - | ||||||||||||||||||
916 | if (index >= 0 && index < d->enumerators.size())
| 0-1 | ||||||||||||||||||
917 | d->enumerators.removeAt(index); executed 1 time by 1 test: d->enumerators.removeAt(index); Executed by:
| 1 | ||||||||||||||||||
918 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
919 | - | |||||||||||||||||||
920 | /*! | - | ||||||||||||||||||
921 | Removes the item of class information at \a index from this class. | - | ||||||||||||||||||
922 | The indices of all following items will be adjusted downwards by 1. | - | ||||||||||||||||||
923 | - | |||||||||||||||||||
924 | \sa classInfoCount(), addClassInfo(), classInfoName(), classInfoValue() | - | ||||||||||||||||||
925 | \sa indexOfClassInfo() | - | ||||||||||||||||||
926 | */ | - | ||||||||||||||||||
927 | void QMetaObjectBuilder::removeClassInfo(int index) | - | ||||||||||||||||||
928 | { | - | ||||||||||||||||||
929 | if (index >= 0 && index < d->classInfoNames.size()) {
| 0-1 | ||||||||||||||||||
930 | d->classInfoNames.removeAt(index); | - | ||||||||||||||||||
931 | d->classInfoValues.removeAt(index); | - | ||||||||||||||||||
932 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
933 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
934 | - | |||||||||||||||||||
935 | /*! | - | ||||||||||||||||||
936 | Removes the related meta object at \a index from this class. | - | ||||||||||||||||||
937 | The indices of all following related meta objects will be adjusted | - | ||||||||||||||||||
938 | downwards by 1. | - | ||||||||||||||||||
939 | - | |||||||||||||||||||
940 | Related meta objects are used when resolving the enumerated type | - | ||||||||||||||||||
941 | associated with a property, where the enumerated type is in a | - | ||||||||||||||||||
942 | different class from the property. | - | ||||||||||||||||||
943 | - | |||||||||||||||||||
944 | \sa relatedMetaObjectCount(), addRelatedMetaObject() | - | ||||||||||||||||||
945 | \sa relatedMetaObject() | - | ||||||||||||||||||
946 | */ | - | ||||||||||||||||||
947 | void QMetaObjectBuilder::removeRelatedMetaObject(int index) | - | ||||||||||||||||||
948 | { | - | ||||||||||||||||||
949 | if (index >= 0 && index < d->relatedMetaObjects.size())
| 0-1 | ||||||||||||||||||
950 | d->relatedMetaObjects.removeAt(index); executed 1 time by 1 test: d->relatedMetaObjects.removeAt(index); Executed by:
| 1 | ||||||||||||||||||
951 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
952 | - | |||||||||||||||||||
953 | /*! | - | ||||||||||||||||||
954 | Finds a method with the specified \a signature and returns its index; | - | ||||||||||||||||||
955 | otherwise returns -1. The \a signature will be normalized by this method. | - | ||||||||||||||||||
956 | - | |||||||||||||||||||
957 | \sa method(), methodCount(), addMethod(), removeMethod() | - | ||||||||||||||||||
958 | */ | - | ||||||||||||||||||
959 | int QMetaObjectBuilder::indexOfMethod(const QByteArray& signature) | - | ||||||||||||||||||
960 | { | - | ||||||||||||||||||
961 | QByteArray sig = QMetaObject::normalizedSignature(signature); | - | ||||||||||||||||||
962 | for (int index = 0; index < d->methods.size(); ++index) {
| 4-20 | ||||||||||||||||||
963 | if (sig == d->methods[index].signature)
| 7-13 | ||||||||||||||||||
964 | return index; executed 7 times by 1 test: return index; Executed by:
| 7 | ||||||||||||||||||
965 | } executed 13 times by 1 test: end of block Executed by:
| 13 | ||||||||||||||||||
966 | return -1; executed 4 times by 1 test: return -1; Executed by:
| 4 | ||||||||||||||||||
967 | } | - | ||||||||||||||||||
968 | - | |||||||||||||||||||
969 | /*! | - | ||||||||||||||||||
970 | Finds a signal with the specified \a signature and returns its index; | - | ||||||||||||||||||
971 | otherwise returns -1. The \a signature will be normalized by this method. | - | ||||||||||||||||||
972 | - | |||||||||||||||||||
973 | \sa indexOfMethod(), indexOfSlot() | - | ||||||||||||||||||
974 | */ | - | ||||||||||||||||||
975 | int QMetaObjectBuilder::indexOfSignal(const QByteArray& signature) | - | ||||||||||||||||||
976 | { | - | ||||||||||||||||||
977 | QByteArray sig = QMetaObject::normalizedSignature(signature); | - | ||||||||||||||||||
978 | for (int index = 0; index < d->methods.size(); ++index) {
| 1-5 | ||||||||||||||||||
979 | if (sig == d->methods[index].signature &&
| 2-3 | ||||||||||||||||||
980 | d->methods[index].methodType() == QMetaMethod::Signal)
| 0-2 | ||||||||||||||||||
981 | return index; executed 2 times by 1 test: return index; Executed by:
| 2 | ||||||||||||||||||
982 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||
983 | return -1; executed 1 time by 1 test: return -1; Executed by:
| 1 | ||||||||||||||||||
984 | } | - | ||||||||||||||||||
985 | - | |||||||||||||||||||
986 | /*! | - | ||||||||||||||||||
987 | Finds a slot with the specified \a signature and returns its index; | - | ||||||||||||||||||
988 | otherwise returns -1. The \a signature will be normalized by this method. | - | ||||||||||||||||||
989 | - | |||||||||||||||||||
990 | \sa indexOfMethod(), indexOfSignal() | - | ||||||||||||||||||
991 | */ | - | ||||||||||||||||||
992 | int QMetaObjectBuilder::indexOfSlot(const QByteArray& signature) | - | ||||||||||||||||||
993 | { | - | ||||||||||||||||||
994 | QByteArray sig = QMetaObject::normalizedSignature(signature); | - | ||||||||||||||||||
995 | for (int index = 0; index < d->methods.size(); ++index) {
| 1-5 | ||||||||||||||||||
996 | if (sig == d->methods[index].signature &&
| 2-3 | ||||||||||||||||||
997 | d->methods[index].methodType() == QMetaMethod::Slot)
| 0-2 | ||||||||||||||||||
998 | return index; executed 2 times by 1 test: return index; Executed by:
| 2 | ||||||||||||||||||
999 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||
1000 | return -1; executed 1 time by 1 test: return -1; Executed by:
| 1 | ||||||||||||||||||
1001 | } | - | ||||||||||||||||||
1002 | - | |||||||||||||||||||
1003 | /*! | - | ||||||||||||||||||
1004 | Finds a constructor with the specified \a signature and returns its index; | - | ||||||||||||||||||
1005 | otherwise returns -1. The \a signature will be normalized by this method. | - | ||||||||||||||||||
1006 | - | |||||||||||||||||||
1007 | \sa constructor(), constructorCount(), addConstructor(), removeConstructor() | - | ||||||||||||||||||
1008 | */ | - | ||||||||||||||||||
1009 | int QMetaObjectBuilder::indexOfConstructor(const QByteArray& signature) | - | ||||||||||||||||||
1010 | { | - | ||||||||||||||||||
1011 | QByteArray sig = QMetaObject::normalizedSignature(signature); | - | ||||||||||||||||||
1012 | for (int index = 0; index < d->constructors.size(); ++index) {
| 3-8 | ||||||||||||||||||
1013 | if (sig == d->constructors[index].signature)
| 3-5 | ||||||||||||||||||
1014 | return index; executed 3 times by 1 test: return index; Executed by:
| 3 | ||||||||||||||||||
1015 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
1016 | return -1; executed 3 times by 1 test: return -1; Executed by:
| 3 | ||||||||||||||||||
1017 | } | - | ||||||||||||||||||
1018 | - | |||||||||||||||||||
1019 | /*! | - | ||||||||||||||||||
1020 | Finds a property with the specified \a name and returns its index; | - | ||||||||||||||||||
1021 | otherwise returns -1. | - | ||||||||||||||||||
1022 | - | |||||||||||||||||||
1023 | \sa property(), propertyCount(), addProperty(), removeProperty() | - | ||||||||||||||||||
1024 | */ | - | ||||||||||||||||||
1025 | int QMetaObjectBuilder::indexOfProperty(const QByteArray& name) | - | ||||||||||||||||||
1026 | { | - | ||||||||||||||||||
1027 | for (int index = 0; index < d->properties.size(); ++index) {
| 3-8 | ||||||||||||||||||
1028 | if (name == d->properties[index].name)
| 3-5 | ||||||||||||||||||
1029 | return index; executed 3 times by 1 test: return index; Executed by:
| 3 | ||||||||||||||||||
1030 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
1031 | return -1; executed 3 times by 1 test: return -1; Executed by:
| 3 | ||||||||||||||||||
1032 | } | - | ||||||||||||||||||
1033 | - | |||||||||||||||||||
1034 | /*! | - | ||||||||||||||||||
1035 | Finds an enumerator with the specified \a name and returns its index; | - | ||||||||||||||||||
1036 | otherwise returns -1. | - | ||||||||||||||||||
1037 | - | |||||||||||||||||||
1038 | \sa enumertor(), enumeratorCount(), addEnumerator(), removeEnumerator() | - | ||||||||||||||||||
1039 | */ | - | ||||||||||||||||||
1040 | int QMetaObjectBuilder::indexOfEnumerator(const QByteArray& name) | - | ||||||||||||||||||
1041 | { | - | ||||||||||||||||||
1042 | for (int index = 0; index < d->enumerators.size(); ++index) {
| 3-8 | ||||||||||||||||||
1043 | if (name == d->enumerators[index].name)
| 3-5 | ||||||||||||||||||
1044 | return index; executed 3 times by 1 test: return index; Executed by:
| 3 | ||||||||||||||||||
1045 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
1046 | return -1; executed 3 times by 1 test: return -1; Executed by:
| 3 | ||||||||||||||||||
1047 | } | - | ||||||||||||||||||
1048 | - | |||||||||||||||||||
1049 | /*! | - | ||||||||||||||||||
1050 | Finds an item of class information with the specified \a name and | - | ||||||||||||||||||
1051 | returns its index; otherwise returns -1. | - | ||||||||||||||||||
1052 | - | |||||||||||||||||||
1053 | \sa classInfoName(), classInfoValue(), classInfoCount(), addClassInfo() | - | ||||||||||||||||||
1054 | \sa removeClassInfo() | - | ||||||||||||||||||
1055 | */ | - | ||||||||||||||||||
1056 | int QMetaObjectBuilder::indexOfClassInfo(const QByteArray& name) | - | ||||||||||||||||||
1057 | { | - | ||||||||||||||||||
1058 | for (int index = 0; index < d->classInfoNames.size(); ++index) {
| 3-8 | ||||||||||||||||||
1059 | if (name == d->classInfoNames[index])
| 3-5 | ||||||||||||||||||
1060 | return index; executed 3 times by 1 test: return index; Executed by:
| 3 | ||||||||||||||||||
1061 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||
1062 | return -1; executed 3 times by 1 test: return -1; Executed by:
| 3 | ||||||||||||||||||
1063 | } | - | ||||||||||||||||||
1064 | - | |||||||||||||||||||
1065 | // Align on a specific type boundary. | - | ||||||||||||||||||
1066 | #define ALIGN(size,type) \ | - | ||||||||||||||||||
1067 | (size) = ((size) + sizeof(type) - 1) & ~(sizeof(type) - 1) | - | ||||||||||||||||||
1068 | - | |||||||||||||||||||
1069 | /*! | - | ||||||||||||||||||
1070 | \class QMetaStringTable | - | ||||||||||||||||||
1071 | \inmodule QtCore | - | ||||||||||||||||||
1072 | \internal | - | ||||||||||||||||||
1073 | \brief The QMetaStringTable class can generate a meta-object string table at runtime. | - | ||||||||||||||||||
1074 | */ | - | ||||||||||||||||||
1075 | - | |||||||||||||||||||
1076 | QMetaStringTable::QMetaStringTable(const QByteArray &className) | - | ||||||||||||||||||
1077 | : m_index(0) | - | ||||||||||||||||||
1078 | , m_className(className) | - | ||||||||||||||||||
1079 | { | - | ||||||||||||||||||
1080 | const int index = enter(m_className); | - | ||||||||||||||||||
1081 | Q_ASSERT(index == 0); | - | ||||||||||||||||||
1082 | Q_UNUSED(index); | - | ||||||||||||||||||
1083 | } executed 180 times by 11 tests: end of block Executed by:
| 180 | ||||||||||||||||||
1084 | - | |||||||||||||||||||
1085 | // Enters the given value into the string table (if it hasn't already been | - | ||||||||||||||||||
1086 | // entered). Returns the index of the string. | - | ||||||||||||||||||
1087 | int QMetaStringTable::enter(const QByteArray &value) | - | ||||||||||||||||||
1088 | { | - | ||||||||||||||||||
1089 | Entries::iterator it = m_entries.find(value); | - | ||||||||||||||||||
1090 | if (it != m_entries.end())
| 1552-2423 | ||||||||||||||||||
1091 | return it.value(); executed 1552 times by 11 tests: return it.value(); Executed by:
| 1552 | ||||||||||||||||||
1092 | int pos = m_index; | - | ||||||||||||||||||
1093 | m_entries.insert(value, pos); | - | ||||||||||||||||||
1094 | ++m_index; | - | ||||||||||||||||||
1095 | return pos; executed 2423 times by 11 tests: return pos; Executed by:
| 2423 | ||||||||||||||||||
1096 | } | - | ||||||||||||||||||
1097 | - | |||||||||||||||||||
1098 | int QMetaStringTable::preferredAlignment() | - | ||||||||||||||||||
1099 | { | - | ||||||||||||||||||
1100 | return Q_ALIGNOF(QByteArrayData); executed 162 times by 11 tests: return alignof(QByteArrayData); Executed by:
| 162 | ||||||||||||||||||
1101 | } | - | ||||||||||||||||||
1102 | - | |||||||||||||||||||
1103 | // Returns the size (in bytes) required for serializing this string table. | - | ||||||||||||||||||
1104 | int QMetaStringTable::blobSize() const | - | ||||||||||||||||||
1105 | { | - | ||||||||||||||||||
1106 | int size = m_entries.size() * sizeof(QByteArrayData); | - | ||||||||||||||||||
1107 | Entries::const_iterator it; | - | ||||||||||||||||||
1108 | for (it = m_entries.constBegin(); it != m_entries.constEnd(); ++it)
| 180-2423 | ||||||||||||||||||
1109 | size += it.key().size() + 1; executed 2423 times by 11 tests: size += it.key().size() + 1; Executed by:
| 2423 | ||||||||||||||||||
1110 | return size; executed 180 times by 11 tests: return size; Executed by:
| 180 | ||||||||||||||||||
1111 | } | - | ||||||||||||||||||
1112 | - | |||||||||||||||||||
1113 | static void writeString(char *out, int i, const QByteArray &str, | - | ||||||||||||||||||
1114 | const int offsetOfStringdataMember, int &stringdataOffset) | - | ||||||||||||||||||
1115 | { | - | ||||||||||||||||||
1116 | int size = str.size(); | - | ||||||||||||||||||
1117 | qptrdiff offset = offsetOfStringdataMember + stringdataOffset | - | ||||||||||||||||||
1118 | - i * sizeof(QByteArrayData); | - | ||||||||||||||||||
1119 | const QByteArrayData data = | - | ||||||||||||||||||
1120 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(size, offset); | - | ||||||||||||||||||
1121 | - | |||||||||||||||||||
1122 | memcpy(out + i * sizeof(QByteArrayData), &data, sizeof(QByteArrayData)); | - | ||||||||||||||||||
1123 | - | |||||||||||||||||||
1124 | memcpy(out + offsetOfStringdataMember + stringdataOffset, str.constData(), size); | - | ||||||||||||||||||
1125 | out[offsetOfStringdataMember + stringdataOffset + size] = '\0'; | - | ||||||||||||||||||
1126 | - | |||||||||||||||||||
1127 | stringdataOffset += size + 1; | - | ||||||||||||||||||
1128 | } executed 2141 times by 11 tests: end of block Executed by:
| 2141 | ||||||||||||||||||
1129 | - | |||||||||||||||||||
1130 | // Writes strings to string data struct. | - | ||||||||||||||||||
1131 | // The struct consists of an array of QByteArrayData, followed by a char array | - | ||||||||||||||||||
1132 | // containing the actual strings. This format must match the one produced by | - | ||||||||||||||||||
1133 | // moc (see generator.cpp). | - | ||||||||||||||||||
1134 | void QMetaStringTable::writeBlob(char *out) const | - | ||||||||||||||||||
1135 | { | - | ||||||||||||||||||
1136 | Q_ASSERT(!(reinterpret_cast<quintptr>(out) & (preferredAlignment()-1))); | - | ||||||||||||||||||
1137 | - | |||||||||||||||||||
1138 | int offsetOfStringdataMember = m_entries.size() * sizeof(QByteArrayData); | - | ||||||||||||||||||
1139 | int stringdataOffset = 0; | - | ||||||||||||||||||
1140 | - | |||||||||||||||||||
1141 | // qt_metacast expects the first string in the string table to be the class name. | - | ||||||||||||||||||
1142 | writeString(out, /*index*/0, m_className, offsetOfStringdataMember, stringdataOffset); | - | ||||||||||||||||||
1143 | - | |||||||||||||||||||
1144 | for (Entries::ConstIterator it = m_entries.constBegin(), end = m_entries.constEnd(); | - | ||||||||||||||||||
1145 | it != end; ++it) {
| 162-2141 | ||||||||||||||||||
1146 | const int i = it.value(); | - | ||||||||||||||||||
1147 | if (i == 0)
| 162-1979 | ||||||||||||||||||
1148 | continue; executed 162 times by 11 tests: continue; Executed by:
| 162 | ||||||||||||||||||
1149 | const QByteArray &str = it.key(); | - | ||||||||||||||||||
1150 | - | |||||||||||||||||||
1151 | writeString(out, i, str, offsetOfStringdataMember, stringdataOffset); | - | ||||||||||||||||||
1152 | } executed 1979 times by 11 tests: end of block Executed by:
| 1979 | ||||||||||||||||||
1153 | } executed 162 times by 11 tests: end of block Executed by:
| 162 | ||||||||||||||||||
1154 | - | |||||||||||||||||||
1155 | // Returns the sum of all parameters (including return type) for the given | - | ||||||||||||||||||
1156 | // \a methods. This is needed for calculating the size of the methods' | - | ||||||||||||||||||
1157 | // parameter type/name meta-data. | - | ||||||||||||||||||
1158 | static int aggregateParameterCount(const QVector<QMetaMethodBuilderPrivate> &methods) | - | ||||||||||||||||||
1159 | { | - | ||||||||||||||||||
1160 | int sum = 0; | - | ||||||||||||||||||
1161 | for (int i = 0; i < methods.size(); ++i)
| 72-258 | ||||||||||||||||||
1162 | sum += methods.at(i).parameterCount() + 1; // +1 for return type executed 258 times by 1 test: sum += methods.at(i).parameterCount() + 1; Executed by:
| 258 | ||||||||||||||||||
1163 | return sum; executed 72 times by 1 test: return sum; Executed by:
| 72 | ||||||||||||||||||
1164 | } | - | ||||||||||||||||||
1165 | - | |||||||||||||||||||
1166 | // Build a QMetaObject in "buf" based on the information in "d". | - | ||||||||||||||||||
1167 | // If "buf" is null, then return the number of bytes needed to | - | ||||||||||||||||||
1168 | // build the QMetaObject. Returns -1 if the metaobject if | - | ||||||||||||||||||
1169 | // relocatable is set, but the metaobject contains relatedMetaObjects. | - | ||||||||||||||||||
1170 | static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf, | - | ||||||||||||||||||
1171 | int expectedSize, bool relocatable) | - | ||||||||||||||||||
1172 | { | - | ||||||||||||||||||
1173 | Q_UNUSED(expectedSize); // Avoid warning in release mode | - | ||||||||||||||||||
1174 | int size = 0; | - | ||||||||||||||||||
1175 | int dataIndex; | - | ||||||||||||||||||
1176 | int paramsIndex; | - | ||||||||||||||||||
1177 | int enumIndex; | - | ||||||||||||||||||
1178 | int index; | - | ||||||||||||||||||
1179 | bool hasRevisionedMethods = d->hasRevisionedMethods(); | - | ||||||||||||||||||
1180 | bool hasRevisionedProperties = d->hasRevisionedProperties(); | - | ||||||||||||||||||
1181 | bool hasNotifySignals = false; | - | ||||||||||||||||||
1182 | - | |||||||||||||||||||
1183 | if (relocatable &&
| 2-34 | ||||||||||||||||||
1184 | (d->relatedMetaObjects.size() > 0 || d->staticMetacallFunction))
| 0-2 | ||||||||||||||||||
1185 | return -1; never executed: return -1; | 0 | ||||||||||||||||||
1186 | - | |||||||||||||||||||
1187 | // Create the main QMetaObject structure at the start of the buffer. | - | ||||||||||||||||||
1188 | QMetaObject *meta = reinterpret_cast<QMetaObject *>(buf); | - | ||||||||||||||||||
1189 | size += sizeof(QMetaObject); | - | ||||||||||||||||||
1190 | ALIGN(size, int); | - | ||||||||||||||||||
1191 | if (buf) {
| 18 | ||||||||||||||||||
1192 | if (!relocatable) meta->d.superdata = d->superClass; executed 17 times by 1 test: meta->d.superdata = d->superClass; Executed by:
| 1-17 | ||||||||||||||||||
1193 | meta->d.relatedMetaObjects = 0; | - | ||||||||||||||||||
1194 | meta->d.extradata = 0; | - | ||||||||||||||||||
1195 | meta->d.static_metacall = d->staticMetacallFunction; | - | ||||||||||||||||||
1196 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||||||||
1197 | - | |||||||||||||||||||
1198 | // Populate the QMetaObjectPrivate structure. | - | ||||||||||||||||||
1199 | QMetaObjectPrivate *pmeta | - | ||||||||||||||||||
1200 | = reinterpret_cast<QMetaObjectPrivate *>(buf + size); | - | ||||||||||||||||||
1201 | int pmetaSize = size; | - | ||||||||||||||||||
1202 | dataIndex = MetaObjectPrivateFieldCount; | - | ||||||||||||||||||
1203 | for (index = 0; index < d->properties.size(); ++index) {
| 4-34 | ||||||||||||||||||
1204 | if (d->properties[index].notifySignal != -1) {
| 2-32 | ||||||||||||||||||
1205 | hasNotifySignals = true; | - | ||||||||||||||||||
1206 | break; executed 32 times by 1 test: break; Executed by:
| 32 | ||||||||||||||||||
1207 | } | - | ||||||||||||||||||
1208 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
1209 | int methodParametersDataSize = | - | ||||||||||||||||||
1210 | ((aggregateParameterCount(d->methods) | - | ||||||||||||||||||
1211 | + aggregateParameterCount(d->constructors)) * 2) // types and parameter names | - | ||||||||||||||||||
1212 | - d->methods.size() // return "parameters" don't have names | - | ||||||||||||||||||
1213 | - d->constructors.size(); // "this" parameters don't have names | - | ||||||||||||||||||
1214 | if (buf) {
| 18 | ||||||||||||||||||
1215 | Q_STATIC_ASSERT_X(QMetaObjectPrivate::OutputRevision == 7, "QMetaObjectBuilder should generate the same version as moc"); | - | ||||||||||||||||||
1216 | pmeta->revision = QMetaObjectPrivate::OutputRevision; | - | ||||||||||||||||||
1217 | pmeta->flags = d->flags; | - | ||||||||||||||||||
1218 | pmeta->className = 0; // Class name is always the first string. | - | ||||||||||||||||||
1219 | //pmeta->signalCount is handled in the "output method loop" as an optimization. | - | ||||||||||||||||||
1220 | - | |||||||||||||||||||
1221 | pmeta->classInfoCount = d->classInfoNames.size(); | - | ||||||||||||||||||
1222 | pmeta->classInfoData = dataIndex; | - | ||||||||||||||||||
1223 | dataIndex += 2 * d->classInfoNames.size(); | - | ||||||||||||||||||
1224 | - | |||||||||||||||||||
1225 | pmeta->methodCount = d->methods.size(); | - | ||||||||||||||||||
1226 | pmeta->methodData = dataIndex; | - | ||||||||||||||||||
1227 | dataIndex += 5 * d->methods.size(); | - | ||||||||||||||||||
1228 | if (hasRevisionedMethods)
| 4-14 | ||||||||||||||||||
1229 | dataIndex += d->methods.size(); executed 4 times by 1 test: dataIndex += d->methods.size(); Executed by:
| 4 | ||||||||||||||||||
1230 | paramsIndex = dataIndex; | - | ||||||||||||||||||
1231 | dataIndex += methodParametersDataSize; | - | ||||||||||||||||||
1232 | - | |||||||||||||||||||
1233 | pmeta->propertyCount = d->properties.size(); | - | ||||||||||||||||||
1234 | pmeta->propertyData = dataIndex; | - | ||||||||||||||||||
1235 | dataIndex += 3 * d->properties.size(); | - | ||||||||||||||||||
1236 | if (hasNotifySignals)
| 2-16 | ||||||||||||||||||
1237 | dataIndex += d->properties.size(); executed 16 times by 1 test: dataIndex += d->properties.size(); Executed by:
| 16 | ||||||||||||||||||
1238 | if (hasRevisionedProperties)
| 4-14 | ||||||||||||||||||
1239 | dataIndex += d->properties.size(); executed 4 times by 1 test: dataIndex += d->properties.size(); Executed by:
| 4 | ||||||||||||||||||
1240 | - | |||||||||||||||||||
1241 | pmeta->enumeratorCount = d->enumerators.size(); | - | ||||||||||||||||||
1242 | pmeta->enumeratorData = dataIndex; | - | ||||||||||||||||||
1243 | dataIndex += 4 * d->enumerators.size(); | - | ||||||||||||||||||
1244 | - | |||||||||||||||||||
1245 | pmeta->constructorCount = d->constructors.size(); | - | ||||||||||||||||||
1246 | pmeta->constructorData = dataIndex; | - | ||||||||||||||||||
1247 | dataIndex += 5 * d->constructors.size(); | - | ||||||||||||||||||
1248 | } else { executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||||||||
1249 | dataIndex += 2 * d->classInfoNames.size(); | - | ||||||||||||||||||
1250 | dataIndex += 5 * d->methods.size(); | - | ||||||||||||||||||
1251 | if (hasRevisionedMethods)
| 4-14 | ||||||||||||||||||
1252 | dataIndex += d->methods.size(); executed 4 times by 1 test: dataIndex += d->methods.size(); Executed by:
| 4 | ||||||||||||||||||
1253 | paramsIndex = dataIndex; | - | ||||||||||||||||||
1254 | dataIndex += methodParametersDataSize; | - | ||||||||||||||||||
1255 | dataIndex += 3 * d->properties.size(); | - | ||||||||||||||||||
1256 | if (hasNotifySignals)
| 2-16 | ||||||||||||||||||
1257 | dataIndex += d->properties.size(); executed 16 times by 1 test: dataIndex += d->properties.size(); Executed by:
| 16 | ||||||||||||||||||
1258 | if (hasRevisionedProperties)
| 4-14 | ||||||||||||||||||
1259 | dataIndex += d->properties.size(); executed 4 times by 1 test: dataIndex += d->properties.size(); Executed by:
| 4 | ||||||||||||||||||
1260 | dataIndex += 4 * d->enumerators.size(); | - | ||||||||||||||||||
1261 | dataIndex += 5 * d->constructors.size(); | - | ||||||||||||||||||
1262 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||||||||
1263 | - | |||||||||||||||||||
1264 | // Allocate space for the enumerator key names and values. | - | ||||||||||||||||||
1265 | enumIndex = dataIndex; | - | ||||||||||||||||||
1266 | for (index = 0; index < d->enumerators.size(); ++index) {
| 16-36 | ||||||||||||||||||
1267 | QMetaEnumBuilderPrivate *enumerator = &(d->enumerators[index]); | - | ||||||||||||||||||
1268 | dataIndex += 2 * enumerator->keys.size(); | - | ||||||||||||||||||
1269 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||
1270 | - | |||||||||||||||||||
1271 | // Zero terminator at the end of the data offset table. | - | ||||||||||||||||||
1272 | ++dataIndex; | - | ||||||||||||||||||
1273 | - | |||||||||||||||||||
1274 | // Find the start of the data and string tables. | - | ||||||||||||||||||
1275 | int *data = reinterpret_cast<int *>(pmeta); | - | ||||||||||||||||||
1276 | size += dataIndex * sizeof(int); | - | ||||||||||||||||||
1277 | ALIGN(size, void *); | - | ||||||||||||||||||
1278 | char *str = reinterpret_cast<char *>(buf + size); | - | ||||||||||||||||||
1279 | if (buf) {
| 18 | ||||||||||||||||||
1280 | if (relocatable) {
| 1-17 | ||||||||||||||||||
1281 | meta->d.stringdata = reinterpret_cast<const QByteArrayData *>((quintptr)size); | - | ||||||||||||||||||
1282 | meta->d.data = reinterpret_cast<uint *>((quintptr)pmetaSize); | - | ||||||||||||||||||
1283 | } else { executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
1284 | meta->d.stringdata = reinterpret_cast<const QByteArrayData *>(str); | - | ||||||||||||||||||
1285 | meta->d.data = reinterpret_cast<uint *>(data); | - | ||||||||||||||||||
1286 | } executed 17 times by 1 test: end of block Executed by:
| 17 | ||||||||||||||||||
1287 | } | - | ||||||||||||||||||
1288 | - | |||||||||||||||||||
1289 | // Reset the current data position to just past the QMetaObjectPrivate. | - | ||||||||||||||||||
1290 | dataIndex = MetaObjectPrivateFieldCount; | - | ||||||||||||||||||
1291 | - | |||||||||||||||||||
1292 | QMetaStringTable strings(d->className); | - | ||||||||||||||||||
1293 | - | |||||||||||||||||||
1294 | // Output the class infos, | - | ||||||||||||||||||
1295 | Q_ASSERT(!buf || dataIndex == pmeta->classInfoData); | - | ||||||||||||||||||
1296 | for (index = 0; index < d->classInfoNames.size(); ++index) {
| 16-36 | ||||||||||||||||||
1297 | int name = strings.enter(d->classInfoNames[index]); | - | ||||||||||||||||||
1298 | int value = strings.enter(d->classInfoValues[index]); | - | ||||||||||||||||||
1299 | if (buf) {
| 8 | ||||||||||||||||||
1300 | data[dataIndex] = name; | - | ||||||||||||||||||
1301 | data[dataIndex + 1] = value; | - | ||||||||||||||||||
1302 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
1303 | dataIndex += 2; | - | ||||||||||||||||||
1304 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||
1305 | - | |||||||||||||||||||
1306 | // Output the methods in the class. | - | ||||||||||||||||||
1307 | Q_ASSERT(!buf || dataIndex == pmeta->methodData); | - | ||||||||||||||||||
1308 | for (index = 0; index < d->methods.size(); ++index) {
| 36-210 | ||||||||||||||||||
1309 | QMetaMethodBuilderPrivate *method = &(d->methods[index]); | - | ||||||||||||||||||
1310 | int name = strings.enter(method->name()); | - | ||||||||||||||||||
1311 | int argc = method->parameterCount(); | - | ||||||||||||||||||
1312 | int tag = strings.enter(method->tag); | - | ||||||||||||||||||
1313 | int attrs = method->attributes; | - | ||||||||||||||||||
1314 | if (buf) {
| 105 | ||||||||||||||||||
1315 | data[dataIndex] = name; | - | ||||||||||||||||||
1316 | data[dataIndex + 1] = argc; | - | ||||||||||||||||||
1317 | data[dataIndex + 2] = paramsIndex; | - | ||||||||||||||||||
1318 | data[dataIndex + 3] = tag; | - | ||||||||||||||||||
1319 | data[dataIndex + 4] = attrs; | - | ||||||||||||||||||
1320 | if (method->methodType() == QMetaMethod::Signal)
| 26-79 | ||||||||||||||||||
1321 | pmeta->signalCount++; executed 26 times by 1 test: pmeta->signalCount++; Executed by:
| 26 | ||||||||||||||||||
1322 | } executed 105 times by 1 test: end of block Executed by:
| 105 | ||||||||||||||||||
1323 | dataIndex += 5; | - | ||||||||||||||||||
1324 | paramsIndex += 1 + argc * 2; | - | ||||||||||||||||||
1325 | } executed 210 times by 1 test: end of block Executed by:
| 210 | ||||||||||||||||||
1326 | if (hasRevisionedMethods) {
| 8-28 | ||||||||||||||||||
1327 | for (index = 0; index < d->methods.size(); ++index) {
| 8-80 | ||||||||||||||||||
1328 | QMetaMethodBuilderPrivate *method = &(d->methods[index]); | - | ||||||||||||||||||
1329 | if (buf)
| 40 | ||||||||||||||||||
1330 | data[dataIndex] = method->revision; executed 40 times by 1 test: data[dataIndex] = method->revision; Executed by:
| 40 | ||||||||||||||||||
1331 | ++dataIndex; | - | ||||||||||||||||||
1332 | } executed 80 times by 1 test: end of block Executed by:
| 80 | ||||||||||||||||||
1333 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
1334 | - | |||||||||||||||||||
1335 | // Output the method parameters in the class. | - | ||||||||||||||||||
1336 | Q_ASSERT(!buf || dataIndex == pmeta->methodData + d->methods.size() * 5 | - | ||||||||||||||||||
1337 | + (hasRevisionedMethods ? d->methods.size() : 0)); | - | ||||||||||||||||||
1338 | for (int x = 0; x < 2; ++x) {
| 36-72 | ||||||||||||||||||
1339 | QVector<QMetaMethodBuilderPrivate> &methods = (x == 0) ? d->methods : d->constructors;
| 36 | ||||||||||||||||||
1340 | for (index = 0; index < methods.size(); ++index) {
| 72-258 | ||||||||||||||||||
1341 | QMetaMethodBuilderPrivate *method = &(methods[index]); | - | ||||||||||||||||||
1342 | QList<QByteArray> paramTypeNames = method->parameterTypes(); | - | ||||||||||||||||||
1343 | int paramCount = paramTypeNames.size(); | - | ||||||||||||||||||
1344 | for (int i = -1; i < paramCount; ++i) {
| 258-444 | ||||||||||||||||||
1345 | const QByteArray &typeName = (i < 0) ? method->returnType : paramTypeNames.at(i);
| 186-258 | ||||||||||||||||||
1346 | int typeInfo; | - | ||||||||||||||||||
1347 | if (QtPrivate::isBuiltinType(typeName))
| 0-444 | ||||||||||||||||||
1348 | typeInfo = QMetaType::type(typeName); executed 444 times by 1 test: typeInfo = QMetaType::type(typeName); Executed by:
| 444 | ||||||||||||||||||
1349 | else | - | ||||||||||||||||||
1350 | typeInfo = IsUnresolvedType | strings.enter(typeName); never executed: typeInfo = IsUnresolvedType | strings.enter(typeName); | 0 | ||||||||||||||||||
1351 | if (buf)
| 222 | ||||||||||||||||||
1352 | data[dataIndex] = typeInfo; executed 222 times by 1 test: data[dataIndex] = typeInfo; Executed by:
| 222 | ||||||||||||||||||
1353 | ++dataIndex; | - | ||||||||||||||||||
1354 | } executed 444 times by 1 test: end of block Executed by:
| 444 | ||||||||||||||||||
1355 | - | |||||||||||||||||||
1356 | QList<QByteArray> paramNames = method->parameterNames; | - | ||||||||||||||||||
1357 | while (paramNames.size() < paramCount)
| 18-258 | ||||||||||||||||||
1358 | paramNames.append(QByteArray()); executed 18 times by 1 test: paramNames.append(QByteArray()); Executed by:
| 18 | ||||||||||||||||||
1359 | for (int i = 0; i < paramCount; ++i) {
| 186-258 | ||||||||||||||||||
1360 | int stringIndex = strings.enter(paramNames.at(i)); | - | ||||||||||||||||||
1361 | if (buf)
| 93 | ||||||||||||||||||
1362 | data[dataIndex] = stringIndex; executed 93 times by 1 test: data[dataIndex] = stringIndex; Executed by:
| 93 | ||||||||||||||||||
1363 | ++dataIndex; | - | ||||||||||||||||||
1364 | } executed 186 times by 1 test: end of block Executed by:
| 186 | ||||||||||||||||||
1365 | } executed 258 times by 1 test: end of block Executed by:
| 258 | ||||||||||||||||||
1366 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||
1367 | - | |||||||||||||||||||
1368 | // Output the properties in the class. | - | ||||||||||||||||||
1369 | Q_ASSERT(!buf || dataIndex == pmeta->propertyData); | - | ||||||||||||||||||
1370 | for (index = 0; index < d->properties.size(); ++index) {
| 36-74 | ||||||||||||||||||
1371 | QMetaPropertyBuilderPrivate *prop = &(d->properties[index]); | - | ||||||||||||||||||
1372 | int name = strings.enter(prop->name); | - | ||||||||||||||||||
1373 | - | |||||||||||||||||||
1374 | int typeInfo; | - | ||||||||||||||||||
1375 | if (QtPrivate::isBuiltinType(prop->type))
| 24-50 | ||||||||||||||||||
1376 | typeInfo = QMetaType::type(prop->type); executed 50 times by 1 test: typeInfo = QMetaType::type(prop->type); Executed by:
| 50 | ||||||||||||||||||
1377 | else | - | ||||||||||||||||||
1378 | typeInfo = IsUnresolvedType | strings.enter(prop->type); executed 24 times by 1 test: typeInfo = IsUnresolvedType | strings.enter(prop->type); Executed by:
| 24 | ||||||||||||||||||
1379 | - | |||||||||||||||||||
1380 | int flags = prop->flags; | - | ||||||||||||||||||
1381 | - | |||||||||||||||||||
1382 | if (!QtPrivate::isBuiltinType(prop->type))
| 24-50 | ||||||||||||||||||
1383 | flags |= EnumOrFlag; executed 24 times by 1 test: flags |= EnumOrFlag; Executed by:
| 24 | ||||||||||||||||||
1384 | - | |||||||||||||||||||
1385 | if (buf) {
| 37 | ||||||||||||||||||
1386 | data[dataIndex] = name; | - | ||||||||||||||||||
1387 | data[dataIndex + 1] = typeInfo; | - | ||||||||||||||||||
1388 | data[dataIndex + 2] = flags; | - | ||||||||||||||||||
1389 | } executed 37 times by 1 test: end of block Executed by:
| 37 | ||||||||||||||||||
1390 | dataIndex += 3; | - | ||||||||||||||||||
1391 | } executed 74 times by 1 test: end of block Executed by:
| 74 | ||||||||||||||||||
1392 | if (hasNotifySignals) {
| 4-32 | ||||||||||||||||||
1393 | for (index = 0; index < d->properties.size(); ++index) {
| 32-72 | ||||||||||||||||||
1394 | QMetaPropertyBuilderPrivate *prop = &(d->properties[index]); | - | ||||||||||||||||||
1395 | if (buf) {
| 36 | ||||||||||||||||||
1396 | if (prop->notifySignal != -1)
| 16-20 | ||||||||||||||||||
1397 | data[dataIndex] = prop->notifySignal; executed 16 times by 1 test: data[dataIndex] = prop->notifySignal; Executed by:
| 16 | ||||||||||||||||||
1398 | else | - | ||||||||||||||||||
1399 | data[dataIndex] = 0; executed 20 times by 1 test: data[dataIndex] = 0; Executed by:
| 20 | ||||||||||||||||||
1400 | } | - | ||||||||||||||||||
1401 | ++dataIndex; | - | ||||||||||||||||||
1402 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||
1403 | } executed 32 times by 1 test: end of block Executed by:
| 32 | ||||||||||||||||||
1404 | if (hasRevisionedProperties) {
| 8-28 | ||||||||||||||||||
1405 | for (index = 0; index < d->properties.size(); ++index) {
| 8-48 | ||||||||||||||||||
1406 | QMetaPropertyBuilderPrivate *prop = &(d->properties[index]); | - | ||||||||||||||||||
1407 | if (buf)
| 24 | ||||||||||||||||||
1408 | data[dataIndex] = prop->revision; executed 24 times by 1 test: data[dataIndex] = prop->revision; Executed by:
| 24 | ||||||||||||||||||
1409 | ++dataIndex; | - | ||||||||||||||||||
1410 | } executed 48 times by 1 test: end of block Executed by:
| 48 | ||||||||||||||||||
1411 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
1412 | - | |||||||||||||||||||
1413 | // Output the enumerators in the class. | - | ||||||||||||||||||
1414 | Q_ASSERT(!buf || dataIndex == pmeta->enumeratorData); | - | ||||||||||||||||||
1415 | for (index = 0; index < d->enumerators.size(); ++index) {
| 16-36 | ||||||||||||||||||
1416 | QMetaEnumBuilderPrivate *enumerator = &(d->enumerators[index]); | - | ||||||||||||||||||
1417 | int name = strings.enter(enumerator->name); | - | ||||||||||||||||||
1418 | int isFlag = (int)(enumerator->isFlag); | - | ||||||||||||||||||
1419 | int count = enumerator->keys.size(); | - | ||||||||||||||||||
1420 | int enumOffset = enumIndex; | - | ||||||||||||||||||
1421 | if (buf) {
| 8 | ||||||||||||||||||
1422 | data[dataIndex] = name; | - | ||||||||||||||||||
1423 | data[dataIndex + 1] = isFlag; | - | ||||||||||||||||||
1424 | data[dataIndex + 2] = count; | - | ||||||||||||||||||
1425 | data[dataIndex + 3] = enumOffset; | - | ||||||||||||||||||
1426 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
1427 | for (int key = 0; key < count; ++key) {
| 16-32 | ||||||||||||||||||
1428 | int keyIndex = strings.enter(enumerator->keys[key]); | - | ||||||||||||||||||
1429 | if (buf) {
| 16 | ||||||||||||||||||
1430 | data[enumOffset++] = keyIndex; | - | ||||||||||||||||||
1431 | data[enumOffset++] = enumerator->values[key]; | - | ||||||||||||||||||
1432 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||
1433 | } executed 32 times by 1 test: end of block Executed by:
| 32 | ||||||||||||||||||
1434 | dataIndex += 4; | - | ||||||||||||||||||
1435 | enumIndex += 2 * count; | - | ||||||||||||||||||
1436 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||
1437 | - | |||||||||||||||||||
1438 | // Output the constructors in the class. | - | ||||||||||||||||||
1439 | Q_ASSERT(!buf || dataIndex == pmeta->constructorData); | - | ||||||||||||||||||
1440 | for (index = 0; index < d->constructors.size(); ++index) {
| 36-48 | ||||||||||||||||||
1441 | QMetaMethodBuilderPrivate *method = &(d->constructors[index]); | - | ||||||||||||||||||
1442 | int name = strings.enter(method->name()); | - | ||||||||||||||||||
1443 | int argc = method->parameterCount(); | - | ||||||||||||||||||
1444 | int tag = strings.enter(method->tag); | - | ||||||||||||||||||
1445 | int attrs = method->attributes; | - | ||||||||||||||||||
1446 | if (buf) {
| 24 | ||||||||||||||||||
1447 | data[dataIndex] = name; | - | ||||||||||||||||||
1448 | data[dataIndex + 1] = argc; | - | ||||||||||||||||||
1449 | data[dataIndex + 2] = paramsIndex; | - | ||||||||||||||||||
1450 | data[dataIndex + 3] = tag; | - | ||||||||||||||||||
1451 | data[dataIndex + 4] = attrs; | - | ||||||||||||||||||
1452 | } executed 24 times by 1 test: end of block Executed by:
| 24 | ||||||||||||||||||
1453 | dataIndex += 5; | - | ||||||||||||||||||
1454 | paramsIndex += 1 + argc * 2; | - | ||||||||||||||||||
1455 | } executed 48 times by 1 test: end of block Executed by:
| 48 | ||||||||||||||||||
1456 | - | |||||||||||||||||||
1457 | size += strings.blobSize(); | - | ||||||||||||||||||
1458 | - | |||||||||||||||||||
1459 | if (buf)
| 18 | ||||||||||||||||||
1460 | strings.writeBlob(str); executed 18 times by 1 test: strings.writeBlob(str); Executed by:
| 18 | ||||||||||||||||||
1461 | - | |||||||||||||||||||
1462 | // Output the zero terminator in the data array. | - | ||||||||||||||||||
1463 | if (buf)
| 18 | ||||||||||||||||||
1464 | data[enumIndex] = 0; executed 18 times by 1 test: data[enumIndex] = 0; Executed by:
| 18 | ||||||||||||||||||
1465 | - | |||||||||||||||||||
1466 | // Create the relatedMetaObjects block if we need one. | - | ||||||||||||||||||
1467 | if (d->relatedMetaObjects.size() > 0) {
| 8-28 | ||||||||||||||||||
1468 | ALIGN(size, QMetaObject *); | - | ||||||||||||||||||
1469 | const QMetaObject **objects = | - | ||||||||||||||||||
1470 | reinterpret_cast<const QMetaObject **>(buf + size); | - | ||||||||||||||||||
1471 | if (buf) {
| 4 | ||||||||||||||||||
1472 | meta->d.relatedMetaObjects = objects; | - | ||||||||||||||||||
1473 | for (index = 0; index < d->relatedMetaObjects.size(); ++index)
| 4 | ||||||||||||||||||
1474 | objects[index] = d->relatedMetaObjects[index]; executed 4 times by 1 test: objects[index] = d->relatedMetaObjects[index]; Executed by:
| 4 | ||||||||||||||||||
1475 | objects[index] = 0; | - | ||||||||||||||||||
1476 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||
1477 | size += sizeof(QMetaObject *) * (d->relatedMetaObjects.size() + 1); | - | ||||||||||||||||||
1478 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
1479 | - | |||||||||||||||||||
1480 | // Align the final size and return it. | - | ||||||||||||||||||
1481 | ALIGN(size, void *); | - | ||||||||||||||||||
1482 | Q_ASSERT(!buf || size == expectedSize); | - | ||||||||||||||||||
1483 | return size; executed 36 times by 1 test: return size; Executed by:
| 36 | ||||||||||||||||||
1484 | } | - | ||||||||||||||||||
1485 | - | |||||||||||||||||||
1486 | /*! | - | ||||||||||||||||||
1487 | Converts this meta object builder into a concrete QMetaObject. | - | ||||||||||||||||||
1488 | The return value should be deallocated using free() once it | - | ||||||||||||||||||
1489 | is no longer needed. | - | ||||||||||||||||||
1490 | - | |||||||||||||||||||
1491 | The returned meta object is a snapshot of the state of the | - | ||||||||||||||||||
1492 | QMetaObjectBuilder. Any further modifications to the QMetaObjectBuilder | - | ||||||||||||||||||
1493 | will not be reflected in previous meta objects returned by | - | ||||||||||||||||||
1494 | this method. | - | ||||||||||||||||||
1495 | */ | - | ||||||||||||||||||
1496 | QMetaObject *QMetaObjectBuilder::toMetaObject() const | - | ||||||||||||||||||
1497 | { | - | ||||||||||||||||||
1498 | int size = buildMetaObject(d, 0, 0, false); | - | ||||||||||||||||||
1499 | char *buf = reinterpret_cast<char *>(malloc(size)); | - | ||||||||||||||||||
1500 | memset(buf, 0, size); | - | ||||||||||||||||||
1501 | buildMetaObject(d, buf, size, false); | - | ||||||||||||||||||
1502 | return reinterpret_cast<QMetaObject *>(buf); executed 17 times by 1 test: return reinterpret_cast<QMetaObject *>(buf); Executed by:
| 17 | ||||||||||||||||||
1503 | } | - | ||||||||||||||||||
1504 | - | |||||||||||||||||||
1505 | /* | - | ||||||||||||||||||
1506 | \internal | - | ||||||||||||||||||
1507 | - | |||||||||||||||||||
1508 | Converts this meta object builder into relocatable data. This data can | - | ||||||||||||||||||
1509 | be stored, copied and later passed to fromRelocatableData() to create a | - | ||||||||||||||||||
1510 | concrete QMetaObject. | - | ||||||||||||||||||
1511 | - | |||||||||||||||||||
1512 | The data is specific to the architecture on which it was created, but is not | - | ||||||||||||||||||
1513 | specific to the process that created it. Not all meta object builder's can | - | ||||||||||||||||||
1514 | be converted to data in this way. If \a ok is provided, it will be set to | - | ||||||||||||||||||
1515 | true if the conversion succeeds, and false otherwise. If a | - | ||||||||||||||||||
1516 | staticMetacallFunction() or any relatedMetaObject()'s are specified the | - | ||||||||||||||||||
1517 | conversion to relocatable data will fail. | - | ||||||||||||||||||
1518 | */ | - | ||||||||||||||||||
1519 | QByteArray QMetaObjectBuilder::toRelocatableData(bool *ok) const | - | ||||||||||||||||||
1520 | { | - | ||||||||||||||||||
1521 | int size = buildMetaObject(d, 0, 0, true); | - | ||||||||||||||||||
1522 | if (size == -1) {
| 0-1 | ||||||||||||||||||
1523 | if (ok) *ok = false; never executed: *ok = false;
| 0 | ||||||||||||||||||
1524 | return QByteArray(); never executed: return QByteArray(); | 0 | ||||||||||||||||||
1525 | } | - | ||||||||||||||||||
1526 | - | |||||||||||||||||||
1527 | QByteArray data; | - | ||||||||||||||||||
1528 | data.resize(size); | - | ||||||||||||||||||
1529 | char *buf = data.data(); | - | ||||||||||||||||||
1530 | memset(buf, 0, size); | - | ||||||||||||||||||
1531 | buildMetaObject(d, buf, size, true); | - | ||||||||||||||||||
1532 | if (ok) *ok = true; executed 1 time by 1 test: *ok = true; Executed by:
| 0-1 | ||||||||||||||||||
1533 | return data; executed 1 time by 1 test: return data; Executed by:
| 1 | ||||||||||||||||||
1534 | } | - | ||||||||||||||||||
1535 | - | |||||||||||||||||||
1536 | /* | - | ||||||||||||||||||
1537 | \internal | - | ||||||||||||||||||
1538 | - | |||||||||||||||||||
1539 | Sets the \a data returned from toRelocatableData() onto a concrete | - | ||||||||||||||||||
1540 | QMetaObject instance, \a output. As the meta object's super class is not | - | ||||||||||||||||||
1541 | saved in the relocatable data, it must be passed as \a superClass. | - | ||||||||||||||||||
1542 | */ | - | ||||||||||||||||||
1543 | void QMetaObjectBuilder::fromRelocatableData(QMetaObject *output, | - | ||||||||||||||||||
1544 | const QMetaObject *superclass, | - | ||||||||||||||||||
1545 | const QByteArray &data) | - | ||||||||||||||||||
1546 | { | - | ||||||||||||||||||
1547 | if (!output)
| 0-1 | ||||||||||||||||||
1548 | return; never executed: return; | 0 | ||||||||||||||||||
1549 | - | |||||||||||||||||||
1550 | const char *buf = data.constData(); | - | ||||||||||||||||||
1551 | const QMetaObject *dataMo = reinterpret_cast<const QMetaObject *>(buf); | - | ||||||||||||||||||
1552 | - | |||||||||||||||||||
1553 | quintptr stringdataOffset = (quintptr)dataMo->d.stringdata; | - | ||||||||||||||||||
1554 | quintptr dataOffset = (quintptr)dataMo->d.data; | - | ||||||||||||||||||
1555 | - | |||||||||||||||||||
1556 | output->d.superdata = superclass; | - | ||||||||||||||||||
1557 | output->d.stringdata = reinterpret_cast<const QByteArrayData *>(buf + stringdataOffset); | - | ||||||||||||||||||
1558 | output->d.data = reinterpret_cast<const uint *>(buf + dataOffset); | - | ||||||||||||||||||
1559 | output->d.extradata = 0; | - | ||||||||||||||||||
1560 | output->d.relatedMetaObjects = 0; | - | ||||||||||||||||||
1561 | output->d.static_metacall = 0; | - | ||||||||||||||||||
1562 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
1563 | - | |||||||||||||||||||
1564 | /*! | - | ||||||||||||||||||
1565 | \typedef QMetaObjectBuilder::StaticMetacallFunction | - | ||||||||||||||||||
1566 | - | |||||||||||||||||||
1567 | Typedef for static metacall functions. The three parameters are | - | ||||||||||||||||||
1568 | the call type value, the constructor index, and the | - | ||||||||||||||||||
1569 | array of parameters. | - | ||||||||||||||||||
1570 | */ | - | ||||||||||||||||||
1571 | - | |||||||||||||||||||
1572 | /*! | - | ||||||||||||||||||
1573 | Returns the static metacall function to use to construct objects | - | ||||||||||||||||||
1574 | of this class. The default value is null. | - | ||||||||||||||||||
1575 | - | |||||||||||||||||||
1576 | \sa setStaticMetacallFunction() | - | ||||||||||||||||||
1577 | */ | - | ||||||||||||||||||
1578 | QMetaObjectBuilder::StaticMetacallFunction QMetaObjectBuilder::staticMetacallFunction() const | - | ||||||||||||||||||
1579 | { | - | ||||||||||||||||||
1580 | return d->staticMetacallFunction; executed 15 times by 1 test: return d->staticMetacallFunction; Executed by:
| 15 | ||||||||||||||||||
1581 | } | - | ||||||||||||||||||
1582 | - | |||||||||||||||||||
1583 | /*! | - | ||||||||||||||||||
1584 | Sets the static metacall function to use to construct objects | - | ||||||||||||||||||
1585 | of this class to \a value. The default value is null. | - | ||||||||||||||||||
1586 | - | |||||||||||||||||||
1587 | \sa staticMetacallFunction() | - | ||||||||||||||||||
1588 | */ | - | ||||||||||||||||||
1589 | void QMetaObjectBuilder::setStaticMetacallFunction | - | ||||||||||||||||||
1590 | (QMetaObjectBuilder::StaticMetacallFunction value) | - | ||||||||||||||||||
1591 | { | - | ||||||||||||||||||
1592 | d->staticMetacallFunction = value; | - | ||||||||||||||||||
1593 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||
1594 | - | |||||||||||||||||||
1595 | #ifndef QT_NO_DATASTREAM | - | ||||||||||||||||||
1596 | - | |||||||||||||||||||
1597 | /*! | - | ||||||||||||||||||
1598 | Serializes the contents of the meta object builder onto \a stream. | - | ||||||||||||||||||
1599 | - | |||||||||||||||||||
1600 | \sa deserialize() | - | ||||||||||||||||||
1601 | */ | - | ||||||||||||||||||
1602 | void QMetaObjectBuilder::serialize(QDataStream& stream) const | - | ||||||||||||||||||
1603 | { | - | ||||||||||||||||||
1604 | int index; | - | ||||||||||||||||||
1605 | - | |||||||||||||||||||
1606 | // Write the class and super class names. | - | ||||||||||||||||||
1607 | stream << d->className; | - | ||||||||||||||||||
1608 | if (d->superClass)
| 0-2 | ||||||||||||||||||
1609 | stream << QByteArray(d->superClass->className()); executed 2 times by 1 test: stream << QByteArray(d->superClass->className()); Executed by:
| 2 | ||||||||||||||||||
1610 | else | - | ||||||||||||||||||
1611 | stream << QByteArray(); never executed: stream << QByteArray(); | 0 | ||||||||||||||||||
1612 | - | |||||||||||||||||||
1613 | // Write the counts for each type of class member. | - | ||||||||||||||||||
1614 | stream << d->classInfoNames.size(); | - | ||||||||||||||||||
1615 | stream << d->methods.size(); | - | ||||||||||||||||||
1616 | stream << d->properties.size(); | - | ||||||||||||||||||
1617 | stream << d->enumerators.size(); | - | ||||||||||||||||||
1618 | stream << d->constructors.size(); | - | ||||||||||||||||||
1619 | stream << d->relatedMetaObjects.size(); | - | ||||||||||||||||||
1620 | - | |||||||||||||||||||
1621 | // Write the items of class information. | - | ||||||||||||||||||
1622 | for (index = 0; index < d->classInfoNames.size(); ++index) {
| 2 | ||||||||||||||||||
1623 | stream << d->classInfoNames[index]; | - | ||||||||||||||||||
1624 | stream << d->classInfoValues[index]; | - | ||||||||||||||||||
1625 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
1626 | - | |||||||||||||||||||
1627 | // Write the methods. | - | ||||||||||||||||||
1628 | for (index = 0; index < d->methods.size(); ++index) {
| 2-10 | ||||||||||||||||||
1629 | const QMetaMethodBuilderPrivate *method = &(d->methods[index]); | - | ||||||||||||||||||
1630 | stream << method->signature; | - | ||||||||||||||||||
1631 | stream << method->returnType; | - | ||||||||||||||||||
1632 | stream << method->parameterNames; | - | ||||||||||||||||||
1633 | stream << method->tag; | - | ||||||||||||||||||
1634 | stream << method->attributes; | - | ||||||||||||||||||
1635 | if (method->revision)
| 1-9 | ||||||||||||||||||
1636 | stream << method->revision; executed 1 time by 1 test: stream << method->revision; Executed by:
| 1 | ||||||||||||||||||
1637 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||
1638 | - | |||||||||||||||||||
1639 | // Write the properties. | - | ||||||||||||||||||
1640 | for (index = 0; index < d->properties.size(); ++index) {
| 2-7 | ||||||||||||||||||
1641 | const QMetaPropertyBuilderPrivate *property = &(d->properties[index]); | - | ||||||||||||||||||
1642 | stream << property->name; | - | ||||||||||||||||||
1643 | stream << property->type; | - | ||||||||||||||||||
1644 | stream << property->flags; | - | ||||||||||||||||||
1645 | stream << property->notifySignal; | - | ||||||||||||||||||
1646 | if (property->revision)
| 1-6 | ||||||||||||||||||
1647 | stream << property->revision; executed 1 time by 1 test: stream << property->revision; Executed by:
| 1 | ||||||||||||||||||
1648 | } executed 7 times by 1 test: end of block Executed by:
| 7 | ||||||||||||||||||
1649 | - | |||||||||||||||||||
1650 | // Write the enumerators. | - | ||||||||||||||||||
1651 | for (index = 0; index < d->enumerators.size(); ++index) {
| 2 | ||||||||||||||||||
1652 | const QMetaEnumBuilderPrivate *enumerator = &(d->enumerators[index]); | - | ||||||||||||||||||
1653 | stream << enumerator->name; | - | ||||||||||||||||||
1654 | stream << enumerator->isFlag; | - | ||||||||||||||||||
1655 | stream << enumerator->keys; | - | ||||||||||||||||||
1656 | stream << enumerator->values; | - | ||||||||||||||||||
1657 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
1658 | - | |||||||||||||||||||
1659 | // Write the constructors. | - | ||||||||||||||||||
1660 | for (index = 0; index < d->constructors.size(); ++index) {
| 1-2 | ||||||||||||||||||
1661 | const QMetaMethodBuilderPrivate *method = &(d->constructors[index]); | - | ||||||||||||||||||
1662 | stream << method->signature; | - | ||||||||||||||||||
1663 | stream << method->returnType; | - | ||||||||||||||||||
1664 | stream << method->parameterNames; | - | ||||||||||||||||||
1665 | stream << method->tag; | - | ||||||||||||||||||
1666 | stream << method->attributes; | - | ||||||||||||||||||
1667 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
1668 | - | |||||||||||||||||||
1669 | // Write the related meta objects. | - | ||||||||||||||||||
1670 | for (index = 0; index < d->relatedMetaObjects.size(); ++index) {
| 1-2 | ||||||||||||||||||
1671 | const QMetaObject *meta = d->relatedMetaObjects[index]; | - | ||||||||||||||||||
1672 | stream << QByteArray(meta->className()); | - | ||||||||||||||||||
1673 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
1674 | - | |||||||||||||||||||
1675 | // Add an extra empty QByteArray for additional data in future versions. | - | ||||||||||||||||||
1676 | // This should help maintain backwards compatibility, allowing older | - | ||||||||||||||||||
1677 | // versions to read newer data. | - | ||||||||||||||||||
1678 | stream << QByteArray(); | - | ||||||||||||||||||
1679 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
1680 | - | |||||||||||||||||||
1681 | // Resolve a class name using the name reference map. | - | ||||||||||||||||||
1682 | static const QMetaObject *resolveClassName | - | ||||||||||||||||||
1683 | (const QMap<QByteArray, const QMetaObject *>& references, | - | ||||||||||||||||||
1684 | const QByteArray& name) | - | ||||||||||||||||||
1685 | { | - | ||||||||||||||||||
1686 | if (name == QByteArray("QObject"))
| 1-2 | ||||||||||||||||||
1687 | return &QObject::staticMetaObject; executed 2 times by 1 test: return &QObject::staticMetaObject; Executed by:
| 2 | ||||||||||||||||||
1688 | else | - | ||||||||||||||||||
1689 | return references.value(name, 0); executed 1 time by 1 test: return references.value(name, 0); Executed by:
| 1 | ||||||||||||||||||
1690 | } | - | ||||||||||||||||||
1691 | - | |||||||||||||||||||
1692 | /*! | - | ||||||||||||||||||
1693 | Deserializes a meta object builder from \a stream into | - | ||||||||||||||||||
1694 | this meta object builder. | - | ||||||||||||||||||
1695 | - | |||||||||||||||||||
1696 | The \a references parameter specifies a mapping from class names | - | ||||||||||||||||||
1697 | to QMetaObject instances for resolving the super class name and | - | ||||||||||||||||||
1698 | related meta objects in the object that is deserialized. | - | ||||||||||||||||||
1699 | The meta object for QObject is implicitly added to \a references | - | ||||||||||||||||||
1700 | and does not need to be supplied. | - | ||||||||||||||||||
1701 | - | |||||||||||||||||||
1702 | The QDataStream::status() value on \a stream will be set to | - | ||||||||||||||||||
1703 | QDataStream::ReadCorruptData if the input data is corrupt. | - | ||||||||||||||||||
1704 | The status will be set to QDataStream::ReadPastEnd if the | - | ||||||||||||||||||
1705 | input was exhausted before the full meta object was read. | - | ||||||||||||||||||
1706 | - | |||||||||||||||||||
1707 | \sa serialize() | - | ||||||||||||||||||
1708 | */ | - | ||||||||||||||||||
1709 | void QMetaObjectBuilder::deserialize | - | ||||||||||||||||||
1710 | (QDataStream& stream, | - | ||||||||||||||||||
1711 | const QMap<QByteArray, const QMetaObject *>& references) | - | ||||||||||||||||||
1712 | { | - | ||||||||||||||||||
1713 | QByteArray name; | - | ||||||||||||||||||
1714 | const QMetaObject *cl; | - | ||||||||||||||||||
1715 | int index; | - | ||||||||||||||||||
1716 | - | |||||||||||||||||||
1717 | // Clear all members in the builder to their default states. | - | ||||||||||||||||||
1718 | d->className.clear(); | - | ||||||||||||||||||
1719 | d->superClass = &QObject::staticMetaObject; | - | ||||||||||||||||||
1720 | d->classInfoNames.clear(); | - | ||||||||||||||||||
1721 | d->classInfoValues.clear(); | - | ||||||||||||||||||
1722 | d->methods.clear(); | - | ||||||||||||||||||
1723 | d->properties.clear(); | - | ||||||||||||||||||
1724 | d->enumerators.clear(); | - | ||||||||||||||||||
1725 | d->constructors.clear(); | - | ||||||||||||||||||
1726 | d->relatedMetaObjects.clear(); | - | ||||||||||||||||||
1727 | d->staticMetacallFunction = 0; | - | ||||||||||||||||||
1728 | - | |||||||||||||||||||
1729 | // Read the class and super class names. | - | ||||||||||||||||||
1730 | stream >> d->className; | - | ||||||||||||||||||
1731 | stream >> name; | - | ||||||||||||||||||
1732 | if (name.isEmpty()) {
| 0-2 | ||||||||||||||||||
1733 | d->superClass = 0; | - | ||||||||||||||||||
1734 | } else if ((cl = resolveClassName(references, name)) != 0) { never executed: end of block
| 0-2 | ||||||||||||||||||
1735 | d->superClass = cl; | - | ||||||||||||||||||
1736 | } else { executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
1737 | stream.setStatus(QDataStream::ReadCorruptData); | - | ||||||||||||||||||
1738 | return; never executed: return; | 0 | ||||||||||||||||||
1739 | } | - | ||||||||||||||||||
1740 | - | |||||||||||||||||||
1741 | // Read the counts for each type of class member. | - | ||||||||||||||||||
1742 | int classInfoCount, methodCount, propertyCount; | - | ||||||||||||||||||
1743 | int enumeratorCount, constructorCount, relatedMetaObjectCount; | - | ||||||||||||||||||
1744 | stream >> classInfoCount; | - | ||||||||||||||||||
1745 | stream >> methodCount; | - | ||||||||||||||||||
1746 | stream >> propertyCount; | - | ||||||||||||||||||
1747 | stream >> enumeratorCount; | - | ||||||||||||||||||
1748 | stream >> constructorCount; | - | ||||||||||||||||||
1749 | stream >> relatedMetaObjectCount; | - | ||||||||||||||||||
1750 | if (classInfoCount < 0 || methodCount < 0 ||
| 0-2 | ||||||||||||||||||
1751 | propertyCount < 0 || enumeratorCount < 0 ||
| 0-2 | ||||||||||||||||||
1752 | constructorCount < 0 || relatedMetaObjectCount < 0) {
| 0-2 | ||||||||||||||||||
1753 | stream.setStatus(QDataStream::ReadCorruptData); | - | ||||||||||||||||||
1754 | return; never executed: return; | 0 | ||||||||||||||||||
1755 | } | - | ||||||||||||||||||
1756 | - | |||||||||||||||||||
1757 | // Read the items of class information. | - | ||||||||||||||||||
1758 | for (index = 0; index < classInfoCount; ++index) {
| 2 | ||||||||||||||||||
1759 | if (stream.status() != QDataStream::Ok)
| 0-2 | ||||||||||||||||||
1760 | return; never executed: return; | 0 | ||||||||||||||||||
1761 | QByteArray value; | - | ||||||||||||||||||
1762 | stream >> name; | - | ||||||||||||||||||
1763 | stream >> value; | - | ||||||||||||||||||
1764 | addClassInfo(name, value); | - | ||||||||||||||||||
1765 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
1766 | - | |||||||||||||||||||
1767 | // Read the member methods. | - | ||||||||||||||||||
1768 | for (index = 0; index < methodCount; ++index) {
| 2-10 | ||||||||||||||||||
1769 | if (stream.status() != QDataStream::Ok)
| 0-10 | ||||||||||||||||||
1770 | return; never executed: return; | 0 | ||||||||||||||||||
1771 | stream >> name; | - | ||||||||||||||||||
1772 | addMethod(name); | - | ||||||||||||||||||
1773 | QMetaMethodBuilderPrivate *method = &(d->methods[index]); | - | ||||||||||||||||||
1774 | stream >> method->returnType; | - | ||||||||||||||||||
1775 | stream >> method->parameterNames; | - | ||||||||||||||||||
1776 | stream >> method->tag; | - | ||||||||||||||||||
1777 | stream >> method->attributes; | - | ||||||||||||||||||
1778 | if (method->attributes & MethodRevisioned)
| 1-9 | ||||||||||||||||||
1779 | stream >> method->revision; executed 1 time by 1 test: stream >> method->revision; Executed by:
| 1 | ||||||||||||||||||
1780 | if (method->methodType() == QMetaMethod::Constructor) {
| 0-10 | ||||||||||||||||||
1781 | // Cannot add a constructor in this set of methods. | - | ||||||||||||||||||
1782 | stream.setStatus(QDataStream::ReadCorruptData); | - | ||||||||||||||||||
1783 | return; never executed: return; | 0 | ||||||||||||||||||
1784 | } | - | ||||||||||||||||||
1785 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||
1786 | - | |||||||||||||||||||
1787 | // Read the properties. | - | ||||||||||||||||||
1788 | for (index = 0; index < propertyCount; ++index) {
| 2-7 | ||||||||||||||||||
1789 | if (stream.status() != QDataStream::Ok)
| 0-7 | ||||||||||||||||||
1790 | return; never executed: return; | 0 | ||||||||||||||||||
1791 | QByteArray type; | - | ||||||||||||||||||
1792 | stream >> name; | - | ||||||||||||||||||
1793 | stream >> type; | - | ||||||||||||||||||
1794 | addProperty(name, type); | - | ||||||||||||||||||
1795 | QMetaPropertyBuilderPrivate *property = &(d->properties[index]); | - | ||||||||||||||||||
1796 | stream >> property->flags; | - | ||||||||||||||||||
1797 | stream >> property->notifySignal; | - | ||||||||||||||||||
1798 | if (property->notifySignal < -1 ||
| 0-7 | ||||||||||||||||||
1799 | property->notifySignal >= d->methods.size()) {
| 0-7 | ||||||||||||||||||
1800 | // Notify signal method index is out of range. | - | ||||||||||||||||||
1801 | stream.setStatus(QDataStream::ReadCorruptData); | - | ||||||||||||||||||
1802 | return; never executed: return; | 0 | ||||||||||||||||||
1803 | } | - | ||||||||||||||||||
1804 | if (property->notifySignal >= 0 &&
| 1-6 | ||||||||||||||||||
1805 | d->methods[property->notifySignal].methodType() != QMetaMethod::Signal) {
| 0-1 | ||||||||||||||||||
1806 | // Notify signal method index does not refer to a signal. | - | ||||||||||||||||||
1807 | stream.setStatus(QDataStream::ReadCorruptData); | - | ||||||||||||||||||
1808 | return; never executed: return; | 0 | ||||||||||||||||||
1809 | } | - | ||||||||||||||||||
1810 | if (property->flags & Revisioned)
| 1-6 | ||||||||||||||||||
1811 | stream >> property->revision; executed 1 time by 1 test: stream >> property->revision; Executed by:
| 1 | ||||||||||||||||||
1812 | } executed 7 times by 1 test: end of block Executed by:
| 7 | ||||||||||||||||||
1813 | - | |||||||||||||||||||
1814 | // Read the enumerators. | - | ||||||||||||||||||
1815 | for (index = 0; index < enumeratorCount; ++index) {
| 2 | ||||||||||||||||||
1816 | if (stream.status() != QDataStream::Ok)
| 0-2 | ||||||||||||||||||
1817 | return; never executed: return; | 0 | ||||||||||||||||||
1818 | stream >> name; | - | ||||||||||||||||||
1819 | addEnumerator(name); | - | ||||||||||||||||||
1820 | QMetaEnumBuilderPrivate *enumerator = &(d->enumerators[index]); | - | ||||||||||||||||||
1821 | stream >> enumerator->isFlag; | - | ||||||||||||||||||
1822 | stream >> enumerator->keys; | - | ||||||||||||||||||
1823 | stream >> enumerator->values; | - | ||||||||||||||||||
1824 | if (enumerator->keys.size() != enumerator->values.size()) {
| 0-2 | ||||||||||||||||||
1825 | // Mismatch between number of keys and number of values. | - | ||||||||||||||||||
1826 | stream.setStatus(QDataStream::ReadCorruptData); | - | ||||||||||||||||||
1827 | return; never executed: return; | 0 | ||||||||||||||||||
1828 | } | - | ||||||||||||||||||
1829 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
1830 | - | |||||||||||||||||||
1831 | // Read the constructor methods. | - | ||||||||||||||||||
1832 | for (index = 0; index < constructorCount; ++index) {
| 1-2 | ||||||||||||||||||
1833 | if (stream.status() != QDataStream::Ok)
| 0-1 | ||||||||||||||||||
1834 | return; never executed: return; | 0 | ||||||||||||||||||
1835 | stream >> name; | - | ||||||||||||||||||
1836 | addConstructor(name); | - | ||||||||||||||||||
1837 | QMetaMethodBuilderPrivate *method = &(d->constructors[index]); | - | ||||||||||||||||||
1838 | stream >> method->returnType; | - | ||||||||||||||||||
1839 | stream >> method->parameterNames; | - | ||||||||||||||||||
1840 | stream >> method->tag; | - | ||||||||||||||||||
1841 | stream >> method->attributes; | - | ||||||||||||||||||
1842 | if (method->methodType() != QMetaMethod::Constructor) {
| 0-1 | ||||||||||||||||||
1843 | // The type must be Constructor. | - | ||||||||||||||||||
1844 | stream.setStatus(QDataStream::ReadCorruptData); | - | ||||||||||||||||||
1845 | return; never executed: return; | 0 | ||||||||||||||||||
1846 | } | - | ||||||||||||||||||
1847 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
1848 | - | |||||||||||||||||||
1849 | // Read the related meta objects. | - | ||||||||||||||||||
1850 | for (index = 0; index < relatedMetaObjectCount; ++index) {
| 1-2 | ||||||||||||||||||
1851 | if (stream.status() != QDataStream::Ok)
| 0-1 | ||||||||||||||||||
1852 | return; never executed: return; | 0 | ||||||||||||||||||
1853 | stream >> name; | - | ||||||||||||||||||
1854 | cl = resolveClassName(references, name); | - | ||||||||||||||||||
1855 | if (!cl) {
| 0-1 | ||||||||||||||||||
1856 | stream.setStatus(QDataStream::ReadCorruptData); | - | ||||||||||||||||||
1857 | return; never executed: return; | 0 | ||||||||||||||||||
1858 | } | - | ||||||||||||||||||
1859 | addRelatedMetaObject(cl); | - | ||||||||||||||||||
1860 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
1861 | - | |||||||||||||||||||
1862 | // Read the extra data block, which is reserved for future use. | - | ||||||||||||||||||
1863 | stream >> name; | - | ||||||||||||||||||
1864 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||
1865 | - | |||||||||||||||||||
1866 | #endif // !QT_NO_DATASTREAM | - | ||||||||||||||||||
1867 | - | |||||||||||||||||||
1868 | /*! | - | ||||||||||||||||||
1869 | \class QMetaMethodBuilder | - | ||||||||||||||||||
1870 | \inmodule QtCore | - | ||||||||||||||||||
1871 | \internal | - | ||||||||||||||||||
1872 | \brief The QMetaMethodBuilder class enables modifications to a method definition on a meta object builder. | - | ||||||||||||||||||
1873 | */ | - | ||||||||||||||||||
1874 | - | |||||||||||||||||||
1875 | QMetaMethodBuilderPrivate *QMetaMethodBuilder::d_func() const | - | ||||||||||||||||||
1876 | { | - | ||||||||||||||||||
1877 | // Positive indices indicate methods, negative indices indicate constructors. | - | ||||||||||||||||||
1878 | if (_mobj && _index >= 0 && _index < _mobj->d->methods.size())
| 0-631 | ||||||||||||||||||
1879 | return &(_mobj->d->methods[_index]); executed 528 times by 1 test: return &(_mobj->d->methods[_index]); Executed by:
| 528 | ||||||||||||||||||
1880 | else if (_mobj && -_index >= 1 && -_index <= _mobj->d->constructors.size())
| 0-103 | ||||||||||||||||||
1881 | return &(_mobj->d->constructors[(-_index) - 1]); executed 103 times by 1 test: return &(_mobj->d->constructors[(-_index) - 1]); Executed by:
| 103 | ||||||||||||||||||
1882 | else | - | ||||||||||||||||||
1883 | return 0; executed 11 times by 1 test: return 0; Executed by:
| 11 | ||||||||||||||||||
1884 | } | - | ||||||||||||||||||
1885 | - | |||||||||||||||||||
1886 | /*! | - | ||||||||||||||||||
1887 | \fn QMetaMethodBuilder::QMetaMethodBuilder() | - | ||||||||||||||||||
1888 | \internal | - | ||||||||||||||||||
1889 | */ | - | ||||||||||||||||||
1890 | - | |||||||||||||||||||
1891 | /*! | - | ||||||||||||||||||
1892 | Returns the index of this method within its QMetaObjectBuilder. | - | ||||||||||||||||||
1893 | */ | - | ||||||||||||||||||
1894 | int QMetaMethodBuilder::index() const | - | ||||||||||||||||||
1895 | { | - | ||||||||||||||||||
1896 | if (_index >= 0)
| 8-19 | ||||||||||||||||||
1897 | return _index; // Method, signal, or slot executed 19 times by 1 test: return _index; Executed by:
| 19 | ||||||||||||||||||
1898 | else | - | ||||||||||||||||||
1899 | return (-_index) - 1; // Constructor executed 8 times by 1 test: return (-_index) - 1; Executed by:
| 8 | ||||||||||||||||||
1900 | } | - | ||||||||||||||||||
1901 | - | |||||||||||||||||||
1902 | /*! | - | ||||||||||||||||||
1903 | Returns the type of this method (signal, slot, method, or constructor). | - | ||||||||||||||||||
1904 | */ | - | ||||||||||||||||||
1905 | QMetaMethod::MethodType QMetaMethodBuilder::methodType() const | - | ||||||||||||||||||
1906 | { | - | ||||||||||||||||||
1907 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
1908 | if (d)
| 1-19 | ||||||||||||||||||
1909 | return d->methodType(); executed 19 times by 1 test: return d->methodType(); Executed by:
| 19 | ||||||||||||||||||
1910 | else | - | ||||||||||||||||||
1911 | return QMetaMethod::Method; executed 1 time by 1 test: return QMetaMethod::Method; Executed by:
| 1 | ||||||||||||||||||
1912 | } | - | ||||||||||||||||||
1913 | - | |||||||||||||||||||
1914 | /*! | - | ||||||||||||||||||
1915 | Returns the signature of this method. | - | ||||||||||||||||||
1916 | - | |||||||||||||||||||
1917 | \sa parameterNames(), returnType() | - | ||||||||||||||||||
1918 | */ | - | ||||||||||||||||||
1919 | QByteArray QMetaMethodBuilder::signature() const | - | ||||||||||||||||||
1920 | { | - | ||||||||||||||||||
1921 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
1922 | if (d)
| 3-23 | ||||||||||||||||||
1923 | return d->signature; executed 23 times by 1 test: return d->signature; Executed by:
| 23 | ||||||||||||||||||
1924 | else | - | ||||||||||||||||||
1925 | return QByteArray(); executed 3 times by 1 test: return QByteArray(); Executed by:
| 3 | ||||||||||||||||||
1926 | } | - | ||||||||||||||||||
1927 | - | |||||||||||||||||||
1928 | /*! | - | ||||||||||||||||||
1929 | Returns the return type for this method; empty if the method's | - | ||||||||||||||||||
1930 | return type is \c{void}. | - | ||||||||||||||||||
1931 | - | |||||||||||||||||||
1932 | \sa setReturnType(), signature() | - | ||||||||||||||||||
1933 | */ | - | ||||||||||||||||||
1934 | QByteArray QMetaMethodBuilder::returnType() const | - | ||||||||||||||||||
1935 | { | - | ||||||||||||||||||
1936 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
1937 | if (d)
| 1-19 | ||||||||||||||||||
1938 | return d->returnType; executed 19 times by 1 test: return d->returnType; Executed by:
| 19 | ||||||||||||||||||
1939 | else | - | ||||||||||||||||||
1940 | return QByteArray(); executed 1 time by 1 test: return QByteArray(); Executed by:
| 1 | ||||||||||||||||||
1941 | } | - | ||||||||||||||||||
1942 | - | |||||||||||||||||||
1943 | /*! | - | ||||||||||||||||||
1944 | Sets the return type for this method to \a value. If \a value | - | ||||||||||||||||||
1945 | is empty, then the method's return type is \c{void}. The \a value | - | ||||||||||||||||||
1946 | will be normalized before it is added to the method. | - | ||||||||||||||||||
1947 | - | |||||||||||||||||||
1948 | \sa returnType(), parameterTypes(), signature() | - | ||||||||||||||||||
1949 | */ | - | ||||||||||||||||||
1950 | void QMetaMethodBuilder::setReturnType(const QByteArray& value) | - | ||||||||||||||||||
1951 | { | - | ||||||||||||||||||
1952 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
1953 | if (d)
| 0-83 | ||||||||||||||||||
1954 | d->returnType = QMetaObject::normalizedType(value); executed 83 times by 1 test: d->returnType = QMetaObject::normalizedType(value); Executed by:
| 83 | ||||||||||||||||||
1955 | } executed 83 times by 1 test: end of block Executed by:
| 83 | ||||||||||||||||||
1956 | - | |||||||||||||||||||
1957 | /*! | - | ||||||||||||||||||
1958 | Returns the list of parameter types for this method. | - | ||||||||||||||||||
1959 | - | |||||||||||||||||||
1960 | \sa returnType(), parameterNames() | - | ||||||||||||||||||
1961 | */ | - | ||||||||||||||||||
1962 | QList<QByteArray> QMetaMethodBuilder::parameterTypes() const | - | ||||||||||||||||||
1963 | { | - | ||||||||||||||||||
1964 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
1965 | if (d)
| 1-19 | ||||||||||||||||||
1966 | return d->parameterTypes(); executed 19 times by 1 test: return d->parameterTypes(); Executed by:
| 19 | ||||||||||||||||||
1967 | else | - | ||||||||||||||||||
1968 | return QList<QByteArray>(); executed 1 time by 1 test: return QList<QByteArray>(); Executed by:
| 1 | ||||||||||||||||||
1969 | } | - | ||||||||||||||||||
1970 | - | |||||||||||||||||||
1971 | /*! | - | ||||||||||||||||||
1972 | Returns the list of parameter names for this method. | - | ||||||||||||||||||
1973 | - | |||||||||||||||||||
1974 | \sa setParameterNames() | - | ||||||||||||||||||
1975 | */ | - | ||||||||||||||||||
1976 | QList<QByteArray> QMetaMethodBuilder::parameterNames() const | - | ||||||||||||||||||
1977 | { | - | ||||||||||||||||||
1978 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
1979 | if (d)
| 1-18 | ||||||||||||||||||
1980 | return d->parameterNames; executed 18 times by 1 test: return d->parameterNames; Executed by:
| 18 | ||||||||||||||||||
1981 | else | - | ||||||||||||||||||
1982 | return QList<QByteArray>(); executed 1 time by 1 test: return QList<QByteArray>(); Executed by:
| 1 | ||||||||||||||||||
1983 | } | - | ||||||||||||||||||
1984 | - | |||||||||||||||||||
1985 | /*! | - | ||||||||||||||||||
1986 | Sets the list of parameter names for this method to \a value. | - | ||||||||||||||||||
1987 | - | |||||||||||||||||||
1988 | \sa parameterNames() | - | ||||||||||||||||||
1989 | */ | - | ||||||||||||||||||
1990 | void QMetaMethodBuilder::setParameterNames(const QList<QByteArray>& value) | - | ||||||||||||||||||
1991 | { | - | ||||||||||||||||||
1992 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
1993 | if (d)
| 0-103 | ||||||||||||||||||
1994 | d->parameterNames = value; executed 103 times by 1 test: d->parameterNames = value; Executed by:
| 103 | ||||||||||||||||||
1995 | } executed 103 times by 1 test: end of block Executed by:
| 103 | ||||||||||||||||||
1996 | - | |||||||||||||||||||
1997 | /*! | - | ||||||||||||||||||
1998 | Returns the tag associated with this method. | - | ||||||||||||||||||
1999 | - | |||||||||||||||||||
2000 | \sa setTag() | - | ||||||||||||||||||
2001 | */ | - | ||||||||||||||||||
2002 | QByteArray QMetaMethodBuilder::tag() const | - | ||||||||||||||||||
2003 | { | - | ||||||||||||||||||
2004 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2005 | if (d)
| 1-18 | ||||||||||||||||||
2006 | return d->tag; executed 18 times by 1 test: return d->tag; Executed by:
| 18 | ||||||||||||||||||
2007 | else | - | ||||||||||||||||||
2008 | return QByteArray(); executed 1 time by 1 test: return QByteArray(); Executed by:
| 1 | ||||||||||||||||||
2009 | } | - | ||||||||||||||||||
2010 | - | |||||||||||||||||||
2011 | /*! | - | ||||||||||||||||||
2012 | Sets the tag associated with this method to \a value. | - | ||||||||||||||||||
2013 | - | |||||||||||||||||||
2014 | \sa setTag() | - | ||||||||||||||||||
2015 | */ | - | ||||||||||||||||||
2016 | void QMetaMethodBuilder::setTag(const QByteArray& value) | - | ||||||||||||||||||
2017 | { | - | ||||||||||||||||||
2018 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2019 | if (d)
| 0-73 | ||||||||||||||||||
2020 | d->tag = value; executed 73 times by 1 test: d->tag = value; Executed by:
| 73 | ||||||||||||||||||
2021 | } executed 73 times by 1 test: end of block Executed by:
| 73 | ||||||||||||||||||
2022 | - | |||||||||||||||||||
2023 | /*! | - | ||||||||||||||||||
2024 | Returns the access specification of this method (private, protected, | - | ||||||||||||||||||
2025 | or public). The default value is QMetaMethod::Public for methods, | - | ||||||||||||||||||
2026 | slots, signals and constructors. | - | ||||||||||||||||||
2027 | - | |||||||||||||||||||
2028 | \sa setAccess() | - | ||||||||||||||||||
2029 | */ | - | ||||||||||||||||||
2030 | QMetaMethod::Access QMetaMethodBuilder::access() const | - | ||||||||||||||||||
2031 | { | - | ||||||||||||||||||
2032 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2033 | if (d)
| 1-19 | ||||||||||||||||||
2034 | return d->access(); executed 19 times by 1 test: return d->access(); Executed by:
| 19 | ||||||||||||||||||
2035 | else | - | ||||||||||||||||||
2036 | return QMetaMethod::Public; executed 1 time by 1 test: return QMetaMethod::Public; Executed by:
| 1 | ||||||||||||||||||
2037 | } | - | ||||||||||||||||||
2038 | - | |||||||||||||||||||
2039 | /*! | - | ||||||||||||||||||
2040 | Sets the access specification of this method (private, protected, | - | ||||||||||||||||||
2041 | or public) to \a value. If the method is a signal, this function | - | ||||||||||||||||||
2042 | will be ignored. | - | ||||||||||||||||||
2043 | - | |||||||||||||||||||
2044 | \sa access() | - | ||||||||||||||||||
2045 | */ | - | ||||||||||||||||||
2046 | void QMetaMethodBuilder::setAccess(QMetaMethod::Access value) | - | ||||||||||||||||||
2047 | { | - | ||||||||||||||||||
2048 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2049 | if (d && d->methodType() != QMetaMethod::Signal)
| 0-73 | ||||||||||||||||||
2050 | d->setAccess(value); executed 60 times by 1 test: d->setAccess(value); Executed by:
| 60 | ||||||||||||||||||
2051 | } executed 73 times by 1 test: end of block Executed by:
| 73 | ||||||||||||||||||
2052 | - | |||||||||||||||||||
2053 | /*! | - | ||||||||||||||||||
2054 | Returns the additional attributes for this method. | - | ||||||||||||||||||
2055 | - | |||||||||||||||||||
2056 | \sa setAttributes() | - | ||||||||||||||||||
2057 | */ | - | ||||||||||||||||||
2058 | int QMetaMethodBuilder::attributes() const | - | ||||||||||||||||||
2059 | { | - | ||||||||||||||||||
2060 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2061 | if (d)
| 1-18 | ||||||||||||||||||
2062 | return (d->attributes >> 4); executed 18 times by 1 test: return (d->attributes >> 4); Executed by:
| 18 | ||||||||||||||||||
2063 | else | - | ||||||||||||||||||
2064 | return 0; executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||
2065 | } | - | ||||||||||||||||||
2066 | - | |||||||||||||||||||
2067 | /*! | - | ||||||||||||||||||
2068 | Sets the additional attributes for this method to \a value. | - | ||||||||||||||||||
2069 | - | |||||||||||||||||||
2070 | \sa attributes() | - | ||||||||||||||||||
2071 | */ | - | ||||||||||||||||||
2072 | void QMetaMethodBuilder::setAttributes(int value) | - | ||||||||||||||||||
2073 | { | - | ||||||||||||||||||
2074 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2075 | if (d)
| 0-73 | ||||||||||||||||||
2076 | d->attributes = ((d->attributes & 0x0f) | (value << 4)); executed 73 times by 1 test: d->attributes = ((d->attributes & 0x0f) | (value << 4)); Executed by:
| 73 | ||||||||||||||||||
2077 | } executed 73 times by 1 test: end of block Executed by:
| 73 | ||||||||||||||||||
2078 | - | |||||||||||||||||||
2079 | /*! | - | ||||||||||||||||||
2080 | Returns the revision of this method. | - | ||||||||||||||||||
2081 | - | |||||||||||||||||||
2082 | \sa setRevision() | - | ||||||||||||||||||
2083 | */ | - | ||||||||||||||||||
2084 | int QMetaMethodBuilder::revision() const | - | ||||||||||||||||||
2085 | { | - | ||||||||||||||||||
2086 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2087 | if (d)
| 1-7 | ||||||||||||||||||
2088 | return d->revision; executed 7 times by 1 test: return d->revision; Executed by:
| 7 | ||||||||||||||||||
2089 | return 0; executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||
2090 | - | |||||||||||||||||||
2091 | } | - | ||||||||||||||||||
2092 | - | |||||||||||||||||||
2093 | /*! | - | ||||||||||||||||||
2094 | Sets the \a revision of this method. | - | ||||||||||||||||||
2095 | - | |||||||||||||||||||
2096 | \sa revision() | - | ||||||||||||||||||
2097 | */ | - | ||||||||||||||||||
2098 | void QMetaMethodBuilder::setRevision(int revision) | - | ||||||||||||||||||
2099 | { | - | ||||||||||||||||||
2100 | QMetaMethodBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2101 | if (d) {
| 0-66 | ||||||||||||||||||
2102 | d->revision = revision; | - | ||||||||||||||||||
2103 | if (revision)
| 5-61 | ||||||||||||||||||
2104 | d->attributes |= MethodRevisioned; executed 5 times by 1 test: d->attributes |= MethodRevisioned; Executed by:
| 5 | ||||||||||||||||||
2105 | else | - | ||||||||||||||||||
2106 | d->attributes &= ~MethodRevisioned; executed 61 times by 1 test: d->attributes &= ~MethodRevisioned; Executed by:
| 61 | ||||||||||||||||||
2107 | } | - | ||||||||||||||||||
2108 | } executed 66 times by 1 test: end of block Executed by:
| 66 | ||||||||||||||||||
2109 | - | |||||||||||||||||||
2110 | /*! | - | ||||||||||||||||||
2111 | \class QMetaPropertyBuilder | - | ||||||||||||||||||
2112 | \inmodule QtCore | - | ||||||||||||||||||
2113 | \internal | - | ||||||||||||||||||
2114 | \brief The QMetaPropertyBuilder class enables modifications to a property definition on a meta object builder. | - | ||||||||||||||||||
2115 | */ | - | ||||||||||||||||||
2116 | - | |||||||||||||||||||
2117 | QMetaPropertyBuilderPrivate *QMetaPropertyBuilder::d_func() const | - | ||||||||||||||||||
2118 | { | - | ||||||||||||||||||
2119 | if (_mobj && _index >= 0 && _index < _mobj->d->properties.size())
| 0-840 | ||||||||||||||||||
2120 | return &(_mobj->d->properties[_index]); executed 840 times by 1 test: return &(_mobj->d->properties[_index]); Executed by:
| 840 | ||||||||||||||||||
2121 | else | - | ||||||||||||||||||
2122 | return 0; executed 17 times by 1 test: return 0; Executed by:
| 17 | ||||||||||||||||||
2123 | } | - | ||||||||||||||||||
2124 | - | |||||||||||||||||||
2125 | /*! | - | ||||||||||||||||||
2126 | \fn QMetaPropertyBuilder::QMetaPropertyBuilder() | - | ||||||||||||||||||
2127 | \internal | - | ||||||||||||||||||
2128 | */ | - | ||||||||||||||||||
2129 | - | |||||||||||||||||||
2130 | /*! | - | ||||||||||||||||||
2131 | \fn int QMetaPropertyBuilder::index() const | - | ||||||||||||||||||
2132 | - | |||||||||||||||||||
2133 | Returns the index of this property within its QMetaObjectBuilder. | - | ||||||||||||||||||
2134 | */ | - | ||||||||||||||||||
2135 | - | |||||||||||||||||||
2136 | /*! | - | ||||||||||||||||||
2137 | Returns the name associated with this property. | - | ||||||||||||||||||
2138 | - | |||||||||||||||||||
2139 | \sa type() | - | ||||||||||||||||||
2140 | */ | - | ||||||||||||||||||
2141 | QByteArray QMetaPropertyBuilder::name() const | - | ||||||||||||||||||
2142 | { | - | ||||||||||||||||||
2143 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2144 | if (d)
| 2-9 | ||||||||||||||||||
2145 | return d->name; executed 9 times by 1 test: return d->name; Executed by:
| 9 | ||||||||||||||||||
2146 | else | - | ||||||||||||||||||
2147 | return QByteArray(); executed 2 times by 1 test: return QByteArray(); Executed by:
| 2 | ||||||||||||||||||
2148 | } | - | ||||||||||||||||||
2149 | - | |||||||||||||||||||
2150 | /*! | - | ||||||||||||||||||
2151 | Returns the type associated with this property. | - | ||||||||||||||||||
2152 | - | |||||||||||||||||||
2153 | \sa name() | - | ||||||||||||||||||
2154 | */ | - | ||||||||||||||||||
2155 | QByteArray QMetaPropertyBuilder::type() const | - | ||||||||||||||||||
2156 | { | - | ||||||||||||||||||
2157 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2158 | if (d)
| 1-7 | ||||||||||||||||||
2159 | return d->type; executed 7 times by 1 test: return d->type; Executed by:
| 7 | ||||||||||||||||||
2160 | else | - | ||||||||||||||||||
2161 | return QByteArray(); executed 1 time by 1 test: return QByteArray(); Executed by:
| 1 | ||||||||||||||||||
2162 | } | - | ||||||||||||||||||
2163 | - | |||||||||||||||||||
2164 | /*! | - | ||||||||||||||||||
2165 | Returns \c true if this property has a notify signal; false otherwise. | - | ||||||||||||||||||
2166 | - | |||||||||||||||||||
2167 | \sa notifySignal(), setNotifySignal(), removeNotifySignal() | - | ||||||||||||||||||
2168 | */ | - | ||||||||||||||||||
2169 | bool QMetaPropertyBuilder::hasNotifySignal() const | - | ||||||||||||||||||
2170 | { | - | ||||||||||||||||||
2171 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2172 | if (d)
| 1-10 | ||||||||||||||||||
2173 | return d->flag(Notify); executed 10 times by 1 test: return d->flag(Notify); Executed by:
| 10 | ||||||||||||||||||
2174 | else | - | ||||||||||||||||||
2175 | return false; executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||
2176 | } | - | ||||||||||||||||||
2177 | - | |||||||||||||||||||
2178 | /*! | - | ||||||||||||||||||
2179 | Returns the notify signal associated with this property. | - | ||||||||||||||||||
2180 | - | |||||||||||||||||||
2181 | \sa hasNotifySignal(), setNotifySignal(), removeNotifySignal() | - | ||||||||||||||||||
2182 | */ | - | ||||||||||||||||||
2183 | QMetaMethodBuilder QMetaPropertyBuilder::notifySignal() const | - | ||||||||||||||||||
2184 | { | - | ||||||||||||||||||
2185 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2186 | if (d && d->notifySignal >= 0)
| 0-7 | ||||||||||||||||||
2187 | return QMetaMethodBuilder(_mobj, d->notifySignal); executed 4 times by 1 test: return QMetaMethodBuilder(_mobj, d->notifySignal); Executed by:
| 4 | ||||||||||||||||||
2188 | else | - | ||||||||||||||||||
2189 | return QMetaMethodBuilder(); executed 3 times by 1 test: return QMetaMethodBuilder(); Executed by:
| 3 | ||||||||||||||||||
2190 | } | - | ||||||||||||||||||
2191 | - | |||||||||||||||||||
2192 | /*! | - | ||||||||||||||||||
2193 | Sets the notify signal associated with this property to \a value. | - | ||||||||||||||||||
2194 | - | |||||||||||||||||||
2195 | \sa hasNotifySignal(), notifySignal(), removeNotifySignal() | - | ||||||||||||||||||
2196 | */ | - | ||||||||||||||||||
2197 | void QMetaPropertyBuilder::setNotifySignal(const QMetaMethodBuilder& value) | - | ||||||||||||||||||
2198 | { | - | ||||||||||||||||||
2199 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2200 | if (d) {
| 0-14 | ||||||||||||||||||
2201 | if (value._mobj) {
| 1-13 | ||||||||||||||||||
2202 | d->notifySignal = value._index; | - | ||||||||||||||||||
2203 | d->setFlag(Notify, true); | - | ||||||||||||||||||
2204 | } else { executed 13 times by 1 test: end of block Executed by:
| 13 | ||||||||||||||||||
2205 | d->notifySignal = -1; | - | ||||||||||||||||||
2206 | d->setFlag(Notify, false); | - | ||||||||||||||||||
2207 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
2208 | } | - | ||||||||||||||||||
2209 | } executed 14 times by 1 test: end of block Executed by:
| 14 | ||||||||||||||||||
2210 | - | |||||||||||||||||||
2211 | /*! | - | ||||||||||||||||||
2212 | Removes the notify signal from this property. | - | ||||||||||||||||||
2213 | - | |||||||||||||||||||
2214 | \sa hasNotifySignal(), notifySignal(), setNotifySignal() | - | ||||||||||||||||||
2215 | */ | - | ||||||||||||||||||
2216 | void QMetaPropertyBuilder::removeNotifySignal() | - | ||||||||||||||||||
2217 | { | - | ||||||||||||||||||
2218 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2219 | if (d) {
| 0-1 | ||||||||||||||||||
2220 | d->notifySignal = -1; | - | ||||||||||||||||||
2221 | d->setFlag(Notify, false); | - | ||||||||||||||||||
2222 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
2223 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
2224 | - | |||||||||||||||||||
2225 | /*! | - | ||||||||||||||||||
2226 | Returns \c true if this property is readable; otherwise returns \c false. | - | ||||||||||||||||||
2227 | The default value is true. | - | ||||||||||||||||||
2228 | - | |||||||||||||||||||
2229 | \sa setReadable(), isWritable() | - | ||||||||||||||||||
2230 | */ | - | ||||||||||||||||||
2231 | bool QMetaPropertyBuilder::isReadable() const | - | ||||||||||||||||||
2232 | { | - | ||||||||||||||||||
2233 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2234 | if (d)
| 1-29 | ||||||||||||||||||
2235 | return d->flag(Readable); executed 29 times by 1 test: return d->flag(Readable); Executed by:
| 29 | ||||||||||||||||||
2236 | else | - | ||||||||||||||||||
2237 | return false; executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||
2238 | } | - | ||||||||||||||||||
2239 | - | |||||||||||||||||||
2240 | /*! | - | ||||||||||||||||||
2241 | Returns \c true if this property is writable; otherwise returns \c false. | - | ||||||||||||||||||
2242 | The default value is true. | - | ||||||||||||||||||
2243 | - | |||||||||||||||||||
2244 | \sa setWritable(), isReadable() | - | ||||||||||||||||||
2245 | */ | - | ||||||||||||||||||
2246 | bool QMetaPropertyBuilder::isWritable() const | - | ||||||||||||||||||
2247 | { | - | ||||||||||||||||||
2248 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2249 | if (d)
| 1-29 | ||||||||||||||||||
2250 | return d->flag(Writable); executed 29 times by 1 test: return d->flag(Writable); Executed by:
| 29 | ||||||||||||||||||
2251 | else | - | ||||||||||||||||||
2252 | return false; executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||
2253 | } | - | ||||||||||||||||||
2254 | - | |||||||||||||||||||
2255 | /*! | - | ||||||||||||||||||
2256 | Returns \c true if this property can be reset to a default value; otherwise | - | ||||||||||||||||||
2257 | returns \c false. The default value is false. | - | ||||||||||||||||||
2258 | - | |||||||||||||||||||
2259 | \sa setResettable() | - | ||||||||||||||||||
2260 | */ | - | ||||||||||||||||||
2261 | bool QMetaPropertyBuilder::isResettable() const | - | ||||||||||||||||||
2262 | { | - | ||||||||||||||||||
2263 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2264 | if (d)
| 1-30 | ||||||||||||||||||
2265 | return d->flag(Resettable); executed 30 times by 1 test: return d->flag(Resettable); Executed by:
| 30 | ||||||||||||||||||
2266 | else | - | ||||||||||||||||||
2267 | return false; executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||
2268 | } | - | ||||||||||||||||||
2269 | - | |||||||||||||||||||
2270 | /*! | - | ||||||||||||||||||
2271 | Returns \c true if this property is designable; otherwise returns \c false. | - | ||||||||||||||||||
2272 | This default value is false. | - | ||||||||||||||||||
2273 | - | |||||||||||||||||||
2274 | \sa setDesignable(), isScriptable(), isStored() | - | ||||||||||||||||||
2275 | */ | - | ||||||||||||||||||
2276 | bool QMetaPropertyBuilder::isDesignable() const | - | ||||||||||||||||||
2277 | { | - | ||||||||||||||||||
2278 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2279 | if (d)
| 1-30 | ||||||||||||||||||
2280 | return d->flag(Designable); executed 30 times by 1 test: return d->flag(Designable); Executed by:
| 30 | ||||||||||||||||||
2281 | else | - | ||||||||||||||||||
2282 | return false; executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||
2283 | } | - | ||||||||||||||||||
2284 | - | |||||||||||||||||||
2285 | /*! | - | ||||||||||||||||||
2286 | Returns \c true if the property is scriptable; otherwise returns \c false. | - | ||||||||||||||||||
2287 | This default value is true. | - | ||||||||||||||||||
2288 | - | |||||||||||||||||||
2289 | \sa setScriptable(), isDesignable(), isStored() | - | ||||||||||||||||||
2290 | */ | - | ||||||||||||||||||
2291 | bool QMetaPropertyBuilder::isScriptable() const | - | ||||||||||||||||||
2292 | { | - | ||||||||||||||||||
2293 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2294 | if (d)
| 1-30 | ||||||||||||||||||
2295 | return d->flag(Scriptable); executed 30 times by 1 test: return d->flag(Scriptable); Executed by:
| 30 | ||||||||||||||||||
2296 | else | - | ||||||||||||||||||
2297 | return false; executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||
2298 | } | - | ||||||||||||||||||
2299 | - | |||||||||||||||||||
2300 | /*! | - | ||||||||||||||||||
2301 | Returns \c true if the property is stored; otherwise returns \c false. | - | ||||||||||||||||||
2302 | This default value is false. | - | ||||||||||||||||||
2303 | - | |||||||||||||||||||
2304 | \sa setStored(), isDesignable(), isScriptable() | - | ||||||||||||||||||
2305 | */ | - | ||||||||||||||||||
2306 | bool QMetaPropertyBuilder::isStored() const | - | ||||||||||||||||||
2307 | { | - | ||||||||||||||||||
2308 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2309 | if (d)
| 1-30 | ||||||||||||||||||
2310 | return d->flag(Stored); executed 30 times by 1 test: return d->flag(Stored); Executed by:
| 30 | ||||||||||||||||||
2311 | else | - | ||||||||||||||||||
2312 | return false; executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||
2313 | } | - | ||||||||||||||||||
2314 | - | |||||||||||||||||||
2315 | /*! | - | ||||||||||||||||||
2316 | Returns \c true if the property is editable; otherwise returns \c false. | - | ||||||||||||||||||
2317 | This default value is false. | - | ||||||||||||||||||
2318 | - | |||||||||||||||||||
2319 | \sa setEditable(), isDesignable(), isScriptable(), isStored() | - | ||||||||||||||||||
2320 | */ | - | ||||||||||||||||||
2321 | bool QMetaPropertyBuilder::isEditable() const | - | ||||||||||||||||||
2322 | { | - | ||||||||||||||||||
2323 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2324 | if (d)
| 1-30 | ||||||||||||||||||
2325 | return d->flag(Editable); executed 30 times by 1 test: return d->flag(Editable); Executed by:
| 30 | ||||||||||||||||||
2326 | else | - | ||||||||||||||||||
2327 | return false; executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||
2328 | } | - | ||||||||||||||||||
2329 | - | |||||||||||||||||||
2330 | /*! | - | ||||||||||||||||||
2331 | Returns \c true if this property is designated as the \c USER | - | ||||||||||||||||||
2332 | property, i.e., the one that the user can edit or that is | - | ||||||||||||||||||
2333 | significant in some other way. Otherwise it returns | - | ||||||||||||||||||
2334 | false. This default value is false. | - | ||||||||||||||||||
2335 | - | |||||||||||||||||||
2336 | \sa setUser(), isDesignable(), isScriptable() | - | ||||||||||||||||||
2337 | */ | - | ||||||||||||||||||
2338 | bool QMetaPropertyBuilder::isUser() const | - | ||||||||||||||||||
2339 | { | - | ||||||||||||||||||
2340 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2341 | if (d)
| 1-30 | ||||||||||||||||||
2342 | return d->flag(User); executed 30 times by 1 test: return d->flag(User); Executed by:
| 30 | ||||||||||||||||||
2343 | else | - | ||||||||||||||||||
2344 | return false; executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||
2345 | } | - | ||||||||||||||||||
2346 | - | |||||||||||||||||||
2347 | /*! | - | ||||||||||||||||||
2348 | Returns \c true if the property has a C++ setter function that | - | ||||||||||||||||||
2349 | follows Qt's standard "name" / "setName" pattern. Designer and uic | - | ||||||||||||||||||
2350 | query hasStdCppSet() in order to avoid expensive | - | ||||||||||||||||||
2351 | QObject::setProperty() calls. All properties in Qt [should] follow | - | ||||||||||||||||||
2352 | this pattern. The default value is false. | - | ||||||||||||||||||
2353 | - | |||||||||||||||||||
2354 | \sa setStdCppSet() | - | ||||||||||||||||||
2355 | */ | - | ||||||||||||||||||
2356 | bool QMetaPropertyBuilder::hasStdCppSet() const | - | ||||||||||||||||||
2357 | { | - | ||||||||||||||||||
2358 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2359 | if (d)
| 1-30 | ||||||||||||||||||
2360 | return d->flag(StdCppSet); executed 30 times by 1 test: return d->flag(StdCppSet); Executed by:
| 30 | ||||||||||||||||||
2361 | else | - | ||||||||||||||||||
2362 | return false; executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||
2363 | } | - | ||||||||||||||||||
2364 | - | |||||||||||||||||||
2365 | /*! | - | ||||||||||||||||||
2366 | Returns \c true if the property is an enumerator or flag type; | - | ||||||||||||||||||
2367 | otherwise returns \c false. This default value is false. | - | ||||||||||||||||||
2368 | - | |||||||||||||||||||
2369 | \sa setEnumOrFlag() | - | ||||||||||||||||||
2370 | */ | - | ||||||||||||||||||
2371 | bool QMetaPropertyBuilder::isEnumOrFlag() const | - | ||||||||||||||||||
2372 | { | - | ||||||||||||||||||
2373 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2374 | if (d)
| 1-30 | ||||||||||||||||||
2375 | return d->flag(EnumOrFlag); executed 30 times by 1 test: return d->flag(EnumOrFlag); Executed by:
| 30 | ||||||||||||||||||
2376 | else | - | ||||||||||||||||||
2377 | return false; executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||
2378 | } | - | ||||||||||||||||||
2379 | - | |||||||||||||||||||
2380 | /*! | - | ||||||||||||||||||
2381 | Returns \c true if the property is constant; otherwise returns \c false. | - | ||||||||||||||||||
2382 | The default value is false. | - | ||||||||||||||||||
2383 | */ | - | ||||||||||||||||||
2384 | bool QMetaPropertyBuilder::isConstant() const | - | ||||||||||||||||||
2385 | { | - | ||||||||||||||||||
2386 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2387 | if (d)
| 1-30 | ||||||||||||||||||
2388 | return d->flag(Constant); executed 30 times by 1 test: return d->flag(Constant); Executed by:
| 30 | ||||||||||||||||||
2389 | else | - | ||||||||||||||||||
2390 | return false; executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||
2391 | } | - | ||||||||||||||||||
2392 | - | |||||||||||||||||||
2393 | /*! | - | ||||||||||||||||||
2394 | Returns \c true if the property is final; otherwise returns \c false. | - | ||||||||||||||||||
2395 | The default value is false. | - | ||||||||||||||||||
2396 | */ | - | ||||||||||||||||||
2397 | bool QMetaPropertyBuilder::isFinal() const | - | ||||||||||||||||||
2398 | { | - | ||||||||||||||||||
2399 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2400 | if (d)
| 1-30 | ||||||||||||||||||
2401 | return d->flag(Final); executed 30 times by 1 test: return d->flag(Final); Executed by:
| 30 | ||||||||||||||||||
2402 | else | - | ||||||||||||||||||
2403 | return false; executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||
2404 | } | - | ||||||||||||||||||
2405 | - | |||||||||||||||||||
2406 | /*! | - | ||||||||||||||||||
2407 | Sets this property to readable if \a value is true. | - | ||||||||||||||||||
2408 | - | |||||||||||||||||||
2409 | \sa isReadable(), setWritable() | - | ||||||||||||||||||
2410 | */ | - | ||||||||||||||||||
2411 | void QMetaPropertyBuilder::setReadable(bool value) | - | ||||||||||||||||||
2412 | { | - | ||||||||||||||||||
2413 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2414 | if (d)
| 0-34 | ||||||||||||||||||
2415 | d->setFlag(Readable, value); executed 34 times by 1 test: d->setFlag(Readable, value); Executed by:
| 34 | ||||||||||||||||||
2416 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
2417 | - | |||||||||||||||||||
2418 | /*! | - | ||||||||||||||||||
2419 | Sets this property to writable if \a value is true. | - | ||||||||||||||||||
2420 | - | |||||||||||||||||||
2421 | \sa isWritable(), setReadable() | - | ||||||||||||||||||
2422 | */ | - | ||||||||||||||||||
2423 | void QMetaPropertyBuilder::setWritable(bool value) | - | ||||||||||||||||||
2424 | { | - | ||||||||||||||||||
2425 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2426 | if (d)
| 0-34 | ||||||||||||||||||
2427 | d->setFlag(Writable, value); executed 34 times by 1 test: d->setFlag(Writable, value); Executed by:
| 34 | ||||||||||||||||||
2428 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
2429 | - | |||||||||||||||||||
2430 | /*! | - | ||||||||||||||||||
2431 | Sets this property to resettable if \a value is true. | - | ||||||||||||||||||
2432 | - | |||||||||||||||||||
2433 | \sa isResettable() | - | ||||||||||||||||||
2434 | */ | - | ||||||||||||||||||
2435 | void QMetaPropertyBuilder::setResettable(bool value) | - | ||||||||||||||||||
2436 | { | - | ||||||||||||||||||
2437 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2438 | if (d)
| 0-34 | ||||||||||||||||||
2439 | d->setFlag(Resettable, value); executed 34 times by 1 test: d->setFlag(Resettable, value); Executed by:
| 34 | ||||||||||||||||||
2440 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
2441 | - | |||||||||||||||||||
2442 | /*! | - | ||||||||||||||||||
2443 | Sets this property to designable if \a value is true. | - | ||||||||||||||||||
2444 | - | |||||||||||||||||||
2445 | \sa isDesignable(), setScriptable(), setStored() | - | ||||||||||||||||||
2446 | */ | - | ||||||||||||||||||
2447 | void QMetaPropertyBuilder::setDesignable(bool value) | - | ||||||||||||||||||
2448 | { | - | ||||||||||||||||||
2449 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2450 | if (d)
| 0-34 | ||||||||||||||||||
2451 | d->setFlag(Designable, value); executed 34 times by 1 test: d->setFlag(Designable, value); Executed by:
| 34 | ||||||||||||||||||
2452 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
2453 | - | |||||||||||||||||||
2454 | /*! | - | ||||||||||||||||||
2455 | Sets this property to scriptable if \a value is true. | - | ||||||||||||||||||
2456 | - | |||||||||||||||||||
2457 | \sa isScriptable(), setDesignable(), setStored() | - | ||||||||||||||||||
2458 | */ | - | ||||||||||||||||||
2459 | void QMetaPropertyBuilder::setScriptable(bool value) | - | ||||||||||||||||||
2460 | { | - | ||||||||||||||||||
2461 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2462 | if (d)
| 0-34 | ||||||||||||||||||
2463 | d->setFlag(Scriptable, value); executed 34 times by 1 test: d->setFlag(Scriptable, value); Executed by:
| 34 | ||||||||||||||||||
2464 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
2465 | - | |||||||||||||||||||
2466 | /*! | - | ||||||||||||||||||
2467 | Sets this property to storable if \a value is true. | - | ||||||||||||||||||
2468 | - | |||||||||||||||||||
2469 | \sa isStored(), setDesignable(), setScriptable() | - | ||||||||||||||||||
2470 | */ | - | ||||||||||||||||||
2471 | void QMetaPropertyBuilder::setStored(bool value) | - | ||||||||||||||||||
2472 | { | - | ||||||||||||||||||
2473 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2474 | if (d)
| 0-34 | ||||||||||||||||||
2475 | d->setFlag(Stored, value); executed 34 times by 1 test: d->setFlag(Stored, value); Executed by:
| 34 | ||||||||||||||||||
2476 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
2477 | - | |||||||||||||||||||
2478 | /*! | - | ||||||||||||||||||
2479 | Sets this property to editable if \a value is true. | - | ||||||||||||||||||
2480 | - | |||||||||||||||||||
2481 | \sa isEditable(), setDesignable(), setScriptable(), setStored() | - | ||||||||||||||||||
2482 | */ | - | ||||||||||||||||||
2483 | void QMetaPropertyBuilder::setEditable(bool value) | - | ||||||||||||||||||
2484 | { | - | ||||||||||||||||||
2485 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2486 | if (d)
| 0-34 | ||||||||||||||||||
2487 | d->setFlag(Editable, value); executed 34 times by 1 test: d->setFlag(Editable, value); Executed by:
| 34 | ||||||||||||||||||
2488 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
2489 | - | |||||||||||||||||||
2490 | /*! | - | ||||||||||||||||||
2491 | Sets the \c USER flag on this property to \a value. | - | ||||||||||||||||||
2492 | - | |||||||||||||||||||
2493 | \sa isUser(), setDesignable(), setScriptable() | - | ||||||||||||||||||
2494 | */ | - | ||||||||||||||||||
2495 | void QMetaPropertyBuilder::setUser(bool value) | - | ||||||||||||||||||
2496 | { | - | ||||||||||||||||||
2497 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2498 | if (d)
| 0-34 | ||||||||||||||||||
2499 | d->setFlag(User, value); executed 34 times by 1 test: d->setFlag(User, value); Executed by:
| 34 | ||||||||||||||||||
2500 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
2501 | - | |||||||||||||||||||
2502 | /*! | - | ||||||||||||||||||
2503 | Sets the C++ setter flag on this property to \a value, which is | - | ||||||||||||||||||
2504 | true if the property has a C++ setter function that follows Qt's | - | ||||||||||||||||||
2505 | standard "name" / "setName" pattern. | - | ||||||||||||||||||
2506 | - | |||||||||||||||||||
2507 | \sa hasStdCppSet() | - | ||||||||||||||||||
2508 | */ | - | ||||||||||||||||||
2509 | void QMetaPropertyBuilder::setStdCppSet(bool value) | - | ||||||||||||||||||
2510 | { | - | ||||||||||||||||||
2511 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2512 | if (d)
| 0-34 | ||||||||||||||||||
2513 | d->setFlag(StdCppSet, value); executed 34 times by 1 test: d->setFlag(StdCppSet, value); Executed by:
| 34 | ||||||||||||||||||
2514 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
2515 | - | |||||||||||||||||||
2516 | /*! | - | ||||||||||||||||||
2517 | Sets this property to be of an enumerator or flag type if | - | ||||||||||||||||||
2518 | \a value is true. | - | ||||||||||||||||||
2519 | - | |||||||||||||||||||
2520 | \sa isEnumOrFlag() | - | ||||||||||||||||||
2521 | */ | - | ||||||||||||||||||
2522 | void QMetaPropertyBuilder::setEnumOrFlag(bool value) | - | ||||||||||||||||||
2523 | { | - | ||||||||||||||||||
2524 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2525 | if (d)
| 0-34 | ||||||||||||||||||
2526 | d->setFlag(EnumOrFlag, value); executed 34 times by 1 test: d->setFlag(EnumOrFlag, value); Executed by:
| 34 | ||||||||||||||||||
2527 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
2528 | - | |||||||||||||||||||
2529 | /*! | - | ||||||||||||||||||
2530 | Sets the \c CONSTANT flag on this property to \a value. | - | ||||||||||||||||||
2531 | - | |||||||||||||||||||
2532 | \sa isConstant() | - | ||||||||||||||||||
2533 | */ | - | ||||||||||||||||||
2534 | void QMetaPropertyBuilder::setConstant(bool value) | - | ||||||||||||||||||
2535 | { | - | ||||||||||||||||||
2536 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2537 | if (d)
| 0-34 | ||||||||||||||||||
2538 | d->setFlag(Constant, value); executed 34 times by 1 test: d->setFlag(Constant, value); Executed by:
| 34 | ||||||||||||||||||
2539 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
2540 | - | |||||||||||||||||||
2541 | /*! | - | ||||||||||||||||||
2542 | Sets the \c FINAL flag on this property to \a value. | - | ||||||||||||||||||
2543 | - | |||||||||||||||||||
2544 | \sa isFinal() | - | ||||||||||||||||||
2545 | */ | - | ||||||||||||||||||
2546 | void QMetaPropertyBuilder::setFinal(bool value) | - | ||||||||||||||||||
2547 | { | - | ||||||||||||||||||
2548 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2549 | if (d)
| 0-34 | ||||||||||||||||||
2550 | d->setFlag(Final, value); executed 34 times by 1 test: d->setFlag(Final, value); Executed by:
| 34 | ||||||||||||||||||
2551 | } executed 34 times by 1 test: end of block Executed by:
| 34 | ||||||||||||||||||
2552 | - | |||||||||||||||||||
2553 | /*! | - | ||||||||||||||||||
2554 | Returns the revision of this property. | - | ||||||||||||||||||
2555 | - | |||||||||||||||||||
2556 | \sa setRevision() | - | ||||||||||||||||||
2557 | */ | - | ||||||||||||||||||
2558 | int QMetaPropertyBuilder::revision() const | - | ||||||||||||||||||
2559 | { | - | ||||||||||||||||||
2560 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2561 | if (d)
| 1-5 | ||||||||||||||||||
2562 | return d->revision; executed 5 times by 1 test: return d->revision; Executed by:
| 5 | ||||||||||||||||||
2563 | return 0; executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||
2564 | - | |||||||||||||||||||
2565 | } | - | ||||||||||||||||||
2566 | - | |||||||||||||||||||
2567 | /*! | - | ||||||||||||||||||
2568 | Sets the \a revision of this property. | - | ||||||||||||||||||
2569 | - | |||||||||||||||||||
2570 | \sa revision() | - | ||||||||||||||||||
2571 | */ | - | ||||||||||||||||||
2572 | void QMetaPropertyBuilder::setRevision(int revision) | - | ||||||||||||||||||
2573 | { | - | ||||||||||||||||||
2574 | QMetaPropertyBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2575 | if (d) {
| 0-21 | ||||||||||||||||||
2576 | d->revision = revision; | - | ||||||||||||||||||
2577 | d->setFlag(Revisioned, revision != 0); | - | ||||||||||||||||||
2578 | } executed 21 times by 1 test: end of block Executed by:
| 21 | ||||||||||||||||||
2579 | } executed 21 times by 1 test: end of block Executed by:
| 21 | ||||||||||||||||||
2580 | - | |||||||||||||||||||
2581 | - | |||||||||||||||||||
2582 | /*! | - | ||||||||||||||||||
2583 | \class QMetaEnumBuilder | - | ||||||||||||||||||
2584 | \inmodule QtCore | - | ||||||||||||||||||
2585 | \internal | - | ||||||||||||||||||
2586 | \brief The QMetaEnumBuilder class enables modifications to an enumerator definition on a meta object builder. | - | ||||||||||||||||||
2587 | */ | - | ||||||||||||||||||
2588 | - | |||||||||||||||||||
2589 | QMetaEnumBuilderPrivate *QMetaEnumBuilder::d_func() const | - | ||||||||||||||||||
2590 | { | - | ||||||||||||||||||
2591 | if (_mobj && _index >= 0 && _index < _mobj->d->enumerators.size())
| 0-89 | ||||||||||||||||||
2592 | return &(_mobj->d->enumerators[_index]); executed 89 times by 1 test: return &(_mobj->d->enumerators[_index]); Executed by:
| 89 | ||||||||||||||||||
2593 | else | - | ||||||||||||||||||
2594 | return 0; executed 1 time by 1 test: return 0; Executed by:
| 1 | ||||||||||||||||||
2595 | } | - | ||||||||||||||||||
2596 | - | |||||||||||||||||||
2597 | /*! | - | ||||||||||||||||||
2598 | \fn QMetaEnumBuilder::QMetaEnumBuilder() | - | ||||||||||||||||||
2599 | \internal | - | ||||||||||||||||||
2600 | */ | - | ||||||||||||||||||
2601 | - | |||||||||||||||||||
2602 | /*! | - | ||||||||||||||||||
2603 | \fn int QMetaEnumBuilder::index() const | - | ||||||||||||||||||
2604 | - | |||||||||||||||||||
2605 | Returns the index of this enumerator within its QMetaObjectBuilder. | - | ||||||||||||||||||
2606 | */ | - | ||||||||||||||||||
2607 | - | |||||||||||||||||||
2608 | /*! | - | ||||||||||||||||||
2609 | Returns the name of the enumerator (without the scope). | - | ||||||||||||||||||
2610 | */ | - | ||||||||||||||||||
2611 | QByteArray QMetaEnumBuilder::name() const | - | ||||||||||||||||||
2612 | { | - | ||||||||||||||||||
2613 | QMetaEnumBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2614 | if (d)
| 1-10 | ||||||||||||||||||
2615 | return d->name; executed 10 times by 1 test: return d->name; Executed by:
| 10 | ||||||||||||||||||
2616 | else | - | ||||||||||||||||||
2617 | return QByteArray(); executed 1 time by 1 test: return QByteArray(); Executed by:
| 1 | ||||||||||||||||||
2618 | } | - | ||||||||||||||||||
2619 | - | |||||||||||||||||||
2620 | /*! | - | ||||||||||||||||||
2621 | Returns \c true if this enumerator is used as a flag; otherwise returns | - | ||||||||||||||||||
2622 | false. | - | ||||||||||||||||||
2623 | - | |||||||||||||||||||
2624 | \sa setIsFlag() | - | ||||||||||||||||||
2625 | */ | - | ||||||||||||||||||
2626 | bool QMetaEnumBuilder::isFlag() const | - | ||||||||||||||||||
2627 | { | - | ||||||||||||||||||
2628 | QMetaEnumBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2629 | if (d)
| 0-9 | ||||||||||||||||||
2630 | return d->isFlag; executed 9 times by 1 test: return d->isFlag; Executed by:
| 9 | ||||||||||||||||||
2631 | else | - | ||||||||||||||||||
2632 | return false; never executed: return false; | 0 | ||||||||||||||||||
2633 | } | - | ||||||||||||||||||
2634 | - | |||||||||||||||||||
2635 | /*! | - | ||||||||||||||||||
2636 | Sets this enumerator to be used as a flag if \a value is true. | - | ||||||||||||||||||
2637 | - | |||||||||||||||||||
2638 | \sa isFlag() | - | ||||||||||||||||||
2639 | */ | - | ||||||||||||||||||
2640 | void QMetaEnumBuilder::setIsFlag(bool value) | - | ||||||||||||||||||
2641 | { | - | ||||||||||||||||||
2642 | QMetaEnumBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2643 | if (d)
| 0-8 | ||||||||||||||||||
2644 | d->isFlag = value; executed 8 times by 1 test: d->isFlag = value; Executed by:
| 8 | ||||||||||||||||||
2645 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||
2646 | - | |||||||||||||||||||
2647 | /*! | - | ||||||||||||||||||
2648 | Returns the number of keys. | - | ||||||||||||||||||
2649 | - | |||||||||||||||||||
2650 | \sa key(), addKey() | - | ||||||||||||||||||
2651 | */ | - | ||||||||||||||||||
2652 | int QMetaEnumBuilder::keyCount() const | - | ||||||||||||||||||
2653 | { | - | ||||||||||||||||||
2654 | QMetaEnumBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2655 | if (d)
| 0-9 | ||||||||||||||||||
2656 | return d->keys.size(); executed 9 times by 1 test: return d->keys.size(); Executed by:
| 9 | ||||||||||||||||||
2657 | else | - | ||||||||||||||||||
2658 | return 0; never executed: return 0; | 0 | ||||||||||||||||||
2659 | } | - | ||||||||||||||||||
2660 | - | |||||||||||||||||||
2661 | /*! | - | ||||||||||||||||||
2662 | Returns the key with the given \a index, or an empty QByteArray | - | ||||||||||||||||||
2663 | if no such key exists. | - | ||||||||||||||||||
2664 | - | |||||||||||||||||||
2665 | \sa keyCount(), addKey(), value() | - | ||||||||||||||||||
2666 | */ | - | ||||||||||||||||||
2667 | QByteArray QMetaEnumBuilder::key(int index) const | - | ||||||||||||||||||
2668 | { | - | ||||||||||||||||||
2669 | QMetaEnumBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2670 | if (d && index >= 0 && index < d->keys.size())
| 0-20 | ||||||||||||||||||
2671 | return d->keys[index]; executed 14 times by 1 test: return d->keys[index]; Executed by:
| 14 | ||||||||||||||||||
2672 | else | - | ||||||||||||||||||
2673 | return QByteArray(); executed 6 times by 1 test: return QByteArray(); Executed by:
| 6 | ||||||||||||||||||
2674 | } | - | ||||||||||||||||||
2675 | - | |||||||||||||||||||
2676 | /*! | - | ||||||||||||||||||
2677 | Returns the value with the given \a index; or returns -1 if there | - | ||||||||||||||||||
2678 | is no such value. | - | ||||||||||||||||||
2679 | - | |||||||||||||||||||
2680 | \sa keyCount(), addKey(), key() | - | ||||||||||||||||||
2681 | */ | - | ||||||||||||||||||
2682 | int QMetaEnumBuilder::value(int index) const | - | ||||||||||||||||||
2683 | { | - | ||||||||||||||||||
2684 | QMetaEnumBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2685 | if (d && index >= 0 && index < d->keys.size())
| 0-15 | ||||||||||||||||||
2686 | return d->values[index]; executed 14 times by 1 test: return d->values[index]; Executed by:
| 14 | ||||||||||||||||||
2687 | else | - | ||||||||||||||||||
2688 | return -1; executed 1 time by 1 test: return -1; Executed by:
| 1 | ||||||||||||||||||
2689 | } | - | ||||||||||||||||||
2690 | - | |||||||||||||||||||
2691 | /*! | - | ||||||||||||||||||
2692 | Adds a new key called \a name to this enumerator, associated | - | ||||||||||||||||||
2693 | with \a value. Returns the index of the new key. | - | ||||||||||||||||||
2694 | - | |||||||||||||||||||
2695 | \sa keyCount(), key(), value(), removeKey() | - | ||||||||||||||||||
2696 | */ | - | ||||||||||||||||||
2697 | int QMetaEnumBuilder::addKey(const QByteArray& name, int value) | - | ||||||||||||||||||
2698 | { | - | ||||||||||||||||||
2699 | QMetaEnumBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2700 | if (d) {
| 0-17 | ||||||||||||||||||
2701 | int index = d->keys.size(); | - | ||||||||||||||||||
2702 | d->keys += name; | - | ||||||||||||||||||
2703 | d->values += value; | - | ||||||||||||||||||
2704 | return index; executed 17 times by 1 test: return index; Executed by:
| 17 | ||||||||||||||||||
2705 | } else { | - | ||||||||||||||||||
2706 | return -1; never executed: return -1; | 0 | ||||||||||||||||||
2707 | } | - | ||||||||||||||||||
2708 | } | - | ||||||||||||||||||
2709 | - | |||||||||||||||||||
2710 | /*! | - | ||||||||||||||||||
2711 | Removes the key at \a index from this enumerator. | - | ||||||||||||||||||
2712 | - | |||||||||||||||||||
2713 | \sa addKey() | - | ||||||||||||||||||
2714 | */ | - | ||||||||||||||||||
2715 | void QMetaEnumBuilder::removeKey(int index) | - | ||||||||||||||||||
2716 | { | - | ||||||||||||||||||
2717 | QMetaEnumBuilderPrivate *d = d_func(); | - | ||||||||||||||||||
2718 | if (d && index >= 0 && index < d->keys.size()) {
| 0-1 | ||||||||||||||||||
2719 | d->keys.removeAt(index); | - | ||||||||||||||||||
2720 | d->values.removeAt(index); | - | ||||||||||||||||||
2721 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
2722 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||
2723 | - | |||||||||||||||||||
2724 | QT_END_NAMESPACE | - | ||||||||||||||||||
Source code | Switch to Preprocessed file |