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

KMIME Library

  • KMime
  • IdentityCodec
Public Member Functions | Protected Member Functions | List of all members
KMime::IdentityCodec Class Reference

#include <kmime_codec_identity.h>

Inheritance diagram for KMime::IdentityCodec:
KMime::Codec KMime::BinaryCodec KMime::EightBitCodec KMime::SevenBitCodec

Public Member Functions

 ~IdentityCodec ()
 
virtual bool decode (const char *&scursor, const char *const send, char *&dcursor, const char *const dend, bool withCRLF=false) const
 
virtual QByteArray decode (const QByteArray &src, bool withCRLF=false) const
 
QByteArray decode (const QByteArray &src, bool withCRLF=false) const
 
virtual bool encode (const char *&scursor, const char *const send, char *&dcursor, const char *const dend, bool withCRLF=false) const
 
virtual QByteArray encode (const QByteArray &src, bool withCRLF=false) const
 
QByteArray encode (const QByteArray &src, bool withCRLF=false) const
 
Decoder * makeDecoder (bool withCRLF=false) const
 
Encoder * makeEncoder (bool withCRLF=false) const
 
int maxDecodedSizeFor (int insize, bool withCRLF) const
 
int maxEncodedSizeFor (int insize, bool withCRLF) const
 
- Public Member Functions inherited from KMime::Codec
virtual ~Codec ()
 
virtual const char * name () const =0
 

Protected Member Functions

 IdentityCodec ()
 
- Protected Member Functions inherited from KMime::Codec
 Codec ()
 

Additional Inherited Members

- Static Public Member Functions inherited from KMime::Codec
static Codec * codecForName (const char *name)
 
static Codec * codecForName (const QByteArray &name)
 

Detailed Description

A class representing the Identify codec.

Definition at line 48 of file kmime_codec_identity.h.

Constructor & Destructor Documentation

◆ IdentityCodec()

KMime::IdentityCodec::IdentityCodec ( )
inlineprotected

Constructs the Identity codec.

Definition at line 55 of file kmime_codec_identity.h.

◆ ~IdentityCodec()

KMime::IdentityCodec::~IdentityCodec ( )
inline

Destroys the codec.

Definition at line 61 of file kmime_codec_identity.h.

Member Function Documentation

◆ decode() [1/3]

bool KMime::Codec::decode ( const char *& scursor,
const char *const send,
char *& dcursor,
const char *const dend,
bool withCRLF = false ) const
virtual

Convenience wrapper that can be used for small chunks of data when you can provide a large enough buffer.

The default implementation creates a Decoder and uses it.

Decodes a chunk of bytes starting at scursor and extending to send into the buffer described by dcursor and dend.

This function doesn't support chaining of blocks. The returned block cannot be added to, but you don't need to finalize it, too.

Example usage (in contains the input data):

KMime::Codec *codec = KMime::Codec::codecForName( "base64" );
kFatal( !codec ) << "no base64 codec found!?";
QByteArray out( in.size() ); // good guess for any encoding...
QByteArray::Iterator iit = in.begin();
QByteArray::Iterator oit = out.begin();
if ( !codec->decode( iit, in.end(), oit, out.end() ) ) {
  kDebug() << "output buffer too small";
  return;
}
kDebug() << "Size of decoded data:" << oit - out.begin();
Parameters
scursoris a pointer to the start of the input buffer.
sendis a pointer to the end of the input buffer.
dcursoris a pointer to the start of the output buffer.
dendis a pointer to the end of the output buffer.
withCRLFif true, make the newlines CRLF; else use LF.
Returns
false if the decoded data didn't fit into the output buffer; true otherwise.

Reimplemented from KMime::Codec.

Definition at line 220 of file kmime_codecs.cpp.

◆ decode() [2/3]

QByteArray KMime::Codec::decode ( const QByteArray & src,
bool withCRLF = false ) const
virtual

Even more convenient, but also a bit slower and more memory intensive, since it allocates storage for the worst case and then shrinks the result QByteArray to the actual size again.

For use with small src.

