KMIME Library
kmime_codec_qp.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00046 #ifndef __KMIME_CODEC_QP__
00047 #define __KMIME_CODEC_QP__
00048
00049 #include "kmime_codecs.h"
00050
00051 namespace KMime {
00052
00058 class KMIME_EXPORT QuotedPrintableCodec : public Codec
00059 {
00060 protected:
00061 friend class Codec;
00065 QuotedPrintableCodec() : Codec() {}
00066
00067 public:
00071 virtual ~QuotedPrintableCodec() {}
00072
00077 const char *name() const
00078 { return "quoted-printable"; }
00079
00084 int maxEncodedSizeFor( int insize, bool withCRLF=false ) const
00085 {
00086 int result = 3*insize;
00087
00088 result += (withCRLF ? 3 : 2) * (insize / 25);
00089
00090 return result;
00091 }
00092
00097 int maxDecodedSizeFor( int insize, bool withCRLF=false ) const;
00098
00103 Encoder *makeEncoder( bool withCRLF=false ) const;
00104
00109 Decoder *makeDecoder( bool withCRLF=false ) const;
00110 };
00111
00117 class KMIME_EXPORT Rfc2047QEncodingCodec : public Codec
00118 {
00119 protected:
00120 friend class Codec;
00124 Rfc2047QEncodingCodec() : Codec() {}
00125
00126 public:
00130 virtual ~Rfc2047QEncodingCodec() {}
00131
00136 const char *name() const
00137 { return "q"; }
00138
00143 int maxEncodedSizeFor( int insize, bool withCRLF=false ) const
00144 {
00145 Q_UNUSED( withCRLF );
00146
00147
00148 return 3 * insize;
00149 }
00150
00155 int maxDecodedSizeFor( int insize, bool withCRLF=false ) const;
00156
00161 Encoder *makeEncoder( bool withCRLF=false ) const;
00162
00167 Decoder *makeDecoder( bool withCRLF=false ) const;
00168 };
00169
00174 class KMIME_EXPORT Rfc2231EncodingCodec : public Codec
00175 {
00176 protected:
00177 friend class Codec;
00181 Rfc2231EncodingCodec() : Codec() {}
00182
00183 public:
00187 virtual ~Rfc2231EncodingCodec() {}
00188
00193 const char *name() const
00194 { return "x-kmime-rfc2231"; }
00195
00200 int maxEncodedSizeFor( int insize, bool withCRLF=false ) const
00201 {
00202 Q_UNUSED( withCRLF );
00203
00204 return 3 * insize;
00205 }
00206
00211 int maxDecodedSizeFor( int insize, bool withCRLF=false ) const;
00212
00217 Encoder *makeEncoder( bool withCRLF=false ) const;
00218
00223 Decoder *makeDecoder( bool withCRLF=false ) const;
00224 };
00225
00226 }
00227
00228 #endif // __KMIME_CODEC_QP__