• 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.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
45using namespace KMime;
46
47namespace KMime {
48
49class 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
72Encoder *IdentityCodec::makeEncoder( bool withCRLF ) const
73{
74 return new IdentityEnDecoder( withCRLF );
75}
76
77Decoder *IdentityCodec::makeDecoder( bool withCRLF ) const
78{
79 return new IdentityEnDecoder( withCRLF );
80}
81
82/********************************************************/
83/********************************************************/
84/********************************************************/
85
86bool 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
98QByteArray IdentityCodec::encode( const QByteArray &src, bool withCRLF ) const
99{
100 kWarning( withCRLF ) << "IdentityCodec::encode(): withCRLF not yet supported!";
101 return src;
102}
103
104QByteArray 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::Decoder
Stateful CTE decoder class.
Definition kmime_codecs.h:342
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::decode
QByteArray decode(const QByteArray &src, bool withCRLF=false) const
Definition kmime_codec_identity.cpp:104
KMime::IdentityCodec::makeEncoder
Encoder * makeEncoder(bool withCRLF=false) const
Definition kmime_codec_identity.cpp:72
KMime::IdentityCodec::makeDecoder
Decoder * makeDecoder(bool withCRLF=false) const
Definition kmime_codec_identity.cpp:77
KMime::IdentityCodec::encode
QByteArray encode(const QByteArray &src, bool withCRLF=false) const
Definition kmime_codec_identity.cpp:98
kmime_codec_identity.h
This file is part of the API for handling MIME data and defines the Identity, seven-bit-text,...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 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