OpenCoverage

qjsvalue.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsapi/qjsvalue.h
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 QtQml 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#ifndef QJSVALUE_H-
41#define QJSVALUE_H-
42-
43#include <QtQml/qtqmlglobal.h>-
44#include <QtCore/qstring.h>-
45#include <QtCore/qlist.h>-
46#include <QtCore/qmetatype.h>-
47-
48QT_BEGIN_NAMESPACE-
49-
50class QJSValue;-
51class QJSEngine;-
52class QVariant;-
53class QObject;-
54struct QMetaObject;-
55class QDateTime;-
56-
57typedef QList<QJSValue> QJSValueList;-
58namespace QV4 {-
59 struct ExecutionEngine;-
60 struct Value;-
61}-
62-
63class Q_QML_EXPORT QJSValue-
64{-
65public:-
66 enum SpecialValue {-
67 NullValue,-
68 UndefinedValue-
69 };-
70-
71public:-
72 QJSValue(SpecialValue value = UndefinedValue);-
73 ~QJSValue();-
74 QJSValue(const QJSValue &other);-
75-
76#ifdef Q_COMPILER_RVALUE_REFS-
77 inline QJSValue(QJSValue && other) : d(other.d) { other.d = 0; }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquicktext
8
78 inline QJSValue &operator=(QJSValue &&other)-
79 { qSwap(d, other.d); return *this; }
executed 1976 times by 7 tests: return *this;
Executed by:
  • tst_qjsengine
  • tst_qjsvalue
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlvaluetypes
  • tst_qquicktext
1976
80#endif-
81-
82 QJSValue(bool value);-
83 QJSValue(int value);-
84 QJSValue(uint value);-
85 QJSValue(double value);-
86 QJSValue(const QString &value);-
87 QJSValue(const QLatin1String &value);-
88#ifndef QT_NO_CAST_FROM_ASCII-
89 QT_ASCII_CAST_WARN QJSValue(const char *str);-
90#endif-
91-
92 QJSValue &operator=(const QJSValue &other);-
93-
94 bool isBool() const;-
95 bool isNumber() const;-
96 bool isNull() const;-
97 bool isString() const;-
98 bool isUndefined() const;-
99 bool isVariant() const;-
100 bool isQObject() const;-
101 bool isQMetaObject() const;-
102 bool isObject() const;-
103 bool isDate() const;-
104 bool isRegExp() const;-
105 bool isArray() const;-
106 bool isError() const;-
107-
108 QString toString() const;-
109 double toNumber() const;-
110 qint32 toInt() const;-
111 quint32 toUInt() const;-
112 bool toBool() const;-
113 QVariant toVariant() const;-
114 QObject *toQObject() const;-
115 const QMetaObject *toQMetaObject() const;-
116 QDateTime toDateTime() const;-
117-
118 bool equals(const QJSValue &other) const;-
119 bool strictlyEquals(const QJSValue &other) const;-
120-
121 QJSValue prototype() const;-
122 void setPrototype(const QJSValue &prototype);-
123-
124 QJSValue property(const QString &name) const;-
125 void setProperty(const QString &name, const QJSValue &value);-
126-
127 bool hasProperty(const QString &name) const;-
128 bool hasOwnProperty(const QString &name) const;-
129-
130 QJSValue property(quint32 arrayIndex) const;-
131 void setProperty(quint32 arrayIndex, const QJSValue &value);-
132-
133 bool deleteProperty(const QString &name);-
134-
135 bool isCallable() const;-
136 QJSValue call(const QJSValueList &args = QJSValueList()); // ### Qt6: Make const-
137 QJSValue callWithInstance(const QJSValue &instance, const QJSValueList &args = QJSValueList()); // ### Qt6: Make const-
138 QJSValue callAsConstructor(const QJSValueList &args = QJSValueList()); // ### Qt6: Make const-
139-
140#ifdef QT_DEPRECATED-
141 QT_DEPRECATED QJSEngine *engine() const;-
142#endif-
143-
144 QJSValue(QV4::ExecutionEngine *e, quint64 val);-
145private:-
146 friend class QJSValuePrivate;-
147 // force compile error, prevent QJSValue(bool) to be called-
148 QJSValue(void *) Q_DECL_EQ_DELETE;-
149-
150 mutable quintptr d;-
151};-
152-
153QT_END_NAMESPACE-
154-
155Q_DECLARE_METATYPE(QJSValue)-
156-
157#endif-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0