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_P_H
5#define QSTORAGEINFO_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/private/qglobal_p.h>
19#include "qstorageinfo.h"
20
21QT_BEGIN_NAMESPACE
22
23class QStorageInfoPrivate : public QSharedData
24{
25public:
26 inline QStorageInfoPrivate() : QSharedData(),
27 bytesTotal(-1), bytesFree(-1), bytesAvailable(-1), blockSize(-1),
28 readOnly(false), ready(false), valid(false)
29 {}
30
31 void initRootPath();
32 void doStat();
33
34 static QList<QStorageInfo> mountedVolumes();
35 static QStorageInfo root();
36
37protected:
38#if defined(Q_OS_WIN)
39 void retrieveVolumeInfo();
40 void retrieveDiskFreeSpace();
41 bool queryStorageProperty();
42 void queryFileFsSectorSizeInformation();
43#elif defined(Q_OS_DARWIN)
44 void retrievePosixInfo();
45 void retrieveUrlProperties(bool initRootPath = false);
46 void retrieveLabel();
47#elif defined(Q_OS_UNIX)
48 void retrieveVolumeInfo();
49#endif
50
51public:
52 QString rootPath;
53 QByteArray device;
54 QByteArray subvolume;
55 QByteArray fileSystemType;
56 QString name;
57
58 qint64 bytesTotal;
59 qint64 bytesFree;
60 qint64 bytesAvailable;
61 ulong blockSize;
62
63 bool readOnly;
64 bool ready;
65 bool valid;
66};
67
68QT_END_NAMESPACE
69
70#endif // QSTORAGEINFO_P_H
71

source code of qtbase/src/corelib/io/qstorageinfo_p.h