libkmime
KMime::Codec Class Reference
#include <kmime_codecs.h>
Inheritance diagram for KMime::Codec:

Detailed Description
Abstract base class of codecs like base64 and quoted-printable.Codecs for common mail transfer encodings.It's a singleton.
- Author:
- Marc Mutz <mutz@kde.org>
Definition at line 57 of file kmime_codecs.h.
Public Member Functions | |
virtual int | maxEncodedSizeFor (int insize, bool withCRLF=false) const =0 |
virtual int | maxDecodedSizeFor (int insize, bool withCRLF=false) const =0 |
virtual Encoder * | makeEncoder (bool withCRLF=false) const =0 |
virtual Decoder * | makeDecoder (bool withCRLF=false) const =0 |
virtual bool | encode (const char *&scursor, const char *const send, char *&dcursor, const char *const dend, bool withCRLF=false) const |
virtual bool | decode (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 |
virtual QCString | encodeToQCString (const QByteArray &src, bool withCRLF=false) const |
virtual QByteArray | decode (const QByteArray &src, bool withCRLF=false) const |
virtual const char * | name () const =0 |
virtual | ~Codec () |
Static Public Member Functions | |
static Codec * | codecForName (const char *name) |
static Codec * | codecForName (const QCString &name) |
Protected Member Functions | |
Codec () | |
Static Protected Attributes | |
static QAsciiDict< Codec > * | all = 0 |
Member Function Documentation
|
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 Reimplemented in KMime::IdentityCodec. Definition at line 172 of file kmime_codecs.cpp. |
|
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 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 ( KMime::Codec * codec = KMime::Codec::codecForName( "base64" ); kdFatal( !codec ) << "no base64 codec found!?" << endl; 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() ) ) { kdDebug() << "output buffer too small" << endl; return; } kdDebug() << "Size of decoded data: " << oit - out.begin() << endl;
Definition at line 194 of file kmime_codecs.cpp. |
|
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 Reimplemented in KMime::IdentityCodec. Definition at line 128 of file kmime_codecs.cpp. |
|
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 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 ( KMime::Codec * codec = KMime::Codec::codecForName( "base64" ); kdFatal( !codec ) << "no base64 codec found!?" << endl; 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() ) ) { kdDebug() << "output buffer too small" << endl; return; } kdDebug() << "Size of encoded data: " << oit - out.begin() << endl;
Definition at line 101 of file kmime_codecs.cpp. |
|
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 QCString to the actual size again.
For use with small This method only works for codecs whose output is in the 8bit domain (ie. not in the binary domain). Codecs that do not fall into this category will return a null QCString. Reimplemented in KMime::IdentityCodec, and KMime::BinaryCodec. Definition at line 150 of file kmime_codecs.cpp. |
|
Implemented in KMime::Base64Codec, KMime::Rfc2047BEncodingCodec, KMime::SevenBitCodec, KMime::EightBitCodec, KMime::BinaryCodec, KMime::QuotedPrintableCodec, KMime::Rfc2047QEncodingCodec, KMime::Rfc2231EncodingCodec, and KMime::UUCodec. |
The documentation for this class was generated from the following files: