| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/dbus/qdbusservicewatcher.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | class 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; | - | ||||||||||||
| 11 | public: | - | ||||||||||||
| 12 | QDBusServiceWatcherPrivate(const QDBusConnection &c, QDBusServiceWatcher::WatchMode wm) | - | ||||||||||||
| 13 | : connection(c), watchMode(wm) | - | ||||||||||||
| 14 | { | - | ||||||||||||
| 15 |     } executed 814 times by 155 tests:  end of blockExecuted by: 
  | 814 | ||||||||||||
| 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 | - | |||||||||||||
| 28 | void 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()
  | 5-8 | ||||||||||||
| 33 |         q->serviceRegistered(service); executed 8 times by 3 tests:  q->serviceRegistered(service);Executed by: 
  | 8 | ||||||||||||
| 34 |     else if (newOwner.isEmpty()
  | 0-5 | ||||||||||||
| 35 |         q->serviceUnregistered(service); executed 5 times by 1 test:  q->serviceUnregistered(service);Executed by: 
  | 5 | ||||||||||||
| 36 | } executed 13 times by 3 tests:  end of blockExecuted by: 
  | 13 | ||||||||||||
| 37 | - | |||||||||||||
| 38 | void QDBusServiceWatcherPrivate::setConnection(const QStringList &s, const QDBusConnection &c, QDBusServiceWatcher::WatchMode wm) | - | ||||||||||||
| 39 | { | - | ||||||||||||
| 40 |     if (connection.isConnected()
  | 6-816 | ||||||||||||
| 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) | - | ||||||||||||
| 43 |             removeService(s); executed 4 times by 1 test:  removeService(s);Executed by: 
  | 4 | ||||||||||||
| 44 |     } executed 816 times by 155 tests:  end of blockExecuted by: 
  | 816 | ||||||||||||
| 45 | - | |||||||||||||
| 46 | connection = c; | - | ||||||||||||
| 47 | watchMode = wm; | - | ||||||||||||
| 48 | servicesWatched = s; | - | ||||||||||||
| 49 | - | |||||||||||||
| 50 |     if (connection.isConnected()
  | 5-817 | ||||||||||||
| 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) | - | ||||||||||||
| 53 |             addService(s); executed 817 times by 155 tests:  addService(s);Executed by: 
  | 817 | ||||||||||||
| 54 |     } executed 817 times by 155 tests:  end of blockExecuted by: 
  | 817 | ||||||||||||
| 55 | } executed 822 times by 155 tests:  end of blockExecuted by: 
  | 822 | ||||||||||||
