• 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.cpp
Go to the documentation of this file.
1 /* -*- c++ -*-
2  kmime_codec_identity.cpp
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 #include "kmime_codec_identity.h"
36 
37 #include <kdebug.h>
38 #include <kglobal.h>
39 
40 #include <QtCore/QByteArray>
41 
42 #include <cassert>
43 #include <cstring>
44 
45 using namespace KMime;
46 
47 namespace KMime {
48 
49 class IdentityEnDecoder : public Encoder, public Decoder
50 {
51  protected:
52  friend class IdentityCodec;
53  IdentityEnDecoder( bool withCRLF ): Encoder( false )
54  {
55  kWarning( withCRLF ) << "IdentityEnDecoder: withCRLF isn't yet supported!";
56  }
57 
58  public:
59  ~IdentityEnDecoder() {}
60 
61  bool encode( const char* &scursor, const char *const send,
62  char* &dcursor, const char *const dend )
63  { return decode( scursor, send, dcursor, dend ); }
64 
65  bool decode( const char* &scursor, const char *const send,
66  char* &dcursor, const char *const dend );
67 
68  bool finish( char* &dcursor, const char *const dend )
69  { Q_UNUSED( dcursor ); Q_UNUSED( dend ); return true; }
70 };
71 
72 Encoder *IdentityCodec::makeEncoder( bool withCRLF ) const
73 {
74  return new IdentityEnDecoder( withCRLF );
75 }
76 
77 Decoder *IdentityCodec::makeDecoder( bool withCRLF ) const
78 {
79  return new IdentityEnDecoder( withCRLF );
80 }
81 
82 /********************************************************/
83 /********************************************************/
84 /********************************************************/
85 
86 bool IdentityEnDecoder::decode( const char* &scursor, const char *const send,
87  char* &dcursor, const char *const dend )
88 {
89  const int size = qMin( send - scursor, dcursor - dend );
90  if ( size > 0 ) {
91  std::memmove( dcursor, scursor, size );
92  dcursor += size;
93  scursor += size;
94  }
95  return scursor == send;
96 }
97 
98 QByteArray IdentityCodec::encode( const QByteArray &src, bool withCRLF ) const
99 {
100  kWarning( withCRLF ) << "IdentityCodec::encode(): withCRLF not yet supported!";
101  return src;
102 }
103 
104 QByteArray IdentityCodec::decode( const QByteArray &src, bool withCRLF ) const
105 {
106  kWarning( withCRLF ) << "IdentityCodec::decode(): withCRLF not yet supported!";
107  return src;
108 }
109 
110 } // namespace KMime
kmime_codec_identity.h
This file is part of the API for handling MIME data and defines the Identity, seven-bit-text, eight-bit-text, and eight-bit-binary Codec classes.
KMime::IdentityCodec::makeDecoder
Decoder * makeDecoder(bool withCRLF=false) const
Definition: kmime_codec_identity.cpp:77
KMime::Encoder
Stateful encoder class.
Definition: kmime_codecs.h:394
KMime::IdentityCodec
A class representing the Identify codec.
Definition: kmime_codec_identity.h:48
KMime::Decoder
Stateful CTE decoder class.
Definition: kmime_codecs.h:341
KMime::IdentityCodec::encode
QByteArray encode(const QByteArray &src, bool withCRLF=false) const
Definition: kmime_codec_identity.cpp:98
KMime::IdentityCodec::makeEncoder
Encoder * makeEncoder(bool withCRLF=false) const
Definition: kmime_codec_identity.cpp:72
KMime::IdentityCodec::decode
QByteArray decode(const QByteArray &src, bool withCRLF=false) const
Definition: kmime_codec_identity.cpp:104
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