| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/dbus/qdbusserver.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | QDBusServer::QDBusServer(const QString &address, QObject *parent) | - | ||||||
| 6 | : QObject(parent), d(0) | - | ||||||
| 7 | { | - | ||||||
| 8 | if (address.isEmpty()) | - | ||||||
| 9 | return; | - | ||||||
| 10 | - | |||||||
| 11 | if (!qdbus_loadLibDBus()) | - | ||||||
| 12 | return; | - | ||||||
| 13 | - | |||||||
| 14 | QDBusConnectionManager::instance()->serverRequested(address, this); | - | ||||||
| 15 | QObject::connect(d, qFlagLocation("2""newServerConnection(QDBusConnectionPrivate*)" "\0" __FILE__ ":" "66""72"), | - | ||||||
| 16 | this, qFlagLocation("1""_q_newConnection(QDBusConnectionPrivate*)" "\0" __FILE__ ":" "67""73"), Qt::QueuedConnection); | - | ||||||
| 17 | } | - | ||||||
| 18 | - | |||||||
| 19 | - | |||||||
| 20 | - | |||||||
| 21 | - | |||||||
| 22 | - | |||||||
| 23 | - | |||||||
| 24 | QDBusServer::QDBusServer(QObject *parent) | - | ||||||
| 25 | : QObject(parent) | - | ||||||
| 26 | { | - | ||||||
| 27 | - | |||||||
| 28 | - | |||||||
| 29 | const QString address = ([]() -> QString { enum { Size = sizeof(u"" "unix:tmpdir=/tmp")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "unix:tmpdir=/tmp" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()); | - | ||||||
| 30 | - | |||||||
| 31 | - | |||||||
| 32 | - | |||||||
| 33 | - | |||||||
| 34 | if (!qdbus_loadLibDBus()) { | - | ||||||
| 35 | d = 0; | - | ||||||
| 36 | return; | - | ||||||
| 37 | } | - | ||||||
| 38 | - | |||||||
| 39 | QDBusConnectionManager::instance()->serverRequested(address, this); | - | ||||||
| 40 | QObject::connect(d, qFlagLocation("2""newServerConnection(QDBusConnectionPrivate*)" "\0" __FILE__ ":" "91""97"), | - | ||||||
| 41 | this, qFlagLocation("1""_q_newConnection(QDBusConnectionPrivate*)" "\0" __FILE__ ":" "92""98"), Qt::QueuedConnection); | - | ||||||
| 42 | } | - | ||||||
| 43 | - | |||||||
| 44 | - | |||||||
| 45 | - | |||||||
| 46 | - | |||||||
| 47 | QDBusServer::~QDBusServer() | - | ||||||
| 48 | { | - | ||||||
| 49 | QWriteLocker locker(&d->lock); | - | ||||||
| 50 | if (QDBusConnectionManager::instance()
| 0-20 | ||||||
| 51 | QMutexLocker locker(&QDBusConnectionManager::instance()->mutex); | - | ||||||
| 52 | for (QForeachContainer<typename QtPrivate::remove_reference<decltypeconst QString &name : qAsConst(d->serverConnectionNames)>::type> _container_((d->serverConnectionNames)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &name = *_container_.i; _container_.control; _container_.control = 0) {)) | - | ||||||
| 53 | QDBusConnectionManager::instance()->removeConnection(name);} executed 158 times by 6 tests: QDBusConnectionManager::instance()->removeConnection(name);Executed by:
| 158 | ||||||
| 54 | d->serverConnectionNames.clear(); | - | ||||||
| 55 | } executed 20 times by 6 tests: end of blockExecuted by:
| 20 | ||||||
| 56 | d->serverObject = nullptr; | - | ||||||
| 57 | d->ref.store(0); | - | ||||||
| 58 | d->deleteLater(); | - | ||||||
| 59 | } executed 20 times by 6 tests: end of blockExecuted by:
| 20 | ||||||
| 60 | - | |||||||
| 61 | - | |||||||
| 62 | - | |||||||
| 63 | - | |||||||
| 64 | - | |||||||
| 65 | - | |||||||
| 66 | bool QDBusServer::isConnected() const | - | ||||||
| 67 | { | - | ||||||
| 68 | return d && d->server && q_dbus_server_get_is_connected(d->server); | - | ||||||
| 69 | } | - | ||||||
| 70 | - | |||||||
| 71 | - | |||||||
| 72 | - | |||||||
| 73 | - | |||||||
| 74 | - | |||||||
| 75 | - | |||||||
| 76 | QDBusError QDBusServer::lastError() const | - | ||||||
| 77 | { | - | ||||||
| 78 | return d ? d->lastError : QDBusError(QDBusError::Disconnected, QDBusUtil::disconnectedErrorMessage()); | - | ||||||
| 79 | } | - | ||||||
| 80 | - | |||||||
| 81 | - | |||||||
| 82 | - | |||||||
| 83 | - | |||||||
| 84 | QString QDBusServer::address() const | - | ||||||
| 85 | { | - | ||||||
| 86 | QString addr; | - | ||||||
| 87 | if (d && d->server) { | - | ||||||
| 88 | char *c = q_dbus_server_get_address(d->server); | - | ||||||
| 89 | addr = QString::fromUtf8(c); | - | ||||||
| 90 | q_dbus_free(c); | - | ||||||
| 91 | } | - | ||||||
| 92 | - | |||||||
| 93 | return addr; | - | ||||||
| 94 | } | - | ||||||
| 95 | void QDBusServer::setAnonymousAuthenticationAllowed(bool value) | - | ||||||
| 96 | { | - | ||||||
| 97 | d->anonymousAuthenticationAllowed = value; | - | ||||||
| 98 | } | - | ||||||
| 99 | bool QDBusServer::isAnonymousAuthenticationAllowed() const | - | ||||||
| 100 | { | - | ||||||
| 101 | return d->anonymousAuthenticationAllowed; | - | ||||||
| 102 | } | - | ||||||
| 103 | - | |||||||
| 104 | - | |||||||
| Switch to Source code | Preprocessed file |