1 | // Copyright (C) 2020 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 QSCXMLTABLEDATA_P_H |
5 | #define QSCXMLTABLEDATA_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 <QtScxml/qscxmltabledata.h> |
19 | #include <QtCore/qhash.h> |
20 | #include <QtCore/qlist.h> |
21 | #include <QtCore/qsharedpointer.h> |
22 | #include <QtCore/private/qglobal_p.h> |
23 | |
24 | #include <functional> |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | class QTextStream; |
28 | class QScxmlInvokableServiceFactory; |
29 | |
30 | namespace DocumentModel { |
31 | struct ScxmlDocument; |
32 | } |
33 | |
34 | namespace QScxmlInternal { |
35 | class Q_SCXML_EXPORT GeneratedTableData: public QScxmlTableData |
36 | { |
37 | public: |
38 | typedef std::function< |
39 | int(const QScxmlExecutableContent::InvokeInfo &invokeInfo, |
40 | const QList<QScxmlExecutableContent::StringId> &namelist, |
41 | const QList<QScxmlExecutableContent::ParameterInfo> ¶ms, |
42 | QSharedPointer<DocumentModel::ScxmlDocument> content) |
43 | > CreateFactoryId; |
44 | |
45 | struct MetaDataInfo { |
46 | QStringList stateNames; |
47 | }; |
48 | |
49 | struct DataModelInfo { |
50 | QHash<QScxmlExecutableContent::EvaluatorId, QString> stringEvaluators; |
51 | QHash<QScxmlExecutableContent::EvaluatorId, QString> boolEvaluators; |
52 | QHash<QScxmlExecutableContent::EvaluatorId, QString> variantEvaluators; |
53 | QHash<QScxmlExecutableContent::EvaluatorId, QString> voidEvaluators; |
54 | }; |
55 | |
56 | public: |
57 | static void build(DocumentModel::ScxmlDocument *doc, GeneratedTableData *table, |
58 | MetaDataInfo *metaDataInfo, DataModelInfo *dataModelInfo, |
59 | CreateFactoryId func); |
60 | static QString toString(const int *stateMachineTable); |
61 | |
62 | public: |
63 | QString string(QScxmlExecutableContent::StringId id) const override final; |
64 | QScxmlExecutableContent::InstructionId *instructions() const override final; |
65 | QScxmlExecutableContent::EvaluatorInfo evaluatorInfo( |
66 | QScxmlExecutableContent::EvaluatorId evaluatorId) const override final; |
67 | QScxmlExecutableContent::AssignmentInfo assignmentInfo( |
68 | QScxmlExecutableContent::EvaluatorId assignmentId) const override final; |
69 | QScxmlExecutableContent::ForeachInfo foreachInfo( |
70 | QScxmlExecutableContent::EvaluatorId foreachId) const override final; |
71 | QScxmlExecutableContent::StringId *dataNames(int *count) const override final; |
72 | QScxmlExecutableContent::ContainerId initialSetup() const override final; |
73 | QString name() const override final; |
74 | const qint32 *stateMachineTable() const override final; |
75 | QScxmlInvokableServiceFactory *serviceFactory(int id) const override; |
76 | |
77 | public: |
78 | QList<qint32> theStateMachineTable; |
79 | QStringList theStrings; |
80 | QList<qint32> theInstructions; |
81 | QList<QScxmlExecutableContent::EvaluatorInfo> theEvaluators; |
82 | QList<QScxmlExecutableContent::AssignmentInfo> theAssignments; |
83 | QList<QScxmlExecutableContent::ForeachInfo> theForeaches; |
84 | QList<QScxmlExecutableContent::StringId> theDataNameIds; |
85 | QScxmlExecutableContent::ContainerId theInitialSetup; |
86 | int theName; |
87 | }; |
88 | } // QScxmlInternal namespace |
89 | |
90 | QT_END_NAMESPACE |
91 | |
92 | #endif // QSCXMLTABLEDATA_P_H |
93 | |