KMIME Library
Go to the documentation of this file.
60 #ifndef __KMIME_CODECS__
61 #define __KMIME_CODECS__
63 #include <QtCore/QByteArray>
67 #include "kmime_export.h"
71 template <
class Key,
class T>
class KAutoDeleteHash;
88 static void cleanupCodec();
101 static Codec *codecForName(
const char *name );
108 static Codec *codecForName(
const QByteArray &name );
118 virtual int maxEncodedSizeFor(
int insize,
bool withCRLF=
false )
const = 0;
128 virtual int maxDecodedSizeFor(
int insize,
bool withCRLF=
false )
const = 0;
137 virtual Encoder *makeEncoder(
bool withCRLF=
false )
const = 0;
146 virtual Decoder *makeDecoder(
bool withCRLF=
false )
const = 0;
182 virtual bool encode(
const char* &scursor,
const char *
const send,
183 char* &dcursor,
const char *
const dend,
184 bool withCRLF=
false )
const;
220 virtual bool decode(
const char* &scursor,
const char *
const send,
221 char* &dcursor,
const char *
const dend,
222 bool withCRLF=
false )
const;
234 virtual QByteArray encode(
const QByteArray &src,
bool withCRLF=
false )
const;
246 virtual QByteArray decode(
const QByteArray &src,
bool withCRLF=
false )
const;
251 virtual const char *name()
const = 0;
262 static void fillDictionary();
352 : mWithCRLF( withCRLF ) {}
369 virtual bool decode(
const char* &scursor,
const char *
const send,
370 char* &dcursor,
const char *
const dend ) = 0;
380 virtual bool finish(
char* &dcursor,
const char *
const dend ) = 0;
384 const bool mWithCRLF;
404 : mOutputBufferCursor( 0 ), mWithCRLF( withCRLF ) {}
421 virtual bool encode(
const char* &scursor,
const char *
const send,
422 char* &dcursor,
const char *
const dend ) = 0;
431 virtual bool finish(
char* &dcursor,
const char *
const dend ) = 0;
451 bool write(
char ch,
char* &dcursor,
const char *
const dend )
453 if ( dcursor != dend ) {
460 <<
"KMime::Encoder: internal buffer overflow!";
461 mOutputBuffer[ mOutputBufferCursor++ ] = ch;
485 bool writeCRLF(
char* &dcursor,
const char *
const dend )
488 write(
'\r', dcursor, dend );
490 return write(
'\n', dcursor, dend );
504 uchar mOutputBufferCursor;
505 const bool mWithCRLF;
511 #endif // __KMIME_CODECS__
The KAutoDeleteHash class is a convenience QHash subclass that provides automatic deletion of the val...
virtual bool decode(const char *&scursor, const char *const send, char *&dcursor, const char *const dend)=0
Decodes a chunk of data, maintaining state information between calls.
An abstract base class of codecs for common mail transfer encodings.
bool write(char ch, char *&dcursor, const char *const dend)
Writes character ch to the output stream or the output buffer, depending on whether or not the output...
virtual ~Codec()
Destroys the codec.
virtual ~Decoder()
Destroys the decoder.
virtual bool finish(char *&dcursor, const char *const dend)=0
Call this method to finalize the output stream.
Stateful CTE decoder class.
virtual bool encode(const char *&scursor, const char *const send, char *&dcursor, const char *const dend)=0
Encodes a chunk of data, maintaining state information between calls.
Decoder(bool withCRLF=false)
Protected constructor.
virtual ~Encoder()
Destroys the encoder.
bool flushOutputBuffer(char *&dcursor, const char *const dend)
Writes characters from the output buffer to the output stream.
virtual bool finish(char *&dcursor, const char *const dend)=0
Call this method to finalize the output stream.
bool writeCRLF(char *&dcursor, const char *const dend)
Convenience function.
Encoder(bool withCRLF=false)
Protected constructor.
Codec()
Contructs the codec.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jan 29 2020 00:00:00 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.