• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 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
40class QByteArray;
41
42namespace KMime {
43
48class 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
121class 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
148class 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
175class 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::BinaryCodec
A class representing the codec for eight-bit-binary.
Definition: kmime_codec_identity.h:176
KMime::BinaryCodec::~BinaryCodec
~BinaryCodec()
Destroys the codec.
Definition: kmime_codec_identity.h:188
KMime::BinaryCodec::BinaryCodec
BinaryCodec()
Constructs the 8-bit-binary codec.
Definition: kmime_codec_identity.h:182
KMime::BinaryCodec::name
const char * name() const
Definition: kmime_codec_identity.h:194
KMime::BinaryCodec::maxEncodedSizeFor
int maxEncodedSizeFor(int insize, bool withCRLF=false) const
Definition: kmime_codec_identity.h:201
KMime::BinaryCodec::maxDecodedSizeFor
int maxDecodedSizeFor(int insize, bool withCRLF=false) const
Definition: kmime_codec_identity.h:208
KMime::Codec
An abstract base class of codecs for common mail transfer encodings.
Definition: kmime_codecs.h:84
KMime::Decoder
Stateful CTE decoder class.
Definition: kmime_codecs.h:342
KMime::EightBitCodec
A class representing the codec for eight-bit-text.
Definition: kmime_codec_identity.h:149
KMime::EightBitCodec::EightBitCodec
EightBitCodec()
Constructs the 8-bit codec.
Definition: kmime_codec_identity.h:155
KMime::EightBitCodec::name
const char * name() const
Definition: kmime_codec_identity.h:167
KMime::EightBitCodec::~EightBitCodec
~EightBitCodec()
Destroys the codec.
Definition: kmime_codec_identity.h:161
KMime::Encoder
Stateful encoder class.
Definition: kmime_codecs.h:395
KMime::IdentityCodec
A class representing the Identify codec.
Definition: kmime_codec_identity.h:49
KMime::IdentityCodec::~IdentityCodec
~IdentityCodec()
Destroys the codec.
Definition: kmime_codec_identity.h:61
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::IdentityCodec::maxDecodedSizeFor
int maxDecodedSizeFor(int insize, bool withCRLF) const
Definition: kmime_codec_identity.h:95
KMime::SevenBitCodec
A class representing the codec for seven-bit-text.
Definition: kmime_codec_identity.h:122
KMime::SevenBitCodec::~SevenBitCodec
~SevenBitCodec()
Destroys the codec.
Definition: kmime_codec_identity.h:134
KMime::SevenBitCodec::name
const char * name() const
Definition: kmime_codec_identity.h:140
KMime::SevenBitCodec::SevenBitCodec
SevenBitCodec()
Constructs the 7-bit codec.
Definition: kmime_codec_identity.h:128
kmime_codecs.h
This file is part of the API for handling MIME data and defines the Codec class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 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-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 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