Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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// Qt-Security score:significant reason:default
4
5#ifndef QSTORAGEINFO_H
6#define QSTORAGEINFO_H
7
8#include <QtCore/qbytearray.h>
9#include <QtCore/qcompare.h>
10#include <QtCore/qdir.h>
11#include <QtCore/qlist.h>
12#include <QtCore/qmetatype.h>
13#include <QtCore/qstring.h>
14#include <QtCore/qshareddata.h>
15
17
18class QDebug;
19
20class QStorageInfoPrivate;
21QT_DECLARE_QESDP_SPECIALIZATION_DTOR(QStorageInfoPrivate)
22class Q_CORE_EXPORT QStorageInfo
23{
24public:
25 QStorageInfo();
26 explicit QStorageInfo(const QString &path);
27 explicit QStorageInfo(const QDir &dir);
28 QStorageInfo(const QStorageInfo &other);
29 QStorageInfo(QStorageInfo &&) noexcept = default;
30 ~QStorageInfo();
31
32 QStorageInfo &operator=(const QStorageInfo &other);
33 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QStorageInfo)
34
35 inline void swap(QStorageInfo &other) noexcept
36 { d.swap(other.d); }
37
38 void setPath(const QString &path);
39
40 QString rootPath() const;
41 QByteArray device() const;
42 QByteArray subvolume() const;
43 QByteArray fileSystemType() const;
44 QString name() const;
45 QString displayName() const;
46
47 qint64 bytesTotal() const;
48 qint64 bytesFree() const;
49 qint64 bytesAvailable() const;
50 int blockSize() const;
51
52 inline bool isRoot() const;
53 bool isReadOnly() const;
54 bool isReady() const;
55 bool isValid() const;
56
57 void refresh();
58
59 static QList<QStorageInfo> mountedVolumes();
60 static QStorageInfo root();
61
62private:
63 explicit QStorageInfo(QStorageInfoPrivate &dd);
64 friend class QStorageInfoPrivate;
65 friend Q_CORE_EXPORT bool
66 comparesEqual(const QStorageInfo &lhs, const QStorageInfo &rhs) noexcept;
67 Q_DECLARE_EQUALITY_COMPARABLE(QStorageInfo)
68
69 friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QStorageInfo &);
70 QExplicitlySharedDataPointer<QStorageInfoPrivate> d;
71};
72
73inline bool QStorageInfo::isRoot() const
74{ return *this == QStorageInfo::root(); }
75
77
78#ifndef QT_NO_DEBUG_STREAM
79Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QStorageInfo &);
80#endif
81
82QT_END_NAMESPACE
83
84QT_DECL_METATYPE_EXTERN(QStorageInfo, Q_CORE_EXPORT)
85
86#endif // QSTORAGEINFO_H
\inmodule QtCore
#define __has_include(x)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2568
#define Q_CHECK_FILE_NAME(name, result)
static int qt_lstatx(const char *, struct statx *)
#define _PATH_TMP
static int qt_fstatx(int, struct statx *)
static QFileSystemMetaData::MetaDataFlags flagsFromStMode(mode_t mode, quint64 attributes)
static QByteArray & removeTrailingSlashes(QByteArray &path)
static QSystemError createDirectoryWithParents(const QByteArray &path, mode_t mode)
static constexpr QLatin1StringView nativeTempPath() noexcept
static int qt_statx(const char *, struct statx *)