qdbusservicewatcher.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/dbus/qdbusservicewatcher.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8class QDBusServiceWatcherPrivate: public QObjectPrivate-
9{-
10 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;-
11public:-
12 QDBusServiceWatcherPrivate(const QDBusConnection &c, QDBusServiceWatcher::WatchMode wm)-
13 : connection(c), watchMode(wm)-
14 {-
15 }-
16-
17 QStringList servicesWatched;-
18 QDBusConnection connection;-
19 QDBusServiceWatcher::WatchMode watchMode;-
20-
21 void _q_serviceOwnerChanged(const QString &, const QString &, const QString &);-
22 void setConnection(const QStringList &services, const QDBusConnection &c, QDBusServiceWatcher::WatchMode watchMode);-
23-
24 void addService(const QString &service);-
25 void removeService(const QString &service);-
26};-
27-
28void QDBusServiceWatcherPrivate::_q_serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner)-
29{-
30 QDBusServiceWatcher * const q = q_func();-
31 q->serviceOwnerChanged(service, oldOwner, newOwner);-
32 if (oldOwner.isEmpty())-
33 q->serviceRegistered(service);-
34 else if (newOwner.isEmpty())-
35 q->serviceUnregistered(service);-
36}-
37-
38void QDBusServiceWatcherPrivate::setConnection(const QStringList &s, const QDBusConnection &c, QDBusServiceWatcher::WatchMode wm)-
39{-
40 if (connection.isConnected()
connection.isConnected()Description
TRUEevaluated 818 times by 155 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • ...
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qdbusservicewatcher - unknown status
) {
6-818
41-
42 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(servicesWatched)>::type> _container_((servicesWatched)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &s = *_container_.i; _container_.control; _container_.control = 0): qAsConst(servicesWatched))-
43 removeService(s);
executed 4 times by 1 test: removeService(s);
Executed by:
  • tst_qdbusservicewatcher - unknown status
4
44 }
executed 818 times by 155 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • ...
818
45-
46 connection = c;-
47 watchMode = wm;-
48 servicesWatched = s;-
49-
50 if (connection.isConnected()
connection.isConnected()Description
TRUEevaluated 819 times by 155 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • ...
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_qdbusservicewatcher - unknown status
) {
5-819
51-
52 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(servicesWatched)>::type> _container_((servicesWatched)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1)for (const QString &s = *_container_.i; _container_.control; _container_.control = 0): qAsConst(servicesWatched))-
53 addService(s);
executed 819 times by 155 tests: addService(s);
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • ...
819
54 }
executed 819 times by 155 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • ...
819
55}
executed 824 times by 155 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDesktopWidget
  • ...
824
56-
57void QDBusServiceWatcherPrivate::addService(const QString &service)-
58{-
59 QDBusConnectionPrivate *d = QDBusConnectionPrivate::d(connection);-
60 if (d && d->shouldWatchService(service))-
61 d->watchService(service, watchMode, q_func(), qFlagLocation("1""_q_serviceOwnerChanged(QString,QString,QString)" "\0" __FILE__ ":" "100""106"));-
62}-
63-
64void QDBusServiceWatcherPrivate::removeService(const QString &service)-
65{-
66 QDBusConnectionPrivate *d = QDBusConnectionPrivate::d(connection);-
67 if (d && d->shouldWatchService(service))-
68 d->unwatchService(service, watchMode, q_func(), qFlagLocation("1""_q_serviceOwnerChanged(QString,QString,QString)" "\0" __FILE__ ":" "107""113"));-
69}-
70QDBusServiceWatcher::QDBusServiceWatcher(QObject *parent)-
71 : QObject(*new QDBusServiceWatcherPrivate(QDBusConnection(QString()), WatchForOwnerChange), parent)-
72{-
73}-
74QDBusServiceWatcher::QDBusServiceWatcher(const QString &service, const QDBusConnection &connection, WatchMode watchMode, QObject *parent)-
75 : QObject(*new QDBusServiceWatcherPrivate(connection, watchMode), parent)-
76{-
77 d_func()->setConnection(QStringList() << service, connection, watchMode);-
78}-
79-
80-
81-
82-
83-
84QDBusServiceWatcher::~QDBusServiceWatcher()-
85{-
86}-
87-
88-
89-
90-
91-
92-
93QStringList QDBusServiceWatcher::watchedServices() const-
94{-
95 return d_func()->servicesWatched;-
96}-
97void QDBusServiceWatcher::setWatchedServices(const QStringList &services)-
98{-
99 QDBusServiceWatcherPrivate * const d = d_func();-
100 if (services == d->servicesWatched)-
101 return;-
102 d->setConnection(services, d->connection, d->watchMode);-
103}-
104-
105-
106-
107-
108-
109-
110void QDBusServiceWatcher::addWatchedService(const QString &newService)-
111{-
112 QDBusServiceWatcherPrivate * const d = d_func();-
113 if (d->servicesWatched.contains(newService))-
114 return;-
115 d->addService(newService);-
116 d->servicesWatched << newService;-
117}-
118bool QDBusServiceWatcher::removeWatchedService(const QString &service)-
119{-
120 QDBusServiceWatcherPrivate * const d = d_func();-
121 d->removeService(service);-
122 return d->servicesWatched.removeOne(service);-
123}-
124-
125QDBusServiceWatcher::WatchMode QDBusServiceWatcher::watchMode() const-
126{-
127 return d_func()->watchMode;-
128}-
129-
130void QDBusServiceWatcher::setWatchMode(WatchMode mode)-
131{-
132 QDBusServiceWatcherPrivate * const d = d_func();-
133 if (mode == d->watchMode)-
134 return;-
135 d->setConnection(d->servicesWatched, d->connection, mode);-
136}-
137-
138-
139-
140-
141-
142-
143QDBusConnection QDBusServiceWatcher::connection() const-
144{-
145 return d_func()->connection;-
146}-
147void QDBusServiceWatcher::setConnection(const QDBusConnection &connection)-
148{-
149 QDBusServiceWatcherPrivate * const d = d_func();-
150 if (connection.name() == d->connection.name())-
151 return;-
152 d->setConnection(d->servicesWatched, connection, d->watchMode);-
153}-
154-
155-
156-
157-
158-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9