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

swmgr.h

00001 /******************************************************************************
00002  *  swmgr.h   - definition of class SWMgr used to interact with an install
00003  *                              base of sword modules.
00004  *
00005  * $Id: swmgr_h-source.html,v 1.4 2001/10/05 20:45:22 mgruner Exp $
00006  *
00007  * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
00008  *      CrossWire Bible Society
00009  *      P. O. Box 2528
00010  *      Tempe, AZ  85280-2528
00011  *
00012  * This program is free software; you can redistribute it and/or modify it
00013  * under the terms of the GNU General Public License as published by the
00014  * Free Software Foundation version 2.
00015  *
00016  * This program is distributed in the hope that it will be useful, but
00017  * WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * General Public License for more details.
00020  *
00021  */
00022 
00036 #ifndef SWMGR_H
00037 #define SWMGR_H
00038 
00039 #include <sys/types.h>
00040 #include <string>
00041 #include <map>
00042 #include <list>
00043 #include <swmodule.h>
00044 #include <swconfig.h>
00045 #include <swlog.h>
00046 
00047 #include <defs.h>
00048 
00049 using namespace std;
00050 
00051 typedef map < string, SWModule *, less < string > >ModMap;
00052 typedef list < string > OptionsList;
00053 typedef map < string, SWFilter * >FilterMap;
00054 
00063 class SWDLLEXPORT SWMgr
00064 {
00065 protected:
00066   SWConfig * myconfig;          //made protected because because BibleTime needs it
00067   SWConfig *mysysconfig;
00068   void CreateMods ();
00069   SWModule *CreateMod (string name, string driver, ConfigEntMap & section);
00070   void DeleteMods ();
00071   char configType;              // 0 = file; 1 = directory
00072   FilterMap optionFilters;
00073   FilterMap cipherFilters;
00074   SWFilter *gbfplain;
00075   SWFilter *thmlplain;
00076   FilterList cleanupFilters;
00077   OptionsList options;
00078   virtual void init (); // use to initialize before loading modules
00079   virtual char AddModToConfig (int conffd, const char *fname);
00080   virtual void loadConfigDir (const char *ipath);
00081   virtual void AddGlobalOptions (SWModule * module, ConfigEntMap & section,
00082                                  ConfigEntMap::iterator start,
00083                                  ConfigEntMap::iterator end);
00084   virtual void AddLocalOptions (SWModule * module, ConfigEntMap & section,
00085                                 ConfigEntMap::iterator start,
00086                                 ConfigEntMap::iterator end);
00092   virtual void AddRenderFilters (SWModule * module, ConfigEntMap & section);
00098   virtual void AddStripFilters (SWModule * module, ConfigEntMap & section);
00104   virtual void AddRawFilters (SWModule * module, ConfigEntMap & section);
00105 
00106 public:
00110   static bool debug;
00114   static void findConfig (char *configType, char **prefixPath,
00115                           char **configPath);
00122   SWConfig *config;
00126   SWConfig *sysconfig;
00130   ModMap Modules;
00134   char *prefixPath;
00138   char *configPath;
00145   SWMgr (SWConfig * iconfig = 0, SWConfig * isysconfig = 0, bool autoload = true);
00149   SWMgr (const char *iConfigPath, bool autoload = true);
00155   virtual ~SWMgr ();
00159   virtual void InstallScan (const char *dir);
00164   virtual void Load ();
00171   virtual void setGlobalOption (const char *option, const char *value);
00176   virtual const char *getGlobalOption (const char *option);
00182   virtual const char *getGlobalOptionTip (const char *option);
00186   virtual OptionsList getGlobalOptions ();
00190   virtual OptionsList getGlobalOptionValues (const char *option);
00232   virtual char setCipherKey (const char *modName, const char *key);
00233   
00239   const float Version() const {return 1.52;};
00240 };
00241 #endif

Generated at Fri Oct 5 22:45:33 2001 for The Sword Project by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001