00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ 00002 00003 /* AbiSource Application Framework 00004 * Copyright (C) 2001 AbiSource, Inc. 00005 * Copyright (C) 2001 Dom Lachowicz <cinamod@hotmail.com> 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00020 * 02110-1301 USA. 00021 */ 00022 00023 #ifndef XAP_MODULE_MANAGER_H 00024 #define XAP_MODULE_MANAGER_H 00025 00026 // Singleton class that will load/unload modules for us 00027 00028 /* pre-emptive dismissal; ut_types.h is needed by just about everything, 00029 * so even if it's commented out in-file that's still a lot of work for 00030 * the preprocessor to do... 00031 */ 00032 #ifndef UT_TYPES_H 00033 #include "ut_types.h" 00034 #endif 00035 00036 #include "ut_vector.h" 00037 00038 #include "xap_Module.h" 00039 00040 00041 class ABI_EXPORT XAP_ModuleManager 00042 { 00043 friend class XAP_Module; 00044 00045 private: 00046 XAP_ModuleManager (); 00047 00048 public: 00049 ~XAP_ModuleManager (); // grrr 00050 00051 static XAP_ModuleManager & instance (); 00052 00053 bool loadModule (const char * szFilename); 00054 00055 bool loadPreloaded (XAP_Plugin_Registration fnRegister, 00056 XAP_Plugin_Registration fnDeregister, 00057 XAP_Plugin_VersionCheck fnSupportsVersion); 00058 00059 void unloadModule (XAP_Module * module); 00060 private: 00061 void unloadModule (UT_sint32 ndx); 00062 public: 00063 void unloadAllPlugins (); 00064 00065 const UT_GenericVector<XAP_Module*> * enumModules () const; 00066 00067 private: 00068 00069 XAP_ModuleManager(const XAP_ModuleManager &); // no impl 00070 void operator=(const XAP_ModuleManager &); // no impl 00071 00072 UT_GenericVector<XAP_Module*> * m_modules; 00073 }; 00074 00075 #endif /* XAP_MODULE_MANAGER_H */