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

textcodec.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     textcodec.h  -  Definition of TextCodec class.
00003                              -------------------
00004     begin                : June 21 2002
00005     copyright            : (C) 2003 by Vojtìch Toman
00006     email                : vtoman@lit.cz
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00025 #ifdef __GNUG__
00026 # pragma interface
00027 #endif
00028 
00029 #ifndef TEXTCODEC_H
00030 #define TEXTCODEC_H
00031 
00032 
00033 
00034 
00035 
00036 #include "defs.h"
00037 #include "xmldefs.h"
00038 #include "xmlchar.h"
00039 #include "encodings.h"
00040 #include "iodevice.h"
00041 
00042 
00044 #define DEFAULT_ALPHABET_BASE_SIZE      256
00045 
00046 
00047 
00053 class TextCodec
00054 {
00055 public:
00057   virtual bool isAbleToConvert(Encodings::MIB mib);
00058 
00060   virtual void fillInMapArray(XmlEncoding *info, Encodings::MIB mib);
00061 
00063   virtual inline int convert(const char *s, Encodings::MIB mib);
00064 
00066   virtual inline void release(Encodings::MIB mib);
00067 
00069   virtual Encodings::MIB getMIB(const XmlChar *encoding) throw (ExaltUnknownEncodingException);
00070 
00072   virtual bool knowsMIB(Encodings::MIB mib);
00073 
00075   virtual inline unsigned long suggestAlphabetBaseSize(Encodings::MIB mib) throw (ExaltUnknownEncodingException);
00076 
00078   virtual inline void output(IODevice *device, XmlChar c, Encodings::MIB toEncoding) throw (ExaltEncodingException, ExaltIOException);
00079 
00081   virtual inline void output(IODevice *device, const XmlChar *str, Encodings::MIB toEncoding) throw (ExaltEncodingException, ExaltIOException);
00082 
00084   virtual inline void output(IODevice *device, const XmlChar *str, size_t length, Encodings::MIB toEncoding) throw (ExaltEncodingException, ExaltIOException);
00085 };
00086 
00087 
00088 
00094 class UserOfTextCodec
00095 {
00096 public:
00102   UserOfTextCodec(void) { textCodec = 0; defaultTextCodecUsed = false; }
00103 
00111   virtual void setTextCodec(TextCodec *codec) { textCodec = codec; defaultTextCodecUsed = false; }
00112 
00113 protected:
00115   TextCodec *textCodec;
00116 
00118   bool defaultTextCodecUsed;
00119 
00125   void createDefaultTextCodec(void)
00126   {
00127     NEW(textCodec, TextCodec);
00128     defaultTextCodecUsed = true;
00129   }
00130 
00136   void deleteDefaultTextCodec(void)
00137   {
00138     if (defaultTextCodecUsed && textCodec)
00139       {
00140         DELETE(textCodec);
00141         defaultTextCodecUsed = false;
00142       }
00143   }
00144 };
00145 
00146 #endif //TEXTCODEC_H
00147 
00148 
00149 

Generated on Wed Feb 5 10:43:02 2003 for Exalt by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002