KCodecs 5.109.0
|
Stateful encoder class. More...
#include <KCodecs>
Public Member Functions | |
virtual | ~Encoder () |
Destroys the encoder. | |
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. | |
virtual bool | finish (char *&dcursor, const char *const dend)=0 |
Call this method to finalize the output stream. | |
Protected Types | |
enum | { maxBufferedChars = 8 } |
The maximum number of characters permitted in the output buffer. More... | |
Protected Member Functions | |
Encoder (Codec::NewlineType newline=Codec::NewlineLF) | |
Protected constructor. | |
bool | flushOutputBuffer (char *&dcursor, const char *const dend) |
Writes characters from the output buffer to the output stream. | |
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 stream has space left. | |
bool | writeCRLF (char *&dcursor, const char *const dend) |
Convenience function. | |
Stateful encoder class.
Stateful encoder class, modeled after QTextEncoder.
|
protected |
|
explicitprotected |
Protected constructor.
Use KCodecs::Codec::makeEncoder if you want one.
|
virtual |
Destroys the encoder.
|
pure virtual |
Encodes a chunk of data, maintaining state information between calls.
See KCodecs::Codec for calling conventions.
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. |
|
pure virtual |
Call this method to finalize the output stream.
Writes all remaining data and resets the encoder. See KCodecs::Codec for calling conventions.
dcursor | is a pointer to the start of the output buffer. |
dend | is a pointer to the end of the output buffer. |
|
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.
dcursor | is a pointer to the start of the output buffer. |
dend | is a pointer to the end of the output buffer. |
|
protected |
Writes character ch
to the output stream or the output buffer, depending on whether or not the output stream has space left.
ch | is the character to write. |
dcursor | is a pointer to the start of the output buffer. |
dend | is a pointer to the end of the output buffer. |