Skip to content

Coder

class Coder

constructor Coder(CoderEngine &engine)

ParameterDescription
engine

TYPE: CoderEngine &

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.

ParameterDescription
data

The data to process.

TYPE: const std::string &

method void process(uint8_t datum)

Process the given byte.

ParameterDescription
datum

The byte to process.

TYPE: uint8_t

class CoderEngine

constructor CoderEngine(CoderOutput &output)

ParameterDescription
output

TYPE: CoderOutput &

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.

ParameterDescription
datum

The byte to process.

TYPE: uint8_t

method void process_implementation(uint8_t datum)

Process the given byte.

ParameterDescription
datum

The byte to process.

TYPE: uint8_t

method void write(uint8_t datum)

ParameterDescription
datum

TYPE: uint8_t

member bool error{false}

member bool finished{false}

member output

class CoderOutput

destructor ~CoderOutput()

method void end()

All output has been written.

ThrowsDescription
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().

ThrowsDescription
std::runtime_error

if an error occurs while ending the output.

method void write(uint8_t datum)

Write the given byte to the output.

ParameterDescription
datum

The byte to write.

TYPE: uint8_t

ThrowsDescription
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().

ParameterDescription
datum

The byte to write.

TYPE: uint8_t

ThrowsDescription
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)

ParameterDescription
stream

TYPE: std::ostream &

line_length

TYPE: size_tDEFAULT: 0

indent

TYPE: size_tDEFAULT: 0

method void write_implementation(uint8_t datum)

Write the given byte to the output. This is called by write().

ParameterDescription
datum

The byte to write.

TYPE: uint8_t

ThrowsDescription
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.

ReturnsDescription
std::string

The string that has been written to the output.

ThrowsDescription
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().

ParameterDescription
datum

The byte to write.

TYPE: uint8_t

ThrowsDescription
std::runtime_error

if an error occurs while writing the byte.