The SWORD Project
1.9.0.svnversion
|
#include <swmgr.h>
Public Member Functions | |
virtual void | augmentModules (const char *path, bool multiMod=false) |
void | deleteModule (const char *) |
virtual char | filterText (const char *filterName, SWBuf &text, const SWKey *key=0, const SWModule *module=0) |
virtual const char * | getGlobalOption (const char *option) |
virtual StringList | getGlobalOptions () |
virtual const char * | getGlobalOptionTip (const char *option) |
virtual StringList | getGlobalOptionValues (const char *option) |
SWModule * | getModule (const char *modName) |
const SWModule * | getModule (const char *modName) const |
ModMap & | getModules () |
const ModMap & | getModules () const |
ModMap & | getUtilModules () |
const ModMap & | getUtilModules () const |
virtual void | InstallScan (const char *dir) |
virtual SWDEPRECATED signed char | Load () |
virtual signed char | load () |
virtual signed char | setCipherKey (const char *modName, const char *key) |
virtual void | setGlobalOption (const char *option, const char *value) |
SWMgr (SWConfig *iconfig=0, SWConfig *isysconfig=0, bool autoload=true, SWFilterMgr *filterMgr=0, bool multiMod=false) | |
SWMgr (SWFilterMgr *filterMgr, bool multiMod=false) | |
SWMgr (const char *iConfigPath, bool autoload=true, SWFilterMgr *filterMgr=0, bool multiMod=false, bool augmentHome=true) | |
virtual | ~SWMgr () |
Static Public Member Functions | |
static void | findConfig (char *configType, char **prefixPath, char **configPath, StringList *augPaths=0, SWConfig **providedSysConf=0) |
static SWDEPRECATED SWBuf | getHomeDir () |
Public Attributes | |
SWConfig * | config |
char * | configPath |
ModMap | Modules |
char * | prefixPath |
SWConfig * | sysConfig |
Static Public Attributes | |
static const char * | globalConfPath = "/etc/sword.conf:/usr/local/etc/sword.conf" |
static bool | isICU = false |
static const char * | MODTYPE_BIBLES = "Biblical Texts" |
static const char * | MODTYPE_COMMENTARIES = "Commentaries" |
static const char * | MODTYPE_DAILYDEVOS = "Daily Devotional" |
static const char * | MODTYPE_GENBOOKS = "Generic Books" |
static const char * | MODTYPE_LEXDICTS = "Lexicons / Dictionaries" |
Private Member Functions | |
void | commonInit (SWConfig *iconfig, SWConfig *isysconfig, bool autoload, SWFilterMgr *filterMgr, bool multiMod=false) |
Private Attributes | |
bool | augmentHome |
bool | mgrModeMultiMod |
ModMap | utilModules |
SWMgr exposes an installed module set
SWMgr exposes an installed module set and can be asked to configure the desired markup and options which modules will produce.
SWMgr::SWMgr | ( | SWConfig * | iconfig = 0 , |
SWConfig * | isysconfig = 0 , |
||
bool | autoload = true , |
||
SWFilterMgr * | filterMgr = 0 , |
||
bool | multiMod = false |
||
) |
Constructs an instance of SWMgr
iconfig | manually supply a configuration. If not supplied, SWMgr will look on the system using a complex hierarchical search. See README for detailed specifics. |
isysconfig | manually supply a an isysconfig (e.g. /etc/sword.conf) |
autoload | whether or not to immediately load modules on construction of this SWMgr. If you reimplemented SWMgr you can set this to false and call SWMgr::load() after you have completed the contruction and setup of your SWMgr subclass. |
filterMgr | an SWFilterMgr subclass to use to manager filters on modules SWMgr TAKES OWNERSHIP FOR DELETING THIS OBJECT For example, this will create an SWMgr and cause its modules to produce HTMLHREF formatted output when asked for renderable text: |
SWMgr *myMgr = new SWMgr(0, 0, true, new MarkupFilterMgr(FMT_HTMLHREF));
Definition at line 368 of file swmgr.cpp.
SWMgr::SWMgr | ( | SWFilterMgr * | filterMgr, |
bool | multiMod = false |
||
) |
Definition at line 363 of file swmgr.cpp.
SWMgr::SWMgr | ( | const char * | iConfigPath, |
bool | autoload = true , |
||
SWFilterMgr * | filterMgr = 0 , |
||
bool | multiMod = false , |
||
bool | augmentHome = true |
||
) |
iConfigPath | provide a custom path to use for module set location, instead of searching the system for it. |
Definition at line 377 of file swmgr.cpp.
|
virtual |
|
inlineprotectedvirtual |
Definition at line 196 of file swmgr.h.
|
protectedvirtual |
Adds appropriate encoding filters to a module. Override to add any special encoding filters. See the module.conf Encoding= entry.
module | module to which to add encoding filters |
section | configuration information for module |
Definition at line 1266 of file swmgr.cpp.
|
protectedvirtual |
Adds appropriate global option filters to a module. Override to add any special global option filters. Global option filters typically update SourceType markup to turn on and off specific features of a text when a user has optionally chosen to show or hide that feature, e.g. Strongs, Footnotes, Headings, etc. Global options can also have more than On and Off values, but these are the most common. A set of all global options included from an entire library of installed modules can be obtained from getGlobalOptions and presented to the user. Values to which each global option may be set can be obtain from getGlobalOptionValues, and similar. See that family of methods for more information. See the module.conf GlobalOptionFilter= entries.
module | module to which to add encoding filters |
section | configuration information for module |
Definition at line 1140 of file swmgr.cpp.
|
inlineprotectedvirtual |
Definition at line 160 of file swmgr.h.
|
protectedvirtual |
Adds appropriate local option filters to a module. Override to add any special local option filters. Local options are similar to global options in that they may be toggled on or off or set to some value from a range of choices but local option See the module.conf LocalOptionFilter= entries.
module | module to which to add encoding filters |
section | configuration information for module |
Definition at line 1215 of file swmgr.cpp.
|
inlineprotectedvirtual |
Definition at line 181 of file swmgr.h.
|
protectedvirtual |
Adds manually specified strip filters specified in module configuration as LocalStripFilters. These might take care of special cases of preparation for searching, e.g., removing ()[] and underdot symbols from manuscript modules
module | module to which to add local strip filters |
section | configuration information for module |
Definition at line 1234 of file swmgr.cpp.
Definition at line 1374 of file swmgr.cpp.
|
inlineprotectedvirtual |
Definition at line 251 of file swmgr.h.
|
protectedvirtual |
Add appropriate raw filters to a module. Override to add any special raw filters. Raw filters are used to manipulate a buffer immediately after it has been read from storage. For example, any decryption that might need to be done. See the module.conf CipherKey= entry.
module | module to which to add raw filters |
section | configuration information for module |
Definition at line 1249 of file swmgr.cpp.
|
inlineprotectedvirtual |
Definition at line 209 of file swmgr.h.
|
protectedvirtual |
Add appropriate render filters to a module. Override to add any special render filters. Render filters are used for preparing a text for display and typically convert markup from SourceType to desired display markup. See the module.conf SourceType= entry.
module | module to which to add render filters |
section | configuration information for module |
Definition at line 1272 of file swmgr.cpp.
|
inlineprotectedvirtual |
Definition at line 224 of file swmgr.h.
|
protectedvirtual |
Adds appropriate strip filters to a module. Override to add any special strip filters. Strip filters are used for preparing text for searching and typically strip out all markup and leave only searchable words See the module.conf SourceType= entry.
module | module to which to add strip filters |
section | configuration information for module |
Definition at line 1298 of file swmgr.cpp.
|
inlineprotectedvirtual |
Definition at line 238 of file swmgr.h.
Adds books from a new path to the library
path | the path in which to search for books |
multiMod | whether or not to keep multiple copies of the same book if found in different paths default - false, uses last found version of the book |
Definition at line 776 of file swmgr.cpp.
|
private |
|
protectedvirtual |
method to create all modules from configuration.
Override to add any special processing before or after calling SWMgr::createAllModules
e.g., augmenting a localConfig.conf to SWMgr::config that might store CipheyKey or Font preferences per module before actual construction of modules
Definition at line 1456 of file swmgr.cpp.
|
inlineprotected |
|
protectedvirtual |
called to create exactly one module from a config entry override to do any extra work before or after each module is created
Definition at line 909 of file swmgr.cpp.
|
protectedvirtual |
|
inlineprotected |
|
virtual |
Filters a buffer thru a named filter
filterName | name of filter which the buffer should be filtered through |
text | buffer to filter |
key | context key if filter needs this for processing |
module | context module if filter needs this for processing |
Definition at line 1192 of file swmgr.cpp.
|
static |
Perform all the logic to discover a SWORD configuration and libraries on a system
Definition at line 449 of file swmgr.cpp.
|
virtual |
Gets a list of all available option names
Gets a brief description for the given option
option | the name of the option, who's tip is desired |
Definition at line 1415 of file swmgr.cpp.
|
virtual |
Gets a list of legal values to which a specific option may be set
option | the name of the option, who's legal values are desired |
|
static |
Definition at line 1577 of file swmgr.cpp.
ModMap & SWMgr::getModules | ( | ) |
The map of available modules. This map exposes the installed modules.
Here's an example how to iterate over all the installed modules and check the module name and type of each module and do something special if the module type is a Bible.
Definition at line 1574 of file swmgr.cpp.
Definition at line 348 of file swmgr.h.
ModMap & SWMgr::getUtilModules | ( | ) |
Definition at line 354 of file swmgr.h.
|
protectedvirtual |
call by every constructor to initialize SWMgr object override to include any addition common initialization
Definition at line 163 of file swmgr.cpp.
|
virtual |
Looks for any newly installed module.conf file in the path provided, displays the copyright information to the user, and then copies the module.conf to the main module set's mods.d directory
dir | where to search for new modules |
Definition at line 1331 of file swmgr.cpp.
|
inlinevirtual |
|
virtual |
Loads installed library of SWORD modules. Should only be manually called if SWMgr was constructed without autoload; otherwise, this will be called on SWMgr construction Reimplement this function to supply special functionality when modules are initially loaded. This includes discovery of config path with SWMgr::fileconfig, loading of composite SWMgr::config, and construction of all modules from config using SWMgr::createAllModules
Definition at line 837 of file swmgr.cpp.
|
protectedvirtual |
Definition at line 747 of file swmgr.cpp.
Sets the cipher key for the given module. This function updates the key at runtime, but it does not write to the config file. This method is NOT the recommended means for applying a CipherKey to a module.
Typically CipherKey entries and other per module user configuration settings are all saved in a separate localConfig.conf that is updated by a UI or other client of the library. e.g.,
[KJV] Font=Arial LocalOptionFilter=SomeSpecialFilterMyUIAppliesToTheKJV
[ISV] CipherKey=xyzzy
[StrongsGreek] SomeUISetting=false
Then these extra config settings in this separate file are applied just before module creation by overriding SWMgr::createAllModules and augmenting SWMgr::config with code like this:
The above convention is preferred to using this setCipherKey method
modName | For this module we change the unlockKey |
key | This is the new unlock key we use for the module. |
Definition at line 1550 of file swmgr.cpp.
Change the values of global options (e.g. Footnotes, Strong's Number, etc.)
option | The name of the option, for which you want to change the value. Well known and often used values are "Footnotes" or "Strong's Numbers" |
value | new value. Common values are "On" and "Off" |
Definition at line 1392 of file swmgr.cpp.
|
protected |
|
protected |
SWConfig* SWMgr::config |
The configuration of a loaded library of SWORD modules e.g., from /usr/share/sword/mods.d/ augmented with ~/.sword/mods.d/
This represents all discovered modules and their configuration compiled into a single SWConfig object with each [section] representing each module. e.g. [KJV]
char* SWMgr::configPath |
|
protected |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
protected |
|
protected |
char* SWMgr::prefixPath |
SWConfig* SWMgr::sysConfig |
|
protected |