File indexing completed on 2024-06-23 05:06:33

0001 /*
0002     SPDX-FileCopyrightText: 2010 Bertjan Broeksema <broeksema@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #pragma once
0007 
0008 #include <QHash>
0009 class QPluginLoader;
0010 
0011 class AgentPluginLoader
0012 {
0013 public:
0014     AgentPluginLoader();
0015 
0016     /**
0017       Deletes all instantiated QPluginLoaders.
0018      */
0019     ~AgentPluginLoader();
0020 
0021     /**
0022       Returns the loader for plugins with @p pluginName. Callers must not
0023       take ownership over the returned loader. Loaders will be unloaded and deleted
0024       when the AgentPluginLoader goes out of scope/gets deleted.
0025 
0026       @return the plugin for @p pluginName or 0 if the plugin is not found.
0027      */
0028     [[nodiscard]] QPluginLoader *load(const QString &pluginName);
0029 
0030 private:
0031     Q_DISABLE_COPY(AgentPluginLoader)
0032     QHash<QString, QPluginLoader *> m_pluginLoaders;
0033 };