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 QSCXMLSTATEMACHINEINFO_H
5#define QSCXMLSTATEMACHINEINFO_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/qscxmlglobals.h>
19#include <QtCore/qobject.h>
20#include <QtCore/private/qglobal_p.h>
21
22QT_BEGIN_NAMESPACE
23
24class QScxmlStateMachine;
25class QScxmlStateMachineInfoPrivate;
26
27class Q_SCXML_EXPORT QScxmlStateMachineInfo: public QObject
28{
29 Q_OBJECT
30
31public: // types
32 typedef int StateId;
33 typedef int TransitionId;
34
35 static const StateId InvalidStateId = -1;
36 static const TransitionId InvalidTransitionId = -1;
37
38 enum StateType : int {
39 InvalidState = -1,
40 NormalState = 0,
41 ParallelState = 1,
42 FinalState = 2,
43 ShallowHistoryState = 3,
44 DeepHistoryState = 4
45 };
46
47 enum TransitionType : int {
48 InvalidTransition = -1,
49 InternalTransition = 0,
50 ExternalTransition = 1,
51 SyntheticTransition = 2
52 };
53
54public: // methods
55 QScxmlStateMachineInfo(QScxmlStateMachine *stateMachine);
56
57 QScxmlStateMachine *stateMachine() const;
58
59 QList<StateId> allStates() const;
60 QList<TransitionId> allTransitions() const;
61 QString stateName(int stateId) const;
62 StateId stateParent(StateId stateId) const;
63 StateType stateType(int stateId) const;
64 QList<StateId> stateChildren(StateId stateId) const;
65 TransitionId initialTransition(StateId stateId) const;
66 TransitionType transitionType(TransitionId transitionId) const;
67 StateId transitionSource(TransitionId transitionId) const;
68 QList<StateId> transitionTargets(TransitionId transitionId) const;
69 QList<QString> transitionEvents(TransitionId transitionId) const;
70 QList<StateId> configuration() const;
71
72Q_SIGNALS:
73 void statesEntered(const QList<QScxmlStateMachineInfo::StateId> &states);
74 void statesExited(const QList<QScxmlStateMachineInfo::StateId> &states);
75 void transitionsTriggered(const QList<QScxmlStateMachineInfo::TransitionId> &transitions);
76
77private:
78 Q_DECLARE_PRIVATE(QScxmlStateMachineInfo)
79};
80
81QT_END_NAMESPACE
82
83#endif // QSCXMLSTATEMACHINEINFO_H
84

source code of qtscxml/src/scxml/qscxmlstatemachineinfo_p.h