Main Page   Namespace List   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.7 2002/06/20 20:23:10 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 
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   SWConfig *homeConfig;
00079   void CreateMods ();
00080   SWModule *CreateMod (string name, string driver, ConfigEntMap & section);
00081   void DeleteMods ();
00082   char configType;              // 0 = file; 1 = directory
00083   FilterMap optionFilters;
00084   FilterMap cipherFilters;
00085   SWFilter *gbfplain;
00086   SWFilter *thmlplain;
00087   FilterList cleanupFilters;
00088   OptionsList options;
00089   virtual void init (); // use to initialize before loading modules
00090   virtual char AddModToConfig (int conffd, const char *fname);
00091   virtual void loadConfigDir (const char *ipath);
00092   virtual void AddGlobalOptions (SWModule * module, ConfigEntMap & section,
00093                                  ConfigEntMap::iterator start,
00094                                  ConfigEntMap::iterator end);
00095   virtual void AddLocalOptions (SWModule * module, ConfigEntMap & section,
00096                                 ConfigEntMap::iterator start,
00097                                 ConfigEntMap::iterator end);
00098 
00104   virtual void AddEncodingFilters (SWModule * module, ConfigEntMap & section);
00110   virtual void AddRenderFilters (SWModule * module, ConfigEntMap & section);
00116   virtual void AddStripFilters (SWModule * module, ConfigEntMap & section);
00122   virtual void AddRawFilters (SWModule * module, ConfigEntMap & section);
00123 
00124 public:
00125 
00130   static bool debug;
00131   static const char *globalConfPath;
00135   static void findConfig (char *configType, char **prefixPath,
00136                           char **configPath);
00145   SWConfig *config;
00149   SWConfig *sysconfig;
00172   ModMap Modules;
00176   char *prefixPath;
00180   char *configPath;
00181 
00189   SWMgr (SWConfig * iconfig = 0, SWConfig * isysconfig = 0, bool autoload = true, SWFilterMgr *filterMgr = 0);
00194   SWMgr (SWFilterMgr *filterMgr);
00204   SWMgr (const char *iConfigPath, bool autoload = true, SWFilterMgr *filterMgr = 0);
00210   virtual ~SWMgr ();
00214   virtual void InstallScan (const char *dir);
00219   virtual signed char Load ();
00227   virtual void setGlobalOption (const char *option, const char *value);
00232   virtual const char *getGlobalOption (const char *option);
00238   virtual const char *getGlobalOptionTip (const char *option);
00242   virtual OptionsList getGlobalOptions ();
00246   virtual OptionsList getGlobalOptionValues (const char *option);
00288   virtual signed char setCipherKey (const char *modName, const char *key);
00289 };
00290 #endif

Generated on Thu Jun 20 22:13:00 2002 for The Sword Project by doxygen1.2.15