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 49 of file markupfiltmgr.cpp.

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


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 168 of file markupfiltmgr.cpp.

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

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

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 80 of file markupfiltmgr.cpp.

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


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