/* $Id$ */ /* * Cantus Tag Editor * Copyright © 2002-2004 by Samuel Abels * Copyright © 2007 by Tim Huetz * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see **/ #ifdef HAVE_CONFIG_H # include #endif #ifndef HAVE_PLUGINHANDLER_H #define HAVE_PLUGINHANDLER_H class PluginHandler; #include #include #include #include #include #include class PluginHandler : public sigc::trackable { protected: // Prevent copys. PluginHandler(PluginHandler &p) { g_assert_not_reached(); } // Prevent assignments. PluginHandler& operator=(PluginHandler &p) { g_assert_not_reached(); } public: PluginHandler(); ~PluginHandler(); /* Triggered whenever a plugin has successfully been loaded. */ SigC::Signal1 signal_plugin_loaded; /* Triggered whenever a plugin has been removed (= when the refcounter has */ /* been decreased). */ SigC::Signal1 signal_plugin_removed; /* Triggered straight before a plugin is being deleted (= when the */ /* refcounter has reached a value <= 0). */ SigC::Signal1 signal_plugin_deleted; /* Register a new input plugin. * Returns 0 on success, an errorcode < 0 otherwise. * Emits the Plugin::Registered signal. */ gint reg(const gchar *filename, gint priority); /* Unregister an input plugin (=decrease the plugin's refcounter). * Emits the Plugin::Unregistered signal. */ void unreg(const gchar *filename); /* Return an std::list of all plugins responsible for the given file type. * Don't forget to delete the list AND UNREF EVERY PLUGIN!! */ std::list *get_responsible_plugins(const gchar *filename); /* Given a list of filenames, this function returns a std::list of all * responsible plugins for the given filetypes. * Don't forget to delete the list AND UNREF EVERY PLUGIN!! */ std::list *get_responsible_plugins_from_list(GList *filenames); /* This function returns a list of all plugins. Don't forget to delete the * list AND UNREF EVERY PLUGIN!! */ std::list *get_plugins(void); protected: // Holds mappings between plugin filenames and "Plugin" objects. std::map plugins_str; std::map plugins_int; }; #endif