Parameters
srcis a QByteArray containing the data to decode.
withCRLFif true, make the newlines CRLF; else use LF.

Reimplemented from KMime::Codec.

Definition at line 246 of file kmime_codecs.cpp.

◆ decode() [3/3]

QByteArray KMime::IdentityCodec::decode ( const QByteArray & src,
bool withCRLF = false ) const
virtual

QByteArray Codec::decode()

Reimplemented from KMime::Codec.

Definition at line 104 of file kmime_codec_identity.cpp.

◆ encode() [1/3]

bool KMime::Codec::encode ( const char *& scursor,
const char *const send,
char *& dcursor,
const char *const dend,
bool withCRLF = false ) const
virtual

Convenience wrapper that can be used for small chunks of data when you can provide a large enough buffer.

The default implementation creates an Encoder and uses it.

Encodes a chunk of bytes starting at scursor and extending to send into the buffer described by dcursor and dend.

This function doesn't support chaining of blocks. The returned block cannot be added to, but you don't need to finalize it, too.

Example usage (in contains the input data):

KMime::Codec *codec = KMime::Codec::codecForName( "base64" );
kFatal( !codec ) << "no base64 codec found!?";
QByteArray out( in.size()*1.4 ); // crude maximal size of b64 encoding
QByteArray::Iterator iit = in.begin();
QByteArray::Iterator oit = out.begin();
if ( !codec->encode( iit, in.end(), oit, out.end() ) ) {
  kDebug() << "output buffer too small";
  return;
}
kDebug() << "Size of encoded data:" << oit - out.begin();
Parameters
scursoris a pointer to the start of the input buffer.
sendis a pointer to the end of the input buffer.
dcursoris a pointer to the start of the output buffer.
dendis a pointer to the end of the output buffer.
withCRLFif true, make the newlines CRLF; else use LF.
Returns
false if the encoded data didn't fit into the output buffer; true otherwise.

Reimplemented from KMime::Codec.

Definition at line 182 of file kmime_codecs.cpp.

◆ encode() [2/3]

QByteArray KMime::Codec::encode ( const QByteArray & src,
bool withCRLF = false ) const
virtual

Even more convenient, but also a bit slower and more memory intensive, since it allocates storage for the worst case and then shrinks the result QByteArray to the actual size again.

For use with small src.

Parameters
srcis a QByteArray containing the data to encode.
withCRLFif true, make the newlines CRLF; else use LF.

Reimplemented from KMime::Codec.

Definition at line 234 of file kmime_codecs.cpp.

◆ encode() [3/3]

QByteArray KMime::IdentityCodec::encode ( const QByteArray & src,
bool withCRLF = false ) const
virtual

QByteArray Codec::encode()

Reimplemented from KMime::Codec.

Definition at line 98 of file kmime_codec_identity.cpp.

◆ makeDecoder()

Decoder * KMime::IdentityCodec::makeDecoder ( bool withCRLF = false) const
virtual

Codec::makeDecoder()

Implements KMime::Codec.

Definition at line 77 of file kmime_codec_identity.cpp.

◆ makeEncoder()

Encoder * KMime::IdentityCodec::makeEncoder ( bool withCRLF = false) const
virtual

Codec::makeEncoder()

Implements KMime::Codec.

Definition at line 72 of file kmime_codec_identity.cpp.

◆ maxDecodedSizeFor()

int KMime::IdentityCodec::maxDecodedSizeFor ( int insize,
bool withCRLF ) const
inlinevirtual

Codec::maxDecodedSizeFor()

Implements KMime::Codec.

Definition at line 95 of file kmime_codec_identity.h.

◆ maxEncodedSizeFor()

int KMime::IdentityCodec::maxEncodedSizeFor ( int insize,
bool withCRLF ) const
inlinevirtual

Codec::maxEncodedSizeFor()

Implements KMime::Codec.

Definition at line 82 of file kmime_codec_identity.h.


The documentation for this class was generated from the following files:
  • kmime_codec_identity.h
  • kmime_codec_identity.cpp
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