OpenCoverage

qjsengine.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsapi/qjsengine.h
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7template <typename T>-
8inline T qjsvalue_cast(const QJSValue &);-
9-
10class QJSEnginePrivate;-
11class __attribute__((visibility("default"))) QJSEngine-
12 : public QObject-
13{-
14 public:-
15#pragma GCC diagnostic push-
16 -
17#pragma GCC diagnostic ignored "-Wsuggest-override"-
18 static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private:-
19#pragma GCC diagnostic ignored "-Wattributes"-
20 __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
21#pragma GCC diagnostic pop-
22 struct QPrivateSignal {};-
23public:-
24 QJSEngine();-
25 explicit QJSEngine(QObject *parent);-
26 ~QJSEngine() override;-
27-
28 QJSValue globalObject() const;-
29-
30 QJSValue evaluate(const QString &program, const QString &fileName = QString(), int lineNumber = 1);-
31-
32 QJSValue newObject();-
33 QJSValue newArray(uint length = 0);-
34-
35 QJSValue newQObject(QObject *object);-
36-
37 QJSValue newQMetaObject(const QMetaObject* metaObject);-
38-
39 template <typename T>-
40 QJSValue newQMetaObject()-
41 {-
42 return
executed 2 times by 1 test: return newQMetaObject(&T::staticMetaObject);
Executed by:
  • tst_qjsengine
newQMetaObject(&T::staticMetaObject);
executed 2 times by 1 test: return newQMetaObject(&T::staticMetaObject);
Executed by:
  • tst_qjsengine
2
43 }-
44-
45 template <typename T>-
46 inline QJSValue toScriptValue(const T &value)-
47 {-
48 return
executed 48668 times by 5 tests: return create(qMetaTypeId<T>(), &value);
Executed by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qqmlvaluetypes
create(qMetaTypeId<T>(), &value);
executed 48668 times by 5 tests: return create(qMetaTypeId<T>(), &value);
Executed by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qjsvalueiterator
  • tst_qqmlvaluetypes
48668
49 }-
50 template <typename T>-
51 inline T fromScriptValue(const QJSValue &value)-
52 {-
53 return
executed 52 times by 2 tests: return qjsvalue_cast<T>(value);
Executed by:
  • tst_qjsengine
  • tst_qqmlvaluetypes
qjsvalue_cast<T>(value);
executed 52 times by 2 tests: return qjsvalue_cast<T>(value);
Executed by:
  • tst_qjsengine
  • tst_qqmlvaluetypes
52
54 }-
55-
56 void collectGarbage();-
57-
58-
59 __attribute__ ((__deprecated__)) void installTranslatorFunctions(const QJSValue &object = QJSValue());-
60-
61-
62 enum Extension {-
63 TranslationExtension = 0x1,-
64 ConsoleExtension = 0x2,-
65 GarbageCollectionExtension = 0x4,-
66 AllExtensions = 0xffffffff-
67 };-
68 typedef QFlags<Extension> Extensions;-
69-
70 void installExtensions(Extensions extensions, const QJSValue &object = QJSValue());-
71-
72 QV4::ExecutionEngine *handle() const { return
executed 10437358 times by 144 tests: return m_v4Engine;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • ...
m_v4Engine;
executed 10437358 times by 144 tests: return m_v4Engine;
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • ...
}
10437358
73-
74 void throwError(const QString &message);-
75-
76private:-
77 QJSValue create(int type, const void *ptr);-
78-
79 static bool convertV2(const QJSValue &value, int type, void *ptr);-
80-
81 friend inline bool qjsvalue_cast_helper(const QJSValue &, int, void *);-
82-
83protected:-
84 QJSEngine(QJSEnginePrivate &dd, QObject *parent = nullptr);-
85-
86private:-
87 QV4::ExecutionEngine *m_v4Engine;-
88 QJSEngine(const QJSEngine &) = delete; QJSEngine &operator=(const QJSEngine &) = delete;-
89 inline QJSEnginePrivate* d_func() { return
executed 473962 times by 60 tests: return reinterpret_cast<QJSEnginePrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllocale
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlsettings
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedimage
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickapplication
  • ...
reinterpret_cast<QJSEnginePrivate *>(qGetPtrHelper(d_ptr));
executed 473962 times by 60 tests: return reinterpret_cast<QJSEnginePrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllocale
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlqt
  • tst_qqmlsettings
  • tst_qqmltypeloader
  • tst_qqmlvaluetypeproviders
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanimatedimage
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickapplication
  • ...
} inline const QJSEnginePrivate* d_func() const { return
never executed: return reinterpret_cast<const QJSEnginePrivate *>(qGetPtrHelper(d_ptr));
reinterpret_cast<const QJSEnginePrivate *>(qGetPtrHelper(d_ptr));
never executed: return reinterpret_cast<const QJSEnginePrivate *>(qGetPtrHelper(d_ptr));
} friend class QJSEnginePrivate;
0-473962
90};-
91-
92constexpr inline QFlags<QJSEngine::Extensions::enum_type> operator|(QJSEngine::Extensions::enum_type f1, QJSEngine::Extensions::enum_type f2) noexcept { return QFlags<QJSEngine::Extensions::enum_type>(f1) | f2; } constexpr inline QFlags<QJSEngine::Extensions::enum_type> operator|(QJSEngine::Extensions::enum_type f1, QFlags<QJSEngine::Extensions::enum_type> f2) noexcept { return f2 | f1; } constexpr inline QIncompatibleFlag operator|(QJSEngine::Extensions::enum_type f1, int f2) noexcept { return QIncompatibleFlag(int(f1) | f2); }-
93-
94inline bool qjsvalue_cast_helper(const QJSValue &value, int type, void *ptr)-
95{-
96 return
executed 482 times by 4 tests: return QJSEngine::convertV2(value, type, ptr);
Executed by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlvaluetypes
QJSEngine::convertV2(value, type, ptr);
executed 482 times by 4 tests: return QJSEngine::convertV2(value, type, ptr);
Executed by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlvaluetypes
482
97}-
98-
99template<typename T>-
100T qjsvalue_cast(const QJSValue &value)-
101{-
102 T t;-
103 const int id = qMetaTypeId<T>();-
104-
105 if (qjsvalue_cast_helper(value, id, &t)
qjsvalue_cast_...value, id, &t)Description
TRUEevaluated 428 times by 4 tests
Evaluated by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlvaluetypes
FALSEevaluated 54 times by 1 test
Evaluated by:
  • tst_qjsvalue
)
54-428
106 return
executed 428 times by 4 tests: return t;
Executed by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlvaluetypes
t;
executed 428 times by 4 tests: return t;
Executed by:
  • tst_qjsengine
  • tst_qjsonbinding
  • tst_qjsvalue
  • tst_qqmlvaluetypes
428
107 else if (value.isVariant()
value.isVariant()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qjsvalue
FALSEevaluated 50 times by 1 test
Evaluated by:
  • tst_qjsvalue
)
4-50
108 return
executed 4 times by 1 test: return qvariant_cast<T>(value.toVariant());
Executed by:
  • tst_qjsvalue
qvariant_cast<T>(value.toVariant());
executed 4 times by 1 test: return qvariant_cast<T>(value.toVariant());
Executed by:
  • tst_qjsvalue
4
109-
110 return
executed 50 times by 1 test: return T();
Executed by:
  • tst_qjsvalue
T();
executed 50 times by 1 test: return T();
Executed by:
  • tst_qjsvalue
50
111}-
112-
113template <>-
114inline QVariant qjsvalue_cast<QVariant>(const QJSValue &value)-
115{-
116 return
executed 30 times by 2 tests: return value.toVariant();
Executed by:
  • tst_qjsengine
  • tst_qjsvalue
value.toVariant();
executed 30 times by 2 tests: return value.toVariant();
Executed by:
  • tst_qjsengine
  • tst_qjsvalue
30
117}-
118-
119__attribute__((visibility("default"))) QJSEngine *qjsEngine(const QObject *);-
120-
121-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0