1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2008 Tobias Koenig <tokoe@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef DISCSPACEUTIL_H
9#define DISCSPACEUTIL_H
10
11#include <QString>
12
13/**
14 * A small utility class to access and calculate
15 * size and usage of mount points.
16 */
17class DiscSpaceUtil
18{
19public:
20 /**
21 * Creates a new disc space util.
22 *
23 * @param directory A directory the util shall work on.
24 */
25 explicit DiscSpaceUtil(const QString &directory);
26
27 /**
28 * Returns the usage of the directory pass in the constructor on this
29 * mount point in percent.
30 *
31 * @param size The current size of the directory.
32 */
33 double usage(qint64 size) const;
34
35 /**
36 * Returns the size of the partition in bytes.
37 */
38 qint64 size() const;
39
40 /**
41 * Returns the mount point of the directory.
42 */
43 QString mountPoint() const;
44
45 /**
46 * Returns the size of the given path in bytes.
47 */
48 static qint64 sizeOfPath(const QString &path);
49
50private:
51 qint64 mFullSize;
52 QString mMountPoint;
53};
54
55#endif
56

source code of kio/src/kioworkers/trash/discspaceutil.h