Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | template <class T> | - |
14 | static uint qHash(const QPointer<T> &p) | - |
15 | { return qHash(p.data()); } executed: return qHash(p.data()); Execution Count:265 | 265 |
16 | | - |
17 | QStateMachinePrivate::QStateMachinePrivate() | - |
18 | { | - |
19 | isMachine = true; | - |
20 | | - |
21 | state = NotRunning; | - |
22 | processing = false; | - |
23 | processingScheduled = false; | - |
24 | stop = false; | - |
25 | stopProcessingReason = EventQueueEmpty; | - |
26 | error = QStateMachine::NoError; | - |
27 | globalRestorePolicy = QState::DontRestoreProperties; | - |
28 | signalEventGenerator = 0; | - |
29 | | - |
30 | animated = true; | - |
31 | | - |
32 | } executed: } Execution Count:134 | 134 |
33 | | - |
34 | QStateMachinePrivate::~QStateMachinePrivate() | - |
35 | { | - |
36 | qDeleteAll(internalEventQueue); | - |
37 | qDeleteAll(externalEventQueue); | - |
38 | } executed: } Execution Count:134 | 134 |
39 | | - |
40 | QStateMachinePrivate *QStateMachinePrivate::get(QStateMachine *q) | - |
41 | { | - |
42 | if (q) evaluated: q yes Evaluation Count:300328 | yes Evaluation Count:1 |
| 1-300328 |
43 | return q->d_func(); executed: return q->d_func(); Execution Count:300330 | 300330 |
44 | return 0; executed: return 0; Execution Count:1 | 1 |
45 | } | - |
46 | | - |
47 | QState *QStateMachinePrivate::rootState() const | - |
48 | { | - |
49 | return const_cast<QStateMachine*>(q_func()); executed: return const_cast<QStateMachine*>(q_func()); Execution Count:9505 | 9505 |
50 | } | - |
51 | | - |
52 | static QEvent *cloneEvent(QEvent *e) | - |
53 | { | - |
54 | switch (e->type()) { | - |
55 | case QEvent::None: | - |
56 | return new QEvent(*e); never executed: return new QEvent(*e); | 0 |
57 | case QEvent::Timer: | - |
58 | return new QTimerEvent(*static_cast<QTimerEvent*>(e)); executed: return new QTimerEvent(*static_cast<QTimerEvent*>(e)); Execution Count:7 | 7 |
59 | default: | - |
60 | qt_noop(); | - |
61 | break; | 0 |
62 | } | - |
63 | return 0; never executed: return 0; | 0 |
64 | } | - |
65 | | - |
66 | const QStateMachinePrivate::Handler qt_kernel_statemachine_handler = { | - |
67 | cloneEvent | - |
68 | }; | - |
69 | | - |
70 | const QStateMachinePrivate::Handler *QStateMachinePrivate::handler = &qt_kernel_statemachine_handler; | - |
71 | | - |
72 | __attribute__((visibility("default"))) const QStateMachinePrivate::Handler *qcoreStateMachineHandler() | - |
73 | { | - |
74 | return &qt_kernel_statemachine_handler; executed: return &qt_kernel_statemachine_handler; Execution Count:7 | 7 |
75 | } | - |
76 | | - |
77 | static int indexOfDescendant(QState *s, QAbstractState *desc) | - |
78 | { | - |
79 | QList<QAbstractState*> childStates = QStatePrivate::get(s)->childStates(); | - |
80 | for (int i = 0; i < childStates.size(); ++i) { partially evaluated: i < childStates.size() yes Evaluation Count:122 | no Evaluation Count:0 |
| 0-122 |
81 | QAbstractState *c = childStates.at(i); | - |
82 | if ((c == desc) || QStateMachinePrivate::isDescendantOf(desc, c)) { evaluated: (c == desc) yes Evaluation Count:23 | yes Evaluation Count:99 |
evaluated: QStateMachinePrivate::isDescendantOf(desc, c) yes Evaluation Count:49 | yes Evaluation Count:50 |
| 23-99 |
83 | return i; executed: return i; Execution Count:72 | 72 |
84 | } | - |
85 | } executed: } Execution Count:50 | 50 |
86 | return -1; never executed: return -1; | 0 |
87 | } | - |
88 | | - |
89 | bool QStateMachinePrivate::stateEntryLessThan(QAbstractState *s1, QAbstractState *s2) | - |
90 | { | - |
91 | if (s1->parent() == s2->parent()) { evaluated: s1->parent() == s2->parent() yes Evaluation Count:10 | yes Evaluation Count:122 |
| 10-122 |
92 | return s1->parent()->children().indexOf(s1) | 10 |
93 | < s2->parent()->children().indexOf(s2); executed: return s1->parent()->children().indexOf(s1) < s2->parent()->children().indexOf(s2); Execution Count:10 | 10 |
94 | } else if (isDescendantOf(s1, s2)) { evaluated: isDescendantOf(s1, s2) yes Evaluation Count:54 | yes Evaluation Count:68 |
| 54-68 |
95 | return false; executed: return false; Execution Count:54 | 54 |
96 | } else if (isDescendantOf(s2, s1)) { evaluated: isDescendantOf(s2, s1) yes Evaluation Count:46 | yes Evaluation Count:22 |
| 22-46 |
97 | return true; executed: return true; Execution Count:46 | 46 |
98 | } else { | - |
99 | qt_noop(); | - |
100 | QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine()); | - |
101 | QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2); | - |
102 | qt_noop(); | - |
103 | return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2)); executed: return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2)); Execution Count:22 | 22 |
104 | } | - |
105 | } | - |
106 | | - |
107 | bool QStateMachinePrivate::stateExitLessThan(QAbstractState *s1, QAbstractState *s2) | - |
108 | { | - |
109 | if (s1->parent() == s2->parent()) { evaluated: s1->parent() == s2->parent() yes Evaluation Count:7 | yes Evaluation Count:82 |
| 7-82 |
110 | return s2->parent()->children().indexOf(s2) | 7 |
111 | < s1->parent()->children().indexOf(s1); executed: return s2->parent()->children().indexOf(s2) < s1->parent()->children().indexOf(s1); Execution Count:7 | 7 |
112 | } else if (isDescendantOf(s1, s2)) { evaluated: isDescendantOf(s1, s2) yes Evaluation Count:31 | yes Evaluation Count:51 |
| 31-51 |
113 | return true; executed: return true; Execution Count:31 | 31 |
114 | } else if (isDescendantOf(s2, s1)) { evaluated: isDescendantOf(s2, s1) yes Evaluation Count:37 | yes Evaluation Count:14 |
| 14-37 |
115 | return false; executed: return false; Execution Count:37 | 37 |
116 | } else { | - |
117 | qt_noop(); | - |
118 | QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine()); | - |
119 | QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2); | - |
120 | qt_noop(); | - |
121 | return (indexOfDescendant(lca, s2) < indexOfDescendant(lca, s1)); executed: return (indexOfDescendant(lca, s2) < indexOfDescendant(lca, s1)); Execution Count:14 | 14 |
122 | } | - |
123 | } | - |
124 | | - |
125 | QState *QStateMachinePrivate::findLCA(const QList<QAbstractState*> &states) const | - |
126 | { | - |
127 | if (states.isEmpty()) partially evaluated: states.isEmpty() no Evaluation Count:0 | yes Evaluation Count:2643 |
| 0-2643 |
128 | return 0; never executed: return 0; | 0 |
129 | QList<QState*> ancestors = properAncestors(states.at(0), rootState()->parentState()); | - |
130 | for (int i = 0; i < ancestors.size(); ++i) { evaluated: i < ancestors.size() yes Evaluation Count:2696 | yes Evaluation Count:6 |
| 6-2696 |
131 | QState *anc = ancestors.at(i); | - |
132 | bool ok = true; | - |
133 | for (int j = states.size() - 1; (j > 0) && ok; --j) { evaluated: (j > 0) yes Evaluation Count:2553 | yes Evaluation Count:2696 |
partially evaluated: ok yes Evaluation Count:2553 | no Evaluation Count:0 |
| 0-2696 |
134 | const QAbstractState *s = states.at(j); | - |
135 | if (!isDescendantOf(s, anc)) evaluated: !isDescendantOf(s, anc) yes Evaluation Count:59 | yes Evaluation Count:2494 |
| 59-2494 |
136 | ok = false; executed: ok = false; Execution Count:59 | 59 |
137 | } executed: } Execution Count:2553 | 2553 |
138 | if (ok) evaluated: ok yes Evaluation Count:2637 | yes Evaluation Count:59 |
| 59-2637 |
139 | return anc; executed: return anc; Execution Count:2637 | 2637 |
140 | } executed: } Execution Count:59 | 59 |
141 | return 0; executed: return 0; Execution Count:6 | 6 |
142 | } | - |
143 | | - |
144 | bool QStateMachinePrivate::isPreempted(const QAbstractState *s, const QSet<QAbstractTransition*> &transitions) const | - |
145 | { | - |
146 | QSet<QAbstractTransition*>::const_iterator it; | - |
147 | for (it = transitions.constBegin(); it != transitions.constEnd(); ++it) { evaluated: it != transitions.constEnd() yes Evaluation Count:9 | yes Evaluation Count:4745 |
| 9-4745 |
148 | QAbstractTransition *t = *it; | - |
149 | QList<QAbstractState*> lst = t->targetStates(); | - |
150 | if (!lst.isEmpty()) { partially evaluated: !lst.isEmpty() yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
151 | lst.prepend(t->sourceState()); | - |
152 | QAbstractState *lca = findLCA(lst); | - |
153 | if (isDescendantOf(s, lca)) { evaluated: isDescendantOf(s, lca) yes Evaluation Count:4 | yes Evaluation Count:5 |
| 4-5 |
154 | | - |
155 | | - |
156 | | - |
157 | | - |
158 | return true; executed: return true; Execution Count:4 | 4 |
159 | } | - |
160 | } executed: } Execution Count:5 | 5 |
161 | } executed: } Execution Count:5 | 5 |
162 | return false; executed: return false; Execution Count:4745 | 4745 |
163 | } | - |
164 | | - |
165 | QSet<QAbstractTransition*> QStateMachinePrivate::selectTransitions(QEvent *event) const | - |
166 | { | - |
167 | const QStateMachine * const q = q_func(); | - |
168 | QSet<QAbstractTransition*> enabledTransitions; | - |
169 | QSet<QAbstractState*>::const_iterator it; | - |
170 | const_cast<QStateMachine*>(q)->beginSelectTransitions(event); | - |
171 | for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) { evaluated: it != configuration.constEnd() yes Evaluation Count:5038 | yes Evaluation Count:4709 |
| 4709-5038 |
172 | QAbstractState *state = *it; | - |
173 | if (!isAtomic(state)) evaluated: !isAtomic(state) yes Evaluation Count:289 | yes Evaluation Count:4749 |
| 289-4749 |
174 | continue; executed: continue; Execution Count:289 | 289 |
175 | if (isPreempted(state, enabledTransitions)) evaluated: isPreempted(state, enabledTransitions) yes Evaluation Count:4 | yes Evaluation Count:4745 |
| 4-4745 |
176 | continue; executed: continue; Execution Count:4 | 4 |
177 | QList<QState*> lst = properAncestors(state, rootState()->parentState()); | - |
178 | if (QState *grp = toStandardState(state)) evaluated: QState *grp = toStandardState(state) yes Evaluation Count:4727 | yes Evaluation Count:18 |
| 18-4727 |
179 | lst.prepend(grp); executed: lst.prepend(grp); Execution Count:4727 | 4727 |
180 | bool found = false; | - |
181 | for (int j = 0; (j < lst.size()) && !found; ++j) { evaluated: (j < lst.size()) yes Evaluation Count:9738 | yes Evaluation Count:3520 |
evaluated: !found yes Evaluation Count:8513 | yes Evaluation Count:1225 |
| 1225-9738 |
182 | QState *s = lst.at(j); | - |
183 | QList<QAbstractTransition*> transitions = QStatePrivate::get(s)->transitions(); | - |
184 | for (int k = 0; k < transitions.size(); ++k) { evaluated: k < transitions.size() yes Evaluation Count:7881 | yes Evaluation Count:7288 |
| 7288-7881 |
185 | QAbstractTransition *t = transitions.at(k); | - |
186 | if (QAbstractTransitionPrivate::get(t)->callEventTest(event)) { evaluated: QAbstractTransitionPrivate::get(t)->callEventTest(event) yes Evaluation Count:1225 | yes Evaluation Count:6656 |
| 1225-6656 |
187 | | - |
188 | | - |
189 | | - |
190 | enabledTransitions.insert(t); | - |
191 | found = true; | - |
192 | break; executed: break; Execution Count:1225 | 1225 |
193 | } | - |
194 | } executed: } Execution Count:6656 | 6656 |
195 | } executed: } Execution Count:8513 | 8513 |
196 | } executed: } Execution Count:4745 | 4745 |
197 | const_cast<QStateMachine*>(q)->endSelectTransitions(event); | - |
198 | return enabledTransitions; executed: return enabledTransitions; Execution Count:4709 | 4709 |
199 | } | - |
200 | | - |
201 | void QStateMachinePrivate::microstep(QEvent *event, const QList<QAbstractTransition*> &enabledTransitions) | - |
202 | { | - |
203 | | - |
204 | | - |
205 | | - |
206 | | - |
207 | QList<QAbstractState*> exitedStates = computeStatesToExit(enabledTransitions); | - |
208 | QHash<RestorableId, QVariant> pendingRestorables = computePendingRestorables(exitedStates); | - |
209 | | - |
210 | QSet<QAbstractState*> statesForDefaultEntry; | - |
211 | QList<QAbstractState*> enteredStates = computeStatesToEnter(enabledTransitions, statesForDefaultEntry); | - |
212 | | - |
213 | QHash<QAbstractState*, QList<QPropertyAssignment> > assignmentsForEnteredStates = | - |
214 | computePropertyAssignments(enteredStates, pendingRestorables); | - |
215 | if (!pendingRestorables.isEmpty()) { evaluated: !pendingRestorables.isEmpty() yes Evaluation Count:23 | yes Evaluation Count:1201 |
| 23-1201 |
216 | | - |
217 | | - |
218 | qt_noop(); | - |
219 | QAbstractState *s = enteredStates.first(); | - |
220 | assignmentsForEnteredStates[s] << restorablesToPropertyList(pendingRestorables); | - |
221 | } executed: } Execution Count:23 | 23 |
222 | | - |
223 | exitStates(event, exitedStates, assignmentsForEnteredStates); | - |
224 | | - |
225 | | - |
226 | | - |
227 | | - |
228 | executeTransitionContent(event, enabledTransitions); | - |
229 | | - |
230 | | - |
231 | QList<QAbstractAnimation *> selectedAnimations = selectAnimations(enabledTransitions); | - |
232 | | - |
233 | | - |
234 | enterStates(event, exitedStates, enteredStates, statesForDefaultEntry, assignmentsForEnteredStates | - |
235 | | - |
236 | , selectedAnimations | - |
237 | | - |
238 | ); | - |
239 | | - |
240 | | - |
241 | | - |
242 | | - |
243 | } executed: } Execution Count:1224 | 1224 |
244 | | - |
245 | QList<QAbstractState*> QStateMachinePrivate::computeStatesToExit(const QList<QAbstractTransition*> &enabledTransitions) | - |
246 | { | - |
247 | QSet<QAbstractState*> statesToExit; | - |
248 | | - |
249 | for (int i = 0; i < enabledTransitions.size(); ++i) { evaluated: i < enabledTransitions.size() yes Evaluation Count:1225 | yes Evaluation Count:1224 |
| 1224-1225 |
250 | QAbstractTransition *t = enabledTransitions.at(i); | - |
251 | QList<QAbstractState*> lst = t->targetStates(); | - |
252 | if (lst.isEmpty()) evaluated: lst.isEmpty() yes Evaluation Count:4 | yes Evaluation Count:1221 |
| 4-1221 |
253 | continue; executed: continue; Execution Count:4 | 4 |
254 | lst.prepend(t->sourceState()); | - |
255 | QAbstractState *lca = findLCA(lst); | - |
256 | if (lca == 0) { evaluated: lca == 0 yes Evaluation Count:3 | yes Evaluation Count:1218 |
| 3-1218 |
257 | setError(QStateMachine::NoCommonAncestorForTransitionError, t->sourceState()); | - |
258 | lst = pendingErrorStates.toList(); | - |
259 | lst.prepend(t->sourceState()); | - |
260 | | - |
261 | lca = findLCA(lst); | - |
262 | qt_noop(); | - |
263 | } executed: } Execution Count:3 | 3 |
264 | | - |
265 | { | - |
266 | QSet<QAbstractState*>::const_iterator it; | - |
267 | for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) { evaluated: it != configuration.constEnd() yes Evaluation Count:1335 | yes Evaluation Count:1221 |
| 1221-1335 |
268 | QAbstractState *s = *it; | - |
269 | if (isDescendantOf(s, lca)) evaluated: isDescendantOf(s, lca) yes Evaluation Count:1271 | yes Evaluation Count:64 |
| 64-1271 |
270 | statesToExit.insert(s); executed: statesToExit.insert(s); Execution Count:1271 | 1271 |
271 | } executed: } Execution Count:1335 | 1335 |
272 | } | - |
273 | } executed: } Execution Count:1221 | 1221 |
274 | QList<QAbstractState*> statesToExit_sorted = statesToExit.toList(); | - |
275 | qSort(statesToExit_sorted.begin(), statesToExit_sorted.end(), stateExitLessThan); | - |
276 | return statesToExit_sorted; executed: return statesToExit_sorted; Execution Count:1224 | 1224 |
277 | } | - |
278 | | - |
279 | void QStateMachinePrivate::exitStates(QEvent *event, const QList<QAbstractState*> &statesToExit_sorted, | - |
280 | const QHash<QAbstractState*, QList<QPropertyAssignment> > &assignmentsForEnteredStates) | - |
281 | { | - |
282 | for (int i = 0; i < statesToExit_sorted.size(); ++i) { evaluated: i < statesToExit_sorted.size() yes Evaluation Count:1271 | yes Evaluation Count:1224 |
| 1224-1271 |
283 | QAbstractState *s = statesToExit_sorted.at(i); | - |
284 | if (QState *grp = toStandardState(s)) { evaluated: QState *grp = toStandardState(s) yes Evaluation Count:1265 | yes Evaluation Count:6 |
| 6-1265 |
285 | QList<QHistoryState*> hlst = QStatePrivate::get(grp)->historyStates(); | - |
286 | for (int j = 0; j < hlst.size(); ++j) { evaluated: j < hlst.size() yes Evaluation Count:8 | yes Evaluation Count:1265 |
| 8-1265 |
287 | QHistoryState *h = hlst.at(j); | - |
288 | QHistoryStatePrivate::get(h)->configuration.clear(); | - |
289 | QSet<QAbstractState*>::const_iterator it; | - |
290 | for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) { evaluated: it != configuration.constEnd() yes Evaluation Count:16 | yes Evaluation Count:8 |
| 8-16 |
291 | QAbstractState *s0 = *it; | - |
292 | if (QHistoryStatePrivate::get(h)->historyType == QHistoryState::DeepHistory) { partially evaluated: QHistoryStatePrivate::get(h)->historyType == QHistoryState::DeepHistory no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
293 | if (isAtomic(s0) && isDescendantOf(s0, s)) never evaluated: isAtomic(s0) never evaluated: isDescendantOf(s0, s) | 0 |
294 | QHistoryStatePrivate::get(h)->configuration.append(s0); never executed: QHistoryStatePrivate::get(h)->configuration.append(s0); | 0 |
295 | } else if (s0->parentState() == s) { evaluated: s0->parentState() == s yes Evaluation Count:8 | yes Evaluation Count:8 |
| 0-8 |
296 | QHistoryStatePrivate::get(h)->configuration.append(s0); | - |
297 | } executed: } Execution Count:8 | 8 |
298 | } | - |
299 | | - |
300 | | - |
301 | | - |
302 | | - |
303 | } executed: } Execution Count:8 | 8 |
304 | } executed: } Execution Count:1265 | 1265 |
305 | } executed: } Execution Count:1271 | 1271 |
306 | for (int i = 0; i < statesToExit_sorted.size(); ++i) { evaluated: i < statesToExit_sorted.size() yes Evaluation Count:1271 | yes Evaluation Count:1224 |
| 1224-1271 |
307 | QAbstractState *s = statesToExit_sorted.at(i); | - |
308 | | - |
309 | | - |
310 | | - |
311 | QAbstractStatePrivate::get(s)->callOnExit(event); | - |
312 | | - |
313 | | - |
314 | terminateActiveAnimations(s, assignmentsForEnteredStates); | - |
315 | | - |
316 | | - |
317 | | - |
318 | | - |
319 | configuration.remove(s); | - |
320 | QAbstractStatePrivate::get(s)->emitExited(); | - |
321 | } executed: } Execution Count:1271 | 1271 |
322 | } executed: } Execution Count:1224 | 1224 |
323 | | - |
324 | void QStateMachinePrivate::executeTransitionContent(QEvent *event, const QList<QAbstractTransition*> &enabledTransitions) | - |
325 | { | - |
326 | for (int i = 0; i < enabledTransitions.size(); ++i) { evaluated: i < enabledTransitions.size() yes Evaluation Count:1368 | yes Evaluation Count:1367 |
| 1367-1368 |
327 | QAbstractTransition *t = enabledTransitions.at(i); | - |
328 | | - |
329 | | - |
330 | | - |
331 | QAbstractTransitionPrivate::get(t)->callOnTransition(event); | - |
332 | QAbstractTransitionPrivate::get(t)->emitTriggered(); | - |
333 | } executed: } Execution Count:1368 | 1368 |
334 | } executed: } Execution Count:1367 | 1367 |
335 | | - |
336 | QList<QAbstractState*> QStateMachinePrivate::computeStatesToEnter(const QList<QAbstractTransition *> &enabledTransitions, | - |
337 | QSet<QAbstractState *> &statesForDefaultEntry) | - |
338 | { | - |
339 | QSet<QAbstractState*> statesToEnter; | - |
340 | if (pendingErrorStates.isEmpty()) { partially evaluated: pendingErrorStates.isEmpty() yes Evaluation Count:1367 | no Evaluation Count:0 |
| 0-1367 |
341 | for (int i = 0; i < enabledTransitions.size(); ++i) { evaluated: i < enabledTransitions.size() yes Evaluation Count:1368 | yes Evaluation Count:1367 |
| 1367-1368 |
342 | QAbstractTransition *t = enabledTransitions.at(i); | - |
343 | QList<QAbstractState*> lst = t->targetStates(); | - |
344 | if (lst.isEmpty()) evaluated: lst.isEmpty() yes Evaluation Count:4 | yes Evaluation Count:1364 |
| 4-1364 |
345 | continue; executed: continue; Execution Count:4 | 4 |
346 | QAbstractState *src = t->sourceState(); | - |
347 | if (src) evaluated: src yes Evaluation Count:1221 | yes Evaluation Count:143 |
| 143-1221 |
348 | lst.prepend(src); executed: lst.prepend(src); Execution Count:1221 | 1221 |
349 | QState *lca = findLCA(lst); | - |
350 | for (int j = src ? 1 : 0; j < lst.size(); ++j) { evaluated: j < lst.size() yes Evaluation Count:1366 | yes Evaluation Count:1364 |
| 1364-1366 |
351 | QAbstractState *s = lst.at(j); | - |
352 | addStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry); | - |
353 | } executed: } Execution Count:1366 | 1366 |
354 | for (int j = src ? 1 : 0; j < lst.size(); ++j) { evaluated: j < lst.size() yes Evaluation Count:1366 | yes Evaluation Count:1364 |
| 1364-1366 |
355 | QAbstractState *s = lst.at(j); | - |
356 | addAncestorStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry); | - |
357 | } executed: } Execution Count:1366 | 1366 |
358 | if (isParallel(lca)) { evaluated: isParallel(lca) yes Evaluation Count:2 | yes Evaluation Count:1362 |
| 2-1362 |
359 | QList<QAbstractState*> lcac = QStatePrivate::get(lca)->childStates(); | - |
360 | for (QForeachContainer<__typeof__(lcac)> _container_(lcac); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QAbstractState* child = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
361 | if (!statesToEnter.contains(child)) evaluated: !statesToEnter.contains(child) yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
362 | addStatesToEnter(child,lca,statesToEnter,statesForDefaultEntry); executed: addStatesToEnter(child,lca,statesToEnter,statesForDefaultEntry); Execution Count:1 | 1 |
363 | } executed: } Execution Count:4 | 4 |
364 | } executed: } Execution Count:2 | 2 |
365 | } executed: } Execution Count:1364 | 1364 |
366 | } executed: } Execution Count:1367 | 1367 |
367 | | - |
368 | | - |
369 | if (!pendingErrorStates.isEmpty()) { evaluated: !pendingErrorStates.isEmpty() yes Evaluation Count:9 | yes Evaluation Count:1358 |
| 9-1358 |
370 | statesToEnter.clear(); | - |
371 | statesToEnter = pendingErrorStates; | - |
372 | statesForDefaultEntry = pendingErrorStatesForDefaultEntry; | - |
373 | pendingErrorStates.clear(); | - |
374 | pendingErrorStatesForDefaultEntry.clear(); | - |
375 | } executed: } Execution Count:9 | 9 |
376 | | - |
377 | QList<QAbstractState*> statesToEnter_sorted = statesToEnter.toList(); | - |
378 | qSort(statesToEnter_sorted.begin(), statesToEnter_sorted.end(), stateEntryLessThan); | - |
379 | return statesToEnter_sorted; executed: return statesToEnter_sorted; Execution Count:1367 | 1367 |
380 | } | - |
381 | | - |
382 | void QStateMachinePrivate::enterStates(QEvent *event, const QList<QAbstractState*> &exitedStates_sorted, | - |
383 | const QList<QAbstractState*> &statesToEnter_sorted, | - |
384 | const QSet<QAbstractState*> &statesForDefaultEntry, | - |
385 | QHash<QAbstractState*, QList<QPropertyAssignment> > &propertyAssignmentsForState | - |
386 | | - |
387 | , const QList<QAbstractAnimation *> &selectedAnimations | - |
388 | | - |
389 | ) | - |
390 | { | - |
391 | | - |
392 | | - |
393 | | - |
394 | for (int i = 0; i < statesToEnter_sorted.size(); ++i) { evaluated: i < statesToEnter_sorted.size() yes Evaluation Count:1442 | yes Evaluation Count:1367 |
| 1367-1442 |
395 | QAbstractState *s = statesToEnter_sorted.at(i); | - |
396 | | - |
397 | | - |
398 | | - |
399 | configuration.insert(s); | - |
400 | registerTransitions(s); | - |
401 | | - |
402 | | - |
403 | initializeAnimations(s, selectedAnimations, exitedStates_sorted, propertyAssignmentsForState); | - |
404 | | - |
405 | | - |
406 | | - |
407 | { | - |
408 | QList<QPropertyAssignment> assignments = propertyAssignmentsForState.value(s); | - |
409 | for (int i = 0; i < assignments.size(); ++i) { evaluated: i < assignments.size() yes Evaluation Count:97 | yes Evaluation Count:1442 |
| 97-1442 |
410 | const QPropertyAssignment &assn = assignments.at(i); | - |
411 | if (globalRestorePolicy == QState::RestoreProperties) { evaluated: globalRestorePolicy == QState::RestoreProperties yes Evaluation Count:54 | yes Evaluation Count:43 |
| 43-54 |
412 | if (assn.explicitlySet) { evaluated: assn.explicitlySet yes Evaluation Count:36 | yes Evaluation Count:18 |
| 18-36 |
413 | if (!hasRestorable(s, assn.object, assn.propertyName)) { evaluated: !hasRestorable(s, assn.object, assn.propertyName) yes Evaluation Count:34 | yes Evaluation Count:2 |
| 2-34 |
414 | QVariant value = savedValueForRestorable(exitedStates_sorted, assn.object, assn.propertyName); | - |
415 | unregisterRestorables(exitedStates_sorted, assn.object, assn.propertyName); | - |
416 | registerRestorable(s, assn.object, assn.propertyName, value); | - |
417 | } executed: } Execution Count:34 | 34 |
418 | } else { executed: } Execution Count:36 | 36 |
419 | | - |
420 | | - |
421 | | - |
422 | unregisterRestorables(exitedStates_sorted, assn.object, assn.propertyName); | - |
423 | } executed: } Execution Count:18 | 18 |
424 | } | - |
425 | assn.write(); | - |
426 | } executed: } Execution Count:97 | 97 |
427 | } | - |
428 | | - |
429 | QAbstractStatePrivate::get(s)->callOnEntry(event); | - |
430 | QAbstractStatePrivate::get(s)->emitEntered(); | - |
431 | if (statesForDefaultEntry.contains(s)) { evaluated: statesForDefaultEntry.contains(s) yes Evaluation Count:45 | yes Evaluation Count:1397 |
| 45-1397 |
432 | | - |
433 | } executed: } Execution Count:45 | 45 |
434 | | - |
435 | | - |
436 | { | - |
437 | QState *ss = toStandardState(s); | - |
438 | if (ss evaluated: ss yes Evaluation Count:1372 | yes Evaluation Count:70 |
| 70-1372 |
439 | | - |
440 | && !animationsForState.contains(s) evaluated: !animationsForState.contains(s) yes Evaluation Count:1340 | yes Evaluation Count:32 |
| 32-1340 |
441 | | - |
442 | ) | - |
443 | QStatePrivate::get(ss)->emitPropertiesAssigned(); executed: QStatePrivate::get(ss)->emitPropertiesAssigned(); Execution Count:1340 | 1340 |
444 | } | - |
445 | | - |
446 | if (isFinal(s)) { evaluated: isFinal(s) yes Evaluation Count:70 | yes Evaluation Count:1372 |
| 70-1372 |
447 | QState *parent = s->parentState(); | - |
448 | if (parent) { partially evaluated: parent yes Evaluation Count:70 | no Evaluation Count:0 |
| 0-70 |
449 | if (parent != rootState()) { evaluated: parent != rootState() yes Evaluation Count:8 | yes Evaluation Count:62 |
| 8-62 |
450 | | - |
451 | | - |
452 | | - |
453 | QStatePrivate::get(parent)->emitFinished(); | - |
454 | } executed: } Execution Count:8 | 8 |
455 | QState *grandparent = parent->parentState(); | - |
456 | if (grandparent && isParallel(grandparent)) { evaluated: grandparent yes Evaluation Count:11 | yes Evaluation Count:59 |
evaluated: isParallel(grandparent) yes Evaluation Count:7 | yes Evaluation Count:4 |
| 4-59 |
457 | bool allChildStatesFinal = true; | - |
458 | QList<QAbstractState*> childStates = QStatePrivate::get(grandparent)->childStates(); | - |
459 | for (int j = 0; j < childStates.size(); ++j) { evaluated: j < childStates.size() yes Evaluation Count:16 | yes Evaluation Count:3 |
| 3-16 |
460 | QAbstractState *cs = childStates.at(j); | - |
461 | if (!isInFinalState(cs)) { evaluated: !isInFinalState(cs) yes Evaluation Count:4 | yes Evaluation Count:12 |
| 4-12 |
462 | allChildStatesFinal = false; | - |
463 | break; executed: break; Execution Count:4 | 4 |
464 | } | - |
465 | } executed: } Execution Count:12 | 12 |
466 | if (allChildStatesFinal && (grandparent != rootState())) { evaluated: allChildStatesFinal yes Evaluation Count:3 | yes Evaluation Count:4 |
evaluated: (grandparent != rootState()) yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-4 |
467 | | - |
468 | | - |
469 | | - |
470 | QStatePrivate::get(grandparent)->emitFinished(); | - |
471 | } executed: } Execution Count:2 | 2 |
472 | } executed: } Execution Count:7 | 7 |
473 | } executed: } Execution Count:70 | 70 |
474 | } executed: } Execution Count:70 | 70 |
475 | } executed: } Execution Count:1442 | 1442 |
476 | { | - |
477 | QSet<QAbstractState*>::const_iterator it; | - |
478 | for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) { evaluated: it != configuration.constEnd() yes Evaluation Count:1502 | yes Evaluation Count:1304 |
| 1304-1502 |
479 | if (isFinal(*it)) { evaluated: isFinal(*it) yes Evaluation Count:72 | yes Evaluation Count:1430 |
| 72-1430 |
480 | QState *parent = (*it)->parentState(); | - |
481 | if (((parent == rootState()) evaluated: (parent == rootState()) yes Evaluation Count:62 | yes Evaluation Count:10 |
| 10-62 |
482 | && (rootState()->childMode() == QState::ExclusiveStates)) partially evaluated: (rootState()->childMode() == QState::ExclusiveStates) yes Evaluation Count:62 | no Evaluation Count:0 |
| 0-62 |
483 | || ((parent->parentState() == rootState()) evaluated: (parent->parentState() == rootState()) yes Evaluation Count:2 | yes Evaluation Count:8 |
| 2-8 |
484 | && (rootState()->childMode() == QState::ParallelStates) evaluated: (rootState()->childMode() == QState::ParallelStates) yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
485 | && isInFinalState(rootState()))) { partially evaluated: isInFinalState(rootState()) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
486 | processing = false; | - |
487 | stopProcessingReason = Finished; | - |
488 | break; executed: break; Execution Count:63 | 63 |
489 | } | - |
490 | } executed: } Execution Count:9 | 9 |
491 | } executed: } Execution Count:1439 | 1439 |
492 | } | - |
493 | | - |
494 | } executed: } Execution Count:1367 | 1367 |
495 | | - |
496 | void QStateMachinePrivate::addStatesToEnter(QAbstractState *s, QState *root, | - |
497 | QSet<QAbstractState*> &statesToEnter, | - |
498 | QSet<QAbstractState*> &statesForDefaultEntry) | - |
499 | { | - |
500 | if (QHistoryState *h = toHistoryState(s)) { evaluated: QHistoryState *h = toHistoryState(s) yes Evaluation Count:12 | yes Evaluation Count:1425 |
| 12-1425 |
501 | QList<QAbstractState*> hconf = QHistoryStatePrivate::get(h)->configuration; | - |
502 | if (!hconf.isEmpty()) { evaluated: !hconf.isEmpty() yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
503 | for (int k = 0; k < hconf.size(); ++k) { evaluated: k < hconf.size() yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
504 | QAbstractState *s0 = hconf.at(k); | - |
505 | addStatesToEnter(s0, root, statesToEnter, statesForDefaultEntry); | - |
506 | } executed: } Execution Count:6 | 6 |
507 | | - |
508 | | - |
509 | | - |
510 | | - |
511 | | - |
512 | } else { executed: } Execution Count:6 | 6 |
513 | QList<QAbstractState*> hlst; | - |
514 | if (QHistoryStatePrivate::get(h)->defaultState) evaluated: QHistoryStatePrivate::get(h)->defaultState yes Evaluation Count:5 | yes Evaluation Count:1 |
| 1-5 |
515 | hlst.append(QHistoryStatePrivate::get(h)->defaultState); executed: hlst.append(QHistoryStatePrivate::get(h)->defaultState); Execution Count:5 | 5 |
516 | | - |
517 | if (hlst.isEmpty()) { evaluated: hlst.isEmpty() yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
518 | setError(QStateMachine::NoDefaultStateInHistoryStateError, h); | - |
519 | } else { executed: } Execution Count:1 | 1 |
520 | for (int k = 0; k < hlst.size(); ++k) { evaluated: k < hlst.size() yes Evaluation Count:5 | yes Evaluation Count:5 |
| 5 |
521 | QAbstractState *s0 = hlst.at(k); | - |
522 | addStatesToEnter(s0, root, statesToEnter, statesForDefaultEntry); | - |
523 | } executed: } Execution Count:5 | 5 |
524 | | - |
525 | | - |
526 | | - |
527 | } executed: } Execution Count:5 | 5 |
528 | } | - |
529 | } else { | - |
530 | if (s == rootState()) { evaluated: s == rootState() yes Evaluation Count:1 | yes Evaluation Count:1424 |
| 1-1424 |
531 | | - |
532 | qt_noop(); | - |
533 | return; executed: return; Execution Count:1 | 1 |
534 | } | - |
535 | statesToEnter.insert(s); | - |
536 | if (isParallel(s)) { evaluated: isParallel(s) yes Evaluation Count:6 | yes Evaluation Count:1418 |
| 6-1418 |
537 | QState *grp = toStandardState(s); | - |
538 | QList<QAbstractState*> lst = QStatePrivate::get(grp)->childStates(); | - |
539 | for (int i = 0; i < lst.size(); ++i) { evaluated: i < lst.size() yes Evaluation Count:11 | yes Evaluation Count:6 |
| 6-11 |
540 | QAbstractState *child = lst.at(i); | - |
541 | addStatesToEnter(child, grp, statesToEnter, statesForDefaultEntry); | - |
542 | } executed: } Execution Count:11 | 11 |
543 | } else if (isCompound(s)) { evaluated: isCompound(s) yes Evaluation Count:54 | yes Evaluation Count:1364 |
executed: } Execution Count:6 | 6-1364 |
544 | statesForDefaultEntry.insert(s); | - |
545 | QState *grp = toStandardState(s); | - |
546 | QAbstractState *initial = grp->initialState(); | - |
547 | if (initial != 0) { evaluated: initial != 0 yes Evaluation Count:38 | yes Evaluation Count:16 |
| 16-38 |
548 | qt_noop(); | - |
549 | addStatesToEnter(initial, grp, statesToEnter, statesForDefaultEntry); | - |
550 | } else { executed: } Execution Count:38 | 38 |
551 | setError(QStateMachine::NoInitialStateError, grp); | - |
552 | return; executed: return; Execution Count:16 | 16 |
553 | } | - |
554 | } | - |
555 | } | - |
556 | } | - |
557 | | - |
558 | void QStateMachinePrivate::addAncestorStatesToEnter(QAbstractState *s, QState *root, | - |
559 | QSet<QAbstractState*> &statesToEnter, | - |
560 | QSet<QAbstractState*> &statesForDefaultEntry) | - |
561 | { | - |
562 | QList<QState*> ancs = properAncestors(s, root); | - |
563 | for (int i = 0; i < ancs.size(); ++i) { evaluated: i < ancs.size() yes Evaluation Count:31 | yes Evaluation Count:1376 |
| 31-1376 |
564 | QState *anc = ancs.at(i); | - |
565 | if (!anc->parentState()) partially evaluated: !anc->parentState() no Evaluation Count:0 | yes Evaluation Count:31 |
| 0-31 |
566 | continue; never executed: continue; | 0 |
567 | statesToEnter.insert(anc); | - |
568 | if (isParallel(anc)) { evaluated: isParallel(anc) yes Evaluation Count:2 | yes Evaluation Count:29 |
| 2-29 |
569 | QList<QAbstractState*> lst = QStatePrivate::get(anc)->childStates(); | - |
570 | for (int j = 0; j < lst.size(); ++j) { evaluated: j < lst.size() yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
571 | QAbstractState *child = lst.at(j); | - |
572 | bool hasDescendantInList = false; | - |
573 | QSet<QAbstractState*>::const_iterator it; | - |
574 | for (it = statesToEnter.constBegin(); it != statesToEnter.constEnd(); ++it) { partially evaluated: it != statesToEnter.constEnd() yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
575 | if (isDescendantOf(*it, child)) { evaluated: isDescendantOf(*it, child) yes Evaluation Count:4 | yes Evaluation Count:10 |
| 4-10 |
576 | hasDescendantInList = true; | - |
577 | break; executed: break; Execution Count:4 | 4 |
578 | } | - |
579 | } executed: } Execution Count:10 | 10 |
580 | if (!hasDescendantInList) partially evaluated: !hasDescendantInList no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
581 | addStatesToEnter(child, anc, statesToEnter, statesForDefaultEntry); never executed: addStatesToEnter(child, anc, statesToEnter, statesForDefaultEntry); | 0 |
582 | } executed: } Execution Count:4 | 4 |
583 | } executed: } Execution Count:2 | 2 |
584 | } executed: } Execution Count:31 | 31 |
585 | } executed: } Execution Count:1376 | 1376 |
586 | | - |
587 | bool QStateMachinePrivate::isFinal(const QAbstractState *s) | - |
588 | { | - |
589 | return s && (QAbstractStatePrivate::get(s)->stateType == QAbstractStatePrivate::FinalState); executed: return s && (QAbstractStatePrivate::get(s)->stateType == QAbstractStatePrivate::FinalState); Execution Count:3302 | 3302 |
590 | } | - |
591 | | - |
592 | bool QStateMachinePrivate::isParallel(const QAbstractState *s) | - |
593 | { | - |
594 | const QState *ss = toStandardState(s); | - |
595 | return ss && (QStatePrivate::get(ss)->childMode == QState::ParallelStates); executed: return ss && (QStatePrivate::get(ss)->childMode == QState::ParallelStates); Execution Count:4195 | 4195 |
596 | } | - |
597 | | - |
598 | bool QStateMachinePrivate::isCompound(const QAbstractState *s) const | - |
599 | { | - |
600 | const QState *group = toStandardState(s); | - |
601 | if (!group) evaluated: !group yes Evaluation Count:70 | yes Evaluation Count:1367 |
| 70-1367 |
602 | return false; executed: return false; Execution Count:70 | 70 |
603 | bool isMachine = QStatePrivate::get(group)->isMachine; | - |
604 | | - |
605 | if (isMachine && (group != rootState())) evaluated: isMachine yes Evaluation Count:4 | yes Evaluation Count:1363 |
evaluated: (group != rootState()) yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-1363 |
606 | return false; executed: return false; Execution Count:3 | 3 |
607 | return (!isParallel(group) && !QStatePrivate::get(group)->childStates().isEmpty()); executed: return (!isParallel(group) && !QStatePrivate::get(group)->childStates().isEmpty()); Execution Count:1364 | 1364 |
608 | } | - |
609 | | - |
610 | bool QStateMachinePrivate::isAtomic(const QAbstractState *s) const | - |
611 | { | - |
612 | const QState *ss = toStandardState(s); | - |
613 | return (ss && QStatePrivate::get(ss)->childStates().isEmpty()) | 5038 |
614 | || isFinal(s) | 5038 |
615 | | 5038 |
616 | || (ss && QStatePrivate::get(ss)->isMachine && (ss != rootState())); executed: return (ss && QStatePrivate::get(ss)->childStates().isEmpty()) || isFinal(s) || (ss && QStatePrivate::get(ss)->isMachine && (ss != rootState())); Execution Count:5038 | 5038 |
617 | } | - |
618 | | - |
619 | | - |
620 | bool QStateMachinePrivate::isDescendantOf(const QAbstractState *state, const QAbstractState *other) | - |
621 | { | - |
622 | qt_noop(); | - |
623 | for (QAbstractState *s = state->parentState(); s != 0; s = s->parentState()) { evaluated: s != 0 yes Evaluation Count:4830 | yes Evaluation Count:343 |
| 343-4830 |
624 | if (s == other) evaluated: s == other yes Evaluation Count:3990 | yes Evaluation Count:840 |
| 840-3990 |
625 | return true; executed: return true; Execution Count:3990 | 3990 |
626 | } executed: } Execution Count:840 | 840 |
627 | return false; executed: return false; Execution Count:343 | 343 |
628 | } | - |
629 | | - |
630 | QList<QState*> QStateMachinePrivate::properAncestors(const QAbstractState *state, const QState *upperBound) | - |
631 | { | - |
632 | qt_noop(); | - |
633 | QList<QState*> result; | - |
634 | for (QState *s = state->parentState(); s && s != upperBound; s = s->parentState()) { evaluated: s yes Evaluation Count:9316 | yes Evaluation Count:7373 |
evaluated: s != upperBound yes Evaluation Count:7925 | yes Evaluation Count:1391 |
| 1391-9316 |
635 | result.append(s); | - |
636 | } executed: } Execution Count:7925 | 7925 |
637 | return result; executed: return result; Execution Count:8764 | 8764 |
638 | } | - |
639 | | - |
640 | QState *QStateMachinePrivate::toStandardState(QAbstractState *state) | - |
641 | { | - |
642 | if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState)) partially evaluated: state yes Evaluation Count:10478 | no Evaluation Count:0 |
evaluated: (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState) yes Evaluation Count:10243 | yes Evaluation Count:235 |
| 0-10478 |
643 | return static_cast<QState*>(state); executed: return static_cast<QState*>(state); Execution Count:10243 | 10243 |
644 | return 0; executed: return 0; Execution Count:235 | 235 |
645 | } | - |
646 | | - |
647 | const QState *QStateMachinePrivate::toStandardState(const QAbstractState *state) | - |
648 | { | - |
649 | if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState)) evaluated: state yes Evaluation Count:10667 | yes Evaluation Count:3 |
evaluated: (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState) yes Evaluation Count:10506 | yes Evaluation Count:161 |
| 3-10667 |
650 | return static_cast<const QState*>(state); executed: return static_cast<const QState*>(state); Execution Count:10506 | 10506 |
651 | return 0; executed: return 0; Execution Count:164 | 164 |
652 | } | - |
653 | | - |
654 | QFinalState *QStateMachinePrivate::toFinalState(QAbstractState *state) | - |
655 | { | - |
656 | if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::FinalState)) never evaluated: (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::FinalState) | 0 |
657 | return static_cast<QFinalState*>(state); never executed: return static_cast<QFinalState*>(state); | 0 |
658 | return 0; never executed: return 0; | 0 |
659 | } | - |
660 | | - |
661 | QHistoryState *QStateMachinePrivate::toHistoryState(QAbstractState *state) | - |
662 | { | - |
663 | if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::HistoryState)) partially evaluated: state yes Evaluation Count:1437 | no Evaluation Count:0 |
evaluated: (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::HistoryState) yes Evaluation Count:12 | yes Evaluation Count:1425 |
| 0-1437 |
664 | return static_cast<QHistoryState*>(state); executed: return static_cast<QHistoryState*>(state); Execution Count:12 | 12 |
665 | return 0; executed: return 0; Execution Count:1425 | 1425 |
666 | } | - |
667 | | - |
668 | bool QStateMachinePrivate::isInFinalState(QAbstractState* s) const | - |
669 | { | - |
670 | if (isCompound(s)) { evaluated: isCompound(s) yes Evaluation Count:18 | yes Evaluation Count:1 |
| 1-18 |
671 | QState *grp = toStandardState(s); | - |
672 | QList<QAbstractState*> lst = QStatePrivate::get(grp)->childStates(); | - |
673 | for (int i = 0; i < lst.size(); ++i) { evaluated: i < lst.size() yes Evaluation Count:30 | yes Evaluation Count:4 |
| 4-30 |
674 | QAbstractState *cs = lst.at(i); | - |
675 | if (isFinal(cs) && configuration.contains(cs)) evaluated: isFinal(cs) yes Evaluation Count:18 | yes Evaluation Count:12 |
evaluated: configuration.contains(cs) yes Evaluation Count:14 | yes Evaluation Count:4 |
| 4-18 |
676 | return true; executed: return true; Execution Count:14 | 14 |
677 | } executed: } Execution Count:16 | 16 |
678 | return false; executed: return false; Execution Count:4 | 4 |
679 | } else if (isParallel(s)) { partially evaluated: isParallel(s) yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
680 | QState *grp = toStandardState(s); | - |
681 | QList<QAbstractState*> lst = QStatePrivate::get(grp)->childStates(); | - |
682 | for (int i = 0; i < lst.size(); ++i) { evaluated: i < lst.size() yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
683 | QAbstractState *cs = lst.at(i); | - |
684 | if (!isInFinalState(cs)) partially evaluated: !isInFinalState(cs) no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
685 | return false; never executed: return false; | 0 |
686 | } executed: } Execution Count:2 | 2 |
687 | return true; executed: return true; Execution Count:1 | 1 |
688 | } | - |
689 | else | - |
690 | return false; never executed: return false; | 0 |
691 | } | - |
692 | bool QStateMachinePrivate::hasRestorable(QAbstractState *state, QObject *object, | - |
693 | const QByteArray &propertyName) const | - |
694 | { | - |
695 | RestorableId id(object, propertyName); | - |
696 | return registeredRestorablesForState.value(state).contains(id); executed: return registeredRestorablesForState.value(state).contains(id); Execution Count:48 | 48 |
697 | } | - |
698 | QVariant QStateMachinePrivate::savedValueForRestorable(const QList<QAbstractState*> &exitedStates_sorted, | - |
699 | QObject *object, const QByteArray &propertyName) const | - |
700 | { | - |
701 | | - |
702 | | - |
703 | | - |
704 | RestorableId id(object, propertyName); | - |
705 | for (int i = exitedStates_sorted.size() - 1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:38 | yes Evaluation Count:29 |
| 29-38 |
706 | QAbstractState *s = exitedStates_sorted.at(i); | - |
707 | QHash<RestorableId, QVariant> restorables = registeredRestorablesForState.value(s); | - |
708 | QHash<RestorableId, QVariant>::const_iterator it = restorables.constFind(id); | - |
709 | if (it != restorables.constEnd()) { evaluated: it != restorables.constEnd() yes Evaluation Count:17 | yes Evaluation Count:21 |
| 17-21 |
710 | | - |
711 | | - |
712 | | - |
713 | return it.value(); executed: return it.value(); Execution Count:17 | 17 |
714 | } | - |
715 | } executed: } Execution Count:21 | 21 |
716 | | - |
717 | | - |
718 | | - |
719 | return id.first->property(id.second); executed: return id.first->property(id.second); Execution Count:29 | 29 |
720 | } | - |
721 | | - |
722 | void QStateMachinePrivate::registerRestorable(QAbstractState *state, QObject *object, const QByteArray &propertyName, | - |
723 | const QVariant &value) | - |
724 | { | - |
725 | | - |
726 | | - |
727 | | - |
728 | RestorableId id(object, propertyName); | - |
729 | QHash<RestorableId, QVariant> &restorables = registeredRestorablesForState[state]; | - |
730 | if (!restorables.contains(id)) partially evaluated: !restorables.contains(id) yes Evaluation Count:46 | no Evaluation Count:0 |
| 0-46 |
731 | restorables.insert(id, value); executed: restorables.insert(id, value); Execution Count:46 | 46 |
732 | | - |
733 | | - |
734 | | - |
735 | | - |
736 | } executed: } Execution Count:46 | 46 |
737 | | - |
738 | void QStateMachinePrivate::unregisterRestorables(const QList<QAbstractState *> &states, QObject *object, | - |
739 | const QByteArray &propertyName) | - |
740 | { | - |
741 | | - |
742 | | - |
743 | | - |
744 | RestorableId id(object, propertyName); | - |
745 | for (int i = 0; i < states.size(); ++i) { evaluated: i < states.size() yes Evaluation Count:70 | yes Evaluation Count:65 |
| 65-70 |
746 | QAbstractState *s = states.at(i); | - |
747 | QHash<QAbstractState*, QHash<RestorableId, QVariant> >::iterator it; | - |
748 | it = registeredRestorablesForState.find(s); | - |
749 | if (it == registeredRestorablesForState.end()) evaluated: it == registeredRestorablesForState.end() yes Evaluation Count:24 | yes Evaluation Count:46 |
| 24-46 |
750 | continue; executed: continue; Execution Count:24 | 24 |
751 | QHash<RestorableId, QVariant> &restorables = it.value(); | - |
752 | QHash<RestorableId, QVariant>::iterator it2; | - |
753 | it2 = restorables.find(id); | - |
754 | if (it2 == restorables.end()) evaluated: it2 == restorables.end() yes Evaluation Count:9 | yes Evaluation Count:37 |
| 9-37 |
755 | continue; executed: continue; Execution Count:9 | 9 |
756 | | - |
757 | | - |
758 | | - |
759 | restorables.erase(it2); | - |
760 | if (restorables.isEmpty()) evaluated: restorables.isEmpty() yes Evaluation Count:32 | yes Evaluation Count:5 |
| 5-32 |
761 | registeredRestorablesForState.erase(it); executed: registeredRestorablesForState.erase(it); Execution Count:32 | 32 |
762 | } executed: } Execution Count:37 | 37 |
763 | } executed: } Execution Count:65 | 65 |
764 | | - |
765 | QList<QPropertyAssignment> QStateMachinePrivate::restorablesToPropertyList(const QHash<RestorableId, QVariant> &restorables) const | - |
766 | { | - |
767 | QList<QPropertyAssignment> result; | - |
768 | QHash<RestorableId, QVariant>::const_iterator it; | - |
769 | for (it = restorables.constBegin(); it != restorables.constEnd(); ++it) { evaluated: it != restorables.constEnd() yes Evaluation Count:25 | yes Evaluation Count:23 |
| 23-25 |
770 | if (!it.key().first) { evaluated: !it.key().first yes Evaluation Count:1 | yes Evaluation Count:24 |
| 1-24 |
771 | | - |
772 | continue; executed: continue; Execution Count:1 | 1 |
773 | } | - |
774 | | - |
775 | | - |
776 | | - |
777 | result.append(QPropertyAssignment(it.key().first, it.key().second, it.value(), false)); | - |
778 | } executed: } Execution Count:24 | 24 |
779 | return result; executed: return result; Execution Count:23 | 23 |
780 | } | - |
781 | QHash<QStateMachinePrivate::RestorableId, QVariant> QStateMachinePrivate::computePendingRestorables( | - |
782 | const QList<QAbstractState*> &statesToExit_sorted) const | - |
783 | { | - |
784 | QHash<QStateMachinePrivate::RestorableId, QVariant> restorables; | - |
785 | for (int i = statesToExit_sorted.size() - 1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:1271 | yes Evaluation Count:1224 |
| 1224-1271 |
786 | QAbstractState *s = statesToExit_sorted.at(i); | - |
787 | QHash<QStateMachinePrivate::RestorableId, QVariant> rs = registeredRestorablesForState.value(s); | - |
788 | QHash<QStateMachinePrivate::RestorableId, QVariant>::const_iterator it; | - |
789 | for (it = rs.constBegin(); it != rs.constEnd(); ++it) { evaluated: it != rs.constEnd() yes Evaluation Count:39 | yes Evaluation Count:1271 |
| 39-1271 |
790 | if (!restorables.contains(it.key())) evaluated: !restorables.contains(it.key()) yes Evaluation Count:38 | yes Evaluation Count:1 |
| 1-38 |
791 | restorables.insert(it.key(), it.value()); executed: restorables.insert(it.key(), it.value()); Execution Count:38 | 38 |
792 | } executed: } Execution Count:39 | 39 |
793 | } executed: } Execution Count:1271 | 1271 |
794 | return restorables; executed: return restorables; Execution Count:1224 | 1224 |
795 | } | - |
796 | QHash<QAbstractState*, QList<QPropertyAssignment> > QStateMachinePrivate::computePropertyAssignments( | - |
797 | const QList<QAbstractState*> &statesToEnter_sorted, QHash<RestorableId, QVariant> &pendingRestorables) const | - |
798 | { | - |
799 | QHash<QAbstractState*, QList<QPropertyAssignment> > assignmentsForState; | - |
800 | for (int i = 0; i < statesToEnter_sorted.size(); ++i) { evaluated: i < statesToEnter_sorted.size() yes Evaluation Count:1442 | yes Evaluation Count:1367 |
| 1367-1442 |
801 | QState *s = toStandardState(statesToEnter_sorted.at(i)); | - |
802 | if (!s) evaluated: !s yes Evaluation Count:70 | yes Evaluation Count:1372 |
| 70-1372 |
803 | continue; executed: continue; Execution Count:70 | 70 |
804 | | - |
805 | QList<QPropertyAssignment> &assignments = QStatePrivate::get(s)->propertyAssignments; | - |
806 | for (int j = 0; j < assignments.size(); ++j) { evaluated: j < assignments.size() yes Evaluation Count:110 | yes Evaluation Count:1372 |
| 110-1372 |
807 | const QPropertyAssignment &assn = assignments.at(j); | - |
808 | if (assn.objectDeleted()) { evaluated: assn.objectDeleted() yes Evaluation Count:1 | yes Evaluation Count:109 |
| 1-109 |
809 | assignments.removeAt(j--); | - |
810 | } else { executed: } Execution Count:1 | 1 |
811 | pendingRestorables.remove(RestorableId(assn.object, assn.propertyName)); | - |
812 | assignmentsForState[s].append(assn); | - |
813 | } executed: } Execution Count:109 | 109 |
814 | } | - |
815 | } executed: } Execution Count:1372 | 1372 |
816 | return assignmentsForState; executed: return assignmentsForState; Execution Count:1367 | 1367 |
817 | } | - |
818 | | - |
819 | | - |
820 | | - |
821 | QAbstractState *QStateMachinePrivate::findErrorState(QAbstractState *context) | - |
822 | { | - |
823 | | - |
824 | QAbstractState *errorState = 0; | - |
825 | if (context != 0) { evaluated: context != 0 yes Evaluation Count:40 | yes Evaluation Count:9 |
| 9-40 |
826 | QState *s = toStandardState(context); | - |
827 | if (s != 0) evaluated: s != 0 yes Evaluation Count:39 | yes Evaluation Count:1 |
| 1-39 |
828 | errorState = s->errorState(); executed: errorState = s->errorState(); Execution Count:39 | 39 |
829 | | - |
830 | if (errorState == 0) evaluated: errorState == 0 yes Evaluation Count:29 | yes Evaluation Count:11 |
| 11-29 |
831 | errorState = findErrorState(context->parentState()); executed: errorState = findErrorState(context->parentState()); Execution Count:29 | 29 |
832 | } executed: } Execution Count:40 | 40 |
833 | | - |
834 | return errorState; executed: return errorState; Execution Count:49 | 49 |
835 | } | - |
836 | | - |
837 | void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractState *currentContext) | - |
838 | { | - |
839 | QStateMachine * const q = q_func(); | - |
840 | | - |
841 | error = errorCode; | - |
842 | switch (errorCode) { | - |
843 | case QStateMachine::NoInitialStateError: | - |
844 | qt_noop(); | - |
845 | | - |
846 | errorString = QStateMachine::tr("Missing initial state in compound state '%1'") | - |
847 | .arg(currentContext->objectName()); | - |
848 | | - |
849 | break; executed: break; Execution Count:16 | 16 |
850 | case QStateMachine::NoDefaultStateInHistoryStateError: | - |
851 | qt_noop(); | - |
852 | | - |
853 | errorString = QStateMachine::tr("Missing default state in history state '%1'") | - |
854 | .arg(currentContext->objectName()); | - |
855 | break; executed: break; Execution Count:1 | 1 |
856 | | - |
857 | case QStateMachine::NoCommonAncestorForTransitionError: | - |
858 | qt_noop(); | - |
859 | | - |
860 | errorString = QStateMachine::tr("No common ancestor for targets and source of transition from state '%1'") | - |
861 | .arg(currentContext->objectName()); | - |
862 | break; executed: break; Execution Count:3 | 3 |
863 | default: | - |
864 | errorString = QStateMachine::tr("Unknown error"); | - |
865 | }; | 0 |
866 | | - |
867 | pendingErrorStates.clear(); | - |
868 | pendingErrorStatesForDefaultEntry.clear(); | - |
869 | | - |
870 | QAbstractState *currentErrorState = findErrorState(currentContext); | - |
871 | | - |
872 | | - |
873 | if (currentContext == currentErrorState) evaluated: currentContext == currentErrorState yes Evaluation Count:1 | yes Evaluation Count:19 |
| 1-19 |
874 | currentErrorState = 0; executed: currentErrorState = 0; Execution Count:1 | 1 |
875 | | - |
876 | qt_noop(); | - |
877 | | - |
878 | if (currentErrorState != 0) { evaluated: currentErrorState != 0 yes Evaluation Count:10 | yes Evaluation Count:10 |
| 10 |
879 | QState *lca = findLCA(QList<QAbstractState*>() << currentErrorState << currentContext); | - |
880 | addStatesToEnter(currentErrorState, lca, pendingErrorStates, pendingErrorStatesForDefaultEntry); | - |
881 | addAncestorStatesToEnter(currentErrorState, lca, pendingErrorStates, pendingErrorStatesForDefaultEntry); | - |
882 | } else { executed: } Execution Count:10 | 10 |
883 | QMessageLogger("statemachine/qstatemachine.cpp", 1091, __PRETTY_FUNCTION__).warning("Unrecoverable error detected in running state machine: %s", | - |
884 | QString(errorString).toLocal8Bit().constData()); | - |
885 | q->stop(); | - |
886 | } executed: } Execution Count:10 | 10 |
887 | } | - |
888 | | - |
889 | | - |
890 | | - |
891 | QPair<QList<QAbstractAnimation*>, QList<QAbstractAnimation*> > | - |
892 | QStateMachinePrivate::initializeAnimation(QAbstractAnimation *abstractAnimation, | - |
893 | const QPropertyAssignment &prop) | - |
894 | { | - |
895 | QList<QAbstractAnimation*> handledAnimations; | - |
896 | QList<QAbstractAnimation*> localResetEndValues; | - |
897 | QAnimationGroup *group = qobject_cast<QAnimationGroup*>(abstractAnimation); | - |
898 | if (group) { evaluated: group yes Evaluation Count:5 | yes Evaluation Count:50 |
| 5-50 |
899 | for (int i = 0; i < group->animationCount(); ++i) { evaluated: i < group->animationCount() yes Evaluation Count:8 | yes Evaluation Count:5 |
| 5-8 |
900 | QAbstractAnimation *animationChild = group->animationAt(i); | - |
901 | QPair<QList<QAbstractAnimation*>, QList<QAbstractAnimation*> > ret; | - |
902 | ret = initializeAnimation(animationChild, prop); | - |
903 | handledAnimations << ret.first; | - |
904 | localResetEndValues << ret.second; | - |
905 | } executed: } Execution Count:8 | 8 |
906 | } else { executed: } Execution Count:5 | 5 |
907 | QPropertyAnimation *animation = qobject_cast<QPropertyAnimation *>(abstractAnimation); | - |
908 | if (animation != 0 partially evaluated: animation != 0 yes Evaluation Count:50 | no Evaluation Count:0 |
| 0-50 |
909 | && prop.object == animation->targetObject() evaluated: prop.object == animation->targetObject() yes Evaluation Count:46 | yes Evaluation Count:4 |
| 4-46 |
910 | && prop.propertyName == animation->propertyName()) { evaluated: prop.propertyName == animation->propertyName() yes Evaluation Count:36 | yes Evaluation Count:10 |
| 10-36 |
911 | | - |
912 | | - |
913 | if (!animation->endValue().isValid()) { evaluated: !animation->endValue().isValid() yes Evaluation Count:35 | yes Evaluation Count:1 |
| 1-35 |
914 | animation->setEndValue(prop.value); | - |
915 | localResetEndValues.append(animation); | - |
916 | } executed: } Execution Count:35 | 35 |
917 | handledAnimations.append(animation); | - |
918 | } executed: } Execution Count:36 | 36 |
919 | } executed: } Execution Count:50 | 50 |
920 | return qMakePair(handledAnimations, localResetEndValues); executed: return qMakePair(handledAnimations, localResetEndValues); Execution Count:55 | 55 |
921 | } | - |
922 | | - |
923 | void QStateMachinePrivate::_q_animationFinished() | - |
924 | { | - |
925 | QStateMachine * const q = q_func(); | - |
926 | QAbstractAnimation *anim = qobject_cast<QAbstractAnimation*>(q->sender()); | - |
927 | qt_noop(); | - |
928 | QObject::disconnect(anim, "2""finished()", q, "1""_q_animationFinished()"); | - |
929 | if (resetAnimationEndValues.contains(anim)) { partially evaluated: resetAnimationEndValues.contains(anim) yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
930 | qobject_cast<QVariantAnimation*>(anim)->setEndValue(QVariant()); | - |
931 | resetAnimationEndValues.remove(anim); | - |
932 | } executed: } Execution Count:15 | 15 |
933 | | - |
934 | QAbstractState *state = stateForAnimation.take(anim); | - |
935 | qt_noop(); | - |
936 | | - |
937 | | - |
938 | | - |
939 | QPropertyAssignment assn = propertyForAnimation.take(anim); | - |
940 | assn.write(); | - |
941 | if (!assn.explicitlySet) evaluated: !assn.explicitlySet yes Evaluation Count:1 | yes Evaluation Count:14 |
| 1-14 |
942 | unregisterRestorables(QList<QAbstractState*>() << state, assn.object, assn.propertyName); executed: unregisterRestorables(QList<QAbstractState*>() << state, assn.object, assn.propertyName); Execution Count:1 | 1 |
943 | | - |
944 | | - |
945 | QHash<QAbstractState*, QList<QAbstractAnimation*> >::iterator it; | - |
946 | it = animationsForState.find(state); | - |
947 | qt_noop(); | - |
948 | QList<QAbstractAnimation*> &animations = it.value(); | - |
949 | animations.removeOne(anim); | - |
950 | if (animations.isEmpty()) { evaluated: animations.isEmpty() yes Evaluation Count:12 | yes Evaluation Count:3 |
| 3-12 |
951 | animationsForState.erase(it); | - |
952 | QStatePrivate::get(toStandardState(state))->emitPropertiesAssigned(); | - |
953 | } executed: } Execution Count:12 | 12 |
954 | } executed: } Execution Count:15 | 15 |
955 | | - |
956 | QList<QAbstractAnimation *> QStateMachinePrivate::selectAnimations(const QList<QAbstractTransition *> &transitionList) const | - |
957 | { | - |
958 | QList<QAbstractAnimation *> selectedAnimations; | - |
959 | if (animated) { partially evaluated: animated yes Evaluation Count:1367 | no Evaluation Count:0 |
| 0-1367 |
960 | for (int i = 0; i < transitionList.size(); ++i) { evaluated: i < transitionList.size() yes Evaluation Count:1368 | yes Evaluation Count:1367 |
| 1367-1368 |
961 | QAbstractTransition *transition = transitionList.at(i); | - |
962 | | - |
963 | selectedAnimations << transition->animations(); | - |
964 | selectedAnimations << defaultAnimationsForSource.values(transition->sourceState()); | - |
965 | | - |
966 | QList<QAbstractState *> targetStates = transition->targetStates(); | - |
967 | for (int j=0; j<targetStates.size(); ++j) evaluated: j<targetStates.size() yes Evaluation Count:1366 | yes Evaluation Count:1368 |
| 1366-1368 |
968 | selectedAnimations << defaultAnimationsForTarget.values(targetStates.at(j)); executed: selectedAnimations << defaultAnimationsForTarget.values(targetStates.at(j)); Execution Count:1366 | 1366 |
969 | } executed: } Execution Count:1368 | 1368 |
970 | selectedAnimations << defaultAnimations; | - |
971 | } executed: } Execution Count:1367 | 1367 |
972 | return selectedAnimations; executed: return selectedAnimations; Execution Count:1367 | 1367 |
973 | } | - |
974 | | - |
975 | void QStateMachinePrivate::terminateActiveAnimations(QAbstractState *state, | - |
976 | const QHash<QAbstractState*, QList<QPropertyAssignment> > &assignmentsForEnteredStates) | - |
977 | { | - |
978 | QStateMachine * const q = q_func(); | - |
979 | QList<QAbstractAnimation*> animations = animationsForState.take(state); | - |
980 | for (int i = 0; i < animations.size(); ++i) { evaluated: i < animations.size() yes Evaluation Count:20 | yes Evaluation Count:1271 |
| 20-1271 |
981 | QAbstractAnimation *anim = animations.at(i); | - |
982 | QObject::disconnect(anim, "2""finished()", q, "1""_q_animationFinished()"); | - |
983 | stateForAnimation.remove(anim); | - |
984 | | - |
985 | | - |
986 | | - |
987 | QAbstractAnimation *topLevelAnim = anim; | - |
988 | while (QAnimationGroup *group = topLevelAnim->group()) partially evaluated: QAnimationGroup *group = topLevelAnim->group() no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
989 | topLevelAnim = group; never executed: topLevelAnim = group; | 0 |
990 | topLevelAnim->stop(); | - |
991 | | - |
992 | if (resetAnimationEndValues.contains(anim)) { evaluated: resetAnimationEndValues.contains(anim) yes Evaluation Count:19 | yes Evaluation Count:1 |
| 1-19 |
993 | qobject_cast<QVariantAnimation*>(anim)->setEndValue(QVariant()); | - |
994 | resetAnimationEndValues.remove(anim); | - |
995 | } executed: } Execution Count:19 | 19 |
996 | QPropertyAssignment assn = propertyForAnimation.take(anim); | - |
997 | qt_noop(); | - |
998 | | - |
999 | | - |
1000 | bool found = false; | - |
1001 | QHash<QAbstractState*, QList<QPropertyAssignment> >::const_iterator it; | - |
1002 | for (it = assignmentsForEnteredStates.constBegin(); it != assignmentsForEnteredStates.constEnd(); ++it) { evaluated: it != assignmentsForEnteredStates.constEnd() yes Evaluation Count:18 | yes Evaluation Count:20 |
| 18-20 |
1003 | const QList<QPropertyAssignment> &assignments = it.value(); | - |
1004 | for (int j = 0; j < assignments.size(); ++j) { evaluated: j < assignments.size() yes Evaluation Count:18 | yes Evaluation Count:8 |
| 8-18 |
1005 | if (assignments.at(j).hasTarget(assn.object, assn.propertyName)) { evaluated: assignments.at(j).hasTarget(assn.object, assn.propertyName) yes Evaluation Count:10 | yes Evaluation Count:8 |
| 8-10 |
1006 | found = true; | - |
1007 | break; executed: break; Execution Count:10 | 10 |
1008 | } | - |
1009 | } executed: } Execution Count:8 | 8 |
1010 | } executed: } Execution Count:18 | 18 |
1011 | if (!found) { evaluated: !found yes Evaluation Count:10 | yes Evaluation Count:10 |
| 10 |
1012 | assn.write(); | - |
1013 | if (!assn.explicitlySet) partially evaluated: !assn.explicitlySet no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
1014 | unregisterRestorables(QList<QAbstractState*>() << state, assn.object, assn.propertyName); never executed: unregisterRestorables(QList<QAbstractState*>() << state, assn.object, assn.propertyName); | 0 |
1015 | } executed: } Execution Count:10 | 10 |
1016 | } executed: } Execution Count:20 | 20 |
1017 | } executed: } Execution Count:1271 | 1271 |
1018 | | - |
1019 | void QStateMachinePrivate::initializeAnimations(QAbstractState *state, const QList<QAbstractAnimation *> &selectedAnimations, | - |
1020 | const QList<QAbstractState*> &exitedStates_sorted, | - |
1021 | QHash<QAbstractState*, QList<QPropertyAssignment> > &assignmentsForEnteredStates) | - |
1022 | { | - |
1023 | QStateMachine * const q = q_func(); | - |
1024 | if (!assignmentsForEnteredStates.contains(state)) evaluated: !assignmentsForEnteredStates.contains(state) yes Evaluation Count:1327 | yes Evaluation Count:115 |
| 115-1327 |
1025 | return; executed: return; Execution Count:1327 | 1327 |
1026 | QList<QPropertyAssignment> &assignments = assignmentsForEnteredStates[state]; | - |
1027 | for (int i = 0; i < selectedAnimations.size(); ++i) { evaluated: i < selectedAnimations.size() yes Evaluation Count:41 | yes Evaluation Count:85 |
| 41-85 |
1028 | QAbstractAnimation *anim = selectedAnimations.at(i); | - |
1029 | QList<QPropertyAssignment>::iterator it; | - |
1030 | for (it = assignments.begin(); it != assignments.end(); ) { evaluated: it != assignments.end() yes Evaluation Count:47 | yes Evaluation Count:41 |
| 41-47 |
1031 | QPair<QList<QAbstractAnimation*>, QList<QAbstractAnimation*> > ret; | - |
1032 | const QPropertyAssignment &assn = *it; | - |
1033 | ret = initializeAnimation(anim, assn); | - |
1034 | QList<QAbstractAnimation*> handlers = ret.first; | - |
1035 | if (!handlers.isEmpty()) { evaluated: !handlers.isEmpty() yes Evaluation Count:36 | yes Evaluation Count:11 |
| 11-36 |
1036 | for (int j = 0; j < handlers.size(); ++j) { evaluated: j < handlers.size() yes Evaluation Count:36 | yes Evaluation Count:36 |
| 36 |
1037 | QAbstractAnimation *a = handlers.at(j); | - |
1038 | propertyForAnimation.insert(a, assn); | - |
1039 | stateForAnimation.insert(a, state); | - |
1040 | animationsForState[state].append(a); | - |
1041 | | - |
1042 | QObject::connect(a, "2""finished()", q, "1""_q_animationFinished()", Qt::UniqueConnection); | - |
1043 | } executed: } Execution Count:36 | 36 |
1044 | if ((globalRestorePolicy == QState::RestoreProperties) evaluated: (globalRestorePolicy == QState::RestoreProperties) yes Evaluation Count:12 | yes Evaluation Count:24 |
| 12-24 |
1045 | && !hasRestorable(state, assn.object, assn.propertyName)) { partially evaluated: !hasRestorable(state, assn.object, assn.propertyName) yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
1046 | QVariant value = savedValueForRestorable(exitedStates_sorted, assn.object, assn.propertyName); | - |
1047 | unregisterRestorables(exitedStates_sorted, assn.object, assn.propertyName); | - |
1048 | registerRestorable(state, assn.object, assn.propertyName, value); | - |
1049 | } executed: } Execution Count:12 | 12 |
1050 | it = assignments.erase(it); | - |
1051 | } else { executed: } Execution Count:36 | 36 |
1052 | ++it; | - |
1053 | } executed: } Execution Count:11 | 11 |
1054 | for (int j = 0; j < ret.second.size(); ++j) evaluated: j < ret.second.size() yes Evaluation Count:35 | yes Evaluation Count:47 |
| 35-47 |
1055 | resetAnimationEndValues.insert(ret.second.at(j)); executed: resetAnimationEndValues.insert(ret.second.at(j)); Execution Count:35 | 35 |
1056 | } executed: } Execution Count:47 | 47 |
1057 | | - |
1058 | | - |
1059 | QList<QVariantAnimation*> variantAnims = anim->findChildren<QVariantAnimation*>(); | - |
1060 | if (QVariantAnimation *va = qobject_cast<QVariantAnimation*>(anim)) evaluated: QVariantAnimation *va = qobject_cast<QVariantAnimation*>(anim) yes Evaluation Count:38 | yes Evaluation Count:3 |
| 3-38 |
1061 | variantAnims.append(va); executed: variantAnims.append(va); Execution Count:38 | 38 |
1062 | | - |
1063 | bool hasValidEndValue = false; | - |
1064 | for (int j = 0; j < variantAnims.size(); ++j) { evaluated: j < variantAnims.size() yes Evaluation Count:41 | yes Evaluation Count:2 |
| 2-41 |
1065 | if (variantAnims.at(j)->endValue().isValid()) { evaluated: variantAnims.at(j)->endValue().isValid() yes Evaluation Count:39 | yes Evaluation Count:2 |
| 2-39 |
1066 | hasValidEndValue = true; | - |
1067 | break; executed: break; Execution Count:39 | 39 |
1068 | } | - |
1069 | } executed: } Execution Count:2 | 2 |
1070 | | - |
1071 | if (hasValidEndValue) { evaluated: hasValidEndValue yes Evaluation Count:39 | yes Evaluation Count:2 |
| 2-39 |
1072 | if (anim->state() == QAbstractAnimation::Running) { evaluated: anim->state() == QAbstractAnimation::Running yes Evaluation Count:5 | yes Evaluation Count:34 |
| 5-34 |
1073 | | - |
1074 | | - |
1075 | | - |
1076 | | - |
1077 | | - |
1078 | anim->stop(); | - |
1079 | } executed: } Execution Count:5 | 5 |
1080 | anim->start(); | - |
1081 | } executed: } Execution Count:39 | 39 |
1082 | | - |
1083 | if (assignments.isEmpty()) { evaluated: assignments.isEmpty() yes Evaluation Count:30 | yes Evaluation Count:11 |
| 11-30 |
1084 | assignmentsForEnteredStates.remove(state); | - |
1085 | break; executed: break; Execution Count:30 | 30 |
1086 | } | - |
1087 | } executed: } Execution Count:11 | 11 |
1088 | } executed: } Execution Count:115 | 115 |
1089 | | - |
1090 | | - |
1091 | | - |
1092 | QAbstractTransition *QStateMachinePrivate::createInitialTransition() const | - |
1093 | { | - |
1094 | class InitialTransition : public QAbstractTransition | - |
1095 | { | - |
1096 | public: | - |
1097 | InitialTransition(const QList<QAbstractState *> &targets) | - |
1098 | : QAbstractTransition() | - |
1099 | { setTargetStates(targets); } executed: } Execution Count:143 | 143 |
1100 | protected: | - |
1101 | virtual bool eventTest(QEvent *) { return true; } never executed: return true; | 0 |
1102 | virtual void onTransition(QEvent *) {} | - |
1103 | }; | - |
1104 | | - |
1105 | QState *root = rootState(); | - |
1106 | qt_noop(); | - |
1107 | QList<QAbstractState *> targets; | - |
1108 | switch (root->childMode()) { | - |
1109 | case QState::ExclusiveStates: | - |
1110 | targets.append(root->initialState()); | - |
1111 | break; executed: break; Execution Count:142 | 142 |
1112 | case QState::ParallelStates: | - |
1113 | targets = QStatePrivate::get(root)->childStates(); | - |
1114 | break; executed: break; Execution Count:1 | 1 |
1115 | } | - |
1116 | return new InitialTransition(targets); executed: return new InitialTransition(targets); Execution Count:143 | 143 |
1117 | } | - |
1118 | | - |
1119 | void QStateMachinePrivate::clearHistory() | - |
1120 | { | - |
1121 | QStateMachine * const q = q_func(); | - |
1122 | QList<QHistoryState*> historyStates = q->findChildren<QHistoryState*>(); | - |
1123 | for (int i = 0; i < historyStates.size(); ++i) { evaluated: i < historyStates.size() yes Evaluation Count:8 | yes Evaluation Count:143 |
| 8-143 |
1124 | QHistoryState *h = historyStates.at(i); | - |
1125 | QHistoryStatePrivate::get(h)->configuration.clear(); | - |
1126 | } executed: } Execution Count:8 | 8 |
1127 | } executed: } Execution Count:143 | 143 |
1128 | void QStateMachinePrivate::registerMultiThreadedSignalTransitions() | - |
1129 | { | - |
1130 | QStateMachine * const q = q_func(); | - |
1131 | QList<QSignalTransition*> transitions = rootState()->findChildren<QSignalTransition*>(); | - |
1132 | for (int i = 0; i < transitions.size(); ++i) { evaluated: i < transitions.size() yes Evaluation Count:68 | yes Evaluation Count:143 |
| 68-143 |
1133 | QSignalTransition *t = transitions.at(i); | - |
1134 | if ((t->machine() == q) && t->senderObject() && (t->senderObject()->thread() != q->thread())) evaluated: (t->machine() == q) yes Evaluation Count:65 | yes Evaluation Count:3 |
evaluated: t->senderObject() yes Evaluation Count:64 | yes Evaluation Count:1 |
evaluated: (t->senderObject()->thread() != q->thread()) yes Evaluation Count:7 | yes Evaluation Count:57 |
| 1-65 |
1135 | registerSignalTransition(t); executed: registerSignalTransition(t); Execution Count:7 | 7 |
1136 | } executed: } Execution Count:68 | 68 |
1137 | } executed: } Execution Count:143 | 143 |
1138 | | - |
1139 | void QStateMachinePrivate::_q_start() | - |
1140 | { | - |
1141 | QStateMachine * const q = q_func(); | - |
1142 | qt_noop(); | - |
1143 | configuration.clear(); | - |
1144 | qDeleteAll(internalEventQueue); | - |
1145 | internalEventQueue.clear(); | - |
1146 | qDeleteAll(externalEventQueue); | - |
1147 | externalEventQueue.clear(); | - |
1148 | clearHistory(); | - |
1149 | | - |
1150 | registerMultiThreadedSignalTransitions(); | - |
1151 | | - |
1152 | | - |
1153 | | - |
1154 | | - |
1155 | state = Running; | - |
1156 | processingScheduled = true; | - |
1157 | | - |
1158 | QList<QAbstractTransition*> transitions; | - |
1159 | QAbstractTransition *initialTransition = createInitialTransition(); | - |
1160 | transitions.append(initialTransition); | - |
1161 | | - |
1162 | QEvent nullEvent(QEvent::None); | - |
1163 | executeTransitionContent(&nullEvent, transitions); | - |
1164 | QList<QAbstractState*> exitedStates = QList<QAbstractState*>(); | - |
1165 | QSet<QAbstractState*> statesForDefaultEntry; | - |
1166 | QList<QAbstractState*> enteredStates = computeStatesToEnter(transitions, | - |
1167 | statesForDefaultEntry); | - |
1168 | QHash<RestorableId, QVariant> pendingRestorables; | - |
1169 | QHash<QAbstractState*, QList<QPropertyAssignment> > assignmentsForEnteredStates = | - |
1170 | computePropertyAssignments(enteredStates, pendingRestorables); | - |
1171 | | - |
1172 | QList<QAbstractAnimation*> selectedAnimations = selectAnimations(transitions); | - |
1173 | | - |
1174 | | - |
1175 | | - |
1176 | stopProcessingReason = EventQueueEmpty; | - |
1177 | enterStates(&nullEvent, exitedStates, enteredStates, statesForDefaultEntry, | - |
1178 | assignmentsForEnteredStates | - |
1179 | | - |
1180 | , selectedAnimations | - |
1181 | | - |
1182 | ); | - |
1183 | delete initialTransition; | - |
1184 | | - |
1185 | | - |
1186 | | - |
1187 | | - |
1188 | | - |
1189 | q->started(QStateMachine::QPrivateSignal()); | - |
1190 | | - |
1191 | if (stopProcessingReason == Finished) { evaluated: stopProcessingReason == Finished yes Evaluation Count:2 | yes Evaluation Count:141 |
| 2-141 |
1192 | | - |
1193 | processingScheduled = false; | - |
1194 | state = NotRunning; | - |
1195 | unregisterAllTransitions(); | - |
1196 | emitFinished(); | - |
1197 | } else { executed: } Execution Count:2 | 2 |
1198 | _q_process(); | - |
1199 | } executed: } Execution Count:141 | 141 |
1200 | } | - |
1201 | | - |
1202 | void QStateMachinePrivate::_q_process() | - |
1203 | { | - |
1204 | QStateMachine * const q = q_func(); | - |
1205 | qt_noop(); | - |
1206 | qt_noop(); | - |
1207 | processing = true; | - |
1208 | processingScheduled = false; | - |
1209 | | - |
1210 | | - |
1211 | | - |
1212 | while (processing) { evaluated: processing yes Evaluation Count:2518 | yes Evaluation Count:335 |
| 335-2518 |
1213 | if (stop) { evaluated: stop yes Evaluation Count:18 | yes Evaluation Count:2500 |
| 18-2500 |
1214 | processing = false; | - |
1215 | break; executed: break; Execution Count:18 | 18 |
1216 | } | - |
1217 | QSet<QAbstractTransition*> enabledTransitions; | - |
1218 | QEvent *e = new QEvent(QEvent::None); | - |
1219 | enabledTransitions = selectTransitions(e); | - |
1220 | if (enabledTransitions.isEmpty()) { evaluated: enabledTransitions.isEmpty() yes Evaluation Count:2476 | yes Evaluation Count:24 |
| 24-2476 |
1221 | delete e; | - |
1222 | e = 0; | - |
1223 | } executed: } Execution Count:2476 | 2476 |
1224 | if (enabledTransitions.isEmpty() && ((e = dequeueInternalEvent()) != 0)) { evaluated: enabledTransitions.isEmpty() yes Evaluation Count:2476 | yes Evaluation Count:24 |
evaluated: ((e = dequeueInternalEvent()) != 0) yes Evaluation Count:88 | yes Evaluation Count:2388 |
| 24-2476 |
1225 | | - |
1226 | | - |
1227 | | - |
1228 | enabledTransitions = selectTransitions(e); | - |
1229 | if (enabledTransitions.isEmpty()) { evaluated: enabledTransitions.isEmpty() yes Evaluation Count:7 | yes Evaluation Count:81 |
| 7-81 |
1230 | delete e; | - |
1231 | e = 0; | - |
1232 | } executed: } Execution Count:7 | 7 |
1233 | } executed: } Execution Count:88 | 88 |
1234 | if (enabledTransitions.isEmpty()) { evaluated: enabledTransitions.isEmpty() yes Evaluation Count:2395 | yes Evaluation Count:105 |
| 105-2395 |
1235 | if ((e = dequeueExternalEvent()) != 0) { evaluated: (e = dequeueExternalEvent()) != 0 yes Evaluation Count:2121 | yes Evaluation Count:274 |
| 274-2121 |
1236 | | - |
1237 | | - |
1238 | | - |
1239 | enabledTransitions = selectTransitions(e); | - |
1240 | if (enabledTransitions.isEmpty()) { evaluated: enabledTransitions.isEmpty() yes Evaluation Count:1002 | yes Evaluation Count:1119 |
| 1002-1119 |
1241 | delete e; | - |
1242 | e = 0; | - |
1243 | } executed: } Execution Count:1002 | 1002 |
1244 | } else { executed: } Execution Count:2121 | 2121 |
1245 | if (isInternalEventQueueEmpty()) { partially evaluated: isInternalEventQueueEmpty() yes Evaluation Count:274 | no Evaluation Count:0 |
| 0-274 |
1246 | processing = false; | - |
1247 | stopProcessingReason = EventQueueEmpty; | - |
1248 | } executed: } Execution Count:274 | 274 |
1249 | } executed: } Execution Count:274 | 274 |
1250 | } | - |
1251 | if (!enabledTransitions.isEmpty()) { evaluated: !enabledTransitions.isEmpty() yes Evaluation Count:1224 | yes Evaluation Count:1276 |
| 1224-1276 |
1252 | q->beginMicrostep(e); | - |
1253 | microstep(e, enabledTransitions.toList()); | - |
1254 | q->endMicrostep(e); | - |
1255 | } executed: } Execution Count:1224 | 1224 |
1256 | | - |
1257 | | - |
1258 | | - |
1259 | | - |
1260 | | - |
1261 | delete e; | - |
1262 | } executed: } Execution Count:2500 | 2500 |
1263 | | - |
1264 | | - |
1265 | | - |
1266 | if (stop) { evaluated: stop yes Evaluation Count:20 | yes Evaluation Count:333 |
| 20-333 |
1267 | stop = false; | - |
1268 | stopProcessingReason = Stopped; | - |
1269 | } executed: } Execution Count:20 | 20 |
1270 | | - |
1271 | switch (stopProcessingReason) { | - |
1272 | case EventQueueEmpty: | - |
1273 | break; executed: break; Execution Count:273 | 273 |
1274 | case Finished: | - |
1275 | state = NotRunning; | - |
1276 | cancelAllDelayedEvents(); | - |
1277 | unregisterAllTransitions(); | - |
1278 | emitFinished(); | - |
1279 | break; executed: break; Execution Count:60 | 60 |
1280 | case Stopped: | - |
1281 | state = NotRunning; | - |
1282 | cancelAllDelayedEvents(); | - |
1283 | unregisterAllTransitions(); | - |
1284 | q->stopped(QStateMachine::QPrivateSignal()); | - |
1285 | break; executed: break; Execution Count:20 | 20 |
1286 | } | - |
1287 | } executed: } Execution Count:353 | 353 |
1288 | | - |
1289 | void QStateMachinePrivate::_q_startDelayedEventTimer(int id, int delay) | - |
1290 | { | - |
1291 | QStateMachine * const q = q_func(); | - |
1292 | QMutexLocker locker(&delayedEventsMutex); | - |
1293 | QHash<int, DelayedEvent>::iterator it = delayedEvents.find(id); | - |
1294 | if (it != delayedEvents.end()) { evaluated: it != delayedEvents.end() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
1295 | DelayedEvent &e = it.value(); | - |
1296 | qt_noop(); | - |
1297 | e.timerId = q->startTimer(delay); | - |
1298 | if (!e.timerId) { partially evaluated: !e.timerId no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1299 | QMessageLogger("statemachine/qstatemachine.cpp", 1519, __PRETTY_FUNCTION__).warning("QStateMachine::postDelayedEvent: failed to start timer (id=%d, delay=%d)", id, delay); | - |
1300 | delayedEvents.erase(it); | - |
1301 | delayedEventIdFreeList.release(id); | - |
1302 | } else { | 0 |
1303 | timerIdToDelayedEventId.insert(e.timerId, id); | - |
1304 | } executed: } Execution Count:1 | 1 |
1305 | } else { | - |
1306 | | - |
1307 | delayedEventIdFreeList.release(id); | - |
1308 | } executed: } Execution Count:1 | 1 |
1309 | } | - |
1310 | | - |
1311 | void QStateMachinePrivate::_q_killDelayedEventTimer(int id, int timerId) | - |
1312 | { | - |
1313 | QStateMachine * const q = q_func(); | - |
1314 | q->killTimer(timerId); | - |
1315 | QMutexLocker locker(&delayedEventsMutex); | - |
1316 | delayedEventIdFreeList.release(id); | - |
1317 | } | 0 |
1318 | | - |
1319 | void QStateMachinePrivate::postInternalEvent(QEvent *e) | - |
1320 | { | - |
1321 | QMutexLocker locker(&internalEventMutex); | - |
1322 | internalEventQueue.append(e); | - |
1323 | } executed: } Execution Count:88 | 88 |
1324 | | - |
1325 | void QStateMachinePrivate::postExternalEvent(QEvent *e) | - |
1326 | { | - |
1327 | QMutexLocker locker(&externalEventMutex); | - |
1328 | externalEventQueue.append(e); | - |
1329 | } executed: } Execution Count:2122 | 2122 |
1330 | | - |
1331 | QEvent *QStateMachinePrivate::dequeueInternalEvent() | - |
1332 | { | - |
1333 | QMutexLocker locker(&internalEventMutex); | - |
1334 | if (internalEventQueue.isEmpty()) evaluated: internalEventQueue.isEmpty() yes Evaluation Count:2388 | yes Evaluation Count:88 |
| 88-2388 |
1335 | return 0; executed: return 0; Execution Count:2388 | 2388 |
1336 | return internalEventQueue.takeFirst(); executed: return internalEventQueue.takeFirst(); Execution Count:88 | 88 |
1337 | } | - |
1338 | | - |
1339 | QEvent *QStateMachinePrivate::dequeueExternalEvent() | - |
1340 | { | - |
1341 | QMutexLocker locker(&externalEventMutex); | - |
1342 | if (externalEventQueue.isEmpty()) evaluated: externalEventQueue.isEmpty() yes Evaluation Count:274 | yes Evaluation Count:2121 |
| 274-2121 |
1343 | return 0; executed: return 0; Execution Count:274 | 274 |
1344 | return externalEventQueue.takeFirst(); executed: return externalEventQueue.takeFirst(); Execution Count:2121 | 2121 |
1345 | } | - |
1346 | | - |
1347 | bool QStateMachinePrivate::isInternalEventQueueEmpty() | - |
1348 | { | - |
1349 | QMutexLocker locker(&internalEventMutex); | - |
1350 | return internalEventQueue.isEmpty(); executed: return internalEventQueue.isEmpty(); Execution Count:274 | 274 |
1351 | } | - |
1352 | | - |
1353 | bool QStateMachinePrivate::isExternalEventQueueEmpty() | - |
1354 | { | - |
1355 | QMutexLocker locker(&externalEventMutex); | - |
1356 | return externalEventQueue.isEmpty(); never executed: return externalEventQueue.isEmpty(); | 0 |
1357 | } | - |
1358 | | - |
1359 | void QStateMachinePrivate::processEvents(EventProcessingMode processingMode) | - |
1360 | { | - |
1361 | QStateMachine * const q = q_func(); | - |
1362 | if ((state != Running) || processing || processingScheduled) partially evaluated: (state != Running) no Evaluation Count:0 | yes Evaluation Count:2234 |
evaluated: processing yes Evaluation Count:1013 | yes Evaluation Count:1221 |
evaluated: processingScheduled yes Evaluation Count:1009 | yes Evaluation Count:212 |
| 0-2234 |
1363 | return; executed: return; Execution Count:2022 | 2022 |
1364 | switch (processingMode) { | - |
1365 | case DirectProcessing: | - |
1366 | if (QThread::currentThread() == q->thread()) { partially evaluated: QThread::currentThread() == q->thread() yes Evaluation Count:86 | no Evaluation Count:0 |
| 0-86 |
1367 | _q_process(); | - |
1368 | break; executed: break; Execution Count:86 | 86 |
1369 | } | - |
1370 | case QueuedProcessing: code before this statement never executed: case QueuedProcessing: | 0 |
1371 | processingScheduled = true; | - |
1372 | QMetaObject::invokeMethod(q, "_q_process", Qt::QueuedConnection); | - |
1373 | break; executed: break; Execution Count:126 | 126 |
1374 | } | - |
1375 | } executed: } Execution Count:212 | 212 |
1376 | | - |
1377 | void QStateMachinePrivate::cancelAllDelayedEvents() | - |
1378 | { | - |
1379 | QStateMachine * const q = q_func(); | - |
1380 | QMutexLocker locker(&delayedEventsMutex); | - |
1381 | QHash<int, DelayedEvent>::const_iterator it; | - |
1382 | for (it = delayedEvents.constBegin(); it != delayedEvents.constEnd(); ++it) { evaluated: it != delayedEvents.constEnd() yes Evaluation Count:2 | yes Evaluation Count:80 |
| 2-80 |
1383 | const DelayedEvent &e = it.value(); | - |
1384 | if (e.timerId) { partially evaluated: e.timerId yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1385 | timerIdToDelayedEventId.remove(e.timerId); | - |
1386 | q->killTimer(e.timerId); | - |
1387 | delayedEventIdFreeList.release(it.key()); | - |
1388 | } else { executed: } Execution Count:2 | 2 |
1389 | | - |
1390 | } | 0 |
1391 | delete e.event; | - |
1392 | } executed: } Execution Count:2 | 2 |
1393 | delayedEvents.clear(); | - |
1394 | } executed: } Execution Count:80 | 80 |
1395 | | - |
1396 | namespace _QStateMachine_Internal{ | - |
1397 | | - |
1398 | class GoToStateTransition : public QAbstractTransition | - |
1399 | { | - |
1400 | public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); struct QPrivateSignal {}; | - |
1401 | public: | - |
1402 | GoToStateTransition(QAbstractState *target) | - |
1403 | : QAbstractTransition() | - |
1404 | { setTargetState(target); } executed: } Execution Count:4 | 4 |
1405 | protected: | - |
1406 | void onTransition(QEvent *) { deleteLater(); } executed: } Execution Count:4 | 4 |
1407 | bool eventTest(QEvent *) { return true; } executed: return true; Execution Count:4 | 4 |
1408 | }; | - |
1409 | | - |
1410 | } | - |
1411 | | - |
1412 | | - |
1413 | using namespace _QStateMachine_Internal; | - |
1414 | void QStateMachinePrivate::goToState(QAbstractState *targetState) | - |
1415 | { | - |
1416 | if (!targetState) { partially evaluated: !targetState no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
1417 | QMessageLogger("statemachine/qstatemachine.cpp", 1648, __PRETTY_FUNCTION__).warning("QStateMachine::goToState(): cannot go to null state"); | - |
1418 | return; | 0 |
1419 | } | - |
1420 | | - |
1421 | if (configuration.contains(targetState)) evaluated: configuration.contains(targetState) yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
1422 | return; executed: return; Execution Count:2 | 2 |
1423 | | - |
1424 | qt_noop(); | - |
1425 | QState *sourceState = 0; | - |
1426 | QSet<QAbstractState*>::const_iterator it; | - |
1427 | for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) { partially evaluated: it != configuration.constEnd() yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
1428 | sourceState = toStandardState(*it); | - |
1429 | if (sourceState != 0) partially evaluated: sourceState != 0 yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
1430 | break; executed: break; Execution Count:5 | 5 |
1431 | } | 0 |
1432 | | - |
1433 | qt_noop(); | - |
1434 | | - |
1435 | | - |
1436 | GoToStateTransition *trans = sourceState->findChild<GoToStateTransition*>(); | - |
1437 | if (!trans) { evaluated: !trans yes Evaluation Count:4 | yes Evaluation Count:1 |
| 1-4 |
1438 | trans = new GoToStateTransition(targetState); | - |
1439 | sourceState->addTransition(trans); | - |
1440 | } else { executed: } Execution Count:4 | 4 |
1441 | trans->setTargetState(targetState); | - |
1442 | } executed: } Execution Count:1 | 1 |
1443 | | - |
1444 | processEvents(QueuedProcessing); | - |
1445 | } executed: } Execution Count:5 | 5 |
1446 | | - |
1447 | void QStateMachinePrivate::registerTransitions(QAbstractState *state) | - |
1448 | { | - |
1449 | QState *group = toStandardState(state); | - |
1450 | if (!group) evaluated: !group yes Evaluation Count:70 | yes Evaluation Count:1372 |
| 70-1372 |
1451 | return; executed: return; Execution Count:70 | 70 |
1452 | QList<QAbstractTransition*> transitions = QStatePrivate::get(group)->transitions(); | - |
1453 | for (int i = 0; i < transitions.size(); ++i) { evaluated: i < transitions.size() yes Evaluation Count:2293 | yes Evaluation Count:1372 |
| 1372-2293 |
1454 | QAbstractTransition *t = transitions.at(i); | - |
1455 | registerTransition(t); | - |
1456 | } executed: } Execution Count:2293 | 2293 |
1457 | } executed: } Execution Count:1372 | 1372 |
1458 | | - |
1459 | void QStateMachinePrivate::maybeRegisterTransition(QAbstractTransition *transition) | - |
1460 | { | - |
1461 | if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)) { evaluated: QSignalTransition *st = qobject_cast<QSignalTransition*>(transition) yes Evaluation Count:57 | yes Evaluation Count:150 |
| 57-150 |
1462 | maybeRegisterSignalTransition(st); | - |
1463 | } executed: } Execution Count:57 | 57 |
1464 | | - |
1465 | else if (QEventTransition *et = qobject_cast<QEventTransition*>(transition)) { evaluated: QEventTransition *et = qobject_cast<QEventTransition*>(transition) yes Evaluation Count:16 | yes Evaluation Count:134 |
| 16-134 |
1466 | maybeRegisterEventTransition(et); | - |
1467 | } executed: } Execution Count:16 | 16 |
1468 | | - |
1469 | } | - |
1470 | | - |
1471 | void QStateMachinePrivate::registerTransition(QAbstractTransition *transition) | - |
1472 | { | - |
1473 | if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)) { evaluated: QSignalTransition *st = qobject_cast<QSignalTransition*>(transition) yes Evaluation Count:1066 | yes Evaluation Count:1227 |
| 1066-1227 |
1474 | registerSignalTransition(st); | - |
1475 | } executed: } Execution Count:1066 | 1066 |
1476 | | - |
1477 | else if (QEventTransition *oet = qobject_cast<QEventTransition*>(transition)) { evaluated: QEventTransition *oet = qobject_cast<QEventTransition*>(transition) yes Evaluation Count:20 | yes Evaluation Count:1207 |
| 20-1207 |
1478 | registerEventTransition(oet); | - |
1479 | } executed: } Execution Count:20 | 20 |
1480 | | - |
1481 | } | - |
1482 | | - |
1483 | void QStateMachinePrivate::unregisterTransition(QAbstractTransition *transition) | - |
1484 | { | - |
1485 | if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)) { evaluated: QSignalTransition *st = qobject_cast<QSignalTransition*>(transition) yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
1486 | unregisterSignalTransition(st); | - |
1487 | } executed: } Execution Count:2 | 2 |
1488 | | - |
1489 | else if (QEventTransition *oet = qobject_cast<QEventTransition*>(transition)) { evaluated: QEventTransition *oet = qobject_cast<QEventTransition*>(transition) yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1490 | unregisterEventTransition(oet); | - |
1491 | } executed: } Execution Count:2 | 2 |
1492 | | - |
1493 | } | - |
1494 | | - |
1495 | void QStateMachinePrivate::maybeRegisterSignalTransition(QSignalTransition *transition) | - |
1496 | { | - |
1497 | QStateMachine * const q = q_func(); | - |
1498 | if ((state == Running) && (configuration.contains(transition->sourceState()) evaluated: (state == Running) yes Evaluation Count:200011 | yes Evaluation Count:55 |
evaluated: configuration.contains(transition->sourceState()) yes Evaluation Count:200009 | yes Evaluation Count:1 |
| 1-200011 |
1499 | || (transition->senderObject() && (transition->senderObject()->thread() != q->thread())))) { partially evaluated: transition->senderObject() yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: (transition->senderObject()->thread() != q->thread()) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1500 | registerSignalTransition(transition); | - |
1501 | } executed: } Execution Count:200011 | 200011 |
1502 | } executed: } Execution Count:200067 | 200067 |
1503 | | - |
1504 | void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transition) | - |
1505 | { | - |
1506 | QStateMachine * const q = q_func(); | - |
1507 | if (QSignalTransitionPrivate::get(transition)->signalIndex != -1) evaluated: QSignalTransitionPrivate::get(transition)->signalIndex != -1 yes Evaluation Count:1007 | yes Evaluation Count:200076 |
| 1007-200076 |
1508 | return; executed: return; Execution Count:1007 | 1007 |
1509 | const QObject *sender = QSignalTransitionPrivate::get(transition)->sender; | - |
1510 | if (!sender) evaluated: !sender yes Evaluation Count:100003 | yes Evaluation Count:100074 |
| 100003-100074 |
1511 | return; executed: return; Execution Count:100003 | 100003 |
1512 | QByteArray signal = QSignalTransitionPrivate::get(transition)->signal; | - |
1513 | if (signal.isEmpty()) evaluated: signal.isEmpty() yes Evaluation Count:1 | yes Evaluation Count:100073 |
| 1-100073 |
1514 | return; executed: return; Execution Count:1 | 1 |
1515 | if (signal.startsWith('0'+2)) evaluated: signal.startsWith('0'+2) yes Evaluation Count:100071 | yes Evaluation Count:2 |
| 2-100071 |
1516 | signal.remove(0, 1); executed: signal.remove(0, 1); Execution Count:100071 | 100071 |
1517 | const QMetaObject *meta = sender->metaObject(); | - |
1518 | int signalIndex = meta->indexOfSignal(signal); | - |
1519 | int originalSignalIndex = signalIndex; | - |
1520 | if (signalIndex == -1) { evaluated: signalIndex == -1 yes Evaluation Count:1 | yes Evaluation Count:100072 |
| 1-100072 |
1521 | signalIndex = meta->indexOfSignal(QMetaObject::normalizedSignature(signal)); | - |
1522 | if (signalIndex == -1) { partially evaluated: signalIndex == -1 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1523 | QMessageLogger("statemachine/qstatemachine.cpp", 1754, __PRETTY_FUNCTION__).warning("QSignalTransition: no such signal: %s::%s", | - |
1524 | meta->className(), signal.constData()); | - |
1525 | return; executed: return; Execution Count:1 | 1 |
1526 | } | - |
1527 | originalSignalIndex = signalIndex; | - |
1528 | } | 0 |
1529 | | - |
1530 | | - |
1531 | while (meta->method(signalIndex).attributes() & QMetaMethod::Cloned) evaluated: meta->method(signalIndex).attributes() & QMetaMethod::Cloned yes Evaluation Count:2 | yes Evaluation Count:100070 |
| 2-100070 |
1532 | --signalIndex; executed: --signalIndex; Execution Count:2 | 2 |
1533 | | - |
1534 | connectionsMutex.lock(); | - |
1535 | QVector<int> &connectedSignalIndexes = connections[sender]; | - |
1536 | if (connectedSignalIndexes.size() <= signalIndex) evaluated: connectedSignalIndexes.size() <= signalIndex yes Evaluation Count:100065 | yes Evaluation Count:7 |
| 7-100065 |
1537 | connectedSignalIndexes.resize(signalIndex+1); executed: connectedSignalIndexes.resize(signalIndex+1); Execution Count:100065 | 100065 |
1538 | if (connectedSignalIndexes.at(signalIndex) == 0) { evaluated: connectedSignalIndexes.at(signalIndex) == 0 yes Evaluation Count:100065 | yes Evaluation Count:7 |
| 7-100065 |
1539 | if (!signalEventGenerator) evaluated: !signalEventGenerator yes Evaluation Count:37 | yes Evaluation Count:100028 |
| 37-100028 |
1540 | signalEventGenerator = new QSignalEventGenerator(q); executed: signalEventGenerator = new QSignalEventGenerator(q); Execution Count:37 | 37 |
1541 | static const int generatorMethodOffset = QSignalEventGenerator::staticMetaObject.methodOffset(); | - |
1542 | bool ok = QMetaObject::connect(sender, signalIndex, signalEventGenerator, generatorMethodOffset); | - |
1543 | if (!ok) { partially evaluated: !ok no Evaluation Count:0 | yes Evaluation Count:100065 |
| 0-100065 |
1544 | | - |
1545 | | - |
1546 | | - |
1547 | | - |
1548 | | - |
1549 | return; | 0 |
1550 | } | - |
1551 | } executed: } Execution Count:100065 | 100065 |
1552 | ++connectedSignalIndexes[signalIndex]; | - |
1553 | connectionsMutex.unlock(); | - |
1554 | | - |
1555 | QSignalTransitionPrivate::get(transition)->signalIndex = signalIndex; | - |
1556 | QSignalTransitionPrivate::get(transition)->originalSignalIndex = originalSignalIndex; | - |
1557 | | - |
1558 | | - |
1559 | | - |
1560 | | - |
1561 | | - |
1562 | } executed: } Execution Count:100070 | 100070 |
1563 | | - |
1564 | void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transition) | - |
1565 | { | - |
1566 | int signalIndex = QSignalTransitionPrivate::get(transition)->signalIndex; | - |
1567 | if (signalIndex == -1) partially evaluated: signalIndex == -1 no Evaluation Count:0 | yes Evaluation Count:100042 |
| 0-100042 |
1568 | return; | 0 |
1569 | const QObject *sender = QSignalTransitionPrivate::get(transition)->sender; | - |
1570 | QSignalTransitionPrivate::get(transition)->signalIndex = -1; | - |
1571 | | - |
1572 | connectionsMutex.lock(); | - |
1573 | QVector<int> &connectedSignalIndexes = connections[sender]; | - |
1574 | qt_noop(); | - |
1575 | qt_noop(); | - |
1576 | if (--connectedSignalIndexes[signalIndex] == 0) { evaluated: --connectedSignalIndexes[signalIndex] == 0 yes Evaluation Count:100047 | yes Evaluation Count:1 |
| 1-100047 |
1577 | qt_noop(); | - |
1578 | static const int generatorMethodOffset = QSignalEventGenerator::staticMetaObject.methodOffset(); | - |
1579 | QMetaObject::disconnect(sender, signalIndex, signalEventGenerator, generatorMethodOffset); | - |
1580 | int sum = 0; | - |
1581 | for (int i = 0; i < connectedSignalIndexes.size(); ++i) evaluated: i < connectedSignalIndexes.size() yes Evaluation Count:300385 | yes Evaluation Count:100047 |
| 100047-300385 |
1582 | sum += connectedSignalIndexes.at(i); executed: sum += connectedSignalIndexes.at(i); Execution Count:300385 | 300385 |
1583 | if (sum == 0) evaluated: sum == 0 yes Evaluation Count:100037 | yes Evaluation Count:10 |
| 10-100037 |
1584 | connections.remove(sender); executed: connections.remove(sender); Execution Count:100037 | 100037 |
1585 | } executed: } Execution Count:100047 | 100047 |
1586 | connectionsMutex.unlock(); | - |
1587 | } executed: } Execution Count:100047 | 100047 |
1588 | | - |
1589 | void QStateMachinePrivate::unregisterAllTransitions() | - |
1590 | { | - |
1591 | QStateMachine * const q = q_func(); | - |
1592 | { | - |
1593 | QList<QSignalTransition*> transitions = rootState()->findChildren<QSignalTransition*>(); | - |
1594 | for (int i = 0; i < transitions.size(); ++i) { evaluated: i < transitions.size() yes Evaluation Count:46 | yes Evaluation Count:82 |
| 46-82 |
1595 | QSignalTransition *t = transitions.at(i); | - |
1596 | if (t->machine() == q) evaluated: t->machine() == q yes Evaluation Count:43 | yes Evaluation Count:3 |
| 3-43 |
1597 | unregisterSignalTransition(t); executed: unregisterSignalTransition(t); Execution Count:43 | 43 |
1598 | } executed: } Execution Count:46 | 46 |
1599 | } | - |
1600 | { | - |
1601 | QList<QEventTransition*> transitions = rootState()->findChildren<QEventTransition*>(); | - |
1602 | for (int i = 0; i < transitions.size(); ++i) { evaluated: i < transitions.size() yes Evaluation Count:15 | yes Evaluation Count:82 |
| 15-82 |
1603 | QEventTransition *t = transitions.at(i); | - |
1604 | if (t->machine() == q) partially evaluated: t->machine() == q yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
1605 | unregisterEventTransition(t); executed: unregisterEventTransition(t); Execution Count:15 | 15 |
1606 | } executed: } Execution Count:15 | 15 |
1607 | } | - |
1608 | } executed: } Execution Count:82 | 82 |
1609 | | - |
1610 | | - |
1611 | void QStateMachinePrivate::maybeRegisterEventTransition(QEventTransition *transition) | - |
1612 | { | - |
1613 | if ((state == Running) && configuration.contains(transition->sourceState())) evaluated: (state == Running) yes Evaluation Count:8 | yes Evaluation Count:15 |
evaluated: configuration.contains(transition->sourceState()) yes Evaluation Count:7 | yes Evaluation Count:1 |
| 1-15 |
1614 | registerEventTransition(transition); executed: registerEventTransition(transition); Execution Count:7 | 7 |
1615 | } executed: } Execution Count:23 | 23 |
1616 | | - |
1617 | void QStateMachinePrivate::registerEventTransition(QEventTransition *transition) | - |
1618 | { | - |
1619 | QStateMachine * const q = q_func(); | - |
1620 | if (QEventTransitionPrivate::get(transition)->registered) partially evaluated: QEventTransitionPrivate::get(transition)->registered no Evaluation Count:0 | yes Evaluation Count:27 |
| 0-27 |
1621 | return; | 0 |
1622 | if (transition->eventType() >= QEvent::User) { evaluated: transition->eventType() >= QEvent::User yes Evaluation Count:1 | yes Evaluation Count:26 |
| 1-26 |
1623 | QMessageLogger("statemachine/qstatemachine.cpp", 1854, __PRETTY_FUNCTION__).warning("QObject event transitions are not supported for custom types"); | - |
1624 | return; executed: return; Execution Count:1 | 1 |
1625 | } | - |
1626 | QObject *object = QEventTransitionPrivate::get(transition)->object; | - |
1627 | if (!object) partially evaluated: !object no Evaluation Count:0 | yes Evaluation Count:26 |
| 0-26 |
1628 | return; | 0 |
1629 | QObjectPrivate *od = QObjectPrivate::get(object); | - |
1630 | if (!od->extraData || !od->extraData->eventFilters.contains(q)) evaluated: !od->extraData yes Evaluation Count:5 | yes Evaluation Count:21 |
evaluated: !od->extraData->eventFilters.contains(q) yes Evaluation Count:14 | yes Evaluation Count:7 |
| 5-21 |
1631 | object->installEventFilter(q); executed: object->installEventFilter(q); Execution Count:19 | 19 |
1632 | ++qobjectEvents[object][transition->eventType()]; | - |
1633 | QEventTransitionPrivate::get(transition)->registered = true; | - |
1634 | | - |
1635 | | - |
1636 | | - |
1637 | | - |
1638 | | - |
1639 | } executed: } Execution Count:26 | 26 |
1640 | | - |
1641 | void QStateMachinePrivate::unregisterEventTransition(QEventTransition *transition) | - |
1642 | { | - |
1643 | QStateMachine * const q = q_func(); | - |
1644 | if (!QEventTransitionPrivate::get(transition)->registered) partially evaluated: !QEventTransitionPrivate::get(transition)->registered no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
1645 | return; | 0 |
1646 | QObject *object = QEventTransitionPrivate::get(transition)->object; | - |
1647 | QHash<QEvent::Type, int> &events = qobjectEvents[object]; | - |
1648 | qt_noop(); | - |
1649 | if (--events[transition->eventType()] == 0) { evaluated: --events[transition->eventType()] == 0 yes Evaluation Count:19 | yes Evaluation Count:1 |
| 1-19 |
1650 | events.remove(transition->eventType()); | - |
1651 | int sum = 0; | - |
1652 | QHash<QEvent::Type, int>::const_iterator it; | - |
1653 | for (it = events.constBegin(); it != events.constEnd(); ++it) evaluated: it != events.constEnd() yes Evaluation Count:3 | yes Evaluation Count:19 |
| 3-19 |
1654 | sum += it.value(); executed: sum += it.value(); Execution Count:3 | 3 |
1655 | if (sum == 0) { evaluated: sum == 0 yes Evaluation Count:16 | yes Evaluation Count:3 |
| 3-16 |
1656 | qobjectEvents.remove(object); | - |
1657 | object->removeEventFilter(q); | - |
1658 | } executed: } Execution Count:16 | 16 |
1659 | } executed: } Execution Count:19 | 19 |
1660 | QEventTransitionPrivate::get(transition)->registered = false; | - |
1661 | } executed: } Execution Count:20 | 20 |
1662 | | - |
1663 | void QStateMachinePrivate::handleFilteredEvent(QObject *watched, QEvent *event) | - |
1664 | { | - |
1665 | if (qobjectEvents.value(watched).contains(event->type())) { evaluated: qobjectEvents.value(watched).contains(event->type()) yes Evaluation Count:25 | yes Evaluation Count:2 |
| 2-25 |
1666 | postInternalEvent(new QStateMachine::WrappedEvent(watched, handler->cloneEvent(event))); | - |
1667 | processEvents(DirectProcessing); | - |
1668 | } executed: } Execution Count:25 | 25 |
1669 | } executed: } Execution Count:27 | 27 |
1670 | | - |
1671 | | - |
1672 | void QStateMachinePrivate::handleTransitionSignal(QObject *sender, int signalIndex, | - |
1673 | void **argv) | - |
1674 | { | - |
1675 | | - |
1676 | | - |
1677 | | - |
1678 | | - |
1679 | | - |
1680 | const QMetaObject *meta = sender->metaObject(); | - |
1681 | QMetaMethod method = meta->method(signalIndex); | - |
1682 | int argc = method.parameterCount(); | - |
1683 | QList<QVariant> vargs; | - |
1684 | for (int i = 0; i < argc; ++i) { evaluated: i < argc yes Evaluation Count:8 | yes Evaluation Count:62 |
| 8-62 |
1685 | int type = method.parameterType(i); | - |
1686 | vargs.append(QVariant(type, argv[i+1])); | - |
1687 | } executed: } Execution Count:8 | 8 |
1688 | | - |
1689 | | - |
1690 | | - |
1691 | | - |
1692 | | - |
1693 | postInternalEvent(new QStateMachine::SignalEvent(sender, signalIndex, vargs)); | - |
1694 | processEvents(DirectProcessing); | - |
1695 | } executed: } Execution Count:62 | 62 |
1696 | | - |
1697 | | - |
1698 | | - |
1699 | | - |
1700 | QStateMachine::QStateMachine(QObject *parent) | - |
1701 | : QState(*new QStateMachinePrivate, 0) | - |
1702 | { | - |
1703 | | - |
1704 | | - |
1705 | setParent(parent); | - |
1706 | } executed: } Execution Count:128 | 128 |
1707 | | - |
1708 | | - |
1709 | | - |
1710 | | - |
1711 | | - |
1712 | | - |
1713 | | - |
1714 | QStateMachine::QStateMachine(QState::ChildMode childMode, QObject *parent) | - |
1715 | : QState(*new QStateMachinePrivate, 0) | - |
1716 | { | - |
1717 | QStateMachinePrivate * const d = d_func(); | - |
1718 | d->childMode = childMode; | - |
1719 | setParent(parent); | - |
1720 | } executed: } Execution Count:6 | 6 |
1721 | | - |
1722 | | - |
1723 | | - |
1724 | | - |
1725 | QStateMachine::QStateMachine(QStateMachinePrivate &dd, QObject *parent) | - |
1726 | : QState(dd, 0) | - |
1727 | { | - |
1728 | setParent(parent); | - |
1729 | } | 0 |
1730 | | - |
1731 | | - |
1732 | | - |
1733 | | - |
1734 | QStateMachine::~QStateMachine() | - |
1735 | { | - |
1736 | } | - |
1737 | QStateMachine::Error QStateMachine::error() const | - |
1738 | { | - |
1739 | const QStateMachinePrivate * const d = d_func(); | - |
1740 | return d->error; executed: return d->error; Execution Count:13 | 13 |
1741 | } | - |
1742 | | - |
1743 | | - |
1744 | | - |
1745 | | - |
1746 | QString QStateMachine::errorString() const | - |
1747 | { | - |
1748 | const QStateMachinePrivate * const d = d_func(); | - |
1749 | return d->errorString; executed: return d->errorString; Execution Count:11 | 11 |
1750 | } | - |
1751 | | - |
1752 | | - |
1753 | | - |
1754 | | - |
1755 | void QStateMachine::clearError() | - |
1756 | { | - |
1757 | QStateMachinePrivate * const d = d_func(); | - |
1758 | d->errorString.clear(); | - |
1759 | d->error = NoError; | - |
1760 | } executed: } Execution Count:1 | 1 |
1761 | | - |
1762 | | - |
1763 | | - |
1764 | | - |
1765 | | - |
1766 | | - |
1767 | QState::RestorePolicy QStateMachine::globalRestorePolicy() const | - |
1768 | { | - |
1769 | const QStateMachinePrivate * const d = d_func(); | - |
1770 | return d->globalRestorePolicy; executed: return d->globalRestorePolicy; Execution Count:1 | 1 |
1771 | } | - |
1772 | | - |
1773 | | - |
1774 | | - |
1775 | | - |
1776 | | - |
1777 | | - |
1778 | | - |
1779 | void QStateMachine::setGlobalRestorePolicy(QState::RestorePolicy restorePolicy) | - |
1780 | { | - |
1781 | QStateMachinePrivate * const d = d_func(); | - |
1782 | d->globalRestorePolicy = restorePolicy; | - |
1783 | } executed: } Execution Count:18 | 18 |
1784 | void QStateMachine::addState(QAbstractState *state) | - |
1785 | { | - |
1786 | if (!state) { partially evaluated: !state no Evaluation Count:0 | yes Evaluation Count:42 |
| 0-42 |
1787 | QMessageLogger("statemachine/qstatemachine.cpp", 2067, __PRETTY_FUNCTION__).warning("QStateMachine::addState: cannot add null state"); | - |
1788 | return; | 0 |
1789 | } | - |
1790 | if (QAbstractStatePrivate::get(state)->machine() == this) { partially evaluated: QAbstractStatePrivate::get(state)->machine() == this no Evaluation Count:0 | yes Evaluation Count:42 |
| 0-42 |
1791 | QMessageLogger("statemachine/qstatemachine.cpp", 2071, __PRETTY_FUNCTION__).warning("QStateMachine::addState: state has already been added to this machine"); | - |
1792 | return; | 0 |
1793 | } | - |
1794 | state->setParent(this); | - |
1795 | } executed: } Execution Count:42 | 42 |
1796 | | - |
1797 | | - |
1798 | | - |
1799 | | - |
1800 | | - |
1801 | | - |
1802 | | - |
1803 | void QStateMachine::removeState(QAbstractState *state) | - |
1804 | { | - |
1805 | if (!state) { | 0 |
1806 | QMessageLogger("statemachine/qstatemachine.cpp", 2086, __PRETTY_FUNCTION__).warning("QStateMachine::removeState: cannot remove null state"); | - |
1807 | return; | 0 |
1808 | } | - |
1809 | if (QAbstractStatePrivate::get(state)->machine() != this) { never evaluated: QAbstractStatePrivate::get(state)->machine() != this | 0 |
1810 | QMessageLogger("statemachine/qstatemachine.cpp", 2090, __PRETTY_FUNCTION__).warning("QStateMachine::removeState: state %p's machine (%p)" | - |
1811 | " is different from this machine (%p)", | - |
1812 | state, QAbstractStatePrivate::get(state)->machine(), this); | - |
1813 | return; | 0 |
1814 | } | - |
1815 | state->setParent(0); | - |
1816 | } | 0 |
1817 | | - |
1818 | | - |
1819 | | - |
1820 | | - |
1821 | | - |
1822 | | - |
1823 | bool QStateMachine::isRunning() const | - |
1824 | { | - |
1825 | const QStateMachinePrivate * const d = d_func(); | - |
1826 | return (d->state == QStateMachinePrivate::Running); executed: return (d->state == QStateMachinePrivate::Running); Execution Count:25 | 25 |
1827 | } | - |
1828 | void QStateMachine::start() | - |
1829 | { | - |
1830 | QStateMachinePrivate * const d = d_func(); | - |
1831 | | - |
1832 | if ((childMode() == QState::ExclusiveStates) && (initialState() == 0)) { evaluated: (childMode() == QState::ExclusiveStates) yes Evaluation Count:145 | yes Evaluation Count:1 |
evaluated: (initialState() == 0) yes Evaluation Count:2 | yes Evaluation Count:143 |
| 1-145 |
1833 | QMessageLogger("statemachine/qstatemachine.cpp", 2125, __PRETTY_FUNCTION__).warning("QStateMachine::start: No initial state set for machine. Refusing to start."); | - |
1834 | return; executed: return; Execution Count:2 | 2 |
1835 | } | - |
1836 | | - |
1837 | switch (d->state) { | - |
1838 | case QStateMachinePrivate::NotRunning: | - |
1839 | d->state = QStateMachinePrivate::Starting; | - |
1840 | QMetaObject::invokeMethod(this, "_q_start", Qt::QueuedConnection); | - |
1841 | break; executed: break; Execution Count:143 | 143 |
1842 | case QStateMachinePrivate::Starting: | - |
1843 | break; | 0 |
1844 | case QStateMachinePrivate::Running: | - |
1845 | QMessageLogger("statemachine/qstatemachine.cpp", 2137, __PRETTY_FUNCTION__).warning("QStateMachine::start(): already running"); | - |
1846 | break; executed: break; Execution Count:1 | 1 |
1847 | } | - |
1848 | } executed: } Execution Count:144 | 144 |
1849 | | - |
1850 | | - |
1851 | | - |
1852 | | - |
1853 | | - |
1854 | | - |
1855 | | - |
1856 | void QStateMachine::stop() | - |
1857 | { | - |
1858 | QStateMachinePrivate * const d = d_func(); | - |
1859 | switch (d->state) { | - |
1860 | case QStateMachinePrivate::NotRunning: | - |
1861 | break; executed: break; Execution Count:4 | 4 |
1862 | case QStateMachinePrivate::Starting: | - |
1863 | | - |
1864 | d->stop = true; | - |
1865 | break; executed: break; Execution Count:1 | 1 |
1866 | case QStateMachinePrivate::Running: | - |
1867 | d->stop = true; | - |
1868 | d->processEvents(QStateMachinePrivate::QueuedProcessing); | - |
1869 | break; executed: break; Execution Count:19 | 19 |
1870 | } | - |
1871 | } executed: } Execution Count:24 | 24 |
1872 | void QStateMachine::postEvent(QEvent *event, EventPriority priority) | - |
1873 | { | - |
1874 | QStateMachinePrivate * const d = d_func(); | - |
1875 | if (d->state != QStateMachinePrivate::Running) { evaluated: d->state != QStateMachinePrivate::Running yes Evaluation Count:2 | yes Evaluation Count:2119 |
| 2-2119 |
1876 | QMessageLogger("statemachine/qstatemachine.cpp", 2183, __PRETTY_FUNCTION__).warning("QStateMachine::postEvent: cannot post event when the state machine is not running"); | - |
1877 | return; executed: return; Execution Count:2 | 2 |
1878 | } | - |
1879 | if (!event) { partially evaluated: !event no Evaluation Count:0 | yes Evaluation Count:2119 |
| 0-2119 |
1880 | QMessageLogger("statemachine/qstatemachine.cpp", 2187, __PRETTY_FUNCTION__).warning("QStateMachine::postEvent: cannot post null event"); | - |
1881 | return; | 0 |
1882 | } | - |
1883 | | - |
1884 | | - |
1885 | | - |
1886 | switch (priority) { | - |
1887 | case NormalPriority: | - |
1888 | d->postExternalEvent(event); | - |
1889 | break; executed: break; Execution Count:2118 | 2118 |
1890 | case HighPriority: | - |
1891 | d->postInternalEvent(event); | - |
1892 | break; executed: break; Execution Count:1 | 1 |
1893 | } | - |
1894 | d->processEvents(QStateMachinePrivate::QueuedProcessing); | - |
1895 | } executed: } Execution Count:2119 | 2119 |
1896 | int QStateMachine::postDelayedEvent(QEvent *event, int delay) | - |
1897 | { | - |
1898 | QStateMachinePrivate * const d = d_func(); | - |
1899 | if (d->state != QStateMachinePrivate::Running) { partially evaluated: d->state != QStateMachinePrivate::Running no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
1900 | QMessageLogger("statemachine/qstatemachine.cpp", 2224, __PRETTY_FUNCTION__).warning("QStateMachine::postDelayedEvent: cannot post event when the state machine is not running"); | - |
1901 | return -1; never executed: return -1; | 0 |
1902 | } | - |
1903 | if (!event) { partially evaluated: !event no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
1904 | QMessageLogger("statemachine/qstatemachine.cpp", 2228, __PRETTY_FUNCTION__).warning("QStateMachine::postDelayedEvent: cannot post null event"); | - |
1905 | return -1; never executed: return -1; | 0 |
1906 | } | - |
1907 | if (delay < 0) { partially evaluated: delay < 0 no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
1908 | QMessageLogger("statemachine/qstatemachine.cpp", 2232, __PRETTY_FUNCTION__).warning("QStateMachine::postDelayedEvent: delay cannot be negative"); | - |
1909 | return -1; never executed: return -1; | 0 |
1910 | } | - |
1911 | | - |
1912 | | - |
1913 | | - |
1914 | QMutexLocker locker(&d->delayedEventsMutex); | - |
1915 | int id = d->delayedEventIdFreeList.next(); | - |
1916 | bool inMachineThread = (QThread::currentThread() == thread()); | - |
1917 | int timerId = inMachineThread ? startTimer(delay) : 0; evaluated: inMachineThread yes Evaluation Count:7 | yes Evaluation Count:2 |
| 2-7 |
1918 | if (inMachineThread && !timerId) { evaluated: inMachineThread yes Evaluation Count:7 | yes Evaluation Count:2 |
partially evaluated: !timerId no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
1919 | QMessageLogger("statemachine/qstatemachine.cpp", 2243, __PRETTY_FUNCTION__).warning("QStateMachine::postDelayedEvent: failed to start timer with interval %d", delay); | - |
1920 | d->delayedEventIdFreeList.release(id); | - |
1921 | return -1; never executed: return -1; | 0 |
1922 | } | - |
1923 | QStateMachinePrivate::DelayedEvent delayedEvent(event, timerId); | - |
1924 | d->delayedEvents.insert(id, delayedEvent); | - |
1925 | if (timerId) { evaluated: timerId yes Evaluation Count:7 | yes Evaluation Count:2 |
| 2-7 |
1926 | d->timerIdToDelayedEventId.insert(timerId, id); | - |
1927 | } else { executed: } Execution Count:7 | 7 |
1928 | qt_noop(); | - |
1929 | QMetaObject::invokeMethod(this, "_q_startDelayedEventTimer", | - |
1930 | Qt::QueuedConnection, | - |
1931 | QArgument<int >("int", id), | - |
1932 | QArgument<int >("int", delay)); | - |
1933 | } executed: } Execution Count:2 | 2 |
1934 | return id; executed: return id; Execution Count:9 | 9 |
1935 | } | - |
1936 | bool QStateMachine::cancelDelayedEvent(int id) | - |
1937 | { | - |
1938 | QStateMachinePrivate * const d = d_func(); | - |
1939 | if (d->state != QStateMachinePrivate::Running) { evaluated: d->state != QStateMachinePrivate::Running yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
1940 | QMessageLogger("statemachine/qstatemachine.cpp", 2274, __PRETTY_FUNCTION__).warning("QStateMachine::cancelDelayedEvent: the machine is not running"); | - |
1941 | return false; executed: return false; Execution Count:1 | 1 |
1942 | } | - |
1943 | QMutexLocker locker(&d->delayedEventsMutex); | - |
1944 | QStateMachinePrivate::DelayedEvent e = d->delayedEvents.take(id); | - |
1945 | if (!e.event) evaluated: !e.event yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
1946 | return false; executed: return false; Execution Count:2 | 2 |
1947 | if (e.timerId) { evaluated: e.timerId yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
1948 | d->timerIdToDelayedEventId.remove(e.timerId); | - |
1949 | bool inMachineThread = (QThread::currentThread() == thread()); | - |
1950 | if (inMachineThread) { partially evaluated: inMachineThread yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1951 | killTimer(e.timerId); | - |
1952 | d->delayedEventIdFreeList.release(id); | - |
1953 | } else { executed: } Execution Count:2 | 2 |
1954 | QMetaObject::invokeMethod(this, "_q_killDelayedEventTimer", | - |
1955 | Qt::QueuedConnection, | - |
1956 | QArgument<int >("int", id), | - |
1957 | QArgument<int >("int", e.timerId)); | - |
1958 | } | 0 |
1959 | } else { | - |
1960 | | - |
1961 | } executed: } Execution Count:1 | 1 |
1962 | delete e.event; | - |
1963 | return true; executed: return true; Execution Count:3 | 3 |
1964 | } | - |
1965 | QSet<QAbstractState*> QStateMachine::configuration() const | - |
1966 | { | - |
1967 | const QStateMachinePrivate * const d = d_func(); | - |
1968 | return d->configuration; executed: return d->configuration; Execution Count:469 | 469 |
1969 | } | - |
1970 | bool QStateMachine::event(QEvent *e) | - |
1971 | { | - |
1972 | QStateMachinePrivate * const d = d_func(); | - |
1973 | if (e->type() == QEvent::Timer) { evaluated: e->type() == QEvent::Timer yes Evaluation Count:4 | yes Evaluation Count:628 |
| 4-628 |
1974 | QTimerEvent *te = static_cast<QTimerEvent*>(e); | - |
1975 | int tid = te->timerId(); | - |
1976 | if (d->state != QStateMachinePrivate::Running) { partially evaluated: d->state != QStateMachinePrivate::Running no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
1977 | | - |
1978 | QMutexLocker locker(&d->delayedEventsMutex); | - |
1979 | qt_noop(); | - |
1980 | return true; never executed: return true; | 0 |
1981 | } | - |
1982 | d->delayedEventsMutex.lock(); | - |
1983 | int id = d->timerIdToDelayedEventId.take(tid); | - |
1984 | QStateMachinePrivate::DelayedEvent ee = d->delayedEvents.take(id); | - |
1985 | if (ee.event != 0) { partially evaluated: ee.event != 0 yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
1986 | qt_noop(); | - |
1987 | killTimer(tid); | - |
1988 | d->delayedEventIdFreeList.release(id); | - |
1989 | d->delayedEventsMutex.unlock(); | - |
1990 | d->postExternalEvent(ee.event); | - |
1991 | d->processEvents(QStateMachinePrivate::DirectProcessing); | - |
1992 | return true; executed: return true; Execution Count:4 | 4 |
1993 | } else { | - |
1994 | d->delayedEventsMutex.unlock(); | - |
1995 | } | 0 |
1996 | } | - |
1997 | return QState::event(e); executed: return QState::event(e); Execution Count:628 | 628 |
1998 | } | - |
1999 | | - |
2000 | | - |
2001 | | - |
2002 | | - |
2003 | | - |
2004 | bool QStateMachine::eventFilter(QObject *watched, QEvent *event) | - |
2005 | { | - |
2006 | QStateMachinePrivate * const d = d_func(); | - |
2007 | d->handleFilteredEvent(watched, event); | - |
2008 | return false; executed: return false; Execution Count:27 | 27 |
2009 | } | - |
2010 | void QStateMachine::beginSelectTransitions(QEvent *event) | - |
2011 | { | - |
2012 | (void)event;; | - |
2013 | } executed: } Execution Count:4709 | 4709 |
2014 | void QStateMachine::endSelectTransitions(QEvent *event) | - |
2015 | { | - |
2016 | (void)event;; | - |
2017 | } executed: } Execution Count:4709 | 4709 |
2018 | void QStateMachine::beginMicrostep(QEvent *event) | - |
2019 | { | - |
2020 | (void)event;; | - |
2021 | } executed: } Execution Count:1224 | 1224 |
2022 | void QStateMachine::endMicrostep(QEvent *event) | - |
2023 | { | - |
2024 | (void)event;; | - |
2025 | } executed: } Execution Count:1224 | 1224 |
2026 | | - |
2027 | | - |
2028 | | - |
2029 | | - |
2030 | | - |
2031 | void QStateMachine::onEntry(QEvent *event) | - |
2032 | { | - |
2033 | start(); | - |
2034 | QState::onEntry(event); | - |
2035 | } executed: } Execution Count:3 | 3 |
2036 | | - |
2037 | | - |
2038 | | - |
2039 | | - |
2040 | | - |
2041 | | - |
2042 | void QStateMachine::onExit(QEvent *event) | - |
2043 | { | - |
2044 | stop(); | - |
2045 | QState::onExit(event); | - |
2046 | } executed: } Execution Count:3 | 3 |
2047 | | - |
2048 | | - |
2049 | | - |
2050 | | - |
2051 | | - |
2052 | | - |
2053 | bool QStateMachine::isAnimated() const | - |
2054 | { | - |
2055 | const QStateMachinePrivate * const d = d_func(); | - |
2056 | return d->animated; executed: return d->animated; Execution Count:3 | 3 |
2057 | } | - |
2058 | | - |
2059 | | - |
2060 | | - |
2061 | | - |
2062 | void QStateMachine::setAnimated(bool enabled) | - |
2063 | { | - |
2064 | QStateMachinePrivate * const d = d_func(); | - |
2065 | d->animated = enabled; | - |
2066 | } executed: } Execution Count:2 | 2 |
2067 | | - |
2068 | | - |
2069 | | - |
2070 | | - |
2071 | void QStateMachine::addDefaultAnimation(QAbstractAnimation *animation) | - |
2072 | { | - |
2073 | QStateMachinePrivate * const d = d_func(); | - |
2074 | d->defaultAnimations.append(animation); | - |
2075 | } executed: } Execution Count:9 | 9 |
2076 | | - |
2077 | | - |
2078 | | - |
2079 | | - |
2080 | QList<QAbstractAnimation*> QStateMachine::defaultAnimations() const | - |
2081 | { | - |
2082 | const QStateMachinePrivate * const d = d_func(); | - |
2083 | return d->defaultAnimations; executed: return d->defaultAnimations; Execution Count:10 | 10 |
2084 | } | - |
2085 | | - |
2086 | | - |
2087 | | - |
2088 | | - |
2089 | void QStateMachine::removeDefaultAnimation(QAbstractAnimation *animation) | - |
2090 | { | - |
2091 | QStateMachinePrivate * const d = d_func(); | - |
2092 | d->defaultAnimations.removeAll(animation); | - |
2093 | } executed: } Execution Count:3 | 3 |
2094 | | - |
2095 | | - |
2096 | | - |
2097 | | - |
2098 | | - |
2099 | struct qt_meta_stringdata_QSignalEventGenerator_t { | - |
2100 | QByteArrayData data[3]; | - |
2101 | char stringdata[32]; | - |
2102 | }; | - |
2103 | | - |
2104 | | - |
2105 | | - |
2106 | | - |
2107 | | - |
2108 | static const qt_meta_stringdata_QSignalEventGenerator_t qt_meta_stringdata_QSignalEventGenerator = { | - |
2109 | { | - |
2110 | { { { (-1) } }, 21, 0, 0, __builtin_offsetof (qt_meta_stringdata_QSignalEventGenerator_t, stringdata) + 0 - 0 * sizeof(QByteArrayData) }, | - |
2111 | { { { (-1) } }, 7, 0, 0, __builtin_offsetof (qt_meta_stringdata_QSignalEventGenerator_t, stringdata) + 22 - 1 * sizeof(QByteArrayData) }, | - |
2112 | { { { (-1) } }, 0, 0, 0, __builtin_offsetof (qt_meta_stringdata_QSignalEventGenerator_t, stringdata) + 30 - 2 * sizeof(QByteArrayData) } | - |
2113 | }, | - |
2114 | "QSignalEventGenerator\0execute\0\0" | - |
2115 | }; | - |
2116 | | - |
2117 | | - |
2118 | static const uint qt_meta_data_QSignalEventGenerator[] = { | - |
2119 | | - |
2120 | | - |
2121 | 7, | - |
2122 | 0, | - |
2123 | 0, 0, | - |
2124 | 1, 14, | - |
2125 | 0, 0, | - |
2126 | 0, 0, | - |
2127 | 0, 0, | - |
2128 | 0, | - |
2129 | 0, | - |
2130 | | - |
2131 | | - |
2132 | 1, 0, 19, 2, 0x0a, | - |
2133 | | - |
2134 | | - |
2135 | QMetaType::Void, | - |
2136 | | - |
2137 | 0 | - |
2138 | }; | - |
2139 | | - |
2140 | void QSignalEventGenerator::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) | - |
2141 | { | - |
2142 | if (_c == QMetaObject::InvokeMetaMethod) { | - |
2143 | qt_noop(); | - |
2144 | QSignalEventGenerator *_t = static_cast<QSignalEventGenerator *>(_o); | - |
2145 | switch (_id) { | - |
2146 | case 0: _t->execute(_a); break; | - |
2147 | default: ; | - |
2148 | } | - |
2149 | } | - |
2150 | (void)_a;; | - |
2151 | } | - |
2152 | | - |
2153 | const QMetaObject QSignalEventGenerator::staticMetaObject = { | - |
2154 | { &QObject::staticMetaObject, qt_meta_stringdata_QSignalEventGenerator.data, | - |
2155 | qt_meta_data_QSignalEventGenerator, qt_static_metacall, 0, 0 } | - |
2156 | }; | - |
2157 | | - |
2158 | const QMetaObject *QSignalEventGenerator::metaObject() const | - |
2159 | { | - |
2160 | return &staticMetaObject; | - |
2161 | } | - |
2162 | | - |
2163 | void *QSignalEventGenerator::qt_metacast(const char *_clname) | - |
2164 | { | - |
2165 | if (!_clname) return 0; | - |
2166 | if (!strcmp(_clname, qt_meta_stringdata_QSignalEventGenerator.stringdata)) | - |
2167 | return static_cast<void*>(const_cast< QSignalEventGenerator*>(this)); | - |
2168 | return QObject::qt_metacast(_clname); | - |
2169 | } | - |
2170 | | - |
2171 | int QSignalEventGenerator::qt_metacall(QMetaObject::Call _c, int _id, void **_a) | - |
2172 | { | - |
2173 | _id = QObject::qt_metacall(_c, _id, _a); | - |
2174 | if (_id < 0) | - |
2175 | return _id; | - |
2176 | if (_c == QMetaObject::InvokeMetaMethod) { | - |
2177 | if (_id < 1) | - |
2178 | qt_static_metacall(this, _c, _id, _a); | - |
2179 | _id -= 1; | - |
2180 | } | - |
2181 | return _id; | - |
2182 | } | - |
2183 | | - |
2184 | | - |
2185 | void QSignalEventGenerator::execute(void **_a) | - |
2186 | { | - |
2187 | int signalIndex = senderSignalIndex(); | - |
2188 | qt_noop(); | - |
2189 | QStateMachine *machine = qobject_cast<QStateMachine*>(parent()); | - |
2190 | QStateMachinePrivate::get(machine)->handleTransitionSignal(sender(), signalIndex, _a); | - |
2191 | } executed: } Execution Count:62 | 62 |
2192 | | - |
2193 | QSignalEventGenerator::QSignalEventGenerator(QStateMachine *parent) | - |
2194 | : QObject(parent) | - |
2195 | { | - |
2196 | } executed: } Execution Count:37 | 37 |
2197 | QStateMachine::SignalEvent::SignalEvent(QObject *sender, int signalIndex, | - |
2198 | const QList<QVariant> &arguments) | - |
2199 | : QEvent(QEvent::StateMachineSignal), m_sender(sender), | - |
2200 | m_signalIndex(signalIndex), m_arguments(arguments) | - |
2201 | { | - |
2202 | } executed: } Execution Count:63 | 63 |
2203 | | - |
2204 | | - |
2205 | | - |
2206 | | - |
2207 | QStateMachine::SignalEvent::~SignalEvent() | - |
2208 | { | - |
2209 | } | - |
2210 | QStateMachine::WrappedEvent::WrappedEvent(QObject *object, QEvent *event) | - |
2211 | : QEvent(QEvent::StateMachineWrapped), m_object(object), m_event(event) | - |
2212 | { | - |
2213 | } executed: } Execution Count:26 | 26 |
2214 | | - |
2215 | | - |
2216 | | - |
2217 | | - |
2218 | QStateMachine::WrappedEvent::~WrappedEvent() | - |
2219 | { | - |
2220 | delete m_event; | - |
2221 | } executed: } Execution Count:25 | 25 |
2222 | | - |
2223 | | - |
2224 | | - |
| | |