KDStateMachineEditor API Documentation  1.2.9
A framework for creating Qt State Machine metacode using a graphical user interface
debuginterface_types.h
1 /*
2  This file is part of the KDAB State Machine Editor Library.
3 
4  SPDX-FileCopyrightText: 2015-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5  Author: Kevin Funk <kevin.funk@kdab.com>
6 
7  SPDX-License-Identifier: LGPL-2.1-only OR LicenseRef-KDAB-KDStateMachineEditor
8 
9  Licensees holding valid commercial KDAB State Machine Editor Library
10  licenses may use this file in accordance with the KDAB State Machine Editor
11  Library License Agreement provided with the Software.
12 
13  Contact info@kdab.com if any conditions of this licensing are not clear to you.
14 */
15 
16 #ifndef KDSME_DEBUGINTERFACE_TYPES_H
17 #define KDSME_DEBUGINTERFACE_TYPES_H
18 
19 #include <QDataStream>
20 #include <QList>
21 #include <QMetaType>
22 
23 QT_BEGIN_NAMESPACE
25 class QAbstractState;
26 QT_END_NAMESPACE
27 
28 namespace KDSME {
29 namespace DebugInterface {
30 
31 // note: typedef bring major pain, on the client side i.e. it would always look for
32 // signal/slots with the base type (or actually, the first type which was registered
33 // to the meta type system)...
35 {
36  operator quint64() const
37  {
38  return id;
39  }
40  quint64 id;
41 };
42 
43 inline QDataStream &operator<<(QDataStream &out, TransitionId value)
44 {
45  out << value.id;
46  return out;
47 }
48 
49 inline QDataStream &operator>>(QDataStream &in, TransitionId &value)
50 {
51  in >> value.id;
52  return in;
53 }
54 
55 struct StateId
56 {
57  operator quint64() const
58  {
59  return id;
60  }
61  quint64 id;
62 };
63 
64 inline QDataStream &operator<<(QDataStream &out, StateId value)
65 {
66  out << value.id;
67  return out;
68 }
69 
70 inline QDataStream &operator>>(QDataStream &in, StateId &value)
71 {
72  in >> value.id;
73  return in;
74 }
75 
76 enum StateType {
77  OtherState,
78  FinalState,
79  ShallowHistoryState,
80  DeepHistoryState,
81  StateMachineState
82 };
83 
84 inline QDataStream &operator<<(QDataStream &out, StateType value)
85 {
86  out << int(value);
87  return out;
88 }
89 
90 inline QDataStream &operator>>(QDataStream &in, StateType &value)
91 {
92  int val;
93  in >> val;
94  value = static_cast<StateType>(val);
95  return in;
96 }
97 
99 
100 inline void registerTypes() //krazy:exclude=inline
101 {
102  qRegisterMetaTypeStreamOperators<StateId>();
103  qRegisterMetaTypeStreamOperators<StateMachineConfiguration>();
104  qRegisterMetaTypeStreamOperators<TransitionId>();
105  qRegisterMetaTypeStreamOperators<StateType>();
106 }
107 
108 }
109 }
110 
111 Q_DECLARE_METATYPE(KDSME::DebugInterface::StateId)
112 Q_DECLARE_METATYPE(KDSME::DebugInterface::TransitionId)
114 Q_DECLARE_METATYPE(KDSME::DebugInterface::StateType)
115 
116 #endif
Definition: state.h:138
Definition: debuginterface_types.h:34
Definition: debuginterface_types.h:55
Definition: mainwindow.h:21

Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDStateMachineEditor
Create Qt State Machine metacode using a graphical user interface
https://github.com/KDAB/KDStateMachineEditor