00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 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
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;
00067 SWConfig *mysysconfig;
00068 void CreateMods ();
00069 SWModule *CreateMod (string name, string driver, ConfigEntMap & section);
00070 void DeleteMods ();
00071 char configType;
00072 FilterMap optionFilters;
00073 FilterMap cipherFilters;
00074 SWFilter *gbfplain;
00075 SWFilter *thmlplain;
00076 FilterList cleanupFilters;
00077 OptionsList options;
00078 virtual void init ();
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 };
00234 #endif