• 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.14
  • kdepimlibs
  • kmime
kmime_codec_qp.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  kmime_codec_qp.h
3 
4  KMime, the KDE Internet mail/usenet news message library.
5  Copyright (c) 2001-2002 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 */
46 #ifndef __KMIME_CODEC_QP__
47 #define __KMIME_CODEC_QP__
48 
49 #include "kmime_codecs.h"
50 
51 namespace KMime {
52 
58 class KMIME_EXPORT QuotedPrintableCodec : public Codec
59 {
60  protected:
61  friend class Codec;
65  QuotedPrintableCodec() : Codec() {}
66 
67  public:
71  virtual ~QuotedPrintableCodec() {}
72 
77  const char *name() const
78  { return "quoted-printable"; }
79 
84  int maxEncodedSizeFor( int insize, bool withCRLF=false ) const
85  { // all chars encoded:
86  int result = 3*insize;
87  // then after 25 hexchars comes a soft linebreak: =(\r)\n
88  result += ( withCRLF ? 3 : 2 ) * ( insize / 25 );
89 
90  return result;
91  }
92 
97  int maxDecodedSizeFor( int insize, bool withCRLF=false ) const;
98 
103  Encoder *makeEncoder( bool withCRLF=false ) const;
104 
109  Decoder *makeDecoder( bool withCRLF=false ) const;
110 };
111 
117 class KMIME_EXPORT Rfc2047QEncodingCodec : public Codec
118 {
119  protected:
120  friend class Codec;
124  Rfc2047QEncodingCodec() : Codec() {}
125 
126  public:
130  virtual ~Rfc2047QEncodingCodec() {}
131 
136  const char *name() const
137  { return "q"; }
138 
143  int maxEncodedSizeFor( int insize, bool withCRLF=false ) const
144  {
145  Q_UNUSED( withCRLF );
146  // this one is simple: We don't do linebreaking, so all that can
147  // happen is that every char needs encoding, so:
148  return 3 * insize;
149  }
150 
155  int maxDecodedSizeFor( int insize, bool withCRLF=false ) const;
156 
161  Encoder *makeEncoder( bool withCRLF=false ) const;
162 
167  Decoder *makeDecoder( bool withCRLF=false ) const;
168 };
169 
174 class KMIME_EXPORT Rfc2231EncodingCodec : public Codec
175 {
176  protected:
177  friend class Codec;
181  Rfc2231EncodingCodec() : Codec() {}
182 
183  public:
187  virtual ~Rfc2231EncodingCodec() {}
188 
193  const char *name() const
194  { return "x-kmime-rfc2231"; }
195 
200  int maxEncodedSizeFor( int insize, bool withCRLF=false ) const
201  {
202  Q_UNUSED( withCRLF );
203  // same as for "q" encoding:
204  return 3 * insize;
205  }
206 
211  int maxDecodedSizeFor( int insize, bool withCRLF=false ) const;
212 
217  Encoder *makeEncoder( bool withCRLF=false ) const;
218 
223  Decoder *makeDecoder( bool withCRLF=false ) const;
224 };
225 
226 } // namespace KMime
227 
228 #endif // __KMIME_CODEC_QP__
kmime_codecs.h
This file is part of the API for handling MIME data and defines the Codec class.
KMime::QuotedPrintableCodec
A class representing the codec for QuotedPrintable as specified in RFC2045 (section 6...
Definition: kmime_codec_qp.h:58
KMime::Rfc2231EncodingCodec::maxEncodedSizeFor
int maxEncodedSizeFor(int insize, bool withCRLF=false) const
Definition: kmime_codec_qp.h:200
KMime::Rfc2231EncodingCodec::name
const char * name() const
Definition: kmime_codec_qp.h:193
KMime::Rfc2047QEncodingCodec::maxEncodedSizeFor
int maxEncodedSizeFor(int insize, bool withCRLF=false) const
Definition: kmime_codec_qp.h:143
KMime::Encoder
Stateful encoder class.
Definition: kmime_codecs.h:394
KMime::Rfc2231EncodingCodec
A class representing the codec for RFC2231.
Definition: kmime_codec_qp.h:174
KMime::Rfc2231EncodingCodec::Rfc2231EncodingCodec
Rfc2231EncodingCodec()
Constructs a RFC2231 codec.
Definition: kmime_codec_qp.h:181
KMime::Codec
An abstract base class of codecs for common mail transfer encodings.
Definition: kmime_codecs.h:83
KMime::Decoder
Stateful CTE decoder class.
Definition: kmime_codecs.h:341
KMime::Rfc2047QEncodingCodec::Rfc2047QEncodingCodec
Rfc2047QEncodingCodec()
Constructs a RFC2047Q codec.
Definition: kmime_codec_qp.h:124
KMime::Rfc2047QEncodingCodec::~Rfc2047QEncodingCodec
virtual ~Rfc2047QEncodingCodec()
Destroys the codec.
Definition: kmime_codec_qp.h:130
KMime::Rfc2231EncodingCodec::~Rfc2231EncodingCodec
virtual ~Rfc2231EncodingCodec()
Destroys the codec.
Definition: kmime_codec_qp.h:187
KMime::QuotedPrintableCodec::maxEncodedSizeFor
int maxEncodedSizeFor(int insize, bool withCRLF=false) const
Definition: kmime_codec_qp.h:84
KMime::QuotedPrintableCodec::name
const char * name() const
Definition: kmime_codec_qp.h:77
KMime::Rfc2047QEncodingCodec
A class representing the codec for the Q encoding as specified in RFC2047Q.
Definition: kmime_codec_qp.h:117
KMime::Rfc2047QEncodingCodec::name
const char * name() const
Definition: kmime_codec_qp.h:136
KMime::QuotedPrintableCodec::QuotedPrintableCodec
QuotedPrintableCodec()
Constructs a QuotedPrintable codec.
Definition: kmime_codec_qp.h:65
KMime::QuotedPrintableCodec::~QuotedPrintableCodec
virtual ~QuotedPrintableCodec()
Destroys the codec.
Definition: kmime_codec_qp.h:71
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:18 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
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

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