EncodingFilterMgr Class Reference

#include <encfiltmgr.h>

Inheritance diagram for EncodingFilterMgr:
Inheritance graph
[legend]
Collaboration diagram for EncodingFilterMgr:
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)
char Encoding (char enc)
 EncodingFilterMgr (char encoding=ENC_UTF8)
virtual SWMgrgetParentMgr ()
virtual void setParentMgr (SWMgr *parentMgr)
 ~EncodingFilterMgr ()

Protected Attributes

char encoding
SWFilterlatin1utf8
SWFiltertargetenc

Detailed Description

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

Definition at line 36 of file encfiltmgr.h.


Constructor & Destructor Documentation

SWORD_NAMESPACE_START EncodingFilterMgr::EncodingFilterMgr ( char  encoding = ENC_UTF8  ) 

Constructor of SWEncodingMgr.

Parameters:
encoding The desired encoding.

Definition at line 44 of file encfiltmgr.cpp.

00045            : SWFilterMgr() {
00046 
00047         latin1utf8 = new Latin1UTF8();
00048 
00049         encoding = enc;
00050 
00051         switch (encoding) {
00052         case ENC_LATIN1:
00053                 targetenc = new UTF8Latin1();
00054                 break;
00055         case ENC_UTF16:
00056                 targetenc = new UTF8UTF16();
00057                 break;
00058         case ENC_RTF:
00059                 targetenc = new UnicodeRTF();
00060                 break;
00061         case ENC_HTML:
00062                 targetenc = new UTF8HTML();
00063                 break;
00064         default: // i.e. case ENC_UTF8
00065                 targetenc = NULL;
00066         }
00067 }

EncodingFilterMgr::~EncodingFilterMgr (  ) 

The destructor of SWEncodingMgr.

Definition at line 72 of file encfiltmgr.cpp.

00072                                       {
00073         if (latin1utf8)
00074                 delete latin1utf8;
00075         if (targetenc)
00076                 delete targetenc;
00077 }


Member Function Documentation

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

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]

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 SWFilterMgr::AddRenderFilters ( SWModule module,
ConfigEntMap section 
) [virtual, inherited]

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 in MarkupFilterMgr, and DiathekeFilterMgr.

Definition at line 70 of file swfiltermgr.cpp.

00070                                                                             {
00071 }

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 }

char EncodingFilterMgr::Encoding ( char  enc  ) 

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 }

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]

Definition at line 46 of file encfiltmgr.h.

Definition at line 39 of file encfiltmgr.h.

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