The Sword Project: sword::SWModule Class Reference |
#include <swmodule.h>
Inheritance diagram for sword::SWModule:
Public Member Functions | |
SWModule (const char *imodname=0, const char *imoddesc=0, SWDisplay *idisp=0, char *imodtype=0, char encoding=ENC_UNKNOWN, char dir=DIRECTION_LTR, char markup=FMT_UNKNOWN, const char *modlang=0) | |
SWModule c-tor. | |
virtual | ~SWModule () |
SWModule d-tor. | |
virtual char | Error () |
Gets and clears error status. | |
virtual const bool | isUnicode () const |
| |
virtual void | setConfig (ConfigEntMap *config) |
virtual const ConfigEntMap & | getConfig () const |
virtual const char * | getConfigEntry (const char *key) const |
virtual const int | getEntrySize () const |
| |
virtual char | setKey (const SWKey *ikey) |
Sets a key to this module for position to a particular record. | |
char | setKey (const SWKey &ikey) |
Sets a key to this module for position to a particular record. | |
char | SetKey (const SWKey *ikey) |
char | SetKey (const SWKey &ikey) |
char | Key (const SWKey &ikey) |
virtual SWKey * | getKey () const |
Gets the current module key. | |
SWKey & | Key () const |
virtual const char * | KeyText (const char *ikeytext=0) |
Sets/gets module KeyText. | |
virtual const char * | getKeyText () const |
gets the key text for the module. | |
virtual long | Index () const |
virtual long | Index (long iindex) |
virtual char | Display () |
Calls this module's display object and passes itself. | |
virtual SWDisplay * | getDisplay () const |
Gets display driver. | |
virtual void | setDisplay (SWDisplay *idisp) |
Sets display driver. | |
SWDisplay * | Disp (SWDisplay *idisp=0) |
virtual char * | Name () const |
Gets module name. | |
virtual char * | Name (const char *imodname) |
Sets module name. | |
virtual char * | Description () const |
Gets module description. | |
virtual char * | Description (const char *imoddesc) |
Sets module description. | |
virtual char * | Type () const |
Gets module type. | |
virtual char * | Type (const char *imodtype) |
Sets module type. | |
virtual char | Direction (signed char newdir=-1) |
Sets/gets module direction. | |
virtual char | Encoding (signed char enc=-1) |
Sets/gets module encoding. | |
virtual char | Markup (signed char markup=-1) |
Sets/gets module markup. | |
virtual char * | Lang (const char *imodlang=0) |
Sets/gets module language. | |
virtual ListKey & | search (const char *istr, int searchType=0, int flags=0, SWKey *scope=0, bool *justCheckIfSupported=0, void(*percent)(char, void *)=&nullPercent, void *percentUserData=0) |
Searches a module for a string. | |
virtual ListKey & | Search (const char *istr, int searchType=0, int flags=0, SWKey *scope=0, bool *justCheckIfSupported=0, void(*percent)(char, void *)=&nullPercent, void *percentUserData=0) |
virtual SWKey * | CreateKey () |
Allocates a key of specific type for module The different reimplementatiosn of SWModule (e.g. | |
virtual SWBuf & | getRawEntryBuf ()=0 |
This function is reimplemented by the different kinds of module objects. | |
virtual const char * | getRawEntry () |
virtual bool | isWritable () |
Is the module writable? :). | |
virtual void | setEntry (const char *inbuf, long len=-1) |
Modify the current module entry text - only if module isWritable(). | |
virtual void | linkEntry (const SWKey *sourceKey) |
Link the current module entry to another module entry - only if module isWritable(). | |
virtual void | deleteEntry () |
Delete current module entry - only if module isWritable(). | |
virtual void | decrement (int steps=1) |
Decrements module key a number of entries. | |
virtual void | increment (int steps=1) |
Increments module key a number of entries. | |
virtual void | setPosition (SW_POSITION pos) |
Positions this modules to a logical position entry. | |
virtual void | filterBuffer (OptionFilterList *filters, SWBuf &buf, SWKey *key) |
OptionFilterBuffer a text buffer. | |
virtual void | filterBuffer (FilterList *filters, SWBuf &buf, SWKey *key) |
FilterBuffer a text buffer. | |
virtual SWModule & | AddRenderFilter (SWFilter *newfilter) |
Adds a RenderFilter to this module's renderFilters queue. | |
virtual const FilterList & | getRenderFilters () const |
Retrieves a container of render filters associated with this module. | |
virtual SWModule & | RemoveRenderFilter (SWFilter *oldfilter) |
Removes a RenderFilter from this module's renderFilters queue. | |
virtual SWModule & | ReplaceRenderFilter (SWFilter *oldfilter, SWFilter *newfilter) |
Replaces a RenderFilter in this module's renderfilters queue. | |
virtual void | renderFilter (SWBuf &buf, SWKey *key) |
RenderFilter run a buf through this module's Render Filters. | |
virtual SWModule & | AddEncodingFilter (SWFilter *newfilter) |
Adds an EncodingFilter to this module's. | |
virtual SWModule & | RemoveEncodingFilter (SWFilter *oldfilter) |
Removes an EncodingFilter from this module's encodingFilters queue. | |
virtual SWModule & | ReplaceEncodingFilter (SWFilter *oldfilter, SWFilter *newfilter) |
Replaces an EncodingFilter in this module's encodingfilters queue. | |
virtual void | encodingFilter (SWBuf &buf, SWKey *key) |
encodingFilter run a buf through this module's Encoding Filters | |
virtual SWModule & | AddStripFilter (SWFilter *newfilter) |
Adds a StripFilter to this module's stripFilters queue. | |
virtual SWModule & | AddRawFilter (SWFilter *newfilter) |
Adds a RawFilter to this module's rawFilters queue. | |
virtual void | stripFilter (SWBuf &buf, SWKey *key) |
StripFilter run a buf through this module's Strip Filters. | |
virtual void | rawFilter (SWBuf &buf, SWKey *key) |
RawFilter a text buffer. | |
virtual SWModule & | AddOptionFilter (SWOptionFilter *newfilter) |
Adds an OptionFilter to this module's optionFilters queue. | |
virtual void | optionFilter (SWBuf &buf, SWKey *key) |
OptionFilter a text buffer. | |
virtual const char * | StripText (const char *buf=0, int len=-1) |
Produces plain text, without markup, of the current module entry, or supplied text. | |
virtual const char * | RenderText (const char *buf=0, int len=-1, bool render=true) |
Produces renderable text of the current module entry or supplied text. | |
virtual const char * | StripText (SWKey *tmpKey) |
Produces plain text, without markup, of the module entry at the supplied key. | |
virtual const char * | RenderText (SWKey *tmpKey) |
Produces renderable text of the module entry at the supplied key. | |
virtual void | setSkipConsecutiveLinks (bool val) |
Whether or not to only hit one entry when iterating encounters consecutive links when iterating. | |
virtual bool | getSkipConsecutiveLinks () |
Whether or not to only hit one entry when iterating encounters consecutive links when iterating. | |
virtual AttributeTypeList & | getEntryAttributes () const |
Entry Attributes are special data pertaining to the current entry. | |
virtual void | processEntryAttributes (bool val) const |
Processing Entry Attributes can be expensive. | |
virtual bool | isProcessEntryAttributes () const |
Whether or not we're processing Entry Attributes. | |
virtual signed char | createSearchFramework (void(*percent)(char, void *)=&nullPercent, void *percentUserData=0) |
ask the object to build any indecies it wants for optimal searching | |
virtual void | deleteSearchFramework () |
virtual bool | hasSearchFramework () |
was SWORD compiled with code to optimize searching for this driver? | |
operator const char * () | |
operator SWKey & () | |
operator SWKey * () | |
SWModule & | operator<< (const char *inbuf) |
SWModule & | operator<< (const SWKey *sourceKey) |
SWModule & | operator-= (int steps) |
SWModule & | operator+= (int steps) |
SWModule & | operator++ (int) |
SWModule & | operator-- (int) |
SWModule & | operator= (SW_POSITION p) |
Static Public Member Functions | |
static signed char | createModule (const char *path) |
Creates a new, empty module. | |
Public Attributes | |
bool | terminateSearch |
Set this bool to false to terminate the search which is executed by this module (search()). | |
Protected Attributes | |
ConfigEntMap | ownConfig |
ConfigEntMap * | config |
AttributeTypeList | entryAttributes |
bool | procEntAttr |
char | error |
bool | skipConsecutiveLinks |
SWKey * | key |
the current key | |
ListKey | listKey |
char * | modname |
char * | moddesc |
char * | modtype |
char * | modlang |
char | direction |
char | markup |
char | encoding |
SWDisplay * | disp |
this module's display object | |
SWBuf | entryBuf |
FilterList * | stripFilters |
filters to be executed to remove all markup (for searches) | |
FilterList * | rawFilters |
filters to be executed immediately upon fileread | |
FilterList * | renderFilters |
filters to be executed to format for display | |
OptionFilterList * | optionFilters |
filters to be executed to change markup to user prefs | |
FilterList * | encodingFilters |
filters to be executed to decode text for display | |
int | entrySize |
long | entryIndex |
Static Protected Attributes | |
static SWDisplay | rawdisp |
It provides functions to look up a text passage, to search in the module, to switch on/off the state of optional things like Strong's numbers or footnotes.
SWModule has also functions to write to the data files.
Definition at line 87 of file swmodule.h.
sword::SWModule::SWModule | ( | const char * | imodname = 0 , |
|
const char * | imoddesc = 0 , |
|||
SWDisplay * | idisp = 0 , |
|||
char * | imodtype = 0 , |
|||
char | encoding = ENC_UNKNOWN , |
|||
char | dir = DIRECTION_LTR , |
|||
char | markup = FMT_UNKNOWN , |
|||
const char * | modlang = 0 | |||
) |
SWModule c-tor.
imodname | Internal name for module; see also getName() | |
imoddesc | Name to display to user for module; see also getDescription() | |
idisp | Display object to use for displaying; see also getDisplay() | |
imodtype | Type of module (e.g. Biblical Text, Commentary, etc.); see also getType() | |
encoding | Encoding of the module (e.g. UTF-8) | |
dir | Direction of text flow (e.g. Right to Left for Hebrew) | |
markup | Source Markup of the module (e.g. OSIS) | |
modlang | Language of the module (e.g. en) |
virtual char sword::SWModule::Error | ( | ) | [virtual] |
Gets and clears error status.
virtual char sword::SWModule::setKey | ( | const SWKey * | ikey | ) | [virtual] |
Sets a key to this module for position to a particular record.
ikey | key with which to set this module |
char sword::SWModule::setKey | ( | const SWKey & | ikey | ) | [inline] |
Sets a key to this module for position to a particular record.
ikey | The SWKey which should be used as new key. |
Definition at line 198 of file swmodule.h.
char sword::SWModule::SetKey | ( | const SWKey * | ikey | ) | [inline] |
char sword::SWModule::SetKey | ( | const SWKey & | ikey | ) | [inline] |
char sword::SWModule::Key | ( | const SWKey & | ikey | ) | [inline] |
virtual SWKey* sword::SWModule::getKey | ( | ) | const [virtual] |
Gets the current module key.
SWKey& sword::SWModule::Key | ( | ) | const [inline] |
virtual const char* sword::SWModule::KeyText | ( | const char * | ikeytext = 0 |
) | [inline, virtual] |
Sets/gets module KeyText.
ikeytext | Value which to set keytext; [0]-only get |
Reimplemented in sword::SWLD.
Definition at line 227 of file swmodule.h.
virtual const char* sword::SWModule::getKeyText | ( | ) | const [inline, virtual] |
gets the key text for the module.
do we really need this?
Definition at line 237 of file swmodule.h.
virtual char sword::SWModule::Display | ( | ) | [virtual] |
Calls this module's display object and passes itself.
virtual SWDisplay* sword::SWModule::getDisplay | ( | ) | const [virtual] |
virtual void sword::SWModule::setDisplay | ( | SWDisplay * | idisp | ) | [virtual] |
virtual char* sword::SWModule::Name | ( | ) | const [virtual] |
Gets module name.
virtual char* sword::SWModule::Name | ( | const char * | imodname | ) | [virtual] |
Sets module name.
imodname | Value which to set modname; [0]-only get |
virtual char* sword::SWModule::Description | ( | ) | const [virtual] |
Gets module description.
virtual char* sword::SWModule::Description | ( | const char * | imoddesc | ) | [virtual] |
Sets module description.
imoddesc | Value which to set moddesc; [0]-only get |
virtual char* sword::SWModule::Type | ( | ) | const [virtual] |
Gets module type.
virtual char* sword::SWModule::Type | ( | const char * | imodtype | ) | [virtual] |
Sets module type.
imodtype | Value which to set modtype; [0]-only get |
virtual char sword::SWModule::Direction | ( | signed char | newdir = -1 |
) | [virtual] |
Sets/gets module direction.
newdir | Value which to set direction; [-1]-only get |
virtual char sword::SWModule::Encoding | ( | signed char | enc = -1 |
) | [virtual] |
Sets/gets module encoding.
enc | Value which to set encoding; [-1]-only get |
virtual char sword::SWModule::Markup | ( | signed char | markup = -1 |
) | [virtual] |
Sets/gets module markup.
markup | Vvalue which to set markup; [-1]-only get |
virtual char* sword::SWModule::Lang | ( | const char * | imodlang = 0 |
) | [virtual] |
Sets/gets module language.
imodlang | Value which to set modlang; [0]-only get |
virtual ListKey& sword::SWModule::search | ( | const char * | istr, | |
int | searchType = 0 , |
|||
int | flags = 0 , |
|||
SWKey * | scope = 0 , |
|||
bool * | justCheckIfSupported = 0 , |
|||
void(*)(char, void *) | percent = &nullPercent , |
|||
void * | percentUserData = 0 | |||
) | [virtual] |
Searches a module for a string.
istr | string for which to search | |
searchType | type of search to perform >=0 - regex -1 - phrase -2 - multiword -3 - entryAttrib (eg. Word//Strongs/G1234/) -4 - Lucene | |
flags | options flags for search | |
scope | Key containing the scope. VerseKey or ListKey are useful here. | |
justCheckIfSupported | if set, don't search, only tell if this function supports requested search. | |
percent | Callback function to get the current search status in %. | |
percentUserData | User data that is given to the callback function as parameter. |
Implements sword::SWSearchable.
Reimplemented in sword::RawText.
virtual SWKey* sword::SWModule::CreateKey | ( | ) | [virtual] |
Allocates a key of specific type for module The different reimplementatiosn of SWModule (e.g.
SWText) support SWKey implementations, which support special. This functions returns a SWKey object which works with the current implementation of SWModule. For example for the SWText class it returns a VerseKey object.
Reimplemented in sword::RawGenBook, sword::SWCom, sword::SWGenBook, sword::SWLD, and sword::SWText.
virtual SWBuf& sword::SWModule::getRawEntryBuf | ( | ) | [pure virtual] |
This function is reimplemented by the different kinds of module objects.
Implemented in sword::EchoMod, sword::HREFCom, sword::RawCom, sword::RawFiles, sword::RawGenBook, sword::RawLD, sword::RawLD4, sword::RawText, sword::zCom, sword::zLD, and sword::zText.
virtual bool sword::SWModule::isWritable | ( | ) | [inline, virtual] |
Is the module writable? :).
Reimplemented in sword::RawCom, sword::RawFiles, sword::RawGenBook, sword::RawLD, sword::RawLD4, sword::RawText, sword::zCom, sword::zLD, and sword::zText.
Definition at line 396 of file swmodule.h.
static signed char sword::SWModule::createModule | ( | const char * | path | ) | [static] |
Creates a new, empty module.
path | path where to create the new module |
Reimplemented in sword::RawCom, sword::RawFiles, sword::RawGenBook, sword::RawLD, sword::RawLD4, sword::RawText, and sword::zLD.
virtual void sword::SWModule::decrement | ( | int | steps = 1 |
) | [virtual] |
Decrements module key a number of entries.
steps | Number of entries to jump backward |
Reimplemented in sword::RawCom, sword::RawLD, sword::RawLD4, sword::RawText, sword::zCom, sword::zLD, and sword::zText.
virtual void sword::SWModule::increment | ( | int | steps = 1 |
) | [virtual] |
Increments module key a number of entries.
steps | Number of entries to jump forward |
Reimplemented in sword::RawCom, sword::RawLD, sword::RawLD4, sword::RawText, sword::zCom, sword::zLD, and sword::zText.
Referenced by sword::zText::decrement(), sword::zLD::decrement(), sword::zCom::decrement(), sword::RawText::decrement(), sword::RawLD4::decrement(), sword::RawLD::decrement(), and sword::RawCom::decrement().
virtual void sword::SWModule::setPosition | ( | SW_POSITION | pos | ) | [virtual] |
Positions this modules to a logical position entry.
pos | position (e.g. TOP, BOTTOM) |
Reimplemented in sword::SWLD.
virtual void sword::SWModule::filterBuffer | ( | OptionFilterList * | filters, | |
SWBuf & | buf, | |||
SWKey * | key | |||
) | [virtual] |
OptionFilterBuffer a text buffer.
filters | the FilterList of filters to iterate | |
buf | the buffer to filter | |
key | key location from where this buffer was extracted |
virtual void sword::SWModule::filterBuffer | ( | FilterList * | filters, | |
SWBuf & | buf, | |||
SWKey * | key | |||
) | [virtual] |
FilterBuffer a text buffer.
filters | the FilterList of filters to iterate | |
buf | the buffer to filter | |
key | key location from where this buffer was extracted |
Adds a RenderFilter to this module's renderFilters queue.
Render Filters are called when the module is asked to produce renderable text.
newFilter | the filter to add |
Definition at line 454 of file swmodule.h.
virtual const FilterList& sword::SWModule::getRenderFilters | ( | ) | const [inline, virtual] |
Retrieves a container of render filters associated with this module.
Definition at line 463 of file swmodule.h.
Removes a RenderFilter from this module's renderFilters queue.
oldfilter | the filter to remove |
Definition at line 471 of file swmodule.h.
virtual SWModule& sword::SWModule::ReplaceRenderFilter | ( | SWFilter * | oldfilter, | |
SWFilter * | newfilter | |||
) | [inline, virtual] |
Replaces a RenderFilter in this module's renderfilters queue.
oldfilter | the filter to remove | |
newfilter | the filter to add in its place |
Definition at line 481 of file swmodule.h.
RenderFilter run a buf through this module's Render Filters.
buf | the buffer to filter | |
key | key location from where this buffer was extracted |
Definition at line 494 of file swmodule.h.
Adds an EncodingFilter to this module's.
newfilter | the filter to add |
Definition at line 505 of file swmodule.h.
Removes an EncodingFilter from this module's encodingFilters queue.
oldfilter | the filter to remove |
Definition at line 514 of file swmodule.h.
virtual SWModule& sword::SWModule::ReplaceEncodingFilter | ( | SWFilter * | oldfilter, | |
SWFilter * | newfilter | |||
) | [inline, virtual] |
Replaces an EncodingFilter in this module's encodingfilters queue.
oldfilter | the filter to remove | |
newfilter | the filter to add in its place |
Definition at line 524 of file swmodule.h.
encodingFilter run a buf through this module's Encoding Filters
buf | the buffer to filter | |
key | key location from where this buffer was extracted |
Definition at line 537 of file swmodule.h.
Adds a StripFilter to this module's stripFilters queue.
Strip filters are called when a module is asked to render an entry without any markup (like when searching).
newfilter | the filter to add |
Definition at line 547 of file swmodule.h.
Adds a RawFilter to this module's rawFilters queue.
newfilter | the filter to add |
Definition at line 556 of file swmodule.h.
StripFilter run a buf through this module's Strip Filters.
buf | the buffer to filter | |
key | key location from where this buffer was extracted |
Definition at line 565 of file swmodule.h.
RawFilter a text buffer.
buf | the buffer to filter | |
key | key location from where this buffer was extracted |
Definition at line 574 of file swmodule.h.
Referenced by sword::zText::rawZFilter(), sword::zLD::rawZFilter(), and sword::zCom::rawZFilter().
virtual SWModule& sword::SWModule::AddOptionFilter | ( | SWOptionFilter * | newfilter | ) | [inline, virtual] |
Adds an OptionFilter to this module's optionFilters queue.
Option Filters are used to turn options in the text on or off, or so some other state (e.g. Strong's Number, Footnotes, Cross References, etc.)
newfilter | the filter to add |
Definition at line 585 of file swmodule.h.
OptionFilter a text buffer.
buf | the buffer to filter | |
key | key location from where this buffer was extracted |
Definition at line 594 of file swmodule.h.
virtual const char* sword::SWModule::StripText | ( | const char * | buf = 0 , |
|
int | len = -1 | |||
) | [virtual] |
Produces plain text, without markup, of the current module entry, or supplied text.
buf | buf to massage instead of current module entry; if buf is 0, the current text will be used | |
len | max len to process |
virtual const char* sword::SWModule::RenderText | ( | const char * | buf = 0 , |
|
int | len = -1 , |
|||
bool | render = true | |||
) | [virtual] |
Produces renderable text of the current module entry or supplied text.
buf | buffer to massage instead of current module entry; if buf is 0, the current module position text will be used | |
len | max len to process | |
render | for internal use |
virtual const char* sword::SWModule::StripText | ( | SWKey * | tmpKey | ) | [virtual] |
Produces plain text, without markup, of the module entry at the supplied key.
tmpKey | desired module entry |
virtual const char* sword::SWModule::RenderText | ( | SWKey * | tmpKey | ) | [virtual] |
Produces renderable text of the module entry at the supplied key.
tmpKey | key to use to grab text |
virtual void sword::SWModule::setSkipConsecutiveLinks | ( | bool | val | ) | [inline, virtual] |
Whether or not to only hit one entry when iterating encounters consecutive links when iterating.
val | = true means only include entry once in iteration |
Definition at line 634 of file swmodule.h.
virtual AttributeTypeList& sword::SWModule::getEntryAttributes | ( | ) | const [inline, virtual] |
Entry Attributes are special data pertaining to the current entry.
To see what Entry Attributes exists for a specific entry of a module, the example examples/cmdline/lookup.cpp is a good utility which displays this information. It is also useful as an example of how to access such.
Definition at line 647 of file swmodule.h.
virtual void sword::SWModule::processEntryAttributes | ( | bool | val | ) | const [inline, virtual] |
Processing Entry Attributes can be expensive.
This method allows turning the processing off if they are not desired. Some internal engine processing turns them off (like searching) temporarily for optimization.
Definition at line 654 of file swmodule.h.
Set this bool to false to terminate the search which is executed by this module (search()).
This is useful for threaded applications to terminate the search from another thread.
Definition at line 143 of file swmodule.h.
The SWORD Project; P. O. Box 2528; Tempe, AZ 85280-2528 USA |