Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsapi/qjsengine.h |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | - | |||||||
6 | - | |||||||
7 | template <typename T> | - | ||||||
8 | inline T qjsvalue_cast(const QJSValue &); | - | ||||||
9 | - | |||||||
10 | class QJSEnginePrivate; | - | ||||||
11 | class __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 {}; | - | ||||||
23 | public: | - | ||||||
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: newQMetaObject(&T::staticMetaObject);return newQMetaObject(&T::staticMetaObject); Executed by:
executed 2 times by 1 test: return newQMetaObject(&T::staticMetaObject); Executed by:
| 2 | ||||||
43 | } | - | ||||||
44 | - | |||||||
45 | template <typename T> | - | ||||||
46 | inline QJSValue toScriptValue(const T &value) | - | ||||||
47 | { | - | ||||||
48 | return executed 48668 times by 5 tests: create(qMetaTypeId<T>(), &value);return create(qMetaTypeId<T>(), &value); Executed by:
executed 48668 times by 5 tests: return create(qMetaTypeId<T>(), &value); Executed by:
| 48668 | ||||||
49 | } | - | ||||||
50 | template <typename T> | - | ||||||
51 | inline T fromScriptValue(const QJSValue &value) | - | ||||||
52 | { | - | ||||||
53 | return executed 52 times by 2 tests: qjsvalue_cast<T>(value);return qjsvalue_cast<T>(value); Executed by:
executed 52 times by 2 tests: return qjsvalue_cast<T>(value); Executed by:
| 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: m_v4Engine;return m_v4Engine; Executed by:
executed 10437358 times by 144 tests: }return m_v4Engine; Executed by:
| 10437358 | ||||||
73 | - | |||||||
74 | void throwError(const QString &message); | - | ||||||
75 | - | |||||||
76 | private: | - | ||||||
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 | - | |||||||
83 | protected: | - | ||||||
84 | QJSEngine(QJSEnginePrivate &dd, QObject *parent = nullptr); | - | ||||||
85 | - | |||||||
86 | private: | - | ||||||
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: reinterpret_cast<QJSEnginePrivate *>(qGetPtrHelper(d_ptr));return reinterpret_cast<QJSEnginePrivate *>(qGetPtrHelper(d_ptr)); Executed by:
executed 473962 times by 60 tests: } inline const QJSEnginePrivate* d_func() const { returnreturn reinterpret_cast<QJSEnginePrivate *>(qGetPtrHelper(d_ptr)); Executed by:
never executed: reinterpret_cast<const QJSEnginePrivate *>(qGetPtrHelper(d_ptr));return reinterpret_cast<const QJSEnginePrivate *>(qGetPtrHelper(d_ptr)); never executed: } friend class QJSEnginePrivate;return reinterpret_cast<const QJSEnginePrivate *>(qGetPtrHelper(d_ptr)); | 0-473962 | ||||||
90 | }; | - | ||||||
91 | - | |||||||
92 | constexpr 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 | - | |||||||
94 | inline bool qjsvalue_cast_helper(const QJSValue &value, int type, void *ptr) | - | ||||||
95 | { | - | ||||||
96 | return executed 482 times by 4 tests: QJSEngine::convertV2(value, type, ptr);return QJSEngine::convertV2(value, type, ptr); Executed by:
executed 482 times by 4 tests: return QJSEngine::convertV2(value, type, ptr); Executed by:
| 482 | ||||||
97 | } | - | ||||||
98 | - | |||||||
99 | template<typename T> | - | ||||||
100 | T qjsvalue_cast(const QJSValue &value) | - | ||||||
101 | { | - | ||||||
102 | T t; | - | ||||||
103 | const int id = qMetaTypeId<T>(); | - | ||||||
104 | - | |||||||
105 | if (qjsvalue_cast_helper(value, id, &t)
| 54-428 | ||||||
106 | return executed 428 times by 4 tests: t;return t; Executed by:
executed 428 times by 4 tests: return t; Executed by:
| 428 | ||||||
107 | else if (value.isVariant()
| 4-50 | ||||||
108 | return executed 4 times by 1 test: qvariant_cast<T>(value.toVariant());return qvariant_cast<T>(value.toVariant()); Executed by:
executed 4 times by 1 test: return qvariant_cast<T>(value.toVariant()); Executed by:
| 4 | ||||||
109 | - | |||||||
110 | return executed 50 times by 1 test: T();return T(); Executed by:
executed 50 times by 1 test: return T(); Executed by:
| 50 | ||||||
111 | } | - | ||||||
112 | - | |||||||
113 | template <> | - | ||||||
114 | inline QVariant qjsvalue_cast<QVariant>(const QJSValue &value) | - | ||||||
115 | { | - | ||||||
116 | return executed 30 times by 2 tests: value.toVariant();return value.toVariant(); Executed by:
executed 30 times by 2 tests: return value.toVariant(); Executed by:
| 30 | ||||||
117 | } | - | ||||||
118 | - | |||||||
119 | __attribute__((visibility("default"))) QJSEngine *qjsEngine(const QObject *); | - | ||||||
120 | - | |||||||
121 | - | |||||||
Switch to Source code | Preprocessed file |