32 #ifndef __KMIME_CODEC_BASE64__ 33 #define __KMIME_CODEC_BASE64__ 35 #include "kmime_codecs.h" 39 class Base64Codec : public Codec { 42 Base64Codec() : Codec() {} 45 virtual ~Base64Codec() {} 47 const char * name() const { 51 int maxEncodedSizeFor( int insize, bool withCRLF= false ) const { 53 int totalNumPackets = ( insize + 2 ) / 3; 55 int numLineBreaks = totalNumPackets / (76/4); 59 return 4 * totalNumPackets + ( withCRLF ? 2 : 1 ) * numLineBreaks; 62 int maxDecodedSizeFor( int insize, bool withCRLF= false ) const { 68 int result = ( ( insize + 3 ) / 4 ) * 3; 76 Encoder * makeEncoder( bool withCRLF= false ) const; 77 Decoder * makeDecoder( bool withCRLF= false ) const; 82 class Rfc2047BEncodingCodec : public Base64Codec { 85 Rfc2047BEncodingCodec() 89 virtual ~Rfc2047BEncodingCodec() {} 91 const char * name() const { return "b"; } 93 int maxEncodedSizeFor( int insize, bool withCRLF= false ) const { 96 return ( ( insize + 2 ) / 3 ) * 4; 99 int maxDecodedSizeFor( int insize, bool withCRLF= false ) const { 103 return ( ( insize + 3 ) / 4 ) * 3; 106 Encoder * makeEncoder( bool withCRLF= false ) const; 112 #endif // __KMIME_CODEC_BASE64__
|