QStorageInfo: Make comparison operators hidden friends
Reduce ADL noise. Task-number: QTBUG-87973 Change-Id: Ia8957e6452cdebac808ec2a20d475db448863149 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
7635d77689
commit
874eb19107
@ -413,9 +413,7 @@ QStorageInfo QStorageInfo::root()
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn inline bool operator==(const QStorageInfo &first, const QStorageInfo &second)
|
||||
|
||||
\relates QStorageInfo
|
||||
\fn bool QStorageInfo::operator==(const QStorageInfo &first, const QStorageInfo &second)
|
||||
|
||||
Returns true if the \a first QStorageInfo object refers to the same drive or volume
|
||||
as the \a second; otherwise it returns false.
|
||||
@ -425,9 +423,7 @@ QStorageInfo QStorageInfo::root()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn inline bool operator!=(const QStorageInfo &first, const QStorageInfo &second)
|
||||
|
||||
\relates QStorageInfo
|
||||
\fn bool QStorageInfo::operator!=(const QStorageInfo &first, const QStorageInfo &second)
|
||||
|
||||
Returns true if the \a first QStorageInfo object refers to a different drive or
|
||||
volume than the \a second; otherwise returns false.
|
||||
|
@ -93,23 +93,22 @@ public:
|
||||
|
||||
private:
|
||||
friend class QStorageInfoPrivate;
|
||||
friend bool operator==(const QStorageInfo &first, const QStorageInfo &second);
|
||||
friend inline bool operator==(const QStorageInfo &first, const QStorageInfo &second)
|
||||
{
|
||||
if (first.d == second.d)
|
||||
return true;
|
||||
return first.device() == second.device() && first.rootPath() == second.rootPath();
|
||||
}
|
||||
|
||||
friend inline bool operator!=(const QStorageInfo &first, const QStorageInfo &second)
|
||||
{
|
||||
return !(first == second);
|
||||
}
|
||||
|
||||
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QStorageInfo &);
|
||||
QExplicitlySharedDataPointer<QStorageInfoPrivate> d;
|
||||
};
|
||||
|
||||
inline bool operator==(const QStorageInfo &first, const QStorageInfo &second)
|
||||
{
|
||||
if (first.d == second.d)
|
||||
return true;
|
||||
return first.device() == second.device() && first.rootPath() == second.rootPath();
|
||||
}
|
||||
|
||||
inline bool operator!=(const QStorageInfo &first, const QStorageInfo &second)
|
||||
{
|
||||
return !(first == second);
|
||||
}
|
||||
|
||||
inline bool QStorageInfo::isRoot() const
|
||||
{ return *this == QStorageInfo::root(); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user