2021-05-03 00:21:36 +08:00
|
|
|
#ifndef SEARCHPLUGINFACTORY_H
|
|
|
|
#define SEARCHPLUGINFACTORY_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2021-05-27 21:10:11 +08:00
|
|
|
#include "search-plugin-iface.h"
|
2021-05-03 00:21:36 +08:00
|
|
|
|
|
|
|
namespace Zeeker {
|
2021-08-02 13:46:59 +08:00
|
|
|
|
|
|
|
struct cmpPluginId
|
|
|
|
{
|
|
|
|
bool operator ()(const QString& k1, const QString& k2){
|
|
|
|
return k1 > k2;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-05-03 00:21:36 +08:00
|
|
|
class SearchPluginManager : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
bool registerPlugin(SearchPluginIface *plugin);
|
|
|
|
|
|
|
|
static SearchPluginManager *getInstance();
|
|
|
|
const QStringList getPluginIds();
|
|
|
|
SearchPluginIface *getPlugin(const QString &pluginId);
|
|
|
|
|
|
|
|
void close();
|
|
|
|
|
|
|
|
private:
|
2021-08-02 13:46:59 +08:00
|
|
|
std::map<QString, SearchPluginIface*, cmpPluginId> m_map;
|
2021-05-03 00:21:36 +08:00
|
|
|
explicit SearchPluginManager(QObject *parent = nullptr);
|
|
|
|
~SearchPluginManager();
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // SEARCHPLUGINFACTORY_H
|