1 /* 2 SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de> 3 SPDX-FileCopyrightText: 2015 Chris Campbell <c.j.campbell@ed.ac.uk> 4 SPDX-FileCopyrightText: 2016-2020 Andrius Štikonas <andrius@stikonas.eu> 5 SPDX-FileCopyrightText: 2020 Arnaud Ferraris <arnaud.ferraris@collabora.com> 6 SPDX-FileCopyrightText: 2020 Gaël PORTAY <gael.portay@collabora.com> 7 8 SPDX-License-Identifier: GPL-3.0-or-later 9 */ 10 11 #ifndef KPMCORE_FILESYSTEMFACTORY_H 12 #define KPMCORE_FILESYSTEMFACTORY_H 13 14 #include "fs/filesystem.h" 15 16 #include "util/libpartitionmanagerexport.h" 17 18 #include <QMap> 19 #include <QtGlobal> 20 21 class QString; 22 23 /** Factory to create instances of FileSystem. 24 @author Volker Lanz <vl@fidra.de> 25 */ 26 class LIBKPMCORE_EXPORT FileSystemFactory 27 { 28 public: 29 /** map of FileSystem::Types to pointers of FileSystem */ 30 typedef QMap<FileSystem::Type, FileSystem*> FileSystems; 31 32 private: 33 FileSystemFactory(); 34 35 public: 36 static void init(); 37 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()); 38 static FileSystem* create(const FileSystem& other); 39 static FileSystem* cloneWithNewType(FileSystem::Type newType, const FileSystem& other); 40 static const FileSystems& map(); 41 42 private: 43 static FileSystems m_FileSystems; 44 }; 45 46 #endif 47