| CMakeLists.txt |
|
2449 |
- |
| doc |
|
|
- |
| qscxmlcompiler.cpp |
|
86023 |
- |
| qscxmlcompiler.h |
|
1136 |
- |
| qscxmlcompiler_p.h |
|
18444 |
- |
| qscxmlcppdatamodel.cpp |
!
\class QScxmlCppDataModel
\brief The QScxmlCppDataModel class is a C++ data model for a Qt SCXML state machine.
\since 5.7
\inmodule QtScxml
\sa QScxmlStateMachine QScxmlDataModel
The C++ data model for SCXML lets you write C++ code for \e expr attributes and \c <script>
elements. The \e {data part} of the data model is backed by a subclass of QScxmlCppDataModel, for
which the Qt SCXML compiler (\c qscxmlc) will generate the dispatch methods. It cannot be used
when loading an SCXML file at runtime.
Usage is through the \e datamodel attribute of the \c <scxml> element:
\code
<scxml datamodel="cplusplus:TheDataModel:thedatamodel.h" ....>
\endcode
The format of the \e datamodel attribute is: \c{cplusplus:<class-name>:<classdef-header>}.
So, for the example above, there should be a file \e thedatamodel.h containing a subclass of
QScxmlCppDataModel, containing at least the following:
\snippet snippets/mediaplayer/thedatamodel.h Declaration1
\dots
\snippet snippets/mediaplayer/thedatamodel.h Declaration2
The Q_SCXML_DATAMODEL has to appear in the private section of the class definition, for example
right after the opening bracket, or after a Q_OBJECT macro.
This macro expands to the declaration of some virtual
methods whose implementation is generated by the Qt SCXML compiler.
The Qt SCXML compiler will generate the various \c evaluateTo methods, and convert expressions and
scripts into lambdas inside those methods. For example:
\code
<scxml datamodel="cplusplus:TheDataModel:thedatamodel.h" xmlns="http://www.w3.org/2005/07/scxml" version="1.0" name="MediaPlayerStateMachine">
<state id="stopped">
<transition event="tap" cond="isValidMedia()" target="playing"/>
</state>
<state id="playing">
<onentry>
<script>
media = eventData().value(QStringLiteral("media")).toString();
</script>
<send event="playbackStarted">
<param name="media" expr="media"/>
</send>
</onentry>
</state>
</scxml>
\endcode
This will result in:
\code
bool TheDataModel::evaluateToBool(QScxmlExecutableContent::EvaluatorId id, bool *ok) {
// ....
return [this]()->bool{ return isValidMedia(); }();
// ....
}
QVariant TheDataModel::evaluateToVariant(QScxmlExecutableContent::EvaluatorId id, bool *ok) {
// ....
return [this]()->QVariant{ return media; }();
// ....
}
void TheDataModel::evaluateToVoid(QScxmlExecutableContent::EvaluatorId id, bool *ok) {
// ....
[this]()->void{ media = eventData().value(QStringLiteral("media")).toString(); }();
// ....
}
\endcode
So, you are not limited to call functions. In a \c <script> element you can put zero or more C++
statements, and in \e cond or \e expr attributes you can use any C++ expression that can be
converted to the respective bool or QVariant. And, as the \c this pointer is also captured, you
can call or access the data model (the \e media attribute in the example above). For the full
example, see \l {SCXML Media Player}.
|
7166 |
- |
| qscxmlcppdatamodel.h |
|
1791 |
- |
| qscxmlcppdatamodel_p.h |
|
787 |
- |
| qscxmldatamodel.cpp |
!
\class QScxmlDataModel::ForeachLoopBody
\brief The ForeachLoopBody class represents a function to be executed on
each iteration of an SCXML foreach loop.
\since 5.8
\inmodule QtScxml
|
8289 |
- |
| qscxmldatamodel.h |
|
2575 |
- |
| qscxmldatamodel_p.h |
|
1442 |
- |
| qscxmldatamodelplugin.cpp |
|
347 |
- |
| qscxmldatamodelplugin_p.h |
|
990 |
- |
| qscxmlerror.cpp |
!
\class QScxmlError
\brief The QScxmlError class describes the errors returned by the Qt SCXML
state machine when parsing an SCXML file.
\since 5.7
\inmodule QtScxml
\sa QScxmlStateMachine QScxmlCompiler
|
3811 |
- |
| qscxmlerror.h |
|
1261 |
- |
| qscxmlevent.cpp |
|
15233 |
- |
| qscxmlevent.h |
|
2220 |
- |
| qscxmlevent_p.h |
|
4882 |
- |
| qscxmlexecutablecontent.cpp |
!
\namespace QScxmlExecutableContent
\inmodule QtScxml
\since 5.8
\brief The QScxmlExecutableContent namespace contains various types used
to interpret executable content in state machines.
|
14006 |
- |
| qscxmlexecutablecontent.h |
|
1348 |
- |
| qscxmlexecutablecontent_p.h |
|
13777 |
- |
| qscxmlglobals.h |
|
443 |
- |
| qscxmlglobals_p.h |
|
731 |
- |
| qscxmlinvokableservice.cpp |
!
\class QScxmlInvokableService
\brief The QScxmlInvokableService class is the base class for services called
from state machines.
\since 5.8
\inmodule QtScxml
The services are called from state machines via the mechanism described in
\l {SCXML Specification - 6.4 <invoke>}. This class represents an actual
instance of an invoked service.
|
13197 |
- |
| qscxmlinvokableservice.h |
|
3496 |
- |
| qscxmlinvokableservice_p.h |
|
3522 |
- |
| qscxmlnulldatamodel.cpp |
!
\class QScxmlNullDataModel
\brief The QScxmlNullDataModel class is the null data model for a Qt SCXML
stateMachine.
\since 5.7
\inmodule QtScxml
This class implements the null data model as described in the
\l {SCXML Specification - B.1 The Null Data Model}. Using the value \c "null"
for the \e datamodel attribute of the \c <scxml> element means that there is
no underlying data model, but some executable content, like \c In(...) or
\c <log> can still be used.
\sa QScxmlStateMachine QScxmlDataModel
|
8053 |
- |
| qscxmlnulldatamodel.h |
|
1659 |
- |
| qscxmlstatemachine.cpp |
!
\class QScxmlStateMachine
\brief The QScxmlStateMachine class provides an interface to the state machines
created from SCXML files.
\since 5.7
\inmodule QtScxml
QScxmlStateMachine is an implementation of the
\l{SCXML Specification}{State Chart XML (SCXML)}.
All states that are defined in the SCXML file
are accessible as properties of QScxmlStateMachine.
These properties are boolean values and indicate
whether the state is active or inactive.
\note The QScxmlStateMachine needs a QEventLoop to work correctly. The event loop is used to
implement the \c delay attribute for events and to schedule the processing of a state
machine when events are received from nested (or parent) state machines.
|
82115 |
- |
| qscxmlstatemachine.h |
|
11332 |
- |
| qscxmlstatemachine_p.h |
|
13631 |
- |
| qscxmlstatemachineinfo.cpp |
|
7077 |
- |
| qscxmlstatemachineinfo_p.h |
|
2451 |
- |
| qscxmltabledata.cpp |
!
\class QScxmlTableData
\since 5.8
\inmodule QtScxml
\brief The QScxmlTableData class is used by compiled state machines.
QScxmlTableData is the interface to the compiled representation of SCXML
state machines. It should only be used internally and by state machines
compiled from SCXML documents.
|
38625 |
- |
| qscxmltabledata.h |
|
1429 |
- |
| qscxmltabledata_p.h |
|
3364 |
- |
| qt_cmdline.cmake |
|
0 |
- |
| Qt5ScxmlConfigExtras.cmake.in |
|
1097 |
- |
| Qt6ScxmlMacros.cmake |
|
3106 |
- |