Base module
hex::Encoder
Hex encoder.
Encoder
#include <icy/hex.h>Inherits:
Encoder
Hex encoder.
Public Attributes
| Return | Name | Description |
|---|---|---|
int | _linePos | |
int | _lineLength | |
int | _uppercase |
_linePos
int _linePos_lineLength
int _lineLength_uppercase
int _uppercasePublic Methods
| Return | Name | Description |
|---|---|---|
Encoder inline | ||
ssize_t | encode virtual inline | Encodes binary input as lowercase hex characters, optionally inserting newlines every _lineLength output characters. |
ssize_t | finalize virtual inline | No-op finalizer; hex encoding has no pending state. |
void | setUppercase inline | Controls whether encoded output uses uppercase hex digits (A-F) or lowercase (a-f). |
void | setLineLength inline | Sets the maximum number of output characters per line before a newline is inserted. Set to 0 to disable line wrapping. |
Encoder
inline
inline Encoder()encode
virtual inline
virtual inline ssize_t encode(const char * inbuf, size_t nread, char * outbuf)Encodes binary input as lowercase hex characters, optionally inserting newlines every _lineLength output characters.
Parameters
inbufInput buffer to encode.nreadNumber of bytes to read from inbuf.outbufDestination buffer; must have capacity >= nread * 2 + nread/_lineLength + 1.
Returns
Number of bytes written to outbuf.
finalize
virtual inline
virtual inline ssize_t finalize(char *)No-op finalizer; hex encoding has no pending state.
Returns
Always 0.
setUppercase
inline
inline void setUppercase(bool flag)Controls whether encoded output uses uppercase hex digits (A-F) or lowercase (a-f).
Parameters
flagtrue for uppercase, false for lowercase.
setLineLength
inline
inline void setLineLength(int lineLength)Sets the maximum number of output characters per line before a newline is inserted. Set to 0 to disable line wrapping.
Parameters
lineLengthCharacters per line.