| 56 | - | |||||||||||||
| 57 | void QDBusServiceWatcherPrivate::addService(const QString &service) | - | ||||||||||||
| 58 | { | - | ||||||||||||
| 59 | QDBusConnectionPrivate *d = QDBusConnectionPrivate::d(connection); | - | ||||||||||||
| 60 |     if (d
 
  | 0-817 | ||||||||||||
| 61 |         d->watchService(service, watchMode, q_func(), qFlagLocation("1""_q_serviceOwnerChanged(QString,QString,QString)" "\0" __FILE__ ":" "100")); executed 817 times by 155 tests:  d->watchService(service, watchMode, q_func(), qFlagLocation("1""_q_serviceOwnerChanged(QString,QString,QString)" "\0" __FILE__ ":" "100"));Executed by: 
  | 817 | ||||||||||||
| 62 | } executed 819 times by 155 tests:  end of blockExecuted by: 
  | 819 | ||||||||||||
| 63 | - | |||||||||||||
| 64 | void QDBusServiceWatcherPrivate::removeService(const QString &service) | - | ||||||||||||
| 65 | { | - | ||||||||||||
| 66 | QDBusConnectionPrivate *d = QDBusConnectionPrivate::d(connection); | - | ||||||||||||
| 67 |     if (d
 
  | 0-4 | ||||||||||||
| 68 |         d->unwatchService(service, watchMode, q_func(), qFlagLocation("1""_q_serviceOwnerChanged(QString,QString,QString)" "\0" __FILE__ ":" "107")); executed 4 times by 1 test:  d->unwatchService(service, watchMode, q_func(), qFlagLocation("1""_q_serviceOwnerChanged(QString,QString,QString)" "\0" __FILE__ ":" "107"));Executed by: 
  | 4 | ||||||||||||
| 69 | } executed 4 times by 1 test:  end of blockExecuted by: 
  | 4 | ||||||||||||
| 70 | QDBusServiceWatcher::QDBusServiceWatcher(QObject *parent) | - | ||||||||||||
| 71 | : QObject(*new QDBusServiceWatcherPrivate(QDBusConnection(QString()), WatchForOwnerChange), parent) | - | ||||||||||||
| 72 | { | - | ||||||||||||
| 73 | } never executed:  end of block | 0 | ||||||||||||
| 74 | QDBusServiceWatcher::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 | } executed 814 times by 155 tests:  end of blockExecuted by: 
  | 814 | ||||||||||||
| 79 | - | |||||||||||||
| 80 | - | |||||||||||||
| 81 | - | |||||||||||||
| 82 | - | |||||||||||||
| 83 | - | |||||||||||||
| 84 | QDBusServiceWatcher::~QDBusServiceWatcher() | - | ||||||||||||
| 85 | { | - | ||||||||||||
| 86 | } | - | ||||||||||||
| 87 | - | |||||||||||||
| 88 | - | |||||||||||||
| 89 | - | |||||||||||||
| 90 | - | |||||||||||||
| 91 | - | |||||||||||||
| 92 | - | |||||||||||||
| 93 | QStringList QDBusServiceWatcher::watchedServices() const | - | ||||||||||||
| 94 | { | - | ||||||||||||
| 95 |     return never executed:   d_func()->servicesWatched;return d_func()->servicesWatched;never executed:  return d_func()->servicesWatched; | 0 | ||||||||||||
| 96 | } | - | ||||||||||||
| 97 | void QDBusServiceWatcher::setWatchedServices(const QStringList &services) | - | ||||||||||||
| 98 | { | - | ||||||||||||
| 99 | QDBusServiceWatcherPrivate * const d = d_func(); | - | ||||||||||||
| 100 |     if (services == d->servicesWatched
  | 0-2 | ||||||||||||
| 101 |         return; never executed:  return; | 0 | ||||||||||||
| 102 | d->setConnection(services, d->connection, d->watchMode); | - | ||||||||||||
| 103 | } executed 2 times by 1 test:  end of blockExecuted by: 
  | 2 | ||||||||||||
| 104 | - | |||||||||||||
| 105 | - | |||||||||||||
| 106 | - | |||||||||||||
| 107 | - | |||||||||||||
| 108 | - | |||||||||||||
| 109 | - | |||||||||||||
| 110 | void QDBusServiceWatcher::addWatchedService(const QString &newService) | - | ||||||||||||
| 111 | { | - | ||||||||||||
| 112 | QDBusServiceWatcherPrivate * const d = d_func(); | - | ||||||||||||
| 113 |     if (d->servicesWatched.contains(newService)
  | 0-2 | ||||||||||||
| 114 |         return; never executed:  return; | 0 | ||||||||||||
| 115 | d->addService(newService); | - | ||||||||||||
| 116 | d->servicesWatched << newService; | - | ||||||||||||
| 117 | } executed 2 times by 1 test:  end of blockExecuted by: 
  | 2 | ||||||||||||
| 118 | bool QDBusServiceWatcher::removeWatchedService(const QString &service) | - | ||||||||||||
| 119 | { | - | ||||||||||||
| 120 | QDBusServiceWatcherPrivate * const d = d_func(); | - | ||||||||||||
| 121 | d->removeService(service); | - | ||||||||||||
| 122 |     return never executed:   d->servicesWatched.removeOne(service);return d->servicesWatched.removeOne(service);never executed:  return d->servicesWatched.removeOne(service); | 0 | ||||||||||||
| 123 | } | - | ||||||||||||
| 124 | - | |||||||||||||
| 125 | QDBusServiceWatcher::WatchMode QDBusServiceWatcher::watchMode() const | - | ||||||||||||
| 126 | { | - | ||||||||||||
| 127 |     return never executed:   d_func()->watchMode;return d_func()->watchMode;never executed:  return d_func()->watchMode; | 0 | ||||||||||||
| 128 | } | - | ||||||||||||
| 129 | - | |||||||||||||
| 130 | void QDBusServiceWatcher::setWatchMode(WatchMode mode) | - | ||||||||||||
| 131 | { | - | ||||||||||||
| 132 | QDBusServiceWatcherPrivate * const d = d_func(); | - | ||||||||||||
| 133 |     if (mode == d->watchMode
  | 0-4 | ||||||||||||
| 134 |         return; never executed:  return; | 0 | ||||||||||||
| 135 | d->setConnection(d->servicesWatched, d->connection, mode); | - | ||||||||||||
| 136 | } executed 4 times by 1 test:  end of blockExecuted by: 
  | 4 | ||||||||||||
| 137 | - | |||||||||||||
| 138 | - | |||||||||||||
| 139 | - | |||||||||||||
| 140 | - | |||||||||||||
| 141 | - | |||||||||||||
| 142 | - | |||||||||||||
| 143 | QDBusConnection QDBusServiceWatcher::connection() const | - | ||||||||||||
| 144 | { | - | ||||||||||||
| 145 |     return never executed:   d_func()->connection;return d_func()->connection;never executed:  return d_func()->connection; | 0 | ||||||||||||
| 146 | } | - | ||||||||||||
| 147 | void QDBusServiceWatcher::setConnection(const QDBusConnection &connection) | - | ||||||||||||
| 148 | { | - | ||||||||||||
| 149 | QDBusServiceWatcherPrivate * const d = d_func(); | - | ||||||||||||
| 150 |     if (connection.name() == d->connection.name()
  | 0-2 | ||||||||||||
| 151 |         return; never executed:  return; | 0 | ||||||||||||
| 152 | d->setConnection(d->servicesWatched, connection, d->watchMode); | - | ||||||||||||
| 153 | } executed 2 times by 1 test:  end of blockExecuted by: 
  | 2 | ||||||||||||
| 154 | - | |||||||||||||
| 155 | - | |||||||||||||
| 156 | - | |||||||||||||
| 157 | - | |||||||||||||
| 158 | - | |||||||||||||
| Switch to Source code | Preprocessed file |