summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-27 23:53:18 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-29 09:48:52 +0100
commit874eb19107e57774d6ec03f38578c584606eb5bc (patch)
treed39a2fa5178a550e7ea36254ca3e8cb72014f7f3 /src/corelib/io
parent7635d77689193e729db248300634571aea4d8c81 (diff)
QStorageInfo: Make comparison operators hidden friends
Reduce ADL noise. Task-number: QTBUG-87973 Change-Id: Ia8957e6452cdebac808ec2a20d475db448863149 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qstorageinfo.cpp8
-rw-r--r--src/corelib/io/qstorageinfo.h25
2 files changed, 14 insertions, 19 deletions
diff --git a/src/corelib/io/qstorageinfo.cpp b/src/corelib/io/qstorageinfo.cpp
index 9054d8e894..86b8ae0ac3 100644
--- a/src/corelib/io/qstorageinfo.cpp
+++ b/src/corelib/io/qstorageinfo.cpp
@@ -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.
diff --git a/src/corelib/io/qstorageinfo.h b/src/corelib/io/qstorageinfo.h
index ec95ea3b23..d441915a9e 100644
--- a/src/corelib/io/qstorageinfo.h
+++ b/src/corelib/io/qstorageinfo.h
@@ -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(); }