File indexing completed on 2024-05-05 05:48:39
0001 /* 0002 SPDX-FileCopyrightText: 2010 Volker Lanz <vl@fidra.de> 0003 SPDX-FileCopyrightText: 2014-2018 Andrius Štikonas <andrius@stikonas.eu> 0004 SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org> 0005 SPDX-FileCopyrightText: 2015 Chris Campbell <c.j.campbell@ed.ac.uk> 0006 0007 SPDX-License-Identifier: GPL-3.0-or-later 0008 */ 0009 0010 #ifndef KPMCORE_COREBACKENDMANAGER_H 0011 #define KPMCORE_COREBACKENDMANAGER_H 0012 0013 #include "util/libpartitionmanagerexport.h" 0014 0015 #include <memory> 0016 0017 #include <QStringList> 0018 #include <QVector> 0019 0020 class QString; 0021 class KPluginMetaData; 0022 class CoreBackend; 0023 struct CoreBackendManagerPrivate; 0024 0025 /** 0026 * The backend manager class. 0027 * 0028 * This is basically a singleton class to give the application access to the currently 0029 * selected backend and also to manage the available backend plugins. 0030 * @author Volker Lanz <vl@fidra.de> 0031 */ 0032 class LIBKPMCORE_EXPORT CoreBackendManager 0033 { 0034 CoreBackendManager(); 0035 ~CoreBackendManager(); 0036 0037 public: 0038 /** 0039 * @return pointer to ourselves 0040 */ 0041 static CoreBackendManager* self(); 0042 0043 /** 0044 * @return the name of the default backend plugin 0045 */ 0046 static QString defaultBackendName() { 0047 return QStringLiteral("pmsfdiskbackendplugin"); 0048 } 0049 0050 /** 0051 * @return a list of available backend plugins 0052 */ 0053 QVector<KPluginMetaData> list() const; 0054 0055 /** 0056 * Loads the given backend plugin into the application. 0057 * @param name the name of the plugin to load 0058 * @return true on success 0059 */ 0060 bool load(const QString& name); 0061 0062 /** 0063 * Unload the current plugin. 0064 */ 0065 void unload(); 0066 0067 /** 0068 * @return a pointer to the currently loaded backend 0069 */ 0070 CoreBackend* backend(); 0071 0072 private: 0073 std::unique_ptr<CoreBackendManagerPrivate> d; 0074 }; 0075 0076 #endif