pgLab/pglab/plugin_support/PluginRegister.h
eelke b0cd47ef46 Extended the plugin system to allow for dynamic runtime bindings between modules.
As a test implementation, this allows the TablesPage to open a CrudTab for a table/view without
the need for TablesPage, CrudTab and DatabaseWindow to know anything about each other.
2018-12-31 15:26:36 +01:00

32 lines
647 B
C++

#ifndef PLUGINREGISTER_H
#define PLUGINREGISTER_H
#include <memory>
#include <map>
#include <mutex>
#include <QString>
class QAction;
class PluginModule;
class PluginRegister {
public:
using PluginModuleSPtr = std::shared_ptr<PluginModule>;
using ModuleMap = std::map<QString, PluginModuleSPtr>;
static PluginRegister* getInstance();
PluginRegister();
void registerModule(PluginModuleSPtr module);
const ModuleMap& modules() const { return m_moduleMap; }
const PluginModule* findModule(const QString &module_ident) const;
private:
ModuleMap m_moduleMap;
static PluginRegister* s_pluginRegister;
};
#endif // PLUGINREGISTER_H