|
plugldr.h00001 /* 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_PLUGLDR_H__ 00020 #define __CS_PLUGLDR_H__ 00021 00022 #include "csutil/csvector.h" 00023 #include "csutil/util.h" 00024 00025 struct iObjectRegistry; 00026 00027 struct csPluginLoadRec 00028 { 00029 char* Tag; 00030 char* ClassID; 00031 00032 csPluginLoadRec (const char* iTag, const char* iClassID) 00033 { Tag = csStrNew (iTag); ClassID = csStrNew (iClassID); } 00034 ~csPluginLoadRec () 00035 { delete [] ClassID; delete [] Tag; } 00036 }; 00037 00038 class csPluginList : public csVector 00039 { 00040 public: 00041 virtual ~csPluginList () 00042 { DeleteAll (); } 00043 bool Sort (iObjectRegistry* object_reg); 00044 csPluginLoadRec &Get (int idx) 00045 { return *(csPluginLoadRec *)csVector::Get (idx); } 00046 virtual bool FreeItem (csSome Item) 00047 { delete (csPluginLoadRec *)Item; return true; } 00048 private: 00049 bool RecurseSort (iObjectRegistry*, int row, int *order, int *loop, 00050 bool *matrix); 00051 }; 00052 00057 class csPluginLoader 00058 { 00059 friend class csPluginList; 00060 00061 private: 00062 // The object registry. 00063 iObjectRegistry* object_reg; 00064 // Requested plugins. 00065 csPluginList requested_plugins; 00066 00067 public: 00069 csPluginLoader (iObjectRegistry* object_reg); 00071 virtual ~csPluginLoader (); 00072 00083 void RequestPlugin (const char* pluginName, const char* tagName); 00084 00086 bool LoadPlugins (); 00087 }; 00088 00089 #endif // __CS_PLUGLDR_H__ 00090 Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |