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 QSCXMLINVOKABLESERVICE_P_H
5#define QSCXMLINVOKABLESERVICE_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 "qscxmlinvokableservice.h"
19#include <QtCore/private/qobject_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class QScxmlInvokableServicePrivate : public QObjectPrivate
24{
25public:
26 QScxmlInvokableServicePrivate(QScxmlStateMachine *parentStateMachine);
27
28 QString calculateId(QScxmlStateMachine *parent,
29 const QScxmlExecutableContent::InvokeInfo &invokeInfo, bool *ok) const;
30 QVariantMap calculateData(QScxmlStateMachine *parent,
31 const QList<QScxmlExecutableContent::ParameterInfo> &parameters,
32 const QList<QScxmlExecutableContent::StringId> &names,
33 bool *ok) const;
34
35 QScxmlStateMachine *parentStateMachine;
36};
37
38class QScxmlInvokableServiceFactoryPrivate : public QObjectPrivate
39{
40public:
41 QScxmlInvokableServiceFactoryPrivate(
42 const QScxmlExecutableContent::InvokeInfo &invokeInfo,
43 const QList<QScxmlExecutableContent::StringId> &names,
44 const QList<QScxmlExecutableContent::ParameterInfo> &parameters);
45
46 QScxmlExecutableContent::InvokeInfo invokeInfo;
47 QList<QScxmlExecutableContent::StringId> names;
48 QList<QScxmlExecutableContent::ParameterInfo> parameters;
49};
50
51class Q_SCXML_EXPORT QScxmlScxmlService: public QScxmlInvokableService
52{
53 Q_OBJECT
54 Q_DECLARE_PRIVATE(QScxmlInvokableService)
55 Q_PROPERTY(QScxmlStateMachine *stateMachine READ stateMachine CONSTANT)
56public:
57 QScxmlScxmlService(QScxmlStateMachine *stateMachine,
58 QScxmlStateMachine *parentStateMachine,
59 QScxmlInvokableServiceFactory *parent);
60 ~QScxmlScxmlService();
61
62 bool start() override;
63 QString id() const override;
64 QString name() const override;
65 void postEvent(QScxmlEvent *event) override;
66 QScxmlStateMachine *stateMachine() const;
67
68private:
69 QScxmlStateMachine *m_stateMachine;
70};
71
72class QScxmlStaticScxmlServiceFactoryPrivate : public QScxmlInvokableServiceFactoryPrivate
73{
74public:
75 QScxmlStaticScxmlServiceFactoryPrivate(
76 const QMetaObject *metaObject,
77 const QScxmlExecutableContent::InvokeInfo &invokeInfo,
78 const QList<QScxmlExecutableContent::StringId> &names,
79 const QList<QScxmlExecutableContent::ParameterInfo> &parameters);
80
81 const QMetaObject *metaObject;
82};
83
84QScxmlScxmlService *invokeDynamicScxmlService(const QString &sourceUrl,
85 QScxmlStateMachine *parentStateMachine,
86 QScxmlInvokableServiceFactory *factory);
87QScxmlScxmlService *invokeStaticScxmlService(QScxmlStateMachine *childStateMachine,
88 QScxmlStateMachine *parentStateMachine,
89 QScxmlInvokableServiceFactory *factory);
90QString calculateSrcexpr(QScxmlStateMachine *parent, QScxmlExecutableContent::EvaluatorId srcexpr,
91 bool *ok);
92
93QT_END_NAMESPACE
94
95#endif // QSCXMLINVOKABLESERVICE_P_H
96

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