KMIME Library
#include <kmime_codec_identity.h>
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 bool | decode (const char *&scursor, const char *const send, char *&dcursor, const char *const dend, 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 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()
|
inlineprotected |
Constructs the Identity codec.
Definition at line 55 of file kmime_codec_identity.h.
◆ ~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 |
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
-
scursor is a pointer to the start of the input buffer. send is a pointer to the end of the input buffer. dcursor is a pointer to the start of the output buffer. dend is a pointer to the end of the output buffer. withCRLF if true, make the newlines CRLF; else use LF.
- Returns
- false if the decoded data didn't fit into the output buffer; true otherwise.
Definition at line 220 of file kmime_codecs.cpp.
◆ decode() [2/3]
| QByteArray KMime::Codec::decode |
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
-
src is a QByteArray containing the data to decode. withCRLF if true, make the newlines CRLF; else use LF.
Definition at line 246 of file kmime_codecs.cpp.
◆ decode() [3/3]
|
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 |
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
-
scursor is a pointer to the start of the input buffer. send is a pointer to the end of the input buffer. dcursor is a pointer to the start of the output buffer. dend is a pointer to the end of the output buffer. withCRLF if true, make the newlines CRLF; else use LF.
- Returns
- false if the encoded data didn't fit into the output buffer; true otherwise.
Definition at line 182 of file kmime_codecs.cpp.
◆ encode() [2/3]
| QByteArray KMime::Codec::encode |
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
-
src is a QByteArray containing the data to encode. withCRLF if true, make the newlines CRLF; else use LF.
Definition at line 234 of file kmime_codecs.cpp.
◆ encode() [3/3]
|
virtual |
QByteArray Codec::encode()
Reimplemented from KMime::Codec.
Definition at line 98 of file kmime_codec_identity.cpp.
◆ makeDecoder()
|
virtual |
Implements KMime::Codec.
Definition at line 77 of file kmime_codec_identity.cpp.
◆ makeEncoder()
|
virtual |
Implements KMime::Codec.
Definition at line 72 of file kmime_codec_identity.cpp.
◆ maxDecodedSizeFor()
|
inlinevirtual |
Implements KMime::Codec.
Reimplemented in KMime::BinaryCodec.
Definition at line 95 of file kmime_codec_identity.h.
◆ maxEncodedSizeFor()
|
inlinevirtual |
Implements KMime::Codec.
Reimplemented in KMime::BinaryCodec.
Definition at line 82 of file kmime_codec_identity.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Jul 27 2021 06:50:37 by doxygen 1.8.20 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.
Public Member Functions inherited from