Skip to content

Commit b58b777

Browse files
marc-kdabQt by Nokia
authored andcommitted
QtDBus: add member-swap to shared classes
Implemented as in other shared classes (e.g. QPen). Change-Id: Ic827540b535fc5506165b5395b796a53a00bb096 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
1 parent 7fbc80f commit b58b777

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

src/dbus/qdbuspendingcall.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,14 @@ QDBusPendingCall &QDBusPendingCall::operator=(const QDBusPendingCall &other)
285285
return *this;
286286
}
287287

288+
/*!
289+
\fn void QDBusPendingCall::swap(QDBusPendingCall &other)
290+
\since 5.0
291+
292+
Swaps this pending call instance with \a other. This function is
293+
very fast and never fails.
294+
*/
295+
288296
/*!
289297
\fn bool QDBusPendingCallWatcher::isFinished() const
290298

src/dbus/qdbuspendingcall.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ class Q_DBUS_EXPORT QDBusPendingCall
6868
~QDBusPendingCall();
6969
QDBusPendingCall &operator=(const QDBusPendingCall &other);
7070

71+
void swap(QDBusPendingCall &other) { qSwap(d, other.d); }
72+
7173
#ifndef Q_QDOC
7274
// pretend that they aren't here
7375
bool isFinished() const;

src/dbus/qdbusunixfiledescriptor.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,14 @@ QDBusUnixFileDescriptor::~QDBusUnixFileDescriptor()
186186
{
187187
}
188188

189+
/*!
190+
\fn void QDBusUnixFileDescriptor::swap(QDBusUnixFileDescriptor &other)
191+
\since 5.0
192+
193+
Swaps this file descriptor instance with \a other. This function
194+
is very fast and never fails.
195+
*/
196+
189197
/*!
190198
Returns true if this Unix file descriptor is valid. A valid Unix file
191199
descriptor is not -1.

src/dbus/qdbusunixfiledescriptor.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ class Q_DBUS_EXPORT QDBusUnixFileDescriptor
6868
QDBusUnixFileDescriptor &operator=(const QDBusUnixFileDescriptor &other);
6969
~QDBusUnixFileDescriptor();
7070

71+
void swap(QDBusUnixFileDescriptor &other)
72+
{ qSwap(d, other.d); }
73+
7174
bool isValid() const;
7275

7376
int fileDescriptor() const;

0 commit comments

Comments
 (0)