1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQMLEXPRESSION_P_H
5#define QQMLEXPRESSION_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qqmlexpression.h"
19
20#include <private/qqmlengine_p.h>
21#include <private/qfieldlist_p.h>
22#include <private/qqmljavascriptexpression_p.h>
23
24QT_BEGIN_NAMESPACE
25
26class QQmlExpression;
27class QString;
28class QQmlExpressionPrivate : public QObjectPrivate,
29 public QQmlJavaScriptExpression
30{
31 Q_DECLARE_PUBLIC(QQmlExpression)
32public:
33 QQmlExpressionPrivate();
34 ~QQmlExpressionPrivate() override;
35
36 void init(const QQmlRefPointer<QQmlContextData> &, const QString &, QObject *);
37 void init(const QQmlRefPointer<QQmlContextData> &, QV4::Function *runtimeFunction, QObject *);
38
39 QVariant value(bool *isUndefined = nullptr);
40
41 QV4::ReturnedValue v4value(bool *isUndefined = nullptr);
42 bool mustCaptureBindableProperty() const final {return true;}
43
44 static inline QQmlExpressionPrivate *get(QQmlExpression *expr);
45 static inline QQmlExpression *get(QQmlExpressionPrivate *expr);
46
47 void _q_notify();
48
49 bool expressionFunctionValid:1;
50
51 // Inherited from QQmlJavaScriptExpression
52 QString expressionIdentifier() const override;
53 void expressionChanged() override;
54
55 QString expression;
56
57 QString url; // This is a QString for a reason. QUrls are slooooooow...
58 quint16 line;
59 quint16 column;
60 QString name; //function name, hint for the debugger
61};
62
63QQmlExpressionPrivate *QQmlExpressionPrivate::get(QQmlExpression *expr)
64{
65 return static_cast<QQmlExpressionPrivate *>(QObjectPrivate::get(o: expr));
66}
67
68QQmlExpression *QQmlExpressionPrivate::get(QQmlExpressionPrivate *expr)
69{
70 return expr->q_func();
71}
72
73
74QT_END_NAMESPACE
75
76#endif // QQMLEXPRESSION_P_H
77

source code of qtdeclarative/src/qml/qml/qqmlexpression_p.h