Sayonara Player
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Utils
FileSystem.h
1
/* FileSystem.h */
2
/*
3
* Copyright (C) 2011-2024 Michael Lugmair
4
*
5
* This file is part of sayonara player
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*/
20
21
#ifndef SAYONARA_PLAYER_FILESYSTEM_H
22
#define SAYONARA_PLAYER_FILESYSTEM_H
23
24
#include <QDir>
25
#include <QString>
26
#include <QStringList>
27
28
#include <optional>
29
#include <memory>
30
31
namespace
Util
32
{
33
class
FileSystem
34
{
35
public
:
36
FileSystem();
37
virtual
~FileSystem()
noexcept
;
38
39
FileSystem(
const
FileSystem& other) =
delete
;
40
FileSystem(FileSystem&& other) =
delete
;
41
FileSystem& operator=(
const
FileSystem& other) =
delete
;
42
FileSystem& operator=(FileSystem&& other) =
delete
;
43
44
virtual
bool
isDir(
const
QString& filename) = 0;
45
virtual
bool
isFile(
const
QString& filename) = 0;
46
virtual
bool
createDirectories(
const
QString& path) = 0;
47
virtual
bool
exists(
const
QString& filename) = 0;
48
virtual
bool
writeFile(
const
QByteArray& data,
const
QString& filename) = 0;
49
virtual
QString readFileIntoString(
const
QString& filename) = 0;
50
virtual
bool
copyFile(
const
QString& sourceFile,
const
QString& targetFile) = 0;
51
virtual
void
deleteFiles(
const
QStringList& files) = 0;
52
[[nodiscard]]
virtual
QStringList
53
entryList(
const
QDir& dir,
const
QStringList& nameFilters, QDir::Filters filters)
const
= 0;
54
55
[[nodiscard]]
virtual
std::optional<QDir> cd(
const
QDir& dir,
const
QString& subDir)
const
= 0;
56
57
static
std::shared_ptr<FileSystem> create();
58
};
59
60
using
FileSystemPtr = std::shared_ptr<FileSystem>;
61
}
62
#endif
//SAYONARA_PLAYER_FILESYSTEM_H
Util
Helper functions.
Definition
MetaTypeRegistry.h:25
Generated on
for Sayonara Player by
1.17.0