File indexing completed on 2024-05-05 05:48:44

0001 /*
0002     SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de>
0003     SPDX-FileCopyrightText: 2015 Chris Campbell <c.j.campbell@ed.ac.uk>
0004     SPDX-FileCopyrightText: 2016-2020 Andrius Štikonas <andrius@stikonas.eu>
0005     SPDX-FileCopyrightText: 2020 Arnaud Ferraris <arnaud.ferraris@collabora.com>
0006     SPDX-FileCopyrightText: 2020 Gaël PORTAY <gael.portay@collabora.com>
0007 
0008     SPDX-License-Identifier: GPL-3.0-or-later
0009 */
0010 
0011 #ifndef KPMCORE_FILESYSTEMFACTORY_H
0012 #define KPMCORE_FILESYSTEMFACTORY_H
0013 
0014 #include "fs/filesystem.h"
0015 
0016 #include "util/libpartitionmanagerexport.h"
0017 
0018 #include <QMap>
0019 #include <QtGlobal>
0020 
0021 class QString;
0022 
0023 /** Factory to create instances of FileSystem.
0024     @author Volker Lanz <vl@fidra.de>
0025  */
0026 class LIBKPMCORE_EXPORT FileSystemFactory
0027 {
0028 public:
0029     /** map of FileSystem::Types to pointers of FileSystem */
0030     typedef QMap<FileSystem::Type, FileSystem*> FileSystems;
0031 
0032 private:
0033     FileSystemFactory();
0034 
0035 public:
0036     static void init();
0037     static FileSystem* create(FileSystem::Type t, qint64 firstsector, qint64 lastsector, qint64 sectorSize, qint64 sectorsused = -1, const QString& label = QString(), const QVariantMap& features = {}, const QString& uuid = QString());
0038     static FileSystem* create(const FileSystem& other);
0039     static FileSystem* cloneWithNewType(FileSystem::Type newType, const FileSystem& other);
0040     static const FileSystems& map();
0041 
0042 private:
0043     static FileSystems m_FileSystems;
0044 };
0045 
0046 #endif