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

MarkupFilterMgr Class Reference

This class is like a normal SWEncodingMgr, but you can additonally specify which markup you want to use. More...

#include <markupfiltmgr.h>

Inheritance diagram for MarkupFilterMgr:

Inheritance graph
[legend]
Collaboration diagram for MarkupFilterMgr:

Collaboration graph
[legend]
List of all members.

Public Methods

 MarkupFilterMgr (char markup=FMT_THML, char encoding=ENC_UTF8)
 Constructor of SWMarkupMgr. More...

 ~MarkupFilterMgr ()
 The destructor of SWMarkupMgr.

char Markup (char m=FMT_UNKNOWN)
 Markup sets/gets the markup after initialization. More...

virtual void AddRenderFilters (SWModule *module, ConfigEntMap &section)
 Adds the render filters which are defined in "section" to the SWModule object "module". More...


Protected Methods

void CreateFilters (char markup)

Protected Attributes

SWFilter * fromthml
SWFilter * fromgbf
SWFilter * fromplain
SWFilter * fromosis
char markup

Detailed Description

This class is like a normal SWEncodingMgr, but you can additonally specify which markup you want to use.

Definition at line 31 of file markupfiltmgr.h.


Constructor & Destructor Documentation

MarkupFilterMgr::MarkupFilterMgr char    markup = FMT_THML,
char    encoding = ENC_UTF8
 

Constructor of SWMarkupMgr.

Parameters:
iconfig 
isysconfig 
autoload  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.
encoding  The desired encoding.
markup  The desired markup format.

Definition at line 47 of file markupfiltmgr.cpp.

00048                    : EncodingFilterMgr(enc) {
00049 
00050         markup = mark;
00051 
00052         CreateFilters(markup);
00053 }


Member Function Documentation

void MarkupFilterMgr::AddRenderFilters SWModule   module,
ConfigEntMap &    section
[virtual]
 

Adds the render filters which are defined in "section" to the SWModule object "module".

Parameters:
module  To this module the render filter(s) are added
section  We use this section to get a list of filters we should apply to the module

Definition at line 166 of file markupfiltmgr.cpp.

References SWModule::AddRenderFilter, and SWModule::Markup.

00166                                                                               {
00167         switch (module->Markup()) {
00168         case FMT_THML:
00169                 if (fromthml)
00170                         module->AddRenderFilter(fromthml);
00171                 break;
00172         case FMT_GBF:
00173                 if (fromgbf)
00174                         module->AddRenderFilter(fromgbf);
00175                 break;
00176         case FMT_PLAIN:
00177                 if (fromplain)
00178                         module->AddRenderFilter(fromplain);
00179                 break;
00180         case FMT_OSIS:
00181                 if (fromosis)
00182                         module->AddRenderFilter(fromosis);
00183                 break;
00184         }
00185 }

char MarkupFilterMgr::Markup char    m = FMT_UNKNOWN
 

Markup sets/gets the markup after initialization.

Parameters:
m  The new markup or FMT_UNKNOWN if you just want to get the current markup.
Returns:
The current (possibly changed) markup format.

Definition at line 78 of file markupfiltmgr.cpp.

00078                                       {
00079         if (mark && mark != markup) {
00080                 markup = mark;
00081                 ModMap::const_iterator module;
00082 
00083                 SWFilter * oldplain = fromplain;
00084                 SWFilter * oldthml = fromthml;
00085                 SWFilter * oldgbf = fromgbf;
00086                 SWFilter * oldosis = fromosis;
00087 
00088                 CreateFilters(markup);
00089 
00090                 for (module = getParentMgr()->Modules.begin(); module != getParentMgr()->Modules.end(); module++)
00091                         switch (module->second->Markup()) {
00092                         case FMT_THML:
00093                                 if (oldthml != fromthml) {
00094                                         if (oldthml) {
00095                                                 if (!fromthml) {
00096                                                         module->second->RemoveRenderFilter(oldthml);
00097                                                 }
00098                                                 else {
00099                                                         module->second->ReplaceRenderFilter(oldthml, fromthml);
00100                                                 }
00101                                         }
00102                                         else if (fromthml) {
00103                                                 module->second->AddRenderFilter(fromthml);
00104                                         }
00105                                 }
00106                                 break;
00107                         case FMT_GBF:
00108                                 if (oldgbf != fromgbf) {
00109                                         if (oldgbf) {
00110                                                 if (!fromgbf) {
00111                                                         module->second->RemoveRenderFilter(oldgbf);
00112                                                 }
00113                                                 else {
00114                                                         module->second->ReplaceRenderFilter(oldgbf, fromgbf);
00115                                                 }
00116                                         }
00117                                         else if (fromgbf) {
00118                                                 module->second->AddRenderFilter(fromgbf);
00119                                         }
00120                                         break;
00121                                 }
00122                         case FMT_PLAIN:
00123                                 if (oldplain != fromplain) {
00124                                         if (oldplain) {
00125                                                 if (!fromplain) {
00126                                                         module->second->RemoveRenderFilter(oldplain);
00127                                                 }
00128                                                 else {
00129                                                         module->second->ReplaceRenderFilter(oldplain, fromplain);
00130                                                 }
00131                                         }
00132                                         else if (fromplain) {
00133                                                 module->second->AddRenderFilter(fromplain);
00134                                         }
00135                                         break;
00136                                 }
00137                         case FMT_OSIS:
00138                                 if (oldosis != fromosis) {
00139                                         if (oldosis) {
00140                                                 if (!fromosis) {
00141                                                         module->second->RemoveRenderFilter(oldosis);
00142                                                 }
00143                                                 else {
00144                                                         module->second->ReplaceRenderFilter(oldosis, fromosis);
00145                                                 }
00146                                         }
00147                                         else if (fromosis) {
00148                                                 module->second->AddRenderFilter(fromosis);
00149                                         }
00150                                         break;
00151                                 }
00152                         }
00153 
00154                 if (oldthml)
00155                         delete oldthml;
00156                 if (oldgbf)
00157                         delete oldgbf;
00158                 if (oldplain)
00159                         delete oldplain;
00160                 if (oldosis)
00161                         delete oldosis;
00162         }
00163         return markup;
00164 }


The documentation for this class was generated from the following files:
Generated on Wed Apr 3 22:34:17 2002 for The Sword Project by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002