KMIME Library
kmime_codec_qp.h
Go to the documentation of this file.
00001 /* -*- c++ -*- 00002 kmime_codec_qp.h 00003 00004 KMime, the KDE Internet mail/usenet news message library. 00005 Copyright (c) 2001-2002 Marc Mutz <mutz@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 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 { // all chars encoded: 00086 int result = 3*insize; 00087 // then after 25 hexchars comes a soft linebreak: =(\r)\n 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 // this one is simple: We don't do linebreaking, so all that can 00147 // happen is that every char needs encoding, so: 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 // same as for "q" encoding: 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 } // namespace KMime 00227 00228 #endif // __KMIME_CODEC_QP__
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 22:17:28 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 22:17:28 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.