8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 20:43:04 +01:00

Some cosmetic changes in the plugin manager.

This commit is contained in:
dimitr 2003-02-05 15:18:26 +00:00
parent 743dc62a3b
commit 6822d129ca
2 changed files with 18 additions and 9 deletions

View File

@ -295,21 +295,18 @@ void PluginManager::PluginModule::unload_module()
// Code that handles loading the generic firebird/plugin directory // Code that handles loading the generic firebird/plugin directory
static const char *ENGINE_PLUGIN_DIR = "plugins"; const char *PluginManager::ENGINE_PLUGIN_DIR = "plugins";
static PluginManager enginePluginManager;
static char enginePluginsLoaded = 0;
#ifndef DARWIN #ifndef DARWIN
static char *ENGINE_PLUGIN_REGISTRATION_ENTRYPOINT = "register_plugin"; const char *PluginManager::ENGINE_PLUGIN_REGISTRATION_ENTRYPOINT = "register_plugin";
#else #else
static char *ENGINE_PLUGIN_REGISTRATION_ENTRYPOINT = "_register_plugin"; const char *PluginManager::ENGINE_PLUGIN_REGISTRATION_ENTRYPOINT = "_register_plugin";
#endif #endif
typedef void (*engineRegistrationFuncType)(PluginManager::Plugin*);
void PluginManager::load_engine_plugins() void PluginManager::load_engine_plugins()
{ {
if (enginePluginsLoaded) PluginManager& enginePluginManager = getEnginePluginManager();
return;
enginePluginManager.addSearchPath(ENGINE_PLUGIN_DIR); enginePluginManager.addSearchPath(ENGINE_PLUGIN_DIR);
enginePluginManager.loadAllPlugins(); enginePluginManager.loadAllPlugins();
@ -325,3 +322,9 @@ void PluginManager::load_engine_plugins()
(*regFunc)(&p); (*regFunc)(&p);
} }
} }
PluginManager& PluginManager::getEnginePluginManager()
{
static PluginManager manager;
return manager;
}

View File

@ -48,6 +48,9 @@
**/ **/
class PluginManager class PluginManager
{ {
static const char *ENGINE_PLUGIN_DIR;
static const char *ENGINE_PLUGIN_REGISTRATION_ENTRYPOINT;
public: public:
static void load_engine_plugins(); static void load_engine_plugins();
@ -199,8 +202,11 @@ public:
/// is the set of all plugins known to the PluginManager. This includes all plugins /// is the set of all plugins known to the PluginManager. This includes all plugins
/// found with the loadAllPluings and findPlugin functions. /// found with the loadAllPluings and findPlugin functions.
iterator begin() { return iterator(moduleList); } iterator begin() { return iterator(moduleList); }
static PluginManager& getEnginePluginManager();
private: private:
typedef void (*engineRegistrationFuncType)(Plugin*);
typedef std::pair<Firebird::string, bool> Path; typedef std::pair<Firebird::string, bool> Path;
Module *moduleList; Module *moduleList;
Firebird::list<Path> searchPaths; Firebird::list<Path> searchPaths;