File: SWMgr.3

package info (click to toggle)
sword 1.5.3-3woody2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 20,484 kB
  • ctags: 11,105
  • sloc: cpp: 49,665; ansic: 13,335; sh: 8,730; pascal: 3,433; tcl: 1,602; makefile: 988; perl: 565; sed: 93
file content (452 lines) | stat: -rw-r--r-- 13,356 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
.TH "SWMgr" 3 "22 Jan 2002" "The Sword Project" \" -*- nroff -*-
.ad l
.nh
.SH NAME
SWMgr \- SWMgr is the main class of the Sword library. 
.SH SYNOPSIS
.br
.PP
\fC#include <swmgr.h>\fP
.PP
.SS "Public Methods"

.in +1c
.ti -1c
.RI "\fBSWMgr\fP (\fBSWConfig\fP *iconfig=0, \fBSWConfig\fP *isysconfig=0, bool autoload=true, SWFilterMgr *filterMgr=0)"
.br
.RI "\fIConstructor of SWMgr.\fP"
.ti -1c
.RI "\fBSWMgr\fP (SWFilterMgr *filterMgr)"
.br
.ti -1c
.RI "\fBSWMgr\fP (const char *iConfigPath, bool autoload=true, SWFilterMgr *filterMgr=0)"
.br
.ti -1c
.RI "virtual \fB~SWMgr\fP ()"
.br
.RI "\fIThe destructor of SWMgr.\fP"
.ti -1c
.RI "virtual void \fBInstallScan\fP (const char *dir)"
.br
.RI "\fIInstalls a scan for modules in the directory givan as parameter.\fP"
.ti -1c
.RI "virtual void \fBLoad\fP ()"
.br
.RI "\fILoad the modules.\fP"
.ti -1c
.RI "virtual void \fBsetGlobalOption\fP (const char *option, const char *value)"
.br
.RI "\fISet a global option Set a global option using the parameters.\fP"
.ti -1c
.RI "virtual const char * \fBgetGlobalOption\fP (const char *option)"
.br
.RI "\fIGives the value of the given option.\fP"
.ti -1c
.RI "virtual const char * \fBgetGlobalOptionTip\fP (const char *option)"
.br
.RI "\fIGives a description for the given option.\fP"
.ti -1c
.RI "virtual OptionsList \fBgetGlobalOptions\fP ()"
.br
.RI "\fIA list of all availble options with the currently set values.\fP"
.ti -1c
.RI "virtual OptionsList \fBgetGlobalOptionValues\fP (const char *option)"
.br
.ti -1c
.RI "virtual signed char \fBsetCipherKey\fP (const char *modName, const char *key)"
.br
.RI "\fISets the cipher key for the given module.\fP"
.in -1c
.SS "Static Public Methods"

.in +1c
.ti -1c
.RI "void \fBfindConfig\fP (char *configType, char **\fBprefixPath\fP, char **configPath)"
.br
.in -1c
.SS "Public Attributes"

.in +1c
.ti -1c
.RI "\fBSWConfig\fP * \fBconfig\fP"
.br
.RI "\fIThe global config object.\fP"
.ti -1c
.RI "\fBSWConfig\fP * \fBsysconfig\fP"
.br
.ti -1c
.RI "ModMap \fBModules\fP"
.br
.RI "\fIThe map of available modules.\fP"
.ti -1c
.RI "char * \fBprefixPath\fP"
.br
.RI "\fIThe path to your Sword directory.\fP"
.ti -1c
.RI "char * \fBconfigPath\fP"
.br
.in -1c
.SS "Static Public Attributes"

.in +1c
.ti -1c
.RI "bool \fBdebug\fP"
.br
.RI "\fIEnable / Disable debug output on runtime Set this to true to get more verbose output of SWMgr at runtime.\fP"
.ti -1c
.RI "const char * \fBglobalConfPath\fP"
.br
.in -1c
.SS "Protected Methods"

.in +1c
.ti -1c
.RI "void \fBCreateMods\fP ()"
.br
.ti -1c
.RI "\fBSWModule\fP * \fBCreateMod\fP (string name, string driver, ConfigEntMap &section)"
.br
.ti -1c
.RI "void \fBDeleteMods\fP ()"
.br
.ti -1c
.RI "virtual void \fBinit\fP ()"
.br
.ti -1c
.RI "virtual char \fBAddModToConfig\fP (int conffd, const char *fname)"
.br
.ti -1c
.RI "virtual void \fBloadConfigDir\fP (const char *ipath)"
.br
.ti -1c
.RI "virtual void \fBAddGlobalOptions\fP (\fBSWModule\fP *module, ConfigEntMap &section, ConfigEntMap::iterator start, ConfigEntMap::iterator end)"
.br
.ti -1c
.RI "virtual void \fBAddLocalOptions\fP (\fBSWModule\fP *module, ConfigEntMap &section, ConfigEntMap::iterator start, ConfigEntMap::iterator end)"
.br
.ti -1c
.RI "virtual void \fBAddEncodingFilters\fP (\fBSWModule\fP *module, ConfigEntMap &section)"
.br
.RI "\fIAdds the encoding filters which are defined in 'section' to the \fBSWModule\fP object 'module'.\fP"
.ti -1c
.RI "virtual void \fBAddRenderFilters\fP (\fBSWModule\fP *module, ConfigEntMap &section)"
.br
.RI "\fIAdds the render filters which are defined in 'section' to the \fBSWModule\fP object 'module'.\fP"
.ti -1c
.RI "virtual void \fBAddStripFilters\fP (\fBSWModule\fP *module, ConfigEntMap &section)"
.br
.RI "\fIAdds the strip filters which are defined in 'section' to the \fBSWModule\fP object 'module'.\fP"
.ti -1c
.RI "virtual void \fBAddRawFilters\fP (\fBSWModule\fP *module, ConfigEntMap &section)"
.br
.RI "\fIAdds the raw filters which are defined in 'section' to the \fBSWModule\fP object 'module'.\fP"
.in -1c
.SS "Protected Attributes"

.in +1c
.ti -1c
.RI "SWFilterMgr * \fBfilterMgr\fP"
.br
.ti -1c
.RI "\fBSWConfig\fP * \fBmyconfig\fP"
.br
.ti -1c
.RI "\fBSWConfig\fP * \fBmysysconfig\fP"
.br
.ti -1c
.RI "char \fBconfigType\fP"
.br
.ti -1c
.RI "FilterMap \fBoptionFilters\fP"
.br
.ti -1c
.RI "FilterMap \fBcipherFilters\fP"
.br
.ti -1c
.RI "SWFilter * \fBgbfplain\fP"
.br
.ti -1c
.RI "SWFilter * \fBthmlplain\fP"
.br
.ti -1c
.RI "FilterList \fBcleanupFilters\fP"
.br
.ti -1c
.RI "OptionsList \fBoptions\fP"
.br
.in -1c
.SS "Private Methods"

.in +1c
.ti -1c
.RI "void \fBcommonInit\fP (\fBSWConfig\fP *iconfig, \fBSWConfig\fP *isysconfig, bool autoload, SWFilterMgr *filterMgr)"
.br
.in -1c
.SH "DETAILED DESCRIPTION"
.PP 
SWMgr is the main class of the Sword library.
.PP
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).
.PP
To get the \fBSWModule\fP objects of the instalelled modules use \fBModules\fP for this. 
.PP
\fBSee also: \fP
.in +1c
\fBAddRawFilters\fP(), \fBAddRenderFilters\fP(), \fBAddStripFilters\fP() 
.PP
\fBVersion: \fP
.in +1c
\fBId: \fP
.in +1c
 swmgr.h,v 1.36 2002/01/04 23:36:32 scribe Exp  
