Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/statemachine/qsignaltransition.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | QSignalTransitionPrivate::QSignalTransitionPrivate() | - | ||||||||||||||||||
7 | { | - | ||||||||||||||||||
8 | sender = 0; | - | ||||||||||||||||||
9 | signalIndex = -1; | - | ||||||||||||||||||
10 | } executed 74 times by 2 tests: end of block Executed by:
| 74 | ||||||||||||||||||
11 | - | |||||||||||||||||||
12 | void QSignalTransitionPrivate::unregister() | - | ||||||||||||||||||
13 | { | - | ||||||||||||||||||
14 | QSignalTransition * const q = q_func(); | - | ||||||||||||||||||
15 | if ((
| 0-100010 | ||||||||||||||||||
16 | return; executed 100010 times by 1 test: return; Executed by:
| 100010 | ||||||||||||||||||
17 | QStateMachinePrivate::get(machine())->unregisterSignalTransition(q); | - | ||||||||||||||||||
18 | } executed 100003 times by 1 test: end of block Executed by:
| 100003 | ||||||||||||||||||
19 | - | |||||||||||||||||||
20 | void QSignalTransitionPrivate::maybeRegister() | - | ||||||||||||||||||
21 | { | - | ||||||||||||||||||
22 | QSignalTransition * const q = q_func(); | - | ||||||||||||||||||
23 | if (QStateMachine *mach = machine()
| 71-200010 | ||||||||||||||||||
24 | QStateMachinePrivate::get(mach)->maybeRegisterSignalTransition(q); executed 200010 times by 2 tests: QStateMachinePrivate::get(mach)->maybeRegisterSignalTransition(q); Executed by:
| 200010 | ||||||||||||||||||
25 | } executed 200081 times by 2 tests: end of block Executed by:
| 200081 | ||||||||||||||||||
26 | - | |||||||||||||||||||
27 | - | |||||||||||||||||||
28 | - | |||||||||||||||||||
29 | - | |||||||||||||||||||
30 | QSignalTransition::QSignalTransition(QState *sourceState) | - | ||||||||||||||||||
31 | : QAbstractTransition(*new QSignalTransitionPrivate, sourceState) | - | ||||||||||||||||||
32 | { | - | ||||||||||||||||||
33 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||
34 | - | |||||||||||||||||||
35 | - | |||||||||||||||||||
36 | - | |||||||||||||||||||
37 | - | |||||||||||||||||||
38 | - | |||||||||||||||||||
39 | QSignalTransition::QSignalTransition(const QObject *sender, const char *signal, | - | ||||||||||||||||||
40 | QState *sourceState) | - | ||||||||||||||||||
41 | : QAbstractTransition(*new QSignalTransitionPrivate, sourceState) | - | ||||||||||||||||||
42 | { | - | ||||||||||||||||||
43 | QSignalTransitionPrivate * const d = d_func(); | - | ||||||||||||||||||
44 | d->sender = sender; | - | ||||||||||||||||||
45 | d->signal = signal; | - | ||||||||||||||||||
46 | d->maybeRegister(); | - | ||||||||||||||||||
47 | } executed 68 times by 2 tests: end of block Executed by:
| 68 | ||||||||||||||||||
48 | - | |||||||||||||||||||
49 | - | |||||||||||||||||||
50 | - | |||||||||||||||||||
51 | - | |||||||||||||||||||
52 | QSignalTransition::~QSignalTransition() | - | ||||||||||||||||||
53 | { | - | ||||||||||||||||||
54 | } | - | ||||||||||||||||||
55 | - | |||||||||||||||||||
56 | - | |||||||||||||||||||
57 | - | |||||||||||||||||||
58 | - | |||||||||||||||||||
59 | QObject *QSignalTransition::senderObject() const | - | ||||||||||||||||||
60 | { | - | ||||||||||||||||||
61 | const QSignalTransitionPrivate * const d = d_func(); | - | ||||||||||||||||||
62 | return executed 161 times by 2 tests: const_cast<QObject *>(d->sender);return const_cast<QObject *>(d->sender); Executed by:
executed 161 times by 2 tests: return const_cast<QObject *>(d->sender); Executed by:
| 161 | ||||||||||||||||||
63 | } | - | ||||||||||||||||||
64 | - | |||||||||||||||||||
65 | - | |||||||||||||||||||
66 | - | |||||||||||||||||||
67 | - | |||||||||||||||||||
68 | void QSignalTransition::setSenderObject(const QObject *sender) | - | ||||||||||||||||||
69 | { | - | ||||||||||||||||||
70 | QSignalTransitionPrivate * const d = d_func(); | - | ||||||||||||||||||
71 | if (sender == d->sender
| 0-199230 | ||||||||||||||||||
72 | return; never executed: return; | 0 | ||||||||||||||||||
73 | d->unregister(); | - | ||||||||||||||||||
74 | d->sender = sender; | - | ||||||||||||||||||
75 | d->maybeRegister(); | - | ||||||||||||||||||
76 | senderObjectChanged(QPrivateSignal()); | - | ||||||||||||||||||
77 | } executed 200004 times by 1 test: end of block Executed by:
| 200004 | ||||||||||||||||||
78 | - | |||||||||||||||||||
79 | - | |||||||||||||||||||
80 | - | |||||||||||||||||||
81 | - | |||||||||||||||||||
82 | QByteArray QSignalTransition::signal() const | - | ||||||||||||||||||
83 | { | - | ||||||||||||||||||
84 | const QSignalTransitionPrivate * const d = d_func(); | - | ||||||||||||||||||
85 | return executed 10 times by 1 test: d->signal;return d->signal; Executed by:
executed 10 times by 1 test: return d->signal; Executed by:
| 10 | ||||||||||||||||||
86 | } | - | ||||||||||||||||||
87 | - | |||||||||||||||||||
88 | - | |||||||||||||||||||
89 | - | |||||||||||||||||||
90 | - | |||||||||||||||||||
91 | void QSignalTransition::setSignal(const QByteArray &signal) | - | ||||||||||||||||||
92 | { | - | ||||||||||||||||||
93 | QSignalTransitionPrivate * const d = d_func(); | - | ||||||||||||||||||
94 | if (signal == d->signal
| 0-9 | ||||||||||||||||||
95 | return; never executed: return; | 0 | ||||||||||||||||||
96 | d->unregister(); | - | ||||||||||||||||||
97 | d->signal = signal; | - | ||||||||||||||||||
98 | d->maybeRegister(); | - | ||||||||||||||||||
99 | signalChanged(QPrivateSignal()); | - | ||||||||||||||||||
100 | } executed 9 times by 1 test: end of block Executed by:
| 9 | ||||||||||||||||||
101 | bool QSignalTransition::eventTest(QEvent *event) | - | ||||||||||||||||||
102 | { | - | ||||||||||||||||||
103 | const QSignalTransitionPrivate * const d = d_func(); | - | ||||||||||||||||||
104 | if (event->type() == QEvent::StateMachineSignal
| 89-2203 | ||||||||||||||||||
105 | if (d->signalIndex == -1
| 0-89 | ||||||||||||||||||
106 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||
107 | QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(event); | - | ||||||||||||||||||
108 | return executed 89 times by 2 tests: (return (se->sender() == d->sender) && (se->signalIndex() == d->signalIndex); Executed by:
executed 89 times by 2 tests: return (se->sender() == d->sender) && (se->signalIndex() == d->signalIndex); Executed by:
| 9-89 | ||||||||||||||||||
109 | && (
executed 89 times by 2 tests: return (se->sender() == d->sender) && (se->signalIndex() == d->signalIndex); Executed by:
| 3-89 | ||||||||||||||||||
110 | } | - | ||||||||||||||||||
111 | return executed 2203 times by 2 tests: false;return false; Executed by:
executed 2203 times by 2 tests: return false; Executed by:
| 2203 | ||||||||||||||||||
112 | } | - | ||||||||||||||||||
113 | - | |||||||||||||||||||
114 | - | |||||||||||||||||||
115 | - | |||||||||||||||||||
116 | - | |||||||||||||||||||
117 | void QSignalTransition::onTransition(QEvent *event) | - | ||||||||||||||||||
118 | { | - | ||||||||||||||||||
119 | (void)event;; | - | ||||||||||||||||||
120 | } executed 71 times by 2 tests: end of block Executed by:
| 71 | ||||||||||||||||||
121 | - | |||||||||||||||||||
122 | - | |||||||||||||||||||
123 | - | |||||||||||||||||||
124 | - | |||||||||||||||||||
125 | bool QSignalTransition::event(QEvent *e) | - | ||||||||||||||||||
126 | { | - | ||||||||||||||||||
127 | return executed 2 times by 1 test: QAbstractTransition::event(e);return QAbstractTransition::event(e); Executed by:
executed 2 times by 1 test: return QAbstractTransition::event(e); Executed by:
| 2 | ||||||||||||||||||
128 | } | - | ||||||||||||||||||
129 | void QSignalTransitionPrivate::callOnTransition(QEvent *e) | - | ||||||||||||||||||
130 | { | - | ||||||||||||||||||
131 | QSignalTransition * const q = q_func(); | - | ||||||||||||||||||
132 | - | |||||||||||||||||||
133 | if (e->type() == QEvent::StateMachineSignal
| 0-71 | ||||||||||||||||||
134 | QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent *>(e); | - | ||||||||||||||||||
135 | int savedSignalIndex = se->m_signalIndex; | - | ||||||||||||||||||
136 | se->m_signalIndex = originalSignalIndex; | - | ||||||||||||||||||
137 | q->onTransition(e); | - | ||||||||||||||||||
138 | se->m_signalIndex = savedSignalIndex; | - | ||||||||||||||||||
139 | } executed 71 times by 2 tests: else {end of block Executed by:
| 71 | ||||||||||||||||||
140 | q->onTransition(e); | - | ||||||||||||||||||
141 | } never executed: end of block | 0 | ||||||||||||||||||
142 | } | - | ||||||||||||||||||
143 | - | |||||||||||||||||||
144 | - | |||||||||||||||||||
145 | - | |||||||||||||||||||
Switch to Source code | Preprocessed file |