00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
#ifndef __KMIME_CODEC_QP__
00033
#define __KMIME_CODEC_QP__
00034
00035
#include "kmime_codecs.h"
00036
00037
namespace KMime {
00038
00039
00040
class QuotedPrintableCodec :
public Codec {
00041
protected:
00042
friend class Codec;
00043 QuotedPrintableCodec() : Codec() {}
00044
00045
public:
00046
virtual ~QuotedPrintableCodec() {}
00047
00048
const char * name()
const {
00049
return "quoted-printable";
00050 }
00051
00052
int maxEncodedSizeFor(
int insize,
bool withCRLF=
false )
const {
00053
00054
int result = 3*insize;
00055
00056 result += (withCRLF ? 3 : 2) * (insize/25);
00057
00058
return result;
00059 }
00060
00061
int maxDecodedSizeFor(
int insize,
bool withCRLF=
false )
const;
00062
00063
Encoder * makeEncoder(
bool withCRLF=
false )
const;
00064 Decoder * makeDecoder(
bool withCRLF=
false )
const;
00065 };
00066
00067
00068
class Rfc2047QEncodingCodec :
public Codec {
00069
protected:
00070
friend class Codec;
00071 Rfc2047QEncodingCodec() : Codec() {}
00072
00073
public:
00074
virtual ~Rfc2047QEncodingCodec() {}
00075
00076
const char * name()
const {
00077
return "q";
00078 }
00079
00080
int maxEncodedSizeFor(
int insize,
bool withCRLF=
false )
const {
00081 (
void)withCRLF;
00082
00083
00084
return 3*insize;
00085 }
00086
00087
int maxDecodedSizeFor(
int insize,
bool withCRLF=
false )
const;
00088
00089
Encoder * makeEncoder(
bool withCRLF=
false )
const;
00090 Decoder * makeDecoder(
bool withCRLF=
false )
const;
00091 };
00092
00093
00094
class Rfc2231EncodingCodec :
public Codec {
00095
protected:
00096
friend class Codec;
00097 Rfc2231EncodingCodec() : Codec() {}
00098
00099
public:
00100
virtual ~Rfc2231EncodingCodec() {}
00101
00102
const char * name()
const {
00103
return "x-kmime-rfc2231";
00104 }
00105
00106
int maxEncodedSizeFor(
int insize,
bool withCRLF=
false )
const {
00107 (
void)withCRLF;
00108
00109
return 3*insize;
00110 }
00111
00112
int maxDecodedSizeFor(
int insize,
bool withCRLF=
false )
const;
00113
00114
Encoder * makeEncoder(
bool withCRLF=
false )
const;
00115 Decoder * makeDecoder(
bool withCRLF=
false )
const;
00116 };
00117
00118
00119 }
00120
00121
#endif // __KMIME_CODEC_QP__