• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

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 
00067     QByteArray encode( const QByteArray &src, bool withCRLF=false ) const;
00068 
00073     QByteArray decode( const QByteArray &src, bool withCRLF=false ) const;
00074 
00079     int maxEncodedSizeFor( int insize, bool withCRLF ) const
00080     {
00081       if ( withCRLF ) {
00082         return 2 * insize;
00083       } else {
00084         return insize;
00085       }
00086     }
00087 
00092     int maxDecodedSizeFor( int insize, bool withCRLF ) const
00093     {
00094       if ( withCRLF ) {
00095         return 2 * insize;
00096       } else {
00097         return insize;
00098       }
00099     }
00100 
00105     Encoder *makeEncoder( bool withCRLF=false ) const;
00106 
00111     Decoder *makeDecoder( bool withCRLF=false ) const;
00112 };
00113 
00118 class KMIME_EXPORT SevenBitCodec : public IdentityCodec
00119 {
00120   protected:
00121     friend class Codec;
00125     SevenBitCodec() : IdentityCodec() {}
00126 
00127   public:
00131     ~SevenBitCodec() {}
00132 
00137     const char *name() const
00138     { return "7bit"; }
00139 };
00140 
00145 class KMIME_EXPORT EightBitCodec : public IdentityCodec
00146 {
00147   protected:
00148     friend class Codec;
00152     EightBitCodec() : IdentityCodec() {}
00153 
00154   public:
00158     ~EightBitCodec() {}
00159 
00164     const char *name() const
00165     { return "8bit"; }
00166 };
00167 
00172 class KMIME_EXPORT BinaryCodec : public IdentityCodec
00173 {
00174   protected:
00175     friend class Codec;
00179     BinaryCodec() : IdentityCodec() {}
00180 
00181   public:
00185     ~BinaryCodec() {}
00186 
00191     const char *name() const
00192     { return "binary"; }
00193 
00198     int maxEncodedSizeFor( int insize, bool withCRLF=false ) const
00199     { Q_UNUSED( withCRLF ); return insize; }
00200 
00205     int maxDecodedSizeFor( int insize, bool withCRLF=false ) const
00206     { Q_UNUSED( withCRLF ); return insize; }
00207 };
00208 
00209 } // namespace KMime
00210 
00211 #endif // __KMIME_CODEC_IDENTITY_H__

KMIME Library

Skip menu "KMIME Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal