Debian Codegraph @

src/af/xap/xp/xap_ModuleManager.h

raw
1 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
2
3 /* AbiSource Application Framework
4 * Copyright (C) 2001 AbiSource, Inc.
5 * Copyright (C) 2001 Dom Lachowicz <[email protected]>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301 USA.
21 */
22
23 #ifndef XAP_MODULE_MANAGER_H
24 #define XAP_MODULE_MANAGER_H
25
26 // Singleton class that will load/unload modules for us
27
28 /* pre-emptive dismissal; ut_types.h is needed by just about everything,
29 * so even if it's commented out in-file that's still a lot of work for
30 * the preprocessor to do...
31 */
32 #ifndef UT_TYPES_H
33 #include "ut_types.h"
34 #endif
35
36 #include "ut_vector.h"
37
38 #include "xap_Module.h"
39
40
41 class ABI_EXPORT XAP_ModuleManager
42 {
43 friend class XAP_Module;
44
45 private:
46 XAP_ModuleManager ();
47
48 public:
49 ~XAP_ModuleManager (); // grrr
50
51 static XAP_ModuleManager & instance ();
52
53 bool loadModule (const char * szFilename);
54
55 bool loadPreloaded (XAP_Plugin_Registration fnRegister,
56 XAP_Plugin_Registration fnDeregister,
57 XAP_Plugin_VersionCheck fnSupportsVersion);
58
59 void unloadModule (XAP_Module * module);
60 private:
61 void unloadModule (UT_sint32 ndx);
62 public:
63 void unloadAllPlugins ();
64
65 const UT_GenericVector<XAP_Module*> * enumModules () const;
66
67 private:
68
69 XAP_ModuleManager(const XAP_ModuleManager &); // no impl
70 void operator=(const XAP_ModuleManager &); // no impl
71
72 UT_GenericVector<XAP_Module*> * m_modules;
73 };
74
75 #endif /* XAP_MODULE_MANAGER_H */