QtDBus: compile-optimize inline swap functions
Instead of using the overly-generic qSwap() monster, use
- qt_ptr_swap() for swapping raw pointers
- member-swap for swapping smart pointers and owning containers
- std::swap() for swapping scalars
In QtCore, this has proven to give a nice reduction in compile time
for Qt users, cf. b1b0c2970e.
Pick-to: 6.3 6.2
Task-number: QTBUG-97601
Change-Id: I2cb0dd3cef3a2923e7d08bb9d93c692308797e5b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
bb10
parent
9f8da21239
commit
870bb22c17
|
|
@ -81,7 +81,7 @@ public:
|
|||
QDBusArgument &operator=(const QDBusArgument &other);
|
||||
~QDBusArgument();
|
||||
|
||||
void swap(QDBusArgument &other) noexcept { qSwap(d, other.d); }
|
||||
void swap(QDBusArgument &other) noexcept { qt_ptr_swap(d, other.d); }
|
||||
|
||||
// used for marshalling (Qt -> D-BUS)
|
||||
QDBusArgument &operator<<(uchar arg);
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ public:
|
|||
QDBusConnection &operator=(const QDBusConnection &other);
|
||||
~QDBusConnection();
|
||||
|
||||
void swap(QDBusConnection &other) noexcept { qSwap(d, other.d); }
|
||||
void swap(QDBusConnection &other) noexcept { qt_ptr_swap(d, other.d); }
|
||||
|
||||
bool isConnected() const;
|
||||
QString baseService() const;
|
||||
|
|
|
|||
|
|
@ -112,9 +112,9 @@ public:
|
|||
|
||||
void swap(QDBusError &other) noexcept
|
||||
{
|
||||
qSwap(code, other.code);
|
||||
qSwap(msg, other.msg);
|
||||
qSwap(nm, other.nm);
|
||||
std::swap(code, other.code);
|
||||
msg.swap(other.msg);
|
||||
nm.swap(other.nm);
|
||||
}
|
||||
|
||||
ErrorType type() const;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public:
|
|||
inline explicit QDBusObjectPath(const QString &path);
|
||||
explicit QDBusObjectPath(QString &&p) : m_path(std::move(p)) { doCheck(); }
|
||||
|
||||
void swap(QDBusObjectPath &other) noexcept { qSwap(m_path, other.m_path); }
|
||||
void swap(QDBusObjectPath &other) noexcept { m_path.swap(other.m_path); }
|
||||
|
||||
inline void setPath(const QString &path);
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ public:
|
|||
inline explicit QDBusSignature(const QString &signature);
|
||||
explicit QDBusSignature(QString &&sig) : m_signature(std::move(sig)) { doCheck(); }
|
||||
|
||||
void swap(QDBusSignature &other) noexcept { qSwap(m_signature, other.m_signature); }
|
||||
void swap(QDBusSignature &other) noexcept { m_signature.swap(other.m_signature); }
|
||||
|
||||
inline void setSignature(const QString &signature);
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ public:
|
|||
inline explicit QDBusVariant(const QVariant &variant);
|
||||
explicit QDBusVariant(QVariant &&v) noexcept : m_variant(std::move(v)) {}
|
||||
|
||||
void swap(QDBusVariant &other) noexcept { qSwap(m_variant, other.m_variant); }
|
||||
void swap(QDBusVariant &other) noexcept { m_variant.swap(other.m_variant); }
|
||||
|
||||
inline void setVariant(const QVariant &variant);
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public:
|
|||
QDBusMessage &operator=(const QDBusMessage &other);
|
||||
~QDBusMessage();
|
||||
|
||||
void swap(QDBusMessage &other) noexcept { qSwap(d_ptr, other.d_ptr); }
|
||||
void swap(QDBusMessage &other) noexcept { qt_ptr_swap(d_ptr, other.d_ptr); }
|
||||
|
||||
static QDBusMessage createSignal(const QString &path, const QString &interface,
|
||||
const QString &name);
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public:
|
|||
QDBusPendingCall &operator=(QDBusPendingCall &&other) noexcept { swap(other); return *this; }
|
||||
QDBusPendingCall &operator=(const QDBusPendingCall &other);
|
||||
|
||||
void swap(QDBusPendingCall &other) noexcept { qSwap(d, other.d); }
|
||||
void swap(QDBusPendingCall &other) noexcept { d.swap(other.d); }
|
||||
|
||||
#ifndef Q_CLANG_QDOC
|
||||
// pretend that they aren't here
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public:
|
|||
~QDBusUnixFileDescriptor();
|
||||
|
||||
void swap(QDBusUnixFileDescriptor &other) noexcept
|
||||
{ qSwap(d, other.d); }
|
||||
{ d.swap(other.d); }
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue