Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:24:28

0001 // Copyright (C) 2014 Ivan Komissarov <ABBAPOH@gmail.com>
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QSTORAGEINFO_H
0005 #define QSTORAGEINFO_H
0006 
0007 #include <QtCore/qbytearray.h>
0008 #include <QtCore/qcompare.h>
0009 #include <QtCore/qdir.h>
0010 #include <QtCore/qlist.h>
0011 #include <QtCore/qmetatype.h>
0012 #include <QtCore/qstring.h>
0013 #include <QtCore/qshareddata.h>
0014 
0015 QT_BEGIN_NAMESPACE
0016 
0017 class QDebug;
0018 
0019 class QStorageInfoPrivate;
0020 class Q_CORE_EXPORT QStorageInfo
0021 {
0022 public:
0023     QStorageInfo();
0024     explicit QStorageInfo(const QString &path);
0025     explicit QStorageInfo(const QDir &dir);
0026     QStorageInfo(const QStorageInfo &other);
0027     ~QStorageInfo();
0028 
0029     QStorageInfo &operator=(const QStorageInfo &other);
0030     QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QStorageInfo)
0031 
0032     inline void swap(QStorageInfo &other) noexcept
0033     { d.swap(other.d); }
0034 
0035     void setPath(const QString &path);
0036 
0037     QString rootPath() const;
0038     QByteArray device() const;
0039     QByteArray subvolume() const;
0040     QByteArray fileSystemType() const;
0041     QString name() const;
0042     QString displayName() const;
0043 
0044     qint64 bytesTotal() const;
0045     qint64 bytesFree() const;
0046     qint64 bytesAvailable() const;
0047     int blockSize() const;
0048 
0049     inline bool isRoot() const;
0050     bool isReadOnly() const;
0051     bool isReady() const;
0052     bool isValid() const;
0053 
0054     void refresh();
0055 
0056     static QList<QStorageInfo> mountedVolumes();
0057     static QStorageInfo root();
0058 
0059 private:
0060     explicit QStorageInfo(QStorageInfoPrivate &dd);
0061     friend class QStorageInfoPrivate;
0062     friend Q_CORE_EXPORT bool
0063     comparesEqual(const QStorageInfo &lhs, const QStorageInfo &rhs) noexcept;
0064     Q_DECLARE_EQUALITY_COMPARABLE(QStorageInfo)
0065 
0066     friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QStorageInfo &);
0067     QExplicitlySharedDataPointer<QStorageInfoPrivate> d;
0068 };
0069 
0070 inline bool QStorageInfo::isRoot() const
0071 { return *this == QStorageInfo::root(); }
0072 
0073 Q_DECLARE_SHARED(QStorageInfo)
0074 
0075 #ifndef QT_NO_DEBUG_STREAM
0076 Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QStorageInfo &);
0077 #endif
0078 
0079 QT_END_NAMESPACE
0080 
0081 QT_DECL_METATYPE_EXTERN(QStorageInfo, Q_CORE_EXPORT)
0082 
0083 #endif // QSTORAGEINFO_H