CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

plugldr.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_PLUGLDR_H__
00020 #define __CS_PLUGLDR_H__
00021 
00022 #include "csutil/csvector.h"
00023 #include "csutil/util.h"
00024 
00025 struct iObjectRegistry;
00026 
00028 struct csPluginLoadRec
00029 {
00030   char* Tag;
00031   char* ClassID;
00032   iBase* plugin;
00033 
00034   csPluginLoadRec (const char* iTag, const char* iClassID)
00035   { Tag = csStrNew (iTag); ClassID = csStrNew (iClassID); }
00036   ~csPluginLoadRec ()
00037   { delete [] ClassID; delete [] Tag; }
00038 };
00039 
00041 class csPluginList : public csVector
00042 {
00043 public:
00044   virtual ~csPluginList ()
00045   { DeleteAll (); }
00046   bool Sort (iObjectRegistry* object_reg);
00047   csPluginLoadRec &Get (int idx)
00048   { return *(csPluginLoadRec *)csVector::Get (idx); }
00049   virtual bool FreeItem (void* Item)
00050   { delete (csPluginLoadRec *)Item; return true; }
00051 private:
00052   bool RecurseSort (iObjectRegistry*, int row, int *order, int *loop,
00053     bool *matrix);
00054 };
00055 
00060 class csPluginLoader
00061 {
00062   friend class csPluginList;
00063 
00064 private:
00065   // The object registry.
00066   iObjectRegistry* object_reg;
00067   // Requested plugins.
00068   csPluginList requested_plugins;
00069 
00070 public:
00072   csPluginLoader (iObjectRegistry* object_reg);
00074   virtual ~csPluginLoader ();
00075 
00086   void RequestPlugin (const char* pluginName, const char* tagName);
00087 
00089   bool LoadPlugins ();
00090 };
00091 
00092 #endif // __CS_PLUGLDR_H__
00093 

Generated for Crystal Space by doxygen 1.2.14