OpenCoverage

qmetaobjectbuilder.cpp

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

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9