qdbusservicewatcher.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8static QString *busService() { static QGlobalStatic<QString > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QString *x = new QString (QLatin1String("org.freedesktop.DBus")); if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QString > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:7
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-7
9static QString *busInterface() { static QGlobalStatic<QString > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QString *x = new QString (QLatin1String("org.freedesktop.DBus")); if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QString > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:7
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-7
10static QString *signalName() { static QGlobalStatic<QString > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QString *x = new QString (QLatin1String("NameOwnerChanged")); if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QString > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
never executed: delete x;
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
executed: return thisGlobalStatic.pointer.load();
Execution Count:7
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-7
11 -
12class QDBusServiceWatcherPrivate: public QObjectPrivate -
13{ -
14 inline QDBusServiceWatcher* q_func() { return static_cast<QDBusServiceWatcher *>(q_ptr); } inline const QDBusServiceWatcher* q_func() const { return static_cast<const QDBusServiceWatcher *>(q_ptr); } friend class QDBusServiceWatcher; -
15public: -
16 QDBusServiceWatcherPrivate(const QDBusConnection &c, QDBusServiceWatcher::WatchMode wm) -
17 : connection(c), watchMode(wm) -
18 { -
19 }
executed: }
Execution Count:5
5
20 -
21 QStringList servicesWatched; -
22 QDBusConnection connection; -
23 QDBusServiceWatcher::WatchMode watchMode; -
24 -
25 void _q_serviceOwnerChanged(const QString &, const QString &, const QString &); -
26 void setConnection(const QStringList &services, const QDBusConnection &c, QDBusServiceWatcher::WatchMode watchMode); -
27 -
28 QStringList matchArgsForService(const QString &service); -
29 void addService(const QString &service); -
30 void removeService(const QString &service); -
31}; -
32 -
33void QDBusServiceWatcherPrivate::_q_serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner) -
34{ -
35 QDBusServiceWatcher * const q = q_func(); -
36 q->serviceOwnerChanged(service, oldOwner, newOwner); -
37 if (oldOwner.isEmpty())
evaluated: oldOwner.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:3
3-5
38 q->serviceRegistered(service);
executed: q->serviceRegistered(service);
Execution Count:5
5
39 else if (newOwner.isEmpty())
partially evaluated: newOwner.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
40 q->serviceUnregistered(service);
executed: q->serviceUnregistered(service);
Execution Count:3
3
41} -
42 -
43void QDBusServiceWatcherPrivate::setConnection(const QStringList &s, const QDBusConnection &c, QDBusServiceWatcher::WatchMode wm) -
44{ -
45 if (connection.isConnected()) {
partially evaluated: connection.isConnected()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
46 -
47 for (QForeachContainer<__typeof__(servicesWatched)> _container_(servicesWatched); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &s = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
48 removeService(s);
executed: removeService(s);
Execution Count:1
1
49 }
executed: }
Execution Count:6
6
50 -
51 connection = c; -
52 watchMode = wm; -
53 servicesWatched = s; -
54 -
55 if (connection.isConnected()) {
partially evaluated: connection.isConnected()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
56 -
57 for (QForeachContainer<__typeof__(servicesWatched)> _container_(servicesWatched); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QString &s = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
58 addService(s);
executed: addService(s);
Execution Count:6
6
59 }
executed: }
Execution Count:6
6
60}
executed: }
Execution Count:6
6
61 -
62QStringList QDBusServiceWatcherPrivate::matchArgsForService(const QString &service) -
63{ -
64 QStringList matchArgs; -
65 matchArgs << service; -
66 -
67 switch (watchMode) { -
68 case QDBusServiceWatcher::WatchForOwnerChange: -
69 break;
executed: break;
Execution Count:1
1
70 -
71 case QDBusServiceWatcher::WatchForRegistration: -
72 matchArgs << QString::fromLatin1("", 0); -
73 break;
executed: break;
Execution Count:4
4
74 -
75 case QDBusServiceWatcher::WatchForUnregistration: -
76 matchArgs << QString() << QString::fromLatin1("", 0); -
77 break;
executed: break;
Execution Count:2
2
78 } -
79 return matchArgs;
executed: return matchArgs;
Execution Count:7
7
80} -
81 -
82void QDBusServiceWatcherPrivate::addService(const QString &service) -
83{ -
84 QStringList matchArgs = matchArgsForService(service); -
85 connection.connect(*busService(), QString(), *busInterface(), *signalName(), -
86 matchArgs, QString(), q_func(), -
87 "1""_q_serviceOwnerChanged(QString,QString,QString)"); -
88}
executed: }
Execution Count:6
6
89 -
90void QDBusServiceWatcherPrivate::removeService(const QString &service) -
91{ -
92 QStringList matchArgs = matchArgsForService(service); -
93 connection.disconnect(*busService(), QString(), *busInterface(), *signalName(), -
94 matchArgs, QString(), q_func(), -
95 "1""_q_serviceOwnerChanged(QString,QString,QString)"); -
96}
executed: }
Execution Count:1
1
97QDBusServiceWatcher::QDBusServiceWatcher(QObject *parent) -
98 : QObject(*new QDBusServiceWatcherPrivate(QDBusConnection(QString()), WatchForOwnerChange), parent) -
99{ -
100}
never executed: }
0
101QDBusServiceWatcher::QDBusServiceWatcher(const QString &service, const QDBusConnection &connection, WatchMode watchMode, QObject *parent) -
102 : QObject(*new QDBusServiceWatcherPrivate(connection, watchMode), parent) -
103{ -
104 d_func()->setConnection(QStringList() << service, connection, watchMode); -
105}
executed: }
Execution Count:5
5
106 -
107 -
108 -
109 -
110 -
111QDBusServiceWatcher::~QDBusServiceWatcher() -
112{ -
113} -
114 -
115 -
116 -
117 -
118 -
119 -
120QStringList QDBusServiceWatcher::watchedServices() const -
121{ -
122 return d_func()->servicesWatched;
never executed: return d_func()->servicesWatched;
0
123} -
124void QDBusServiceWatcher::setWatchedServices(const QStringList &services) -
125{ -
126 QDBusServiceWatcherPrivate * const d = d_func(); -
127 if (services == d->servicesWatched)
never evaluated: services == d->servicesWatched
0
128 return;
never executed: return;
0
129 d->setConnection(services, d->connection, d->watchMode); -
130}
never executed: }
0
131 -
132 -
133 -
134 -
135 -
136 -
137void QDBusServiceWatcher::addWatchedService(const QString &newService) -
138{ -
139 QDBusServiceWatcherPrivate * const d = d_func(); -
140 if (d->servicesWatched.contains(newService))
never evaluated: d->servicesWatched.contains(newService)
0
141 return;
never executed: return;
0
142 d->addService(newService); -
143 d->servicesWatched << newService; -
144}
never executed: }
0
145bool QDBusServiceWatcher::removeWatchedService(const QString &service) -
146{ -
147 QDBusServiceWatcherPrivate * const d = d_func(); -
148 d->removeService(service); -
149 return d->servicesWatched.removeOne(service);
never executed: return d->servicesWatched.removeOne(service);
0
150} -
151 -
152QDBusServiceWatcher::WatchMode QDBusServiceWatcher::watchMode() const -
153{ -
154 return d_func()->watchMode;
never executed: return d_func()->watchMode;
0
155} -
156 -
157void QDBusServiceWatcher::setWatchMode(WatchMode mode) -
158{ -
159 QDBusServiceWatcherPrivate * const d = d_func(); -
160 if (mode == d->watchMode)
partially evaluated: mode == d->watchMode
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
161 return;
never executed: return;
0
162 d->setConnection(d->servicesWatched, d->connection, mode); -
163}
executed: }
Execution Count:1
1
164 -
165 -
166 -
167 -
168 -
169 -
170QDBusConnection QDBusServiceWatcher::connection() const -
171{ -
172 return d_func()->connection;
never executed: return d_func()->connection;
0
173} -
174void QDBusServiceWatcher::setConnection(const QDBusConnection &connection) -
175{ -
176 QDBusServiceWatcherPrivate * const d = d_func(); -
177 if (connection.name() == d->connection.name())
never evaluated: connection.name() == d->connection.name()
0
178 return;
never executed: return;
0
179 d->setConnection(d->servicesWatched, connection, d->watchMode); -
180}
never executed: }
0
181 -
182 -
183 -
184 -
185 -
186 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial