Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages
plugmgr.h
00001 /* 00002 Copyright (C) 1998-2001 by Jorrit Tyberghein 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_PLUGMGR_H__ 00020 #define __CS_PLUGMGR_H__ 00021 00022 #include "csextern.h" 00023 #include "csutil/parray.h" 00024 #include "csutil/scf.h" 00025 #include "csutil/thread.h" 00026 #include "iutil/plugin.h" 00027 #include "iutil/pluginconfig.h" 00028 00029 struct iComponent; 00030 struct iObjectRegistry; 00031 00036 class CS_CRYSTALSPACE_EXPORT csPluginManager : public iPluginManager 00037 { 00038 private: 00040 csRef<csMutex> mutex; 00041 00045 class CS_CRYSTALSPACE_EXPORT csPlugin 00046 { 00047 public: 00049 iComponent *Plugin; 00051 char *ClassID; 00052 00054 csPlugin (iComponent *iObject, const char *iClassID); 00056 virtual ~csPlugin (); 00057 }; 00058 00062 class CS_CRYSTALSPACE_EXPORT csPluginsVector : public csPDelArray<csPlugin> 00063 { 00064 public: 00066 csPluginsVector (int l, int d) : csPDelArray<csPlugin> (l, d) {} 00068 static int CompareAddress (csPlugin* const& Item, iComponent* const& Key) 00069 { return Item->Plugin == Key ? 0 : 1; } 00070 }; 00071 00075 class CS_CRYSTALSPACE_EXPORT csPluginOption 00076 { 00077 public: 00078 char *Name; 00079 csVariantType Type; 00080 int ID; 00081 bool Value; // If Type is CSVAR_BOOL 00082 csRef<iPluginConfig> Config; 00083 00084 csPluginOption (const char *iName, csVariantType iType, int iID, 00085 bool iValue, iPluginConfig* cfg) 00086 { 00087 Name = csStrNew (iName); 00088 Type = iType; 00089 ID = iID; 00090 Value = iValue; 00091 Config = cfg; 00092 } 00093 virtual ~csPluginOption () 00094 { 00095 delete [] Name; 00096 } 00097 }; 00098 00100 iObjectRegistry* object_reg; 00101 00103 csPluginsVector Plugins; 00104 00105 // List of all options for all plug-in modules. 00106 csPDelArray<csPluginOption> OptionList; 00107 00108 public: 00110 csPluginManager (iObjectRegistry* object_reg); 00112 virtual ~csPluginManager (); 00113 00114 SCF_DECLARE_IBASE; 00115 00117 virtual iBase *LoadPlugin (const char *iClassID, bool init = true); 00118 00122 virtual iBase *QueryPlugin (const char *iInterface, int iVersion); 00124 virtual iBase *QueryPlugin (const char* iClassID, 00125 const char *iInterface, int iVersion); 00127 virtual bool UnloadPlugin (iComponent *iObject); 00129 virtual bool RegisterPlugin (const char *iClassID, 00130 iComponent *iObject); 00132 virtual csPtr<iPluginIterator> GetPlugins (); 00134 virtual void Clear (); 00135 00137 virtual void QueryOptions (iComponent *iObject); 00138 }; 00139 00140 #endif // __CS_PLUGMGR_H__ 00141
Generated for Crystal Space by doxygen 1.4.4