libkdenetwork Library API Documentation

KMime::Encoder Class Reference

Stateful encoder class, modelled after QTextEncoder::Stateful encoder class. More...

#include <kmime_codecs.h>

List of all members.

Public Member Functions

virtual bool encode (const char *&scursor, const char *const send, char *&dcursor, const char *const dend)=0
virtual bool finish (char *&dcursor, const char *const dend)=0

Protected Types

enum  { maxBufferedChars = 8 }

Protected Member Functions

 Encoder (bool withCRLF=false)
bool write (char ch, char *&dcursor, const char *const dend)
bool flushOutputBuffer (char *&dcursor, const char *const dend)
bool writeCRLF (char *&dcursor, const char *const dend)

Protected Attributes

uchar mOutputBufferCursor
const bool mWithCRLF

Friends

class Codec


Detailed Description

Stateful encoder class, modelled after QTextEncoder::Stateful encoder class.

Author:
Marc Mutz <mutz@kde.org>

Definition at line 299 of file kmime_codecs.h.


Member Enumeration Documentation

anonymous enum [protected]
 

Space in the output buffer.

Definition at line 322 of file kmime_codecs.h.


Constructor & Destructor Documentation

KMime::Encoder::Encoder bool  withCRLF = false  )  [inline, protected]
 

Protected constructor.

Use KMime::Codec::makeEncoder if you want one. The bool parameter determines whether lines end with CRLF (true) or LF (false, default).

Definition at line 305 of file kmime_codecs.h.


Member Function Documentation

virtual bool KMime::Encoder::encode const char *&  scursor,
const char *const   send,
char *&  dcursor,
const char *const   dend
[pure virtual]
 

Encode a chunk of data, maintaining state information between calls.

See KMime::Codec for calling conventions.

Referenced by KMime::Codec::encode().

virtual bool KMime::Encoder::finish char *&  dcursor,
const char *const   dend
[pure virtual]
 

Call this method to finalize the output stream.

Writes all remaining data and resets the encoder. See KMime::Codec for calling conventions.

Referenced by KMime::Codec::encode().

bool KMime::Encoder::write char  ch,
char *&  dcursor,
const char *const   dend
[inline, protected]
 

Writes ch to the output stream or the output buffer, depending on whether or not the output stream has space left.

Returns:
true if written to the output stream, false if buffered.

Definition at line 327 of file kmime_codecs.h.

Referenced by writeCRLF().

bool KMime::Encoder::flushOutputBuffer char *&  dcursor,
const char *const   dend
[protected]
 

Writes characters from the output buffer to the output stream.

Implementations of encode and finish should call this at the very beginning and for each iteration of the while loop.

Returns:
true if all chars could be written, false otherwise

Definition at line 216 of file kmime_codecs.cpp.

bool KMime::Encoder::writeCRLF char *&  dcursor,
const char *const   dend
[inline, protected]
 

Convenience function.

Outputs LF or CRLF, based on the state of mWithCRLF

Definition at line 349 of file kmime_codecs.h.

References write().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for libkdenetwork Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 4 14:39:20 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003