#include <swmgr.h>
Public Methods | |
SWMgr (SWConfig * iconfig = 0, SWConfig * isysconfig = 0, bool autoload = true) | |
Constructor of SWMgr. More... | |
SWMgr (const char *iConfigPath, bool autoload = true) | |
virtual | ~SWMgr () |
The destructor of SWMgr. More... | |
virtual void | InstallScan (const char *dir) |
Installs a scan for modules in the directory givan as parameter. More... | |
virtual void | Load () |
Load the modules. More... | |
virtual void | setGlobalOption (const char *option, const char *value) |
Set a global option Set a global option using the parameters. More... | |
virtual const char* | getGlobalOption (const char *option) |
Gives the value of the given option. More... | |
virtual const char* | getGlobalOptionTip (const char *option) |
Gives a description for the given option. More... | |
virtual OptionsList | getGlobalOptions () |
A list of all availble options with the currently set values. More... | |
virtual OptionsList | getGlobalOptionValues (const char *option) |
virtual char | setCipherKey (const char *modName, const char *key) |
Sets the cipher key for the given module. More... | |
Public Attributes | |
SWConfig* | config |
The global config object. More... | |
SWConfig* | sysconfig |
ModMap | Modules |
A map of all modules This map contains the list of installed modules we use. | |
char* | prefixPath |
The path to your Sword directory. | |
char* | configPath |
Static Public Methods | |
void | findConfig (char *configType, char **prefixPath, char **configPath) |
Static Public Attributes | |
bool | debug |
Enable / Disable debug output Set this static bool to true to get more verbose debug messages from SWMgr. | |
Protected Methods | |
void | CreateMods () |
SWModule* | CreateMod (string name, string driver, ConfigEntMap & section) |
void | DeleteMods () |
virtual void | init () |
virtual char | AddModToConfig (int conffd, const char *fname) |
virtual void | loadConfigDir (const char *ipath) |
virtual void | AddGlobalOptions (SWModule * module, ConfigEntMap & section, ConfigEntMap::iterator start, ConfigEntMap::iterator end) |
virtual void | AddLocalOptions (SWModule * module, ConfigEntMap & section, ConfigEntMap::iterator start, ConfigEntMap::iterator end) |
virtual void | AddRenderFilters (SWModule * module, ConfigEntMap & section) |
Adds the render filters which are defined in "section" to the SWModule object "module". More... | |
virtual void | AddStripFilters (SWModule * module, ConfigEntMap & section) |
Adds the strip filters which are defined in "section" to the SWModule object "module". More... | |
virtual void | AddRawFilters (SWModule * module, ConfigEntMap & section) |
Adds the raw filters which are defined in "section" to the SWModule object "module". More... | |
Protected Attributes | |
SWConfig* | myconfig |
SWConfig* | mysysconfig |
char | configType |
FilterMap | optionFilters |
FilterMap | cipherFilters |
SWFilter* | gbfplain |
SWFilter* | thmlplain |
FilterList | cleanupFilters |
OptionsList | options |
SWmgr manages the installed modules, the filters and global options like footnotes or strong numbers. The class SWMgr is the most important class of Sword. It is used to manage the installed modules. It also manages the filters (Render-, Strip- and Rawfilters).
Definition at line 63 of file swmgr.h.
|
Constructor of SWMgr.
iconfig | |
isysconfig | |
autoload | If this bool is true the constructor starts loading the installed modules. If you reimplemented SWMgr you can set autoload=false to load the modules with your own reimplemented function. |
|
The destructor of SWMgr.
This destrutcot cleans up the modules and deletes the created object. Destroy the SWMgr at last in your application.
|
Adds the raw filters which are defined in "section" to the SWModule object "module".
module | To this module the raw filter(s) are added |
section | We use this section to get a list of filters we should apply to the module |
|
Adds the render filters which are defined in "section" to the SWModule object "module".
module | To this module the render filter(s) are added |
section | We use this section to get a list of filters we should apply to the module |
|
Adds the strip filters which are defined in "section" to the SWModule object "module".
module | To this module the strip filter(s) are added |
section | We use this section to get a list of filters we should apply to the module |
|
Installs a scan for modules in the directory givan as parameter.
dir | The directory where new modules should be searched. |
|
Load the modules.
Reimplement this function to use your own Load function, for example to use your own filters.
|
Gives the value of the given option.
The | option, which should be used to return the value of it |
|
Gives a description for the given option.
option | The option, which should be used |
|
A list of all availble options with the currently set values.
|
Sets the cipher key for the given module.
This function updates the key at runtime, but it does not write to the config file. To write the new unlock key to the config file use code like this:
SectionMap::iterator section; ConfigEntMap::iterator entry; DIR *dir = opendir(configPath); struct dirent *ent; char* modFile; if (dir) { // find and update .conf file rewinddir(dir); while ((ent = readdir(dir))) { if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) { modFile = m_backend->configPath; modFile += "/"; modFile += ent->d_name; SWConfig *myConfig = new SWConfig( modFile ); section = myConfig->Sections.find( m_module->Name() ); if ( section != myConfig->Sections.end() ) { entry = section->second.find("CipherKey"); if (entry != section->second.end()) { entry->second = unlockKey;//set cipher key myConfig->Save();//save config file } } delete myConfig; } } } closedir(dir);
modName | For this module we change the unlockKey @paran key This is the new unlck key we use for te module. |
|
Set a global option Set a global option using the parameters.
A global option could be for example footnotes.
option | The name of the option, for which you want to change the value. Well known and often used values are "Footnotes" or "Strongs" |
value | The value. Common values are "On" and "Off" |
|
The global config object.
This is the global config object. It contains all items of all modules, so lookups should use this config object. If you want to save a cipher key or other things to the module config file, do NOT use this object, because it would corrupt your configs after config->Save().