.PP
Definition at line 69 of file swmgr.h.
.SH "CONSTRUCTOR & DESTRUCTOR DOCUMENTATION"
.PP 
.SS "SWMgr::SWMgr (\fBSWConfig\fP * iconfig = 0, \fBSWConfig\fP * isysconfig = 0, bool autoload = true, SWFilterMgr * filterMgr = 0)"
.PP
Constructor of SWMgr.
.PP
Parameters: 
.in +1c
.TP
\fB\fIiconfig\fP\fP
.TP
\fB\fIisysconfig\fP\fP
.TP
\fB\fIautoload\fP\fP
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. 
.TP
\fB\fIfilterMgr\fP\fP
an SWFilterMgr subclass to use to manager filters on modules THIS WILL BE DELETED BY SWMgr 
.SS "SWMgr::SWMgr (SWFilterMgr * filterMgr)"
.PP
Parameters: 
.in +1c
.TP
\fB\fIfilterMgr\fP\fP
an SWFilterMgr subclass to use to manager filters on modules THIS WILL BE DELETED BY SWMgr 
.SS "SWMgr::SWMgr (const char * iConfigPath, bool autoload = true, SWFilterMgr * filterMgr = 0)"
.PP
Parameters: 
.in +1c
.TP
\fB\fIautoload\fP\fP
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. 
.TP
\fB\fIfilterMgr\fP\fP
an SWFilterMgr subclass to use to manager filters on modules THIS WILL BE DELETED BY SWMgr 
.SS "virtual SWMgr::~SWMgr ()\fC [virtual]\fP"
.PP
The destructor of SWMgr.
.PP
This function cleans up the modules and deletes the created object. Destroy the SWMgr at last object in your application, because otherwise you may experience crashes because the \fBSWModule\fP objects become invalid. 
.SH "MEMBER FUNCTION DOCUMENTATION"
.PP 
.SS "virtual void SWMgr::AddEncodingFilters (\fBSWModule\fP * module, ConfigEntMap & section)\fC [protected, virtual]\fP"
.PP
Adds the encoding filters which are defined in 'section' to the \fBSWModule\fP object 'module'.
.PP
Parameters: 
.in +1c
.TP
\fB\fImodule\fP\fP
To this module the encoding filter(s) are added 
.TP
\fB\fIsection\fP\fP
We use this section to get a list of filters we should apply to the module 
.SS "virtual void SWMgr::AddRawFilters (\fBSWModule\fP * module, ConfigEntMap & section)\fC [protected, virtual]\fP"
.PP
Adds the raw filters which are defined in 'section' to the \fBSWModule\fP object 'module'.
.PP
Parameters: 
.in +1c
.TP
\fB\fImodule\fP\fP
To this module the raw filter(s) are added 
.TP
\fB\fIsection\fP\fP
We use this section to get a list of filters we should apply to the module 
.SS "virtual void SWMgr::AddRenderFilters (\fBSWModule\fP * module, ConfigEntMap & section)\fC [protected, virtual]\fP"
.PP
Adds the render filters which are defined in 'section' to the \fBSWModule\fP object 'module'.
.PP
Parameters: 
.in +1c
.TP
\fB\fImodule\fP\fP
To this module the render filter(s) are added 
.TP
\fB\fIsection\fP\fP
We use this section to get a list of filters we should apply to the module 
.SS "virtual void SWMgr::AddStripFilters (\fBSWModule\fP * module, ConfigEntMap & section)\fC [protected, virtual]\fP"
.PP
Adds the strip filters which are defined in 'section' to the \fBSWModule\fP object 'module'.
.PP
Parameters: 
.in +1c
.TP
\fB\fImodule\fP\fP
To this module the strip filter(s) are added 
.TP
\fB\fIsection\fP\fP
We use this section to get a list of filters we should apply to the module 
.SS "virtual void SWMgr::InstallScan (const char * dir)\fC [virtual]\fP"
.PP
Installs a scan for modules in the directory givan as parameter.
.PP
Parameters: 
.in +1c
.TP
\fB\fIdir\fP\fP
The directory where new modules should be searched. 
.SS "virtual void SWMgr::Load ()\fC [virtual]\fP"
.PP
Load the modules.
.PP
Reimplement this function to use your own Load function, for example to use your own filters. 
.SS "virtual const char* SWMgr::getGlobalOption (const char * option)\fC [virtual]\fP"
.PP
Gives the value of the given option.
.PP
Parameters: 
.in +1c
.TP
\fB\fIThe\fP\fP
option, which should be used to return the value of it 
.PP
\fBReturns: \fP
.in +1c
The value of the given option 
.SS "virtual const char* SWMgr::getGlobalOptionTip (const char * option)\fC [virtual]\fP"
.PP
Gives a description for the given option.
.PP
Parameters: 
.in +1c
.TP
\fB\fIoption\fP\fP
The option, which should be used 
.PP
\fBReturns: \fP
.in +1c
A description of the given option 
.PP
\fBSee also: \fP
.in +1c
\fBsetGlobalOption\fP, \fBgetGlobalOption\fP, \fBgetGlobalOptions\fP 
.SS "virtual OptionsList SWMgr::getGlobalOptions ()\fC [virtual]\fP"
.PP
A list of all availble options with the currently set values.
.PP
\fBReturns: \fP
.in +1c
This function returns a list of global options. 
.SS "virtual signed char SWMgr::setCipherKey (const char * modName, const char * key)\fC [virtual]\fP"
.PP
Sets the cipher key for the given module.
.PP
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:
.PP
.nf
 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);
.fi
Parameters: 
.in +1c
.TP
\fB\fImodName\fP\fP
For this module we change the unlockKey 
.PP
\fBan key This is the new unlck key we use for te module.\fP
.in +1c
.SS "virtual void SWMgr::setGlobalOption (const char * option, const char * value)\fC [virtual]\fP"
.PP
Set a global option Set a global option using the parameters.
.PP
A global option could be for example footnotes. 
.PP
Parameters: 
.in +1c
.TP
\fB\fIoption\fP\fP
The name of the option, for which you want to change the value. Well known and often used values are 'Footnotes' or 'Strongs' 
.TP
\fB\fIvalue\fP\fP
The value. Common values are 'On' and 'Off' 
.SH "MEMBER DATA DOCUMENTATION"
.PP 
.SS "ModMap SWMgr::Modules"
.PP
The map of available modules.
.PP
This map contains thew list of available modules in Sword. Here's an example how to got through the map and how toc ehck for the module type.
.PP
.nf
 ModMap::iterator it;
 SWModule*      curMod = 0;

 for (it = Modules.begin(); it != Modules.end(); it++) {
     curMod = (*it).second;
     if (!strcmp(curMod->Type(), 'Biblical Texts')) {
       //do something with curMod
     }
     else if (!strcmp(curMod->Type(), 'Commentaries')) {
       //do something with curMod
     }
     else if (!strcmp(curMod->Type(), 'Lexicons / Dictionaries')) {
       //do something with curMod
     }
 }
.fi
 
.PP
Definition at line 170 of file swmgr.h.
.SS "\fBSWConfig\fP* SWMgr::config"
.PP
The global config object.
.PP
This is the global config object. It contains all items of all modules, so lookups of entries 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 config files after config->Save().
.PP
If you want to write to the modules config file read the informtaion of \fBsetCipherKey\fP() for an example of this. 
.PP
Definition at line 143 of file swmgr.h.
.SS "bool SWMgr::debug\fC [static]\fP"
.PP
Enable / Disable debug output on runtime Set this to true to get more verbose output of SWMgr at runtime.
.PP
Set it to false to get no debug output. The default is 'false'. 
.PP
Definition at line 128 of file swmgr.h.

.SH "AUTHOR"
.PP 
Generated automatically by Doxygen for The Sword Project from the source code.