Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

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.1 2003/02/28 21:22:04 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 SWORD_NAMESPACE_START
00054 
00055 typedef std::map < std::string, SWModule *, std::less < std::string > >ModMap;
00056 typedef std::map < std::string, SWFilter * >FilterMap;
00057 
00068 class SWDLLEXPORT SWMgr {
00069 
00070 private:
00071         void commonInit(SWConfig * iconfig, SWConfig * isysconfig, bool autoload, SWFilterMgr *filterMgr);
00072 
00073 protected:
00074         SWFilterMgr *filterMgr;         //made protected because because BibleTime needs it
00075         SWConfig * myconfig;            //made protected because because BibleTime needs it
00076         SWConfig *mysysconfig;
00077         SWConfig *homeConfig;
00078         void CreateMods();
00079         SWModule *CreateMod(std::string name, std::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         SWFilter *osisplain;
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);
00210         SWMgr(const char *iConfigPath, bool autoload = true, SWFilterMgr *filterMgr = 0);
00216         virtual ~SWMgr();
00220         virtual void InstallScan(const char *dir);
00225         virtual signed char Load();
00233         virtual void setGlobalOption(const char *option, const char *value);
00238         virtual const char *getGlobalOption(const char *option);
00244         virtual const char *getGlobalOptionTip(const char *option);
00248         virtual OptionsList getGlobalOptions();
00252         virtual OptionsList getGlobalOptionValues(const char *option);
00294         virtual signed char setCipherKey(const char *modName, const char *key);
00295 };
00296 
00297 SWORD_NAMESPACE_END
00298 #endif

Generated on Fri Feb 28 22:01:39 2003 for The Sword Project by doxygen1.3-rc3