KCodecs::Encoder
#include <KCodecs>
Public Member Functions | |
virtual | ~Encoder () |
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 (Codec::NewlineType newline=Codec::NewlineLF) | |
bool | flushOutputBuffer (char *&dcursor, const char *const dend) |
bool | write (char ch, char *&dcursor, const char *const dend) |
bool | writeCRLF (char *&dcursor, const char *const dend) |
Detailed Description
Stateful encoder class.
Stateful encoder class, modeled after QTextEncoder.
- Since
- 5.5
Member Enumeration Documentation
◆ anonymous enum
|
protected |
Constructor & Destructor Documentation
◆ Encoder()
|
explicitprotected |
Protected constructor.
Use KCodecs::Codec::makeEncoder if you want one.
Definition at line 649 of file kcodecs.cpp.
◆ ~Encoder()
|
virtualdefault |
Destroys the encoder.
Member Function Documentation
◆ encode()
|
pure virtual |
Encodes a chunk of data, maintaining state information between calls.
See KCodecs::Codec for calling conventions.
- 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.
◆ finish()
|
pure virtual |
Call this method to finalize the output stream.
Writes all remaining data and resets the encoder. See KCodecs::Codec for calling conventions.
- Parameters
-
dcursor is a pointer to the start of the output buffer. dend is a pointer to the end of the output buffer.
◆ flushOutputBuffer()
|
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.
- Parameters
-
dcursor is a pointer to the start of the output buffer. dend is a pointer to the end of the output buffer.
- Returns
- true if all chars could be written, false otherwise
Definition at line 675 of file kcodecs.cpp.
◆ write()
|
protected |
Writes character ch
to the output stream or the output buffer, depending on whether or not the output stream has space left.
- Parameters
-
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.
- Returns
- true if written to the output stream; else false if buffered.
Definition at line 656 of file kcodecs.cpp.
◆ writeCRLF()
|
protected |
Convenience function.
Outputs LF or CRLF, based on the state of mWithCRLF.
- Parameters
-
dcursor is a pointer to the start of the output buffer. dend is a pointer to the end of the output buffer.
Definition at line 695 of file kcodecs.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:08:36 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.