Coder
class Coder
constructor Coder(CoderEngine &engine)
| Parameter | Description |
|---|---|
engine |
TYPE: |
destructor ~Coder()
method void finish()
Finish the coding process.
Subclasses should call this method in their end() method.
method void process(const std::string &data)
Process the given data.
| Parameter | Description |
|---|---|
data |
The data to process. TYPE: |
method void process(uint8_t datum)
Process the given byte.
| Parameter | Description |
|---|---|
datum |
The byte to process. TYPE: |
class CoderEngine
constructor CoderEngine(CoderOutput &output)
| Parameter | Description |
|---|---|
output |
TYPE: |
destructor ~CoderEngine()
method void end()
method void finish()
Finish the coding process.
method void finish_implementation()
Finish the coding process.
method void process(uint8_t datum)
Process the given byte.
| Parameter | Description |
|---|---|
datum |
The byte to process. TYPE: |
method void process_implementation(uint8_t datum)
Process the given byte.
| Parameter | Description |
|---|---|
datum |
The byte to process. TYPE: |
method void write(uint8_t datum)
| Parameter | Description |
|---|---|
datum |
TYPE: |
member bool error{false}
member bool finished{false}
member output
class CoderOutput
destructor ~CoderOutput()
method void end()
All output has been written.
| Throws | Description |
|---|---|
Exception |
if the output has already been ended. |
std::runtime_error |
if an error occurs while ending the output. |
method void end_implementation()
End the output. This is called by end().
| Throws | Description |
|---|---|
std::runtime_error |
if an error occurs while ending the output. |
method void write(uint8_t datum)
Write the given byte to the output.
| Parameter | Description |
|---|---|
datum |
The byte to write. TYPE: |
| Throws | Description |
|---|---|
Exception |
if the output has already been ended. |
std::runtime_error |
if an error occurs while writing the byte. |
method void write_implementation(uint8_t datum)
Write the given byte to the output. This is called by write().
| Parameter | Description |
|---|---|
datum |
The byte to write. TYPE: |
| Throws | Description |
|---|---|
std::runtime_error |
if an error occurs while writing the byte. |
member bool ended{false}
class StreamCoderOutput
constructor StreamCoderOutput(std::ostream &stream, size_t line_length = 0, size_t indent = 0)
| Parameter | Description |
|---|---|
stream |
TYPE: |
line_length |
TYPE: |
indent |
TYPE: |
method void write_implementation(uint8_t datum)
Write the given byte to the output. This is called by write().
| Parameter | Description |
|---|---|
datum |
The byte to write. TYPE: |
| Throws | Description |
|---|---|
std::runtime_error |
if an error occurs while writing the byte. |
class StringCoderOutput
constructor StringCoderOutput()
method std::string get_string()
Get the string that has been written to the output.
| Returns | Description |
|---|---|
std::string |
The string that has been written to the output. |
| Throws | Description |
|---|---|
Exception |
if the output has not been ended yet. |
method void write_implementation(uint8_t datum)
Write the given byte to the output. This is called by write().
| Parameter | Description |
|---|---|
datum |
The byte to write. TYPE: |
| Throws | Description |
|---|---|
std::runtime_error |
if an error occurs while writing the byte. |