QDBusObjectPath: Add QDebug stream operator

Prints its path.

Change-Id: I9467f9d33b927cf6b6d4692b2e2824001366625c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Kai Uwe Broulik 2024-02-21 18:41:37 +01:00
parent 735d2d41c3
commit c89b1bbddc
2 changed files with 12 additions and 0 deletions

View File

@ -12,6 +12,15 @@ QT_IMPL_METATYPE_EXTERN(QDBusVariant)
QT_IMPL_METATYPE_EXTERN(QDBusObjectPath)
QT_IMPL_METATYPE_EXTERN(QDBusSignature)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QDBusObjectPath &path)
{
QDebugStateSaver saver(dbg);
dbg.nospace() << "QDBusObjectPath(" << path.path() << ')';
return dbg;
}
#endif
void QDBusObjectPath::doCheck()
{
if (!QDBusUtil::isValidObjectPath(m_path)) {

View File

@ -69,6 +69,9 @@ inline bool operator<(const QDBusObjectPath &lhs, const QDBusObjectPath &rhs)
inline size_t qHash(const QDBusObjectPath &objectPath, size_t seed = 0)
{ return qHash(objectPath.path(), seed); }
#ifndef QT_NO_DEBUG_STREAM
Q_DBUS_EXPORT QDebug operator<<(QDebug, const QDBusObjectPath &);
#endif
class Q_DBUS_EXPORT QDBusSignature
{