DiathekeFilterMgr Class Reference

#include <diafiltmgr.h>

Inheritance diagram for DiathekeFilterMgr:
Inheritance graph
[legend]
Collaboration diagram for DiathekeFilterMgr:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void AddEncodingFilters (SWModule *module, ConfigEntMap &section)
virtual void AddGlobalOptions (SWModule *module, ConfigEntMap &section, ConfigEntMap::iterator start, ConfigEntMap::iterator end)
virtual void AddLocalOptions (SWModule *module, ConfigEntMap &section, ConfigEntMap::iterator start, ConfigEntMap::iterator end)
virtual void AddRawFilters (SWModule *module, ConfigEntMap &section)
virtual void AddRenderFilters (SWModule *module, ConfigEntMap &section)
virtual void AddStripFilters (SWModule *module, ConfigEntMap &section)
 DiathekeFilterMgr (char markup=FMT_THML, char encoding=ENC_UTF8)
char Encoding (char enc)
virtual SWMgrgetParentMgr ()
char Markup (char m=FMT_UNKNOWN)
virtual void setParentMgr (SWMgr *parentMgr)
 ~DiathekeFilterMgr ()

Protected Member Functions

void CreateFilters (char markup)

Protected Attributes

char encoding
SWFilterfromgbf
SWFilterfromosis
SWFilterfromplain
SWFilterfromthml
SWFilterlatin1utf8
char markup
SWFiltertargetenc

Detailed Description

Definition at line 31 of file diafiltmgr.h.


Constructor & Destructor Documentation

DiathekeFilterMgr::DiathekeFilterMgr ( char  markup = FMT_THML,
char  encoding = ENC_UTF8 
)

Definition at line 45 of file diafiltmgr.cpp.

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

DiathekeFilterMgr::~DiathekeFilterMgr (  ) 

Definition at line 53 of file diafiltmgr.cpp.

00053                                       {
00054         if (fromthml)
00055                 delete (fromthml);
00056         if (fromgbf)
00057                 delete (fromgbf);
00058         if (fromplain)
00059                 delete (fromplain);
00060         if (fromosis)
00061                 delete (fromosis);
00062 }


Member Function Documentation

void EncodingFilterMgr::AddEncodingFilters ( SWModule module,
ConfigEntMap section 
) [virtual, inherited]

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

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

Reimplemented from SWFilterMgr.

Definition at line 89 of file encfiltmgr.cpp.

00089                                                                                   {
00090         if (targetenc)
00091                 module->addEncodingFilter(targetenc);
00092 }

void SWFilterMgr::AddGlobalOptions ( SWModule module,
ConfigEntMap section,
ConfigEntMap::iterator  start,
ConfigEntMap::iterator  end 
) [virtual, inherited]

Definition at line 46 of file swfiltermgr.cpp.

00046                                                                                                                                   {
00047 }

void SWFilterMgr::AddLocalOptions ( SWModule module,
ConfigEntMap section,
ConfigEntMap::iterator  start,
ConfigEntMap::iterator  end 
) [virtual, inherited]

Definition at line 50 of file swfiltermgr.cpp.

00050                                                                                                                                  {
00051 }

void EncodingFilterMgr::AddRawFilters ( SWModule module,
ConfigEntMap section 
) [virtual, inherited]

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

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

Reimplemented from SWFilterMgr.

Definition at line 79 of file encfiltmgr.cpp.

00079                                                                              {
00080 
00081     ConfigEntMap::iterator entry;
00082 
00083     SWBuf encoding = ((entry = section.find("Encoding")) != section.end()) ? (*entry).second : (SWBuf)"";
00084     if (!encoding.length() || !stricmp(encoding.c_str(), "Latin-1")) {
00085                 module->addRawFilter(latin1utf8);
00086     }
00087 }

void DiathekeFilterMgr::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

Reimplemented from SWFilterMgr.

Definition at line 64 of file diafiltmgr.cpp.

00064                                                                                 {
00065         switch (module->getMarkup()) {
00066         case FMT_THML:
00067                 if (fromthml)
00068                         module->addRenderFilter(fromthml);
00069                 break;
00070         case FMT_GBF:
00071                 if (fromgbf)
00072                         module->addRenderFilter(fromgbf);
00073                 break;
00074         case FMT_PLAIN:
00075                 if (fromplain)
00076                         module->addRenderFilter(fromplain);
00077                 break;
00078         case FMT_OSIS:
00079                 if (fromosis)
00080                         module->addRenderFilter(fromosis);
00081                 break;
00082         }
00083     EncodingFilterMgr::AddRenderFilters(module, section);
00084 }

void SWFilterMgr::AddStripFilters ( SWModule module,
ConfigEntMap section 
) [virtual, inherited]

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

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

Definition at line 80 of file swfiltermgr.cpp.

00080                                                                            {
00081 }

void DiathekeFilterMgr::CreateFilters ( char  markup  )  [protected]

Definition at line 175 of file diafiltmgr.cpp.

00175                                                  {
00176 
00177                 switch (markup) {
00178         case FMT_CGI:
00179             fromplain = NULL;
00180             fromthml = new ThMLCGI();
00181             fromgbf = new GBFCGI();
00182             fromosis = new OSISCGI();
00183             break;
00184                 case FMT_PLAIN:
00185                         fromplain = NULL;
00186                         fromthml = new ThMLPlain();
00187                         fromgbf = new GBFPlain();
00188                         fromosis = new OSISPlain();
00189                         break;
00190                 case FMT_THML:
00191                         fromplain = NULL;
00192                         fromthml = NULL;
00193                         fromgbf = new GBFThML();
00194                         fromosis = NULL;
00195                         break;
00196                 case FMT_GBF:
00197                         fromplain = NULL;
00198                         fromthml = new ThMLGBF();
00199                         fromgbf = NULL;
00200                         fromosis = NULL;
00201                         break;
00202                 case FMT_HTML:
00203                         fromplain = new PLAINHTML();
00204                         fromthml = new ThMLHTML();
00205                         fromgbf = new GBFHTML();
00206                         fromosis = NULL;
00207                         break;
00208                 case FMT_HTMLHREF:
00209                         fromplain = NULL;
00210                         fromthml = new ThMLHTMLHREF();
00211                         fromgbf = new GBFHTMLHREF();
00212                         fromosis = new OSISHTMLHREF();
00213                         break;
00214                 case FMT_RTF:
00215                         fromplain = NULL;
00216                         fromthml = new ThMLRTF();
00217                         fromgbf = new GBFRTF();
00218                         fromosis = new OSISRTF();
00219                         break;
00220                 case FMT_OSIS:
00221                         fromplain = NULL;
00222                         fromthml = new ThMLOSIS();
00223                         fromgbf = new GBFOSIS();
00224                         fromosis = NULL;
00225                         break;
00226                 }
00227 
00228 }

char EncodingFilterMgr::Encoding ( char  enc  )  [inherited]

Markup sets/gets the encoding after initialization

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

Definition at line 101 of file encfiltmgr.cpp.

00101                                          {
00102         if (enc && enc != encoding) {
00103                 encoding = enc;
00104                 SWFilter * oldfilter = targetenc;
00105                 
00106                 switch (encoding) {
00107                 case ENC_LATIN1:
00108                         targetenc = new UTF8Latin1();
00109                         break;
00110                 case ENC_UTF16:
00111                         targetenc = new UTF8UTF16();
00112                         break;
00113                 case ENC_RTF:
00114                         targetenc = new UnicodeRTF();
00115                         break;
00116                 case ENC_HTML:
00117                         targetenc = new UTF8HTML();
00118                         break;
00119                 default: // i.e. case ENC_UTF8
00120                         targetenc = NULL;
00121                 }
00122 
00123                 ModMap::const_iterator module;
00124 
00125                 if (oldfilter != targetenc) {
00126                         if (oldfilter) {
00127                                 if (!targetenc) {
00128                                         for (module = getParentMgr()->Modules.begin(); module != getParentMgr()->Modules.end(); module++)
00129                                                 module->second->removeRenderFilter(oldfilter);
00130                                 }
00131                                 else {
00132                                         for (module = getParentMgr()->Modules.begin(); module != getParentMgr()->Modules.end(); module++)
00133                                                 module->second->replaceRenderFilter(oldfilter, targetenc);
00134                                 }
00135                                 delete oldfilter;
00136                         }
00137                         else if (targetenc) {
00138                                 for (module = getParentMgr()->Modules.begin(); module != getParentMgr()->Modules.end(); module++)
00139                                         module->second->addRenderFilter(targetenc);
00140                         }
00141                 }
00142 
00143         }
00144         return encoding;
00145 }

SWMgr * SWFilterMgr::getParentMgr (  )  [virtual, inherited]

Definition at line 41 of file swfiltermgr.cpp.

00041                                  {
00042     return parentMgr;
00043 }

char DiathekeFilterMgr::Markup ( char  m = FMT_UNKNOWN  ) 

Definition at line 87 of file diafiltmgr.cpp.

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

void SWFilterMgr::setParentMgr ( SWMgr parentMgr  )  [virtual, inherited]

Definition at line 36 of file swfiltermgr.cpp.

00036                                                {
00037     this->parentMgr = parentMgr;
00038 }


Member Data Documentation

char EncodingFilterMgr::encoding [protected, inherited]

Definition at line 46 of file encfiltmgr.h.

Definition at line 34 of file diafiltmgr.h.

Definition at line 36 of file diafiltmgr.h.

Definition at line 35 of file diafiltmgr.h.

Definition at line 33 of file diafiltmgr.h.

SWFilter* EncodingFilterMgr::latin1utf8 [protected, inherited]

Definition at line 39 of file encfiltmgr.h.

char DiathekeFilterMgr::markup [protected]

Definition at line 38 of file diafiltmgr.h.

SWFilter* EncodingFilterMgr::targetenc [protected, inherited]

Definition at line 40 of file encfiltmgr.h.


The documentation for this class was generated from the following files:

Generated on 18 Mar 2013 for The SWORD Project by  doxygen 1.6.1