Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   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.9 2002/10/31 11:30:16 joachim 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 SWORD_NAMESPACE_START
00054 
00055 typedef std::map < std::string, SWModule *, std::less < std::string > >ModMap;
00056 typedef std::list < std::string > OptionsList;
00057 typedef std::map < std::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(std::string name, std::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         SWFilter *transliterator;
00088         FilterList cleanupFilters;
00089         OptionsList options;
00090         virtual void init(); // use to initialize before loading modules
00091         virtual char AddModToConfig(int conffd, const char *fname);
00092         virtual void loadConfigDir(const char *ipath);
00093         virtual void AddGlobalOptions(SWModule * module, ConfigEntMap & section,
00094         ConfigEntMap::iterator start,
00095         ConfigEntMap::iterator end);
00096         virtual void AddLocalOptions(SWModule * module, ConfigEntMap & section,
00097         ConfigEntMap::iterator start,
00098         ConfigEntMap::iterator end);
00099         std::list<std::string> augPaths;
00100 
00106         virtual void AddEncodingFilters(SWModule * module, ConfigEntMap & section);
00112         virtual void AddRenderFilters(SWModule * module, ConfigEntMap & section);
00118         virtual void AddStripFilters(SWModule * module, ConfigEntMap & section);
00124         virtual void AddRawFilters(SWModule * module, ConfigEntMap & section);
00125 
00126         virtual void augmentModules(const char *ipath);
00127 
00128 public:
00129 
00134         static bool debug;
00135         static bool isICU;
00136         static const char *globalConfPath;
00140         static void findConfig(char *configType, char **prefixPath, char **configPath, std::list<std::string> *augPaths = 0);
00149         SWConfig *config;
00153         SWConfig *sysconfig;
00176         ModMap Modules;
00177         SWModule *getModule(const char *modName) { ModMap::iterator it = Modules.find(modName); return ((it != Modules.end()) ? it->second : 0); }
00181         char *prefixPath;
00185         char *configPath;
00186 
00194         SWMgr(SWConfig * iconfig = 0, SWConfig * isysconfig = 0, bool autoload = true, SWFilterMgr *filterMgr = 0);
00199         SWMgr(SWFilterMgr *filterMgr);
00209         SWMgr(const char *iConfigPath, bool autoload = true, SWFilterMgr *filterMgr = 0);
00215         virtual ~SWMgr();
00219         virtual void InstallScan(const char *dir);
00224         virtual signed char Load();
00232         virtual void setGlobalOption(const char *option, const char *value);
00237         virtual const char *getGlobalOption(const char *option);
00243         virtual const char *getGlobalOptionTip(const char *option);
00247         virtual OptionsList getGlobalOptions();
00251         virtual OptionsList getGlobalOptionValues(const char *option);
00293         virtual signed char setCipherKey(const char *modName, const char *key);
00294 };
00295 
00296 SWORD_NAMESPACE_END
00297 #endif

Generated on Thu Oct 31 12:11:28 2002 for The Sword Project by doxygen1.2.17