summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qstorageinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qstorageinfo.cpp')
-rw-r--r--src/corelib/io/qstorageinfo.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/corelib/io/qstorageinfo.cpp b/src/corelib/io/qstorageinfo.cpp
index 25b11103b9..b7a17febaf 100644
--- a/src/corelib/io/qstorageinfo.cpp
+++ b/src/corelib/io/qstorageinfo.cpp
@@ -20,6 +20,8 @@ QT_IMPL_METATYPE_EXTERN(QStorageInfo)
\ingroup io
\ingroup shared
+ \compares equality
+
Allows retrieving information about the volume's space, its mount point,
label, and filesystem name.
@@ -37,6 +39,11 @@ QT_IMPL_METATYPE_EXTERN(QStorageInfo)
\snippet code/src_corelib_io_qstorageinfo.cpp 2
*/
+QStorageInfo::QStorageInfo(QStorageInfoPrivate &dd)
+ : d(&dd)
+{
+}
+
/*!
Constructs an empty QStorageInfo object.
@@ -241,9 +248,10 @@ QByteArray QStorageInfo::device() const
Returns the subvolume name for this volume.
Some filesystem types allow multiple subvolumes inside one device, which
- may be mounted in different paths. If the subvolume could be detected, it
- is returned here. The format of the subvolume name is specific to each
- filesystem type.
+ may be mounted in different paths (e.g. 'bind' mounts on Unix, or Btrfs
+ filesystem subvolumes). If the subvolume could be detected, its name is
+ returned by this function. The format of the subvolume name is specific
+ to each filesystem type.
If this volume was not mounted from a subvolume of a larger filesystem or
if the subvolume could not be detected, this function returns an empty byte
@@ -380,22 +388,29 @@ QStorageInfo QStorageInfo::root()
}
/*!
- \fn bool QStorageInfo::operator==(const QStorageInfo &first, const QStorageInfo &second)
+ \fn bool QStorageInfo::operator==(const QStorageInfo &lhs, const QStorageInfo &rhs)
- Returns true if the \a first QStorageInfo object refers to the same drive or volume
- as the \a second; otherwise it returns false.
+ Returns \c true if the QStorageInfo object \a lhs refers to the same drive or
+ volume as the QStorageInfo object \a rhs; otherwise it returns \c false.
Note that the result of comparing two invalid QStorageInfo objects is always
positive.
*/
/*!
- \fn bool QStorageInfo::operator!=(const QStorageInfo &first, const QStorageInfo &second)
+ \fn bool QStorageInfo::operator!=(const QStorageInfo &lhs, const QStorageInfo &rhs)
- Returns true if the \a first QStorageInfo object refers to a different drive or
- volume than the \a second; otherwise returns false.
+ Returns \c true if the QStorageInfo object \a lhs refers to a different drive or
+ volume than the QStorageInfo object \a rhs; otherwise returns \c false.
*/
+bool comparesEqual(const QStorageInfo &lhs, const QStorageInfo &rhs)
+{
+ if (lhs.d == rhs.d)
+ return true;
+ return lhs.device() == rhs.device() && lhs.rootPath() == rhs.rootPath();
+}
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, const QStorageInfo &s)
{