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

muo_convert_table.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2001 Karsten Reincke <karsten.reincke@gnukose.org>
00003  *  
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software 
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  *  
00018  * file <muo_convert_table.h> version <#1.3.1#> of project <MrProjext>
00019  */   
00020 
00027 #ifndef  CODETOKENMAP_H
00028 #define  CODETOKENMAP_H
00029 
00030 #ifdef HAVE_CONFIG_H
00031 #include <config.h>
00032 #endif
00033 
00034 #include <string>
00035 #include <map>
00036 /* &&& exported preprocessor-defines &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00037 
00038 /* &&& class-declarations &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00039 
00040 using namespace std;
00041 
00042 namespace krmuo
00043 {
00044 
00066 class CodeTokenMap
00067 {
00068   /* &&& attributes &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00069   protected:
00070   
00071     const string* mClearToken;              
00072     map<string,unsigned char>* mDecoderMap; 
00073     map<unsigned char,string>* mEncoderMap; 
00074 
00075     
00076   /* &&& methods &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00077   
00078   public:
00079   
00080     /* :-: public constructors / init / operators :-:-:-:-:-:-:-: */
00081     
00085     CodeTokenMap();           
00086         
00087     virtual ~CodeTokenMap();                      
00088         
00089   
00090   public:
00091     /* :-: protected getter :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
00095     virtual bool isEncodableSign(unsigned char pSign) const;
00096     
00100     virtual const string& encodeSign(unsigned char pSign) const;
00101     
00102 
00107     bool isDecodableToken(const string& pToken) const;
00108 
00112     virtual unsigned char decodeToken(const string& pToken) const;
00113 
00114     /* :-: protected setter :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
00115     /* :-: protected others :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
00117     inline void dumpEncodeTable()
00118     {
00119       map<unsigned char,string>::const_iterator i=mEncoderMap->begin();
00120       while(i!=mEncoderMap->end())
00121       {
00122         cout << "[" << i->first << "][" << i->second << "]\n";
00123         i++;
00124       }
00125     }
00126 
00128     inline void dumpDecodeTable()
00129     {
00130       map<string,unsigned char>::const_iterator i=mDecoderMap->begin();
00131       while(i!=mDecoderMap->end())
00132       {
00133         cout << "[" << i->first << "][" << i->second << "]\n";
00134         i++;
00135       }
00136     }
00137     
00138     
00139   private:
00140     /* :-: private constructors / init / operators :-:-:-:-:-:-: */
00141      CodeTokenMap(const CodeTokenMap& pCo);  
00142     /* :-: private getter -:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
00143     /* :-: private setter -:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
00144     /* :-: private others -:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */      
00145 };
00146 
00147 
00152 class HtmlCodeTokenMap:public CodeTokenMap
00153 {
00154   /* &&& attributes &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00155   public:
00156   
00157   private:
00158     static const string mHtmlClearToken;
00159     static map<string,unsigned char> mHtmlDecoderMap; 
00160     static map<unsigned char,string> mHtmlEncoderMap; 
00161     
00162     static bool mHtmlMapsMustStillBeFilled; 
00163     
00164     static const unsigned char signValueAmp;   
00165     static const string signEncodationAmp;          
00166     static const unsigned char signValueLt;
00167     static const string signEncodationLt;
00168     static const unsigned char signValueGt;
00169     static const string signEncodationGt;
00170     static const unsigned char signValueApos;
00171     static const string signEncodationApos;
00172     static const unsigned char signValueQuot;
00173     static const string signEncodationQuot;
00174     
00175     static const unsigned char signValue160;
00176     static const string signEncodation160;
00177     static const unsigned char signValue161;
00178     static const string signEncodation161;
00179     static const unsigned char signValue162;
00180     static const string signEncodation162;
00181     static const unsigned char signValue163;
00182     static const string signEncodation163;
00183     static const unsigned char signValue164;
00184     static const string signEncodation164;
00185     static const unsigned char signValue165;
00186     static const string signEncodation165;
00187     static const unsigned char signValue166;
00188     static const string signEncodation166;
00189     static const unsigned char signValue167;
00190     static const string signEncodation167;
00191     static const unsigned char signValue168;
00192     static const string signEncodation168;
00193     static const unsigned char signValue169;
00194     static const string signEncodation169;
00195    
00196     static const unsigned char signValue170;
00197     static const string signEncodation170;
00198     static const unsigned char signValue171;
00199     static const string signEncodation171;
00200     static const unsigned char signValue172;
00201     static const string signEncodation172;
00202     static const unsigned char signValue173;
00203     static const string signEncodation173;
00204     static const unsigned char signValue174;
00205     static const string signEncodation174;
00206     static const unsigned char signValue175;
00207     static const string signEncodation175;
00208     static const unsigned char signValue176;
00209     static const string signEncodation176;
00210     static const unsigned char signValue177;
00211     static const string signEncodation177;
00212     static const unsigned char signValue178;
00213     static const string signEncodation178;
00214     static const unsigned char signValue179;
00215     static const string signEncodation179;
00216 
00217     static const unsigned char signValue180;
00218     static const string signEncodation180;
00219     static const unsigned char signValue181;
00220     static const string signEncodation181;
00221     static const unsigned char signValue182;
00222     static const string signEncodation182;
00223     static const unsigned char signValue183;
00224     static const string signEncodation183;
00225     static const unsigned char signValue184;
00226     static const string signEncodation184;
00227     static const unsigned char signValue185;
00228     static const string signEncodation185;
00229     static const unsigned char signValue186;
00230     static const string signEncodation186;
00231     static const unsigned char signValue187;
00232     static const string signEncodation187;
00233     static const unsigned char signValue188;
00234     static const string signEncodation188;
00235     static const unsigned char signValue189;
00236     static const string signEncodation189;
00237 
00238     static const unsigned char signValue190;
00239     static const string signEncodation190;
00240     static const unsigned char signValue191;
00241     static const string signEncodation191;
00242     static const unsigned char signValue192;
00243     static const string signEncodation192;
00244     static const unsigned char signValue193;
00245     static const string signEncodation193;
00246     static const unsigned char signValue194;
00247     static const string signEncodation194;
00248     static const unsigned char signValue195;
00249     static const string signEncodation195;
00250     static const unsigned char signValue196;
00251     static const string signEncodation196;
00252     static const unsigned char signValue197;
00253     static const string signEncodation197;
00254     static const unsigned char signValue198;
00255     static const string signEncodation198;
00256     static const unsigned char signValue199;
00257     static const string signEncodation199;
00258 
00259     static const unsigned char signValue200;
00260     static const string signEncodation200;
00261     static const unsigned char signValue201;
00262     static const string signEncodation201;
00263     static const unsigned char signValue202;
00264     static const string signEncodation202;
00265     static const unsigned char signValue203;
00266     static const string signEncodation203;
00267     static const unsigned char signValue204;
00268     static const string signEncodation204;
00269     static const unsigned char signValue205;
00270     static const string signEncodation205;
00271     static const unsigned char signValue206;
00272     static const string signEncodation206;
00273     static const unsigned char signValue207;
00274     static const string signEncodation207;
00275     static const unsigned char signValue208;
00276     static const string signEncodation208;
00277     static const unsigned char signValue209;
00278     static const string signEncodation209;
00279 
00280     static const unsigned char signValue210;
00281     static const string signEncodation210;
00282     static const unsigned char signValue211;
00283     static const string signEncodation211;
00284     static const unsigned char signValue212;
00285     static const string signEncodation212;
00286     static const unsigned char signValue213;
00287     static const string signEncodation213;
00288     static const unsigned char signValue214;
00289     static const string signEncodation214;
00290     static const unsigned char signValue215;
00291     static const string signEncodation215;
00292     static const unsigned char signValue216;
00293     static const string signEncodation216;
00294     static const unsigned char signValue217;
00295     static const string signEncodation217;
00296     static const unsigned char signValue218;
00297     static const string signEncodation218;
00298     static const unsigned char signValue219;
00299     static const string signEncodation219;
00300 
00301     static const unsigned char signValue220;
00302     static const string signEncodation220;
00303     static const unsigned char signValue221;
00304     static const string signEncodation221;
00305     static const unsigned char signValue222;
00306     static const string signEncodation222;
00307     static const unsigned char signValue223;
00308     static const string signEncodation223;
00309     static const unsigned char signValue224;
00310     static const string signEncodation224;
00311     static const unsigned char signValue225;
00312     static const string signEncodation225;
00313     static const unsigned char signValue226;
00314     static const string signEncodation226;
00315     static const unsigned char signValue227;
00316     static const string signEncodation227;
00317     static const unsigned char signValue228;
00318     static const string signEncodation228;
00319     static const unsigned char signValue229;
00320     static const string signEncodation229;
00321 
00322     static const unsigned char signValue230;
00323     static const string signEncodation230;
00324     static const unsigned char signValue231;
00325     static const string signEncodation231;
00326     static const unsigned char signValue232;
00327     static const string signEncodation232;
00328     static const unsigned char signValue233;
00329     static const string signEncodation233;
00330     static const unsigned char signValue234;
00331     static const string signEncodation234;
00332     static const unsigned char signValue235;
00333     static const string signEncodation235;
00334     static const unsigned char signValue236;
00335     static const string signEncodation236;
00336     static const unsigned char signValue237;
00337     static const string signEncodation237;
00338     static const unsigned char signValue238;
00339     static const string signEncodation238;
00340     static const unsigned char signValue239;
00341     static const string signEncodation239;
00342 
00343     static const unsigned char signValue240;
00344     static const string signEncodation240;
00345     static const unsigned char signValue241;
00346     static const string signEncodation241;
00347     static const unsigned char signValue242;
00348     static const string signEncodation242;
00349     static const unsigned char signValue243;
00350     static const string signEncodation243;
00351     static const unsigned char signValue244;
00352     static const string signEncodation244;
00353     static const unsigned char signValue245;
00354     static const string signEncodation245;
00355     static const unsigned char signValue246;
00356     static const string signEncodation246;
00357     static const unsigned char signValue247;
00358     static const string signEncodation247;
00359     static const unsigned char signValue248;
00360     static const string signEncodation248;
00361     static const unsigned char signValue249;
00362     static const string signEncodation249;
00363 
00364     static const unsigned char signValue250;
00365     static const string signEncodation250;
00366     static const unsigned char signValue251;
00367     static const string signEncodation251;
00368     static const unsigned char signValue252;
00369     static const string signEncodation252;
00370     static const unsigned char signValue253;
00371     static const string signEncodation253;
00372     static const unsigned char signValue254;
00373     static const string signEncodation254;
00374     static const unsigned char signValue255;
00375     static const string signEncodation255;
00376 
00377   protected:
00378     
00379  
00380   /* &&& methods &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00381   
00382   public:
00383   
00384     /* :-: public constructors / init / operators :-:-:-:-:-:-:-: */
00385     
00389     HtmlCodeTokenMap();           
00390         
00391     ~HtmlCodeTokenMap();                      
00392         
00393     /* :-: protected setter :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
00394     /* :-: protected others :-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
00395     
00396   private:
00397     /* :-: private constructors / init / operators :-:-:-:-:-:-: */
00398      HtmlCodeTokenMap(const HtmlCodeTokenMap& pCo);  
00399     /* :-: private getter -:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
00400     /* :-: private setter -:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */
00401     /* :-: private others -:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-: */      
00402 };
00403 
00407 class XmlCodeTokenMap:public CodeTokenMap
00408 {
00409   /* &&& attributes &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00410   public:
00411   
00412   private:
00413     static const string mXmlClearToken;
00414     static map<string,unsigned char> mXmlDecoderMap; 
00415     static map<unsigned char,string> mXmlEncoderMap; 
00416     
00417     static bool mXmlMapsMustStillBeFilled; 
00418     
00419     static const unsigned char signValueAmp;
00420     static const string signEncodationAmp;
00421     static const unsigned char signValueLt;
00422     static const string signEncodationLt;
00423     static const unsigned char signValueGt;
00424     static const string signEncodationGt;
00425     static const unsigned char signValueApos;
00426     static const string signEncodationApos;
00427     static const unsigned char signValueQuot;
00428     static const string signEncodationQuot;
00429    
00430   protected:
00431   
00432   /* &&& methods &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00433   
00434   public:
00435   
00436     /* &&& constructors / init / operators &&&&&&&&&&&&&&&&&&&&&&&&&&& */
00437     
00441     XmlCodeTokenMap();                       
00442     
00443     ~XmlCodeTokenMap();                      
00444         
00445    
00446   private:
00447     XmlCodeTokenMap(const XmlCodeTokenMap& co); 
00448       
00449   protected:
00450   
00451 };
00452 
00456 class UrlCodeTokenMap:public CodeTokenMap
00457 {
00458   /* &&& attributes &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& */
00459   public:
00460   
00461   private:
00462     static const string mUrlClearToken;
00463     static map<string,unsigned char> mUrlDecoderMap; 
00464     static map<unsigned char,string> mUrlEncoderMap; 
00465     
00466     static bool mUrlMapsMustStillBeFilled; 
00467 
00468     static const unsigned char signValueSemicolon;
00469     static const string signEncodationSemicolon;
00470     static const unsigned char signValueSlash;
00471     static const string signEncodationSlash;
00472     static const unsigned char signValueQuest;
00473     static const string signEncodationQuest;
00474     static const unsigned char signValueColon;
00475     static const string signEncodationColon;
00476     static const unsigned char signValueAtsign;
00477     static const string signEncodationAtsign;
00478     static const unsigned char signValueEqual;
00479     static const string signEncodationEqual;
00480     static const unsigned char signValueAmpercent;
00481     static const string signEncodationAmpercent;
00482     static const unsigned char signValueSpace;
00483     static const string signEncodationSpace;
00484     static const unsigned char signValueLt;
00485     static const string signEncodationLt;
00486     static const unsigned char signValueGt;
00487     static const string signEncodationGt;
00488     static const unsigned char signValueQuote;
00489     static const string signEncodationQuote;
00490     static const unsigned char signValueGadder;
00491     static const string signEncodationGadder;
00492     static const unsigned char signValuePercent;
00493     static const string signEncodationPercent;
00494     static const unsigned char signValueLsBracket;
00495     static const string signEncodationLsBracket;
00496     static const unsigned char signValueRsBracket;
00497     static const string signEncodationRsBracket;
00498     static const unsigned char signValueLBrace;
00499     static const string signEncodationLBrace;
00500     static const unsigned char signValueRBrace;
00501     static const string signEncodationRBrace;
00502     static const unsigned char signValueVBar;
00503     static const string signEncodationVBar;
00504     static const unsigned char signValueBackSlash;
00505     static const string signEncodationBackSlash;
00506     static const unsigned char signValueCaret;
00507     static const string signEncodationCaret;
00508     static const unsigned char signValueTilde;
00509     static const string signEncodationTilde;
00510     static const unsigned char signValueBackQuote;
00511     static const string signEncodationBackQuote;
00512    
00513     static const unsigned char signValuePlusSign;
00514     static const string signEncodationPlusSign;
00515     static const unsigned char signValueBlank;
00516     static const string signEncodationBlank;
00517   public:
00518     /* &&& constructors / init / operators &&&&&&&&&&&&&&&&&&&&&&&&&&& */
00519     
00523     UrlCodeTokenMap();                       
00524     
00525     ~UrlCodeTokenMap();                      
00526         
00527    
00528   private:
00529     UrlCodeTokenMap(const UrlCodeTokenMap& co); 
00530 
00531 };
00532 
00533 
00534 }
00535 
00536 #endif

Generated on Sun Mar 16 10:58:37 2003 for MRPROJEXT by doxygen1.2.17