Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SWBasicFilter Class Reference

A filter providing commonly used functionality. More...

#include <swbasicfilter.h>

Inheritance diagram for SWBasicFilter:

Inheritance graph
[legend]
Collaboration diagram for SWBasicFilter:

Collaboration graph
[legend]
List of all members.

Public Methods

 SWBasicFilter ()
virtual char ProcessText (char *text, int maxlen, const SWKey *, const SWModule *=0)
virtual ~SWBasicFilter ()

Protected Types

typedef map< string, string > DualStringMap

Protected Methods

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 pass thru unknown tokens unchanged or just ignore (remove) them. More...

void setPassThruUnknownEscapeString (bool val)
 Sets whether pass thru unknown escape sequences unchanged or just ignore (remove) them. More...

void setTokenCaseSensitive (bool val)
void setEscapeStringCaseSensitive (bool val)
void addTokenSubstitute (const char *findString, const char *replaceString)
void addEscapeStringSubstitute (const char *findString, const char *replaceString)
bool substituteToken (char **buf, const char *token)
bool substituteEscapeString (char **buf, const char *escString)
void pushString (char **buf, const char *format,...)
 Like sprintf.

virtual bool handleToken (char **buf, const char *token, DualStringMap &userData)
 This function is called for every token encountered in the input text. More...

virtual bool handleEscapeString (char **buf, const char *escString, DualStringMap &userData)
 This function is called for every escape sequence encountered in the input text. More...


Protected Attributes

const SWModulemodule
const SWKeykey
char * resultBuffer
DualStringMap tokenSubMap
DualStringMap escSubMap

Private Attributes

char * tokenStart
char * tokenEnd
char * escStart
char * escEnd
bool escStringCaseSensitive
bool tokenCaseSensitive
bool passThruUnknownToken
bool passThruUnknownEsc

Detailed Description

A filter providing commonly used functionality.

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 45 of file swbasicfilter.h.


Member Function Documentation

bool SWBasicFilter::handleEscapeString char **    buf,
const char *    escString,
DualStringMap &    userData
[protected, virtual]
 

This function is called for every escape sequence encountered in the input text.

Parameters:
buf  the output buffer (FIXME: what is its size?)
escString  the escape sequence (e.g. "amp" for &amp;)
userData  FIXME: document this
Returns:
false if was not handled and should be handled in the default way (by just substituting).

Definition at line 166 of file swbasicfilter.cpp.

00166                                                                                                  {
00167         return substituteEscapeString(buf, escString);
00168 }

bool SWBasicFilter::handleToken char **    buf,
const char *    token,
DualStringMap &    userData
[protected, virtual]
 

This function is called for every token encountered in the input text.

Parameters:
buf  the output buffer (FIXME: what is its size?)
token  the token (e.g. "p align='left'"
userData  FIXME: document this
Returns:
false if was not handled and should be handled in the default way (by just substituting).

Reimplemented in GBFHTMLHREF, ThMLHTML, ThMLHTMLHREF, and ThMLRTF.

Definition at line 161 of file swbasicfilter.cpp.

00161                                                                                       {
00162         return substituteToken(buf, token);
00163 }

void SWBasicFilter::setPassThruUnknownEscapeString bool    val [protected]
 

Sets whether pass thru unknown escape sequences unchanged or just ignore (remove) them.

Default is false.

Definition at line 54 of file swbasicfilter.cpp.

00054                                                            {
00055         passThruUnknownEsc = val;
00056 }

void SWBasicFilter::setPassThruUnknownToken bool    val [protected]
 

Sets whether pass thru unknown tokens unchanged or just ignore (remove) them.

Default is false.

Definition at line 49 of file swbasicfilter.cpp.

00049                                                     {
00050         passThruUnknownToken = val;
00051 }


The documentation for this class was generated from the following files:
Generated on Thu Jun 20 22:13:02 2002 for The Sword Project by doxygen1.2.15