#include <encfiltmgr.h>
Inheritance diagram for EncodingFilterMgr:
Public Methods | |
EncodingFilterMgr (char encoding=ENC_UTF8) | |
Constructor of SWEncodingMgr. More... | |
~EncodingFilterMgr () | |
The destructor of SWEncodingMgr. | |
char | Encoding (char enc) |
Markup sets/gets the encoding after initialization. More... | |
virtual void | AddRawFilters (SWModule *module, ConfigEntMap §ion) |
Adds the raw filters which are defined in "section" to the SWModule object "module". More... | |
virtual void | AddEncodingFilters (SWModule *module, ConfigEntMap §ion) |
Adds the encoding filters which are defined in "section" to the SWModule object "module". More... | |
Protected Attributes | |
SWFilter * | latin1utf8 |
SWFilter * | scsuutf8 |
SWFilter * | targetenc |
char | encoding |
Definition at line 33 of file encfiltmgr.h.
|
Constructor of SWEncodingMgr.
Definition at line 41 of file encfiltmgr.cpp.
00042 : SWFilterMgr() { 00043 00044 scsuutf8 = new SCSUUTF8(); 00045 latin1utf8 = new Latin1UTF8(); 00046 00047 encoding = enc; 00048 00049 switch (encoding) { 00050 case ENC_LATIN1: 00051 targetenc = new UTF8Latin1(); 00052 break; 00053 case ENC_UTF16: 00054 targetenc = new UTF8UTF16(); 00055 break; 00056 case ENC_RTF: 00057 targetenc = new UnicodeRTF(); 00058 break; 00059 case ENC_HTML: 00060 targetenc = new UTF8HTML(); 00061 break; 00062 default: // i.e. case ENC_UTF8 00063 targetenc = NULL; 00064 } 00065 } |
|
Adds the encoding filters which are defined in "section" to the SWModule object "module".
Definition at line 92 of file encfiltmgr.cpp. References SWModule::AddEncodingFilter().
00092 { 00093 if (targetenc) 00094 module->AddEncodingFilter(targetenc); 00095 } |
|
Adds the raw filters which are defined in "section" to the SWModule object "module".
Definition at line 79 of file encfiltmgr.cpp. References SWModule::AddRawFilter().
00079 { 00080 00081 ConfigEntMap::iterator entry; 00082 00083 string encoding = ((entry = section.find("Encoding")) != section.end()) ? (*entry).second : (string)""; 00084 if (encoding.empty() || !stricmp(encoding.c_str(), "Latin-1")) { 00085 module->AddRawFilter(latin1utf8); 00086 } 00087 else if (!stricmp(encoding.c_str(), "SCSU")) { 00088 module->AddRawFilter(scsuutf8); 00089 } 00090 } |
|
Markup sets/gets the encoding after initialization.
Definition at line 104 of file encfiltmgr.cpp.
00104 { 00105 if (enc && enc != encoding) { 00106 encoding = enc; 00107 SWFilter * oldfilter = targetenc; 00108 00109 switch (encoding) { 00110 case ENC_LATIN1: 00111 targetenc = new UTF8Latin1(); 00112 break; 00113 case ENC_UTF16: 00114 targetenc = new UTF8UTF16(); 00115 break; 00116 case ENC_RTF: 00117 targetenc = new UnicodeRTF(); 00118 break; 00119 case ENC_HTML: 00120 targetenc = new UTF8HTML(); 00121 break; 00122 default: // i.e. case ENC_UTF8 00123 targetenc = NULL; 00124 } 00125 00126 ModMap::const_iterator module; 00127 00128 if (oldfilter != targetenc) { 00129 if (oldfilter) { 00130 if (!targetenc) { 00131 for (module = getParentMgr()->Modules.begin(); module != getParentMgr()->Modules.end(); module++) 00132 module->second->RemoveRenderFilter(oldfilter); 00133 } 00134 else { 00135 for (module = getParentMgr()->Modules.begin(); module != getParentMgr()->Modules.end(); module++) 00136 module->second->ReplaceRenderFilter(oldfilter, targetenc); 00137 } 00138 delete oldfilter; 00139 } 00140 else if (targetenc) { 00141 for (module = getParentMgr()->Modules.begin(); module != getParentMgr()->Modules.end(); module++) 00142 module->second->AddRenderFilter(targetenc); 00143 } 00144 } 00145 00146 } 00147 return encoding; 00148 } |