statemachine/qsignaltransition.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6QSignalTransitionPrivate::QSignalTransitionPrivate() -
7{ -
8 sender = 0; -
9 signalIndex = -1; -
10}
executed: }
Execution Count:60
60
11 -
12QSignalTransitionPrivate *QSignalTransitionPrivate::get(QSignalTransition *q) -
13{ -
14 return q->d_func();
executed: return q->d_func();
Execution Count:1001483
1001483
15} -
16 -
17void QSignalTransitionPrivate::unregister() -
18{ -
19 QSignalTransition * const q = q_func(); -
20 if ((signalIndex == -1) || !machine())
evaluated: (signalIndex == -1)
TRUEFALSE
yes
Evaluation Count:100010
yes
Evaluation Count:100001
partially evaluated: !machine()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:100002
0-100010
21 return;
executed: return;
Execution Count:100010
100010
22 QStateMachinePrivate::get(machine())->unregisterSignalTransition(q); -
23}
executed: }
Execution Count:100003
100003
24 -
25void QSignalTransitionPrivate::maybeRegister() -
26{ -
27 QSignalTransition * const q = q_func(); -
28 if (QStateMachine *mach = machine())
evaluated: QStateMachine *mach = machine()
TRUEFALSE
yes
Evaluation Count:200009
yes
Evaluation Count:57
57-200009
29 QStateMachinePrivate::get(mach)->maybeRegisterSignalTransition(q);
executed: QStateMachinePrivate::get(mach)->maybeRegisterSignalTransition(q);
Execution Count:200009
200009
30}
executed: }
Execution Count:200067
200067
31 -
32 -
33 -
34 -
35QSignalTransition::QSignalTransition(QState *sourceState) -
36 : QAbstractTransition(*new QSignalTransitionPrivate, sourceState) -
37{ -
38}
executed: }
Execution Count:6
6
39 -
40 -
41 -
42 -
43 -
44QSignalTransition::QSignalTransition(const QObject *sender, const char *signal, -
45 QState *sourceState) -
46 : QAbstractTransition(*new QSignalTransitionPrivate, sourceState) -
47{ -
48 QSignalTransitionPrivate * const d = d_func(); -
49 d->sender = sender; -
50 d->signal = signal; -
51 d->maybeRegister(); -
52}
executed: }
Execution Count:54
54
53 -
54 -
55 -
56 -
57QSignalTransition::~QSignalTransition() -
58{ -
59} -
60 -
61 -
62 -
63 -
64QObject *QSignalTransition::senderObject() const -
65{ -
66 const QSignalTransitionPrivate * const d = d_func(); -
67 return const_cast<QObject *>(d->sender);
executed: return const_cast<QObject *>(d->sender);
Execution Count:135
135
68} -
69 -
70 -
71 -
72 -
73void QSignalTransition::setSenderObject(const QObject *sender) -
74{ -
75 QSignalTransitionPrivate * const d = d_func(); -
76 if (sender == d->sender)
partially evaluated: sender == d->sender
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:200000
0-200000
77 return;
never executed: return;
0
78 d->unregister(); -
79 d->sender = sender; -
80 d->maybeRegister(); -
81}
executed: }
Execution Count:200004
200004
82 -
83 -
84 -
85 -
86QByteArray QSignalTransition::signal() const -
87{ -
88 const QSignalTransitionPrivate * const d = d_func(); -
89 return d->signal;
executed: return d->signal;
Execution Count:10
10
90} -
91 -
92 -
93 -
94 -
95void QSignalTransition::setSignal(const QByteArray &signal) -
96{ -
97 QSignalTransitionPrivate * const d = d_func(); -
98 if (signal == d->signal)
partially evaluated: signal == d->signal
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
99 return;
never executed: return;
0
100 d->unregister(); -
101 d->signal = signal; -
102 d->maybeRegister(); -
103}
executed: }
Execution Count:9
9
104bool QSignalTransition::eventTest(QEvent *event) -
105{ -
106 const QSignalTransitionPrivate * const d = d_func(); -
107 if (event->type() == QEvent::StateMachineSignal) {
evaluated: event->type() == QEvent::StateMachineSignal
TRUEFALSE
yes
Evaluation Count:73
yes
Evaluation Count:3166
73-3166
108 if (d->signalIndex == -1)
partially evaluated: d->signalIndex == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:73
0-73
109 return false;
never executed: return false;
0
110 QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(event); -
111 return (se->sender() == d->sender) 73
112 && (se->signalIndex() == d->signalIndex);
executed: return (se->sender() == d->sender) && (se->signalIndex() == d->signalIndex);
Execution Count:73
73
113 } -
114 return false;
executed: return false;
Execution Count:3166
3166
115} -
116 -
117 -
118 -
119 -
120void QSignalTransition::onTransition(QEvent *event) -
121{ -
122 (void)event;; -
123}
executed: }
Execution Count:61
61
124 -
125 -
126 -
127 -
128bool QSignalTransition::event(QEvent *e) -
129{ -
130 return QAbstractTransition::event(e);
executed: return QAbstractTransition::event(e);
Execution Count:2
2
131} -
132 -
133void QSignalTransitionPrivate::callOnTransition(QEvent *e) -
134{ -
135 QSignalTransition * const q = q_func(); -
136 -
137 if (e->type() == QEvent::StateMachineSignal) {
partially evaluated: e->type() == QEvent::StateMachineSignal
TRUEFALSE
yes
Evaluation Count:61
no
Evaluation Count:0
0-61
138 QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent *>(e); -
139 int savedSignalIndex = se->m_signalIndex; -
140 se->m_signalIndex = originalSignalIndex; -
141 q->onTransition(e); -
142 se->m_signalIndex = savedSignalIndex; -
143 } else {
executed: }
Execution Count:61
61
144 q->onTransition(e); -
145 }
never executed: }
0
146} -
147 -
148 -
149 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial