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

KMIME Library

  • sources
  • kde-4.12
  • kdepimlibs
  • 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__
kmime_codecs.h
This file is part of the API for handling MIME data and defines the Codec class.
KMime::EightBitCodec::~EightBitCodec
~EightBitCodec()
Destroys the codec.
Definition: kmime_codec_identity.h:161
KMime::EightBitCodec::name
const char * name() const
Definition: kmime_codec_identity.h:167
KMime::SevenBitCodec
A class representing the codec for seven-bit-text.
Definition: kmime_codec_identity.h:121
KMime::BinaryCodec::~BinaryCodec
~BinaryCodec()
Destroys the codec.
Definition: kmime_codec_identity.h:188
KMime::Encoder
Stateful encoder class.
Definition: kmime_codecs.h:394
KMime::BinaryCodec::maxDecodedSizeFor
int maxDecodedSizeFor(int insize, bool withCRLF=false) const
Definition: kmime_codec_identity.h:208
KMime::BinaryCodec::BinaryCodec
BinaryCodec()
Constructs the 8-bit-binary codec.
Definition: kmime_codec_identity.h:182
KMime::EightBitCodec::EightBitCodec
EightBitCodec()
Constructs the 8-bit codec.
Definition: kmime_codec_identity.h:155
KMime::BinaryCodec::name
const char * name() const
Definition: kmime_codec_identity.h:194
KMime::IdentityCodec
A class representing the Identify codec.
Definition: kmime_codec_identity.h:48
KMime::SevenBitCodec::name
const char * name() const
Definition: kmime_codec_identity.h:140
KMime::Codec
An abstract base class of codecs for common mail transfer encodings.
Definition: kmime_codecs.h:83
KMime::IdentityCodec::maxDecodedSizeFor
int maxDecodedSizeFor(int insize, bool withCRLF) const
Definition: kmime_codec_identity.h:95
KMime::SevenBitCodec::SevenBitCodec
SevenBitCodec()
Constructs the 7-bit codec.
Definition: kmime_codec_identity.h:128
KMime::IdentityCodec::maxEncodedSizeFor
int maxEncodedSizeFor(int insize, bool withCRLF) const
Definition: kmime_codec_identity.h:82
KMime::IdentityCodec::IdentityCodec
IdentityCodec()
Constructs the Identity codec.
Definition: kmime_codec_identity.h:55
KMime::Decoder
Stateful CTE decoder class.
Definition: kmime_codecs.h:341
KMime::Codec::decode
virtual bool decode(const char *&scursor, const char *const send, char *&dcursor, const char *const dend, bool withCRLF=false) const
Convenience wrapper that can be used for small chunks of data when you can provide a large enough buf...
Definition: kmime_codecs.cpp:183
KMime::Codec::encode
virtual bool encode(const char *&scursor, const char *const send, char *&dcursor, const char *const dend, bool withCRLF=false) const
Convenience wrapper that can be used for small chunks of data when you can provide a large enough buf...
Definition: kmime_codecs.cpp:108
KMime::SevenBitCodec::~SevenBitCodec
~SevenBitCodec()
Destroys the codec.
Definition: kmime_codec_identity.h:134
KMime::EightBitCodec
A class representing the codec for eight-bit-text.
Definition: kmime_codec_identity.h:148
KMime::BinaryCodec
A class representing the codec for eight-bit-binary.
Definition: kmime_codec_identity.h:175
KMime::BinaryCodec::maxEncodedSizeFor
int maxEncodedSizeFor(int insize, bool withCRLF=false) const
Definition: kmime_codec_identity.h:201
KMime::IdentityCodec::~IdentityCodec
~IdentityCodec()
Destroys the codec.
Definition: kmime_codec_identity.h:61
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KMIME Library

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

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



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