Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qstorageinfo.h
Go to the documentation of this file.
1// Copyright (C) 2014 Ivan Komissarov <ABBAPOH@gmail.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSTORAGEINFO_H
5#define QSTORAGEINFO_H
6
7#include <QtCore/qbytearray.h>
8#include <QtCore/qdir.h>
9#include <QtCore/qlist.h>
10#include <QtCore/qmetatype.h>
11#include <QtCore/qstring.h>
12#include <QtCore/qshareddata.h>
13
15
16class QDebug;
17
18class QStorageInfoPrivate;
19class Q_CORE_EXPORT QStorageInfo
20{
21public:
23 explicit QStorageInfo(const QString &path);
24 explicit QStorageInfo(const QDir &dir);
27
28 QStorageInfo &operator=(const QStorageInfo &other);
29 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QStorageInfo)
30
31 inline void swap(QStorageInfo &other) noexcept
32 { d.swap(other.d); }
33
34 void setPath(const QString &path);
35
36 QString rootPath() const;
37 QByteArray device() const;
38 QByteArray subvolume() const;
39 QByteArray fileSystemType() const;
40 QString name() const;
41 QString displayName() const;
42
43 qint64 bytesTotal() const;
44 qint64 bytesFree() const;
45 qint64 bytesAvailable() const;
46 int blockSize() const;
47
48 inline bool isRoot() const;
49 bool isReadOnly() const;
50 bool isReady() const;
51 bool isValid() const;
52
53 void refresh();
54
55 static QList<QStorageInfo> mountedVolumes();
56 static QStorageInfo root();
57
58private:
59 friend class QStorageInfoPrivate;
60 friend inline bool operator==(const QStorageInfo &first, const QStorageInfo &second)
61 {
62 if (first.d == second.d)
63 return true;
64 return first.device() == second.device() && first.rootPath() == second.rootPath();
65 }
66
67 friend inline bool operator!=(const QStorageInfo &first, const QStorageInfo &second)
68 {
69 return !(first == second);
70 }
71
72 friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QStorageInfo &);
74};
75
76inline bool QStorageInfo::isRoot() const
77{ return *this == QStorageInfo::root(); }
78
79Q_DECLARE_SHARED(QStorageInfo)
80
81#ifndef QT_NO_DEBUG_STREAM
82Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QStorageInfo &);
83#endif
84
86
88
89#endif // QSTORAGEINFO_H
IOBluetoothDevice * device
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
\inmodule QtCore
Definition qdir.h:19
Definition qlist.h:74
\inmodule QtCore
bool isRoot() const
Returns true if this QStorageInfo represents the system root volume; false otherwise.
friend bool operator==(const QStorageInfo &first, const QStorageInfo &second)
Returns true if the first QStorageInfo object refers to the same drive or volume as the second; other...
static QStorageInfo root()
Returns a QStorageInfo object that represents the system root volume.
QByteArray device() const
Returns the device for this volume.
friend bool operator!=(const QStorageInfo &first, const QStorageInfo &second)
Returns true if the first QStorageInfo object refers to a different drive or volume than the second; ...
QString rootPath() const
Returns the mount point of the filesystem this QStorageInfo object represents.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
Combined button and popup list for selecting options.
const int blockSize
static QString displayName(CGDirectDisplayID displayID)
#define QT_DECL_METATYPE_EXTERN(TYPE, EXPORT)
Definition qmetatype.h:1367
GLuint name
GLint first
GLsizei const GLchar *const * path
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QStorageInfo &)
long long qint64
Definition qtypes.h:55
QDataStream & operator<<(QDataStream &out, const MyClass &myObj)
[4]
QSharedPointer< T > other(t)
[5]
QString dir
[11]