• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

KMIME Library

  • kmime
kmime_codec_identity.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  kmime_codec_identity.h
3 
4  KMime, the KDE Internet mail/usenet news message library.
5  Copyright (c) 2004 Marc Mutz <mutz@kde.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
35 #ifndef __KMIME_CODEC_IDENTITY_H__
36 #define __KMIME_CODEC_IDENTITY_H__
37 
38 #include "kmime_codecs.h"
39 
40 class QByteArray;
41 
42 namespace KMime {
43 
48 class KMIME_EXPORT IdentityCodec : public Codec
49 {
50  protected:
51  friend class Codec;
55  IdentityCodec() : Codec() {}
56 
57  public:
61  ~IdentityCodec() {}
62 
63  using Codec::encode;
64  using Codec::decode;
65 
70  QByteArray encode( const QByteArray &src, bool withCRLF=false ) const;
71 
76  QByteArray decode( const QByteArray &src, bool withCRLF=false ) const;
77 
82  int maxEncodedSizeFor( int insize, bool withCRLF ) const
83  {
84  if ( withCRLF ) {
85  return 2 * insize;
86  } else {
87  return insize;
88  }
89  }
90 
95  int maxDecodedSizeFor( int insize, bool withCRLF ) const
96  {
97  if ( withCRLF ) {
98  return 2 * insize;
99  } else {
100  return insize;
101  }
102  }
103 
108  Encoder *makeEncoder( bool withCRLF=false ) const;
109 
114  Decoder *makeDecoder( bool withCRLF=false ) const;
115 };
116 
121 class KMIME_EXPORT SevenBitCodec : public IdentityCodec
122 {
123  protected:
124  friend class Codec;
128  SevenBitCodec() : IdentityCodec() {}
129 
130  public:
134  ~SevenBitCodec() {}
135 
140  const char *name() const
141  { return "7bit"; }
142 };
143 
148 class KMIME_EXPORT EightBitCodec : public IdentityCodec
149 {
150  protected:
151  friend class Codec;
155  EightBitCodec() : IdentityCodec() {}
156 
157  public:
161  ~EightBitCodec() {}
162 
167  const char *name() const
168  { return "8bit"; }
169 };
170 
175 class KMIME_EXPORT BinaryCodec : public IdentityCodec
176 {
177  protected:
178  friend class Codec;
182  BinaryCodec() : IdentityCodec() {}
183 
184  public:
188  ~BinaryCodec() {}
189 
194  const char *name() const
195  { return "binary"; }
196 
201  int maxEncodedSizeFor( int insize, bool withCRLF=false ) const
202  { Q_UNUSED( withCRLF ); return insize; }
203 
208  int maxDecodedSizeFor( int insize, bool withCRLF=false ) const
209  { Q_UNUSED( withCRLF ); return insize; }
210 };
211 
212 } // namespace KMime
213 
214 #endif // __KMIME_CODEC_IDENTITY_H__
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:25:45 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KMIME Library

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

kdepimlibs-4.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal