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_8h-source.html,v 1.4 2002/01/22 14:20:28 jansorg 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 
00039 #ifndef SWMGR_H
00040 #define SWMGR_H
00041 
00042 #include <sys/types.h>
00043 #include <string>
00044 #include <map>
00045 #include <list>
00046 #include <swmodule.h>
00047 #include <swconfig.h>
00048 #include <swlog.h>
00049 #include <swfiltermgr.h>
00050 
00051 #include <defs.h>
00052 
00053 using namespace std;
00054 
00055 typedef map < string, SWModule *, less < string > >ModMap;
00056 typedef list < string > OptionsList;
00057 typedef map < string, SWFilter * >FilterMap;
00058 
00069 class SWDLLEXPORT SWMgr {
00070 
00071 private:
00072   void commonInit(SWConfig * iconfig, SWConfig * isysconfig, bool autoload, SWFilterMgr *filterMgr);
00073 
00074 protected:
00075   SWFilterMgr *filterMgr;               //made protected because because BibleTime needs it
00076   SWConfig * myconfig;          //made protected because because BibleTime needs it
00077   SWConfig *mysysconfig;
00078   void CreateMods ();
00079   SWModule *CreateMod (string name, string driver, ConfigEntMap & section);
00080   void DeleteMods ();
00081   char configType;              // 0 = file; 1 = directory
00082   FilterMap optionFilters;
00083   FilterMap cipherFilters;
00084   SWFilter *gbfplain;
00085   SWFilter *thmlplain;
00086   FilterList cleanupFilters;
00087   OptionsList options;
00088   virtual void init (); // use to initialize before loading modules
00089   virtual char AddModToConfig (int conffd, const char *fname);
00090   virtual void loadConfigDir (const char *ipath);
00091   virtual void AddGlobalOptions (SWModule * module, ConfigEntMap & section,
00092                                  ConfigEntMap::iterator start,
00093                                  ConfigEntMap::iterator end);
00094   virtual void AddLocalOptions (SWModule * module, ConfigEntMap & section,
00095                                 ConfigEntMap::iterator start,
00096                                 ConfigEntMap::iterator end);
00097 
00103   virtual void AddEncodingFilters (SWModule * module, ConfigEntMap & section);
00109   virtual void AddRenderFilters (SWModule * module, ConfigEntMap & section);
00115   virtual void AddStripFilters (SWModule * module, ConfigEntMap & section);
00121   virtual void AddRawFilters (SWModule * module, ConfigEntMap & section);
00122 
00123 public:
00128   static bool debug;
00129   static const char *globalConfPath;
00133   static void findConfig (char *configType, char **prefixPath,
00134                           char **configPath);
00143   SWConfig *config;
00147   SWConfig *sysconfig;
00170   ModMap Modules;
00174   char *prefixPath;
00178   char *configPath;
00179 
00187   SWMgr (SWConfig * iconfig = 0, SWConfig * isysconfig = 0, bool autoload = true, SWFilterMgr *filterMgr = 0);
00192   SWMgr (SWFilterMgr *filterMgr);
00202   SWMgr (const char *iConfigPath, bool autoload = true, SWFilterMgr *filterMgr = 0);
00208   virtual ~SWMgr ();
00212   virtual void InstallScan (const char *dir);
00217   virtual void Load ();
00225   virtual void setGlobalOption (const char *option, const char *value);
00230   virtual const char *getGlobalOption (const char *option);
00236   virtual const char *getGlobalOptionTip (const char *option);
00240   virtual OptionsList getGlobalOptions ();
00244   virtual OptionsList getGlobalOptionValues (const char *option);
00286   virtual signed char setCipherKey (const char *modName, const char *key);
00287 };
00288 #endif

Generated at Tue Jan 22 14:52:48 2002 for The Sword Project by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001