kernel/qsocketnotifier.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7class QSocketNotifierPrivate : public QObjectPrivate -
8{ -
9 inline QSocketNotifier* q_func() { return static_cast<QSocketNotifier *>(q_ptr); } inline const QSocketNotifier* q_func() const { return static_cast<const QSocketNotifier *>(q_ptr); } friend class QSocketNotifier; -
10public: -
11 qintptr sockfd; -
12 QSocketNotifier::Type sntype; -
13 bool snenabled; -
14}; -
15QSocketNotifier::QSocketNotifier(qintptr socket, Type type, QObject *parent) -
16 : QObject(*new QSocketNotifierPrivate, parent) -
17{ -
18 QSocketNotifierPrivate * const d = d_func(); -
19 if (socket < 0)
partially evaluated: socket < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17761
0-17761
20 QMessageLogger("kernel/qsocketnotifier.cpp", 185, __PRETTY_FUNCTION__).warning("QSocketNotifier: Invalid socket specified");
never executed: QMessageLogger("kernel/qsocketnotifier.cpp", 185, __PRETTY_FUNCTION__).warning("QSocketNotifier: Invalid socket specified");
0
21 d->sockfd = socket; -
22 d->sntype = type; -
23 d->snenabled = true; -
24 -
25 if (!d->threadData->eventDispatcher) {
partially evaluated: !d->threadData->eventDispatcher
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17761
0-17761
26 QMessageLogger("kernel/qsocketnotifier.cpp", 191, __PRETTY_FUNCTION__).warning("QSocketNotifier: Can only be used with threads started with QThread"); -
27 } else {
never executed: }
0
28 d->threadData->eventDispatcher->registerSocketNotifier(this); -
29 }
executed: }
Execution Count:17760
17760
30} -
31 -
32 -
33 -
34 -
35 -
36QSocketNotifier::~QSocketNotifier() -
37{ -
38 setEnabled(false); -
39}
executed: }
Execution Count:18312
18312
40qintptr QSocketNotifier::socket() const -
41{ -
42 const QSocketNotifierPrivate * const d = d_func(); -
43 return d->sockfd;
executed: return d->sockfd;
Execution Count:43694
43694
44} -
45 -
46 -
47 -
48 -
49 -
50 -
51QSocketNotifier::Type QSocketNotifier::type() const -
52{ -
53 const QSocketNotifierPrivate * const d = d_func(); -
54 return d->sntype;
executed: return d->sntype;
Execution Count:43696
43696
55} -
56 -
57 -
58 -
59 -
60 -
61 -
62bool QSocketNotifier::isEnabled() const -
63{ -
64 const QSocketNotifierPrivate * const d = d_func(); -
65 return d->snenabled;
executed: return d->snenabled;
Execution Count:461140
461140
66} -
67void QSocketNotifier::setEnabled(bool enable) -
68{ -
69 QSocketNotifierPrivate * const d = d_func(); -
70 if (d->sockfd < 0)
partially evaluated: d->sockfd < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1111499
0-1111499
71 return;
never executed: return;
0
72 if (d->snenabled == enable)
evaluated: d->snenabled == enable
TRUEFALSE
yes
Evaluation Count:1041502
yes
Evaluation Count:69999
69999-1041502
73 return;
executed: return;
Execution Count:1041502
1041502
74 d->snenabled = enable; -
75 -
76 if (!d->threadData->eventDispatcher)
evaluated: !d->threadData->eventDispatcher
TRUEFALSE
yes
Evaluation Count:503
yes
Evaluation Count:69502
503-69502
77 return;
executed: return;
Execution Count:503
503
78 if (d->snenabled)
evaluated: d->snenabled
TRUEFALSE
yes
Evaluation Count:25940
yes
Evaluation Count:43565
25940-43565
79 d->threadData->eventDispatcher->registerSocketNotifier(this);
executed: d->threadData->eventDispatcher->registerSocketNotifier(this);
Execution Count:25939
25939
80 else -
81 d->threadData->eventDispatcher->unregisterSocketNotifier(this);
executed: d->threadData->eventDispatcher->unregisterSocketNotifier(this);
Execution Count:43564
43564
82} -
83 -
84 -
85 -
86 -
87bool QSocketNotifier::event(QEvent *e) -
88{ -
89 QSocketNotifierPrivate * const d = d_func(); -
90 -
91 -
92 if (e->type() == QEvent::ThreadChange) {
evaluated: e->type() == QEvent::ThreadChange
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:2290
9-2290
93 if (d->snenabled) {
evaluated: d->snenabled
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:2
2-7
94 QMetaObject::invokeMethod(this, "setEnabled", Qt::QueuedConnection, -
95 QArgument<bool >("bool", d->snenabled)); -
96 setEnabled(false); -
97 }
executed: }
Execution Count:7
7
98 }
executed: }
Execution Count:9
9
99 QObject::event(e); -
100 if ((e->type() == QEvent::SockAct) || (e->type() == QEvent::SockClose)) {
evaluated: (e->type() == QEvent::SockAct)
TRUEFALSE
yes
Evaluation Count:2039
yes
Evaluation Count:261
partially evaluated: (e->type() == QEvent::SockClose)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:261
0-2039
101 activated(d->sockfd, QPrivateSignal()); -
102 return true;
executed: return true;
Execution Count:2038
2038
103 } -
104 return false;
executed: return false;
Execution Count:261
261
105} -
106 -
107 -
108 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial