| #pragma once |
| |
| #ifndef TPLUGINMANAGER_INCLUDED |
| #define TPLUGINMANAGER_INCLUDED |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #include "tcommon.h" |
| #include <set> |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TSYSTEM_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| class TFilePath; |
| |
| |
| |
| class DVAPI TPluginInfo { |
| std::string m_name; |
| |
| public: |
| TPluginInfo(std::string name = "") : m_name(name){}; |
| ~TPluginInfo(){}; |
| std::string getName() const { return m_name; }; |
| }; |
| |
| |
| |
| |
| |
| #ifdef _WIN32 |
| #define TLIBMAIN extern "C" __declspec(dllexport) const TPluginInfo *TLibMain() |
| #else |
| #define TLIBMAIN extern "C" const TPluginInfo *TLibMain() |
| #endif |
| |
| |
| |
| class DVAPI TPluginManager { |
| |
| class Plugin; |
| |
| std::set<std::string> m_ignoreList; |
| typedef std::vector<const Plugin *> PluginTable; |
| PluginTable m_pluginTable; |
| std::set<TFilePath> m_loadedPlugins; |
| |
| TPluginManager(); |
| |
| public: |
| ~TPluginManager(); |
| static TPluginManager *instance(); |
| |
| |
| bool isIgnored(std::string name) const; |
| |
| |
| void setIgnoredList(const std::set<std::string> &lst); |
| |
| |
| void setIgnored(std::string name) { |
| std::set<std::string> lst; |
| lst.insert(name); |
| setIgnoredList(lst); |
| } |
| |
| |
| void loadPlugin(const TFilePath &fp); |
| |
| |
| void loadPlugins(const TFilePath &dir); |
| |
| |
| void loadStandardPlugins(); |
| |
| |
| void unloadPlugins(); |
| }; |
| |
| #endif |