The Sword Project: sword::SWBasicFilter Class Reference |
#include <swbasicfilter.h>
Inheritance diagram for sword::SWBasicFilter:
Public Member Functions | |
virtual char | processText (SWBuf &text, const SWKey *key=0, const SWModule *module=0) |
This is the main filter function. | |
Protected Member Functions | |
virtual BasicFilterUserData * | createUserData (const SWModule *module, const SWKey *key) |
void | setEscapeStart (const char *escStart) |
Sets the beginning of escape sequence (by default "&"). | |
void | setEscapeEnd (const char *escEnd) |
Sets the end of escape sequence (by default ";"). | |
void | setTokenStart (const char *tokenStart) |
Sets the beginning of token start sequence (by default "<"). | |
void | setTokenEnd (const char *tokenEnd) |
Sets the end of token start sequence (by default ">"). | |
void | setPassThruUnknownToken (bool val) |
Sets whether to pass thru an unknown token unchanged or just remove it. | |
void | setPassThruUnknownEscapeString (bool val) |
Sets whether to pass thru an unknown escape sequence unchanged or just remove it. | |
void | setPassThruNumericEscapeString (bool val) |
Sets whether to pass thru a numeric escape sequence unchanged or allow it to be handled otherwise. | |
void | setEscapeStringCaseSensitive (bool val) |
Are escapeStrings case sensitive or not? Call this function before addEscapeStingSubstitute(). | |
void | addAllowedEscapeString (const char *findString) |
Registers an esc control sequence that can pass unchanged. | |
void | removeAllowedEscapeString (const char *findString) |
Unregisters an esc control sequence that can pass unchanged. | |
void | addEscapeStringSubstitute (const char *findString, const char *replaceString) |
Registers an esc control sequence. | |
void | removeEscapeStringSubstitute (const char *findString) |
Unregisters an esc control sequence. | |
bool | substituteEscapeString (SWBuf &buf, const char *escString) |
This function performs the substitution of escapeStrings. | |
bool | passAllowedEscapeString (SWBuf &buf, const char *escString) |
This passes allowed escapeStrings. | |
void | appendEscapeString (SWBuf &buf, const char *escString) |
This appends escString to buf as an entity. | |
void | setTokenCaseSensitive (bool val) |
Are tokens case sensitive (like in GBF) or not? Call this function before addTokenSubstitute(). | |
void | addTokenSubstitute (const char *findString, const char *replaceString) |
Registers a simple token substitutions. | |
void | removeTokenSubstitute (const char *findString) |
Unregisters a simple token substitute. | |
bool | substituteToken (SWBuf &buf, const char *token) |
This function performs the substitution of tokens. | |
virtual bool | handleToken (SWBuf &buf, const char *token, BasicFilterUserData *userData) |
This function is called for every token encountered in the input text. | |
virtual bool | processStage (char, SWBuf &, char *&, BasicFilterUserData *) |
virtual void | setStageProcessing (char stages) |
virtual bool | handleEscapeString (SWBuf &buf, const char *escString, BasicFilterUserData *userData) |
This function is called for every escape sequence encountered in the input text. | |
virtual bool | handleNumericEscapeString (SWBuf &buf, const char *escString) |
This function is called for all numeric escape sequences. | |
Static Protected Attributes | |
static const char | INITIALIZE |
static const char | PRECHAR |
static const char | POSTCHAR |
static const char | FINALIZE |
Private Attributes | |
char * | tokenStart |
char * | tokenEnd |
char * | escStart |
char * | escEnd |
char | escStartLen |
char | escEndLen |
char | tokenStartLen |
char | tokenEndLen |
bool | escStringCaseSensitive |
bool | tokenCaseSensitive |
bool | passThruUnknownToken |
bool | passThruUnknownEsc |
bool | passThruNumericEsc |
char | processStages |
Private * | p |
This filter has facilities for handling SGML/HTML/XML like tokens and escape strings (like SGML entities). It has the facility for just substituting the given tokens and escape strings to other strings and for "manual" custom token handling.
In this class the functions with arguments looking as char **buf
write a character sequnce at address specified by *buf
address and change *buf
to point past the last char of the written sequence.
Definition at line 58 of file swbasicfilter.h.
virtual char sword::SWBasicFilter::processText | ( | SWBuf & | text, | |
const SWKey * | key = 0 , |
|||
const SWModule * | module = 0 | |||
) | [virtual] |
This is the main filter function.
text | The text to be filtered/converted | |
key | Current key That was used. | |
module | Current module. |
Implements sword::SWFilter.
Reimplemented in sword::OSISOSIS, sword::OSISRTF, and sword::ThMLRTF.
void sword::SWBasicFilter::setPassThruUnknownToken | ( | bool | val | ) | [protected] |
Sets whether to pass thru an unknown token unchanged or just remove it.
Default is false.
void sword::SWBasicFilter::setPassThruUnknownEscapeString | ( | bool | val | ) | [protected] |
Sets whether to pass thru an unknown escape sequence unchanged or just remove it.
Default is false.
void sword::SWBasicFilter::setPassThruNumericEscapeString | ( | bool | val | ) | [protected] |
Sets whether to pass thru a numeric escape sequence unchanged or allow it to be handled otherwise.
Default is false.
void sword::SWBasicFilter::addTokenSubstitute | ( | const char * | findString, | |
const char * | replaceString | |||
) | [protected] |
Registers a simple token substitutions.
Usually called from the c-tor of a subclass
virtual bool sword::SWBasicFilter::handleToken | ( | SWBuf & | buf, | |
const char * | token, | |||
BasicFilterUserData * | userData | |||
) | [protected, virtual] |
This function is called for every token encountered in the input text.
buf | the output buffer | |
token | the token (e.g. "p align='left'" | |
userData | user storage space for data transient to 1 full buffer parse |
Reimplemented in sword::GBFHTML, sword::GBFHTMLHREF, sword::GBFWEBIF, sword::OSISHTMLHREF, sword::OSISOSIS, sword::OSISPlain, sword::OSISRTF, sword::OSISWEBIF, sword::TEIPlain, sword::TEIRTF, sword::ThMLHTML, sword::ThMLHTMLHREF, sword::ThMLRTF, and sword::ThMLWEBIF.
virtual bool sword::SWBasicFilter::handleEscapeString | ( | SWBuf & | buf, | |
const char * | escString, | |||
BasicFilterUserData * | userData | |||
) | [protected, virtual] |
This function is called for every escape sequence encountered in the input text.
buf | the output buffer | |
escString | the escape sequence (e.g. "amp" for &) | |
userData | user storage space for data transient to 1 full buffer parse |
false
if was not handled and should be handled in subclasses should return true if they handled the esc seq, or false if they did not.
virtual bool sword::SWBasicFilter::handleNumericEscapeString | ( | SWBuf & | buf, | |
const char * | escString | |||
) | [protected, virtual] |
This function is called for all numeric escape sequences.
If passThrough
buf | the output buffer | |
escString | the escape sequence (e.g. "#235" for &235;) |
The SWORD Project; P. O. Box 2528; Tempe, AZ 85280-2528 USA |