KMIME Library
kmime_codec_identity.h
Go to the documentation of this file.
00001 /* -*- c++ -*- 00002 kmime_codec_identity.h 00003 00004 KMime, the KDE Internet mail/usenet news message library. 00005 Copyright (c) 2004 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 */ 00035 #ifndef __KMIME_CODEC_IDENTITY_H__ 00036 #define __KMIME_CODEC_IDENTITY_H__ 00037 00038 #include "kmime_codecs.h" 00039 00040 class QByteArray; 00041 00042 namespace KMime { 00043 00048 class KMIME_EXPORT IdentityCodec : public Codec 00049 { 00050 protected: 00051 friend class Codec; 00055 IdentityCodec() : Codec() {} 00056 00057 public: 00061 ~IdentityCodec() {} 00062 00063 using Codec::encode; 00064 using Codec::decode; 00065 00070 QByteArray encode( const QByteArray &src, bool withCRLF=false ) const; 00071 00076 QByteArray decode( const QByteArray &src, bool withCRLF=false ) const; 00077 00082 int maxEncodedSizeFor( int insize, bool withCRLF ) const 00083 { 00084 if ( withCRLF ) { 00085 return 2 * insize; 00086 } else { 00087 return insize; 00088 } 00089 } 00090 00095 int maxDecodedSizeFor( int insize, bool withCRLF ) const 00096 { 00097 if ( withCRLF ) { 00098 return 2 * insize; 00099 } else { 00100 return insize; 00101 } 00102 } 00103 00108 Encoder *makeEncoder( bool withCRLF=false ) const; 00109 00114 Decoder *makeDecoder( bool withCRLF=false ) const; 00115 }; 00116 00121 class KMIME_EXPORT SevenBitCodec : public IdentityCodec 00122 { 00123 protected: 00124 friend class Codec; 00128 SevenBitCodec() : IdentityCodec() {} 00129 00130 public: 00134 ~SevenBitCodec() {} 00135 00140 const char *name() const 00141 { return "7bit"; } 00142 }; 00143 00148 class KMIME_EXPORT EightBitCodec : public IdentityCodec 00149 { 00150 protected: 00151 friend class Codec; 00155 EightBitCodec() : IdentityCodec() {} 00156 00157 public: 00161 ~EightBitCodec() {} 00162 00167 const char *name() const 00168 { return "8bit"; } 00169 }; 00170 00175 class KMIME_EXPORT BinaryCodec : public IdentityCodec 00176 { 00177 protected: 00178 friend class Codec; 00182 BinaryCodec() : IdentityCodec() {} 00183 00184 public: 00188 ~BinaryCodec() {} 00189 00194 const char *name() const 00195 { return "binary"; } 00196 00201 int maxEncodedSizeFor( int insize, bool withCRLF=false ) const 00202 { Q_UNUSED( withCRLF ); return insize; } 00203 00208 int maxDecodedSizeFor( int insize, bool withCRLF=false ) const 00209 { Q_UNUSED( withCRLF ); return insize; } 00210 }; 00211 00212 } // namespace KMime 00213 00214 #endif // __KMIME_CODEC_IDENTITY_H__
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.