#include <swmodule.h>
Inheritance diagram for SWModule:
Public Methods | |
SWModule (const char *imodname=0, const char *imoddesc=0, SWDisplay *idisp=0, char *imodtype=0, SWTextEncoding encoding=ENC_UNKNOWN, SWTextDirection dir=DIRECTION_LTR, SWTextMarkup markup=FMT_UNKNOWN, const char *modlang=0) | |
Initializes data for instance of SWModule. More... | |
virtual | ~SWModule () |
Cleans up instance of SWModule. | |
virtual char | Error () |
Gets and clears error status. More... | |
virtual const bool | isUnicode () const |
virtual const ConfigEntMap & | getConfig () const |
virtual void | setConfig (ConfigEntMap *config) |
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 or set of records. More... | |
virtual char | SetKey (const SWKey &ikey) |
Sets the key of this module. More... | |
virtual SWKey & | Key () const |
Gets the current module key. More... | |
virtual char | Key (const SWKey &ikey) |
Sets the current key of the module to ikey, and returns the keytext. More... | |
virtual const char * | KeyText (const char *imodtype=0) |
Sets/gets module KeyText. More... | |
virtual char | Display () |
Calls this modules display object and passes itself. More... | |
virtual SWDisplay * | Disp (SWDisplay *idisp=0) |
Sets/gets display driver. More... | |
virtual char * | Name (const char *imodname=0) |
Sets/gets module name. More... | |
virtual char * | Description (const char *imoddesc=0) |
Sets/gets module description. More... | |
virtual char * | Type (const char *imodtype=0) |
Sets/gets module type. More... | |
virtual char | Direction (signed char newdir=-1) |
Sets/gets module direction. More... | |
virtual char | Encoding (signed char enc=-1) |
Sets/gets module encoding. More... | |
virtual char | Markup (signed char enc=-1) |
Sets/gets module markup. More... | |
virtual char * | Lang (const char *imodlang=0) |
Sets/gets module language. More... | |
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. More... | |
virtual signed char | createSearchFramework () |
virtual bool | hasSearchFramework () |
virtual bool | isSearchOptimallySupported (const char *istr, int searchType, int flags, SWKey *scope) |
Check if the search is optimally supported (e.g. More... | |
virtual SWKey * | CreateKey () |
Allocates a key of specific type for module The different reimplementatiosn of SWModule (e.g. More... | |
virtual | operator const char * () |
Renders and returns the current module text. More... | |
virtual char * | getRawEntry ()=0 |
This function is reimplemented by the different kinds of module objects. More... | |
virtual | operator SWKey & () |
Cast operator to cast to a SWKey reference. More... | |
virtual | operator SWKey * () |
Operator to cast to an SWKey pointer. More... | |
virtual bool | isWritable () |
Is the module writable? :). More... | |
virtual SWModule & | setentry (const char *inbuf, long len) |
Modify the current module entry text only if module isWritable. More... | |
virtual SWModule & | operator<< (const char *) |
Modify the current module entry text only if module isWritable. More... | |
virtual SWModule & | operator<< (const SWKey *) |
Link the current module entry to another module entry only if module isWritable. More... | |
virtual void | deleteEntry () |
Delete current module entry - only if module isWritable. | |
virtual SWModule & | operator-= (int decrement) |
Decrements module key a number of entries. More... | |
virtual SWModule & | operator+= (int increment) |
Increments module key a number of entries. More... | |
virtual SWModule & | operator++ (int) |
Increments module key by 1 entry. | |
virtual SWModule & | operator-- (int) |
Decrements module key by 1 entry. | |
virtual SWModule & | operator= (SW_POSITION p) |
Positions this modules to an entry. More... | |
virtual SWModule & | AddRenderFilter (SWFilter *newfilter) |
Adds a RenderFilter to this module's. More... | |
virtual SWModule & | RemoveRenderFilter (SWFilter *oldfilter) |
Removes a RenderFilter from this module's. More... | |
virtual SWModule & | ReplaceRenderFilter (SWFilter *oldfilter, SWFilter *newfilter) |
Replaces a RenderFilter in this module's. More... | |
virtual void | renderFilter (char *buf, long size, SWKey *key) |
RenderFilter a text buffer. More... | |
virtual SWModule & | AddEncodingFilter (SWFilter *newfilter) |
Adds an EncodingFilter to this module's. More... | |
virtual SWModule & | RemoveEncodingFilter (SWFilter *oldfilter) |
Removes an EncodingFilter from this module's. More... | |
virtual SWModule & | ReplaceEncodingFilter (SWFilter *oldfilter, SWFilter *newfilter) |
Replaces an EncodingFilter in this module's. More... | |
virtual void | encodingFilter (char *buf, long size, SWKey *key) |
encodingFilter a text buffer. More... | |
virtual SWModule & | AddStripFilter (SWFilter *newfilter) |
Adds a StripFilter to this module's stripfilters queue. More... | |
virtual void | stripFilter (char *buf, long size, SWKey *key) |
StripFilter a text buffer. More... | |
virtual SWModule & | AddRawFilter (SWFilter *newfilter) |
Adds a RawFilter to this module's rawfilters queue. More... | |
virtual void | filterBuffer (FilterList *filters, char *buf, long size, SWKey *key) |
FilterBuffer a text buffer. More... | |
virtual void | rawFilter (char *buf, long size, SWKey *key) |
RawFilter a text buffer. More... | |
virtual SWModule & | AddOptionFilter (SWFilter *newfilter) |
Adds an OptionFilter to this module's optionfilters queue. More... | |
virtual void | optionFilter (char *buf, long size, SWKey *key) |
OptionFilter a text buffer. More... | |
virtual const char * | StripText (char *buf=0, int len=-1) |
calls all StripFilters on buffer or current text. More... | |
virtual const char * | RenderText (char *buf=0, int len=-1, bool render=true) |
calls all RenderFilters on buffer or current text. More... | |
virtual const char * | StripText (SWKey *tmpKey) |
calls all StripFilters on current text. More... | |
virtual const char * | RenderText (SWKey *tmpKey) |
calls all RenderFilters on current text. More... | |
virtual void | setSkipConsecutiveLinks (bool val) |
option to specify behaviour when iterating over consecutive entried linked to same text. More... | |
virtual bool | getSkipConsecutiveLinks () |
virtual AttributeTypeList & | getEntryAttributes () const |
virtual void | processEntryAttributes (bool val) const |
virtual bool | isProcessEntryAttributes () const |
Static Public Methods | |
void | nullPercent (char percent, void *userData) |
This is the default callback function for searching. More... | |
signed char | createModule (const char *) |
Creates a new module. More... | |
Public Attributes | |
bool | terminateSearch |
Set this bool to false to terminate the search which is executed by this module (Search). More... | |
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. | |
char * | entrybuf |
unsigned long | entrybufallocsize |
FilterList * | stripFilters |
executed to remove all markup (for searches). | |
FilterList * | rawFilters |
executed immediately upon fileread. | |
FilterList * | renderFilters |
executed to format for display. | |
FilterList * | optionFilters |
executed to change markup to user prefs. | |
FilterList * | encodingFilters |
executed to decode text for display. | |
int | entrySize |
Static Protected Attributes | |
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. This might be useful in future for frontend authors to support user-created modules.
Definition at line 64 of file swmodule.h.
|
Initializes data for instance of SWModule.
Definition at line 31 of file swmodule.cpp. References CreateKey(), disp, encodingFilters, key, optionFilters, rawFilters, renderFilters, and stripFilters.
00032 { 00033 key = CreateKey(); 00034 entrybuf = new char [1]; 00035 *entrybuf = 0; 00036 config = &ownConfig; 00037 entrybufallocsize = 0; 00038 modname = 0; 00039 error = 0; 00040 moddesc = 0; 00041 modtype = 0; 00042 modlang = 0; 00043 this->encoding = encoding; 00044 this->direction = direction; 00045 this->markup = markup; 00046 entrySize= -1; 00047 disp = (idisp) ? idisp : &rawdisp; 00048 stdstr(&modname, imodname); 00049 stdstr(&moddesc, imoddesc); 00050 stdstr(&modtype, imodtype); 00051 stdstr(&modlang, imodlang); 00052 stripFilters = new FilterList(); 00053 rawFilters = new FilterList(); 00054 renderFilters = new FilterList(); 00055 optionFilters = new FilterList(); 00056 encodingFilters = new FilterList(); 00057 skipConsecutiveLinks = true; 00058 procEntAttr = true; 00059 } |
|
Adds an EncodingFilter to this module's.
Definition at line 451 of file swmodule.h. Referenced by EncodingFilterMgr::AddEncodingFilters().
00451 { 00452 encodingFilters->push_back (newfilter); 00453 return *this; 00454 } |
|
Adds an OptionFilter to this module's optionfilters queue.
Definition at line 536 of file swmodule.h.
00536 { 00537 optionFilters->push_back (newfilter); 00538 return *this; 00539 } |
|
Adds a RawFilter to this module's rawfilters queue.
Definition at line 505 of file swmodule.h. Referenced by SWMgr::AddRawFilters(), and EncodingFilterMgr::AddRawFilters().
00505 { 00506 rawFilters->push_back (newfilter); 00507 return *this; 00508 } |
|
Adds a RenderFilter to this module's.
Definition at line 414 of file swmodule.h. Referenced by MarkupFilterMgr::AddRenderFilters().
00414 { 00415 renderFilters->push_back (newfilter); 00416 return *this; 00417 } |
|
Adds a StripFilter to this module's stripfilters queue.
Definition at line 488 of file swmodule.h. Referenced by SWMgr::AddStripFilters().
00488 { 00489 stripFilters->push_back (newfilter); 00490 return *this; 00491 } |
|
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 SWCom, SWGenBook, SWLD, and SWText. Definition at line 105 of file swmodule.cpp. Referenced by RenderText(), Search(), SetKey(), StripText(), and SWModule().
00106 { 00107 return new SWKey(); 00108 } |
|
Creates a new module.
Definition at line 349 of file swmodule.h.
00349 { 00350 return -1; 00351 } |
|
Sets/gets module description.
Definition at line 150 of file swmodule.cpp.
00151 { 00152 return stdstr(&moddesc, imoddesc); 00153 } |
|
Sets/gets module direction.
Definition at line 178 of file swmodule.cpp.
00178 { 00179 if (newdir != -1) 00180 direction = newdir; 00181 return direction; 00182 } |
|
Sets/gets display driver.
Definition at line 237 of file swmodule.cpp. References disp.
|
|
Calls this modules display object and passes itself.
Definition at line 252 of file swmodule.cpp. References disp, and SWDisplay::Display().
|
|
Sets/gets module encoding.
Definition at line 192 of file swmodule.cpp.
00192 { 00193 if (newenc != -1) 00194 encoding = newenc; 00195 return encoding; 00196 } |
|
encodingFilter a text buffer.
Definition at line 481 of file swmodule.h. Referenced by RenderText().
00481 { 00482 filterBuffer(encodingFilters, buf, size, key); 00483 } |
|
Gets and clears error status.
Definition at line 117 of file swmodule.cpp. Referenced by Search().
00118 { 00119 char retval = error; 00120 00121 error = 0; 00122 return retval; 00123 } |
|
FilterBuffer a text buffer.
Definition at line 516 of file swmodule.h.
00516 { 00517 FilterList::iterator it; 00518 for (it = filters->begin(); it != filters->end(); it++) { 00519 (*it)->ProcessText(buf, size, key, this); 00520 } 00521 } |
|
Definition at line 162 of file swmodule.h. Referenced by RenderText().
00162 {return entrySize;} |
|
This function is reimplemented by the different kinds of module objects.
Referenced by SWLD::KeyText(), and RenderText(). |
|
Check if the search is optimally supported (e.g. if index files are presnt and working) This function checks whether the search framework may work in the best way.
Definition at line 295 of file swmodule.h.
00296 { 00297 bool retVal = false; 00298 Search (istr, searchType, flags, scope, &retVal); 00299 return retVal; 00300 } |
|
Definition at line 150 of file swmodule.h.
00150 {return (encoding == (char)ENC_UTF8 || encoding == (char)ENC_SCSU);} |
|
Is the module writable? :).
Definition at line 342 of file swmodule.h.
00342 { 00343 return false; 00344 } |
|
Sets the current key of the module to ikey, and returns the keytext.
Definition at line 189 of file swmodule.h.
00189 { 00190 return SetKey (ikey); 00191 } |
|
Gets the current module key.
Definition at line 180 of file swmodule.h.
00180 { 00181 return *key; 00182 } |
|
Sets/gets module KeyText.
Reimplemented in SWLD. Definition at line 303 of file swmodule.cpp. Referenced by SWLD::KeyText(), and Search().
|
|
Sets/gets module language.
Definition at line 222 of file swmodule.cpp.
00223 { 00224 return stdstr(&modlang, imodlang); 00225 } |
|
Sets/gets module markup.
Definition at line 206 of file swmodule.cpp. Referenced by MarkupFilterMgr::AddRenderFilters().
00206 { 00207 if (newmark != -1) 00208 markup = newmark; 00209 return markup; 00210 } |
|
Sets/gets module name.
Definition at line 135 of file swmodule.cpp. Referenced by SWMgr::AddRawFilters().
00136 { 00137 return stdstr(&modname, imodname); 00138 } |
|
This is the default callback function for searching. This function is a placeholder and does nothing. You can define your own function for search progress evaluation, and pass it over to Search. Definition at line 18 of file swmodule.cpp.
00018 {} |
|
Renders and returns the current module text.
Definition at line 662 of file swmodule.cpp. References RenderText().
00662 { 00663 return RenderText(); 00664 } |
|
Cast operator to cast to a SWKey reference. This operator may be used to cast this module to a SWKey object.
Definition at line 322 of file swmodule.h.
00322 { 00323 return *key; 00324 } |
|
Operator to cast to an SWKey pointer. This function may be used to cast this object to an SWKey pointer. //we assume here that SWModule* module is already defined and valid. SWKey* currentKey = (SWKey*)module; // do something with currentKey (e.g. print out on screen) Definition at line 333 of file swmodule.h.
00333 { 00334 return key; 00335 } |
|
Increments module key a number of entries.
Definition at line 350 of file swmodule.cpp. References SWKey::Error(), and key.
|
|
Decrements module key a number of entries.
Definition at line 367 of file swmodule.cpp. References SWKey::Error(), and key.
|
|
Link the current module entry to another module entry only if module isWritable.
Definition at line 370 of file swmodule.h.
00370 { 00371 return *this; 00372 } |
|
Modify the current module entry text only if module isWritable.
Definition at line 363 of file swmodule.h.
00363 { 00364 return *this; 00365 } |
|
Positions this modules to an entry.
Definition at line 320 of file swmodule.cpp. References SWKey::Error(), and key.
|
|
OptionFilter a text buffer.
Definition at line 546 of file swmodule.h. Referenced by RenderText().
00546 { 00547 filterBuffer(optionFilters, buf, size, key); 00548 } |
|
RawFilter a text buffer.
Definition at line 528 of file swmodule.h.
00528 { 00529 buf[size] = 0; 00530 filterBuffer(rawFilters, buf, size, key); 00531 } |
|
Removes an EncodingFilter from this module's.
Definition at line 459 of file swmodule.h.
00459 { 00460 encodingFilters->remove (oldfilter); 00461 return *this; 00462 } |
|
Removes a RenderFilter from this module's.
Definition at line 422 of file swmodule.h.
00422 { 00423 renderFilters->remove (oldfilter); 00424 return *this; 00425 } |
|
RenderFilter a text buffer.
Definition at line 444 of file swmodule.h. Referenced by RenderText().
00444 { 00445 filterBuffer(renderFilters, buf, size, key); 00446 } |
|
calls all RenderFilters on current text.
Definition at line 606 of file swmodule.cpp. References CreateKey(), key, SWKey::Persist(), RenderText(), and SetKey().
00607 { 00608 SWKey *savekey; 00609 const char *retVal; 00610 00611 if (!key->Persist()) { 00612 savekey = CreateKey(); 00613 *savekey = *key; 00614 } 00615 else savekey = key; 00616 00617 SetKey(*tmpKey); 00618 00619 retVal = RenderText(); 00620 00621 SetKey(*savekey); 00622 00623 if (!savekey->Persist()) 00624 delete savekey; 00625 00626 return retVal; 00627 } |
|
calls all RenderFilters on buffer or current text.
Definition at line 570 of file swmodule.cpp. References encodingFilter(), getEntrySize(), getRawEntry(), key, optionFilter(), renderFilter(), and stripFilter(). Referenced by operator const char *(), RenderText(), and StripText().
00570 { 00571 entryAttributes.clear(); 00572 char *tmpbuf = (buf) ? buf : getRawEntry(); 00573 SWKey *key = 0; 00574 static char *null = ""; 00575 00576 if (tmpbuf) { 00577 unsigned long size = (len < 0) ? ((getEntrySize()<0) ? strlen(tmpbuf) : getEntrySize()) * FILTERPAD : len; 00578 if (size > 0) { 00579 key = (SWKey *)*this; 00580 00581 optionFilter(tmpbuf, size, key); 00582 00583 if (render) { 00584 renderFilter(tmpbuf, size, key); 00585 encodingFilter(tmpbuf, size, key); 00586 } 00587 else stripFilter(tmpbuf, size, key); 00588 } 00589 } 00590 else { 00591 tmpbuf = null; 00592 } 00593 00594 return tmpbuf; 00595 } |
|
Replaces an EncodingFilter in this module's.
Definition at line 468 of file swmodule.h.
00468 { 00469 FilterList::iterator iter; 00470 for (iter = encodingFilters->begin(); iter != encodingFilters->end(); iter++) 00471 if (*iter == oldfilter) 00472 *iter = newfilter; 00473 return *this; 00474 } |
|
Replaces a RenderFilter in this module's.
Definition at line 431 of file swmodule.h.
00431 { 00432 FilterList::iterator iter; 00433 for (iter = renderFilters->begin(); iter != renderFilters->end(); iter++) 00434 if (*iter == oldfilter) 00435 *iter = newfilter; 00436 return *this; 00437 } |
|
Searches a module for a string.
Definition at line 391 of file swmodule.cpp. References ListKey::ClearList(), SWKey::clone(), CreateKey(), Error(), SWKey::Index(), key, KeyText(), VerseKey::NewIndex(), SWKey::Persist(), SetKey(), StripText(), and terminateSearch.
00392 { 00393 SWKey *savekey = 0; 00394 SWKey *searchkey = 0; 00395 regex_t preg; 00396 SWKey textkey; 00397 char **words = 0; 00398 char *wordBuf = 0; 00399 int wordCount = 0; 00400 const char *sres; 00401 terminateSearch = false; 00402 char perc = 1; 00403 bool savePEA = isProcessEntryAttributes(); 00404 00405 processEntryAttributes(false); 00406 listkey.ClearList(); 00407 00408 if (!key->Persist()) { 00409 savekey = CreateKey(); 00410 *savekey = *key; 00411 } 00412 else savekey = key; 00413 00414 searchkey = (scope)?scope->clone():(key->Persist())?key->clone():0; 00415 if (searchkey) { 00416 searchkey->Persist(1); 00417 SetKey(*searchkey); 00418 } 00419 00420 (*percent)(perc, percentUserData); 00421 // MAJOR KLUDGE: VerseKey::Index still return index within testament. 00422 // VerseKey::NewIndex should be moved to Index and Index should be some 00423 // VerseKey specific name 00424 VerseKey *vkcheck = 0; 00425 #ifndef _WIN32_WCE 00426 try { 00427 #endif 00428 vkcheck = SWDYNAMIC_CAST(VerseKey, key); 00429 #ifndef _WIN32_WCE 00430 } 00431 catch (...) {} 00432 #endif 00433 // end MAJOR KLUDGE 00434 00435 *this = BOTTOM; 00436 // fix below when we find out the bug 00437 long highIndex = (vkcheck)?32300/*vkcheck->NewIndex()*/:key->Index(); 00438 if (!highIndex) 00439 highIndex = 1; // avoid division by zero errors. 00440 *this = TOP; 00441 if (searchType >= 0) { 00442 flags |=searchType|REG_NOSUB|REG_EXTENDED; 00443 regcomp(&preg, istr, flags); 00444 } 00445 00446 (*percent)(++perc, percentUserData); 00447 if (searchType == -2) { 00448 wordBuf = (char *)calloc(sizeof(char), strlen(istr) + 1); 00449 strcpy(wordBuf, istr); 00450 words = (char **)calloc(sizeof(char *), 10); 00451 int allocWords = 10; 00452 words[wordCount] = strtok(wordBuf, " "); 00453 while (words[wordCount]) { 00454 wordCount++; 00455 if (wordCount == allocWords) { 00456 allocWords+=10; 00457 words = (char **)realloc(words, sizeof(char *)*allocWords); 00458 } 00459 words[wordCount] = strtok(NULL, " "); 00460 } 00461 } 00462 00463 perc = 5; 00464 (*percent)(perc, percentUserData); 00465 00466 while (!Error() && !terminateSearch) { 00467 00468 00469 long mindex = 0; 00470 if (vkcheck) 00471 mindex = vkcheck->NewIndex(); 00472 else mindex = key->Index(); 00473 float per = (float)mindex / highIndex; 00474 per *= 93; 00475 per += 5; 00476 char newperc = (char)per; 00477 // char newperc = (char)(5+(93*(((float)((vkcheck)?vkcheck->NewIndex():key->Index()))/highIndex))); 00478 if (newperc > perc) { 00479 perc = newperc; 00480 (*percent)(perc, percentUserData); 00481 } 00482 else if (newperc < perc) { 00483 #ifndef _MSC_VER 00484 cerr << "Serious error: new percentage complete is less than previous value\n"; 00485 cerr << "using vk? " << ((vkcheck)?"yes":"no") << "\n"; 00486 cerr << "index: " << ((vkcheck)?vkcheck->NewIndex():key->Index()) << "\n"; 00487 cerr << "highIndex: " << highIndex << "\n"; 00488 cerr << "newperc ==" << (int)newperc << "%" << "is smaller than\n"; 00489 cerr << "perc == " << (int )perc << "% \n"; 00490 #endif 00491 } 00492 if (searchType >= 0) { 00493 if (!regexec(&preg, StripText(), 0, 0, 0)) { 00494 textkey = KeyText(); 00495 listkey << textkey; 00496 } 00497 } 00498 else { 00499 if (searchType == -1) { 00500 sres = ((flags & REG_ICASE) == REG_ICASE) ? stristr(StripText(), istr) : strstr(StripText(), istr); 00501 if (sres) { 00502 textkey = KeyText(); 00503 listkey << textkey; 00504 } 00505 } 00506 if (searchType == -2) { 00507 int i; 00508 const char *stripBuf = StripText(); 00509 for (i = 0; i < wordCount; i++) { 00510 sres = ((flags & REG_ICASE) == REG_ICASE) ? stristr(stripBuf, words[i]) : strstr(stripBuf, words[i]); 00511 if (!sres) 00512 break; 00513 } 00514 if (i == wordCount) { 00515 textkey = KeyText(); 00516 listkey << textkey; 00517 } 00518 00519 } 00520 } 00521 (*this)++; 00522 } 00523 if (searchType >= 0) 00524 regfree(&preg); 00525 00526 if (searchType == -2) { 00527 free(words); 00528 free(wordBuf); 00529 } 00530 00531 SetKey(*savekey); 00532 00533 if (!savekey->Persist()) 00534 delete savekey; 00535 00536 if (searchkey) 00537 delete searchkey; 00538 00539 listkey = TOP; 00540 processEntryAttributes(savePEA); 00541 (*percent)(100, percentUserData); 00542 00543 return listkey; 00544 } |
|
Modify the current module entry text only if module isWritable.
Definition at line 356 of file swmodule.h.
00356 { 00357 return *this; 00358 } |
|
Sets the key of this module. Similair to
Definition at line 268 of file swmodule.cpp. References SetKey().
00268 { 00269 return SetKey(&ikey); 00270 } |
|
Sets a key to this module for position to a particular record or set of records.
Definition at line 272 of file swmodule.cpp. References CreateKey(), key, and SWKey::Persist(). Referenced by KeyText(), RenderText(), Search(), SetKey(), and StripText().
00273 { 00274 SWKey *oldKey = 0; 00275 00276 if (key) { 00277 if (!key->Persist()) // if we have our own copy 00278 oldKey = key; 00279 } 00280 00281 if (!ikey->Persist()) { // if we are to keep our own copy 00282 key = CreateKey(); 00283 *key = *ikey; 00284 } 00285 else key = (SWKey *)ikey; // if we are to just point to an external key 00286 00287 if (oldKey) 00288 delete oldKey; 00289 00290 return 0; 00291 } |
|
option to specify behaviour when iterating over consecutive entried linked to same text.
Definition at line 584 of file swmodule.h.
00584 { skipConsecutiveLinks = val; } |
|
StripFilter a text buffer.
Definition at line 498 of file swmodule.h. Referenced by RenderText().
00498 { 00499 filterBuffer(stripFilters, buf, size, key); 00500 } |
|
calls all StripFilters on current text.
Definition at line 638 of file swmodule.cpp. References CreateKey(), key, SWKey::Persist(), SetKey(), and StripText().
00639 { 00640 SWKey *savekey; 00641 const char *retVal; 00642 00643 if (!key->Persist()) { 00644 savekey = CreateKey(); 00645 *savekey = *key; 00646 } 00647 else savekey = key; 00648 00649 SetKey(*tmpKey); 00650 00651 retVal = StripText(); 00652 00653 SetKey(*savekey); 00654 00655 if (!savekey->Persist()) 00656 delete savekey; 00657 00658 return retVal; 00659 } |
|
calls all StripFilters on buffer or current text.
Definition at line 556 of file swmodule.cpp. References RenderText(). Referenced by Search(), and StripText().
00557 { 00558 return RenderText(buf, len, false); 00559 } |
|
Sets/gets module type.
Definition at line 165 of file swmodule.cpp.
00166 { 00167 return stdstr(&modtype, imodtype); 00168 } |
|
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 in another thread. Definition at line 125 of file swmodule.h. Referenced by Search(). |