| 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 QSCXMLCPPDATAMODEL_H |
| 5 | #define QSCXMLCPPDATAMODEL_H |
| 6 | |
| 7 | #include <QtScxml/qscxmldatamodel.h> |
| 8 | |
| 9 | #define Q_SCXML_DATAMODEL \ |
| 10 | public: \ |
| 11 | QString evaluateToString(QScxmlExecutableContent::EvaluatorId id, bool *ok) override final; \ |
| 12 | bool evaluateToBool(QScxmlExecutableContent::EvaluatorId id, bool *ok) override final; \ |
| 13 | QVariant evaluateToVariant(QScxmlExecutableContent::EvaluatorId id, bool *ok) override final; \ |
| 14 | void evaluateToVoid(QScxmlExecutableContent::EvaluatorId id, bool *ok) override final; \ |
| 15 | private: |
| 16 | |
| 17 | QT_BEGIN_NAMESPACE |
| 18 | |
| 19 | class QScxmlCppDataModelPrivate; |
| 20 | class Q_SCXML_EXPORT QScxmlCppDataModel: public QScxmlDataModel |
| 21 | { |
| 22 | Q_OBJECT |
| 23 | Q_DECLARE_PRIVATE(QScxmlCppDataModel) |
| 24 | public: |
| 25 | explicit QScxmlCppDataModel(QObject *parent = nullptr); |
| 26 | |
| 27 | Q_INVOKABLE bool setup(const QVariantMap &initialDataValues) override; |
| 28 | |
| 29 | void evaluateAssignment(QScxmlExecutableContent::EvaluatorId id, bool *ok) override; |
| 30 | void evaluateInitialization(QScxmlExecutableContent::EvaluatorId id, bool *ok) override; |
| 31 | void evaluateForeach(QScxmlExecutableContent::EvaluatorId id, bool *ok, ForeachLoopBody *body) override; |
| 32 | |
| 33 | void setScxmlEvent(const QScxmlEvent &scxmlEvent) override final; |
| 34 | const QScxmlEvent &scxmlEvent() const; |
| 35 | |
| 36 | QVariant scxmlProperty(const QString &name) const override; |
| 37 | bool hasScxmlProperty(const QString &name) const override; |
| 38 | bool setScxmlProperty(const QString &name, const QVariant &value, const QString &context) override; |
| 39 | |
| 40 | bool inState(const QString &stateName) const; |
| 41 | }; |
| 42 | |
| 43 | QT_END_NAMESPACE |
| 44 | |
| 45 | #endif // QSCXMLCPPDATAMODEL_H |
| 46 | |