libfly  6.2.2
C++20 utility library for Linux, macOS, and Windows
fly::coders::Encoder Class Referenceabstract

#include <coder.hpp>

Inheritance diagram for fly::coders::Encoder:

Public Member Functions

virtual ~Encoder ()=default
 
virtual bool encode_string (const std::string &decoded, std::string &encoded)
 
virtual bool encode_file (const std::filesystem::path &decoded, const std::filesystem::path &encoded)
 

Protected Member Functions

virtual bool encode_internal (std::istream &decoded, std::ostream &encoded)=0
 

Detailed Description

Virtual interface to encode a string or file with a plaintext encoder. Coders for specific algorithms should inherit from this class to perform encoding.

Author
Timothy Flynn (trfly.nosp@m.nn89.nosp@m.@pm.m.nosp@m.e)
Version
July 7, 2019

Constructor & Destructor Documentation

◆ ~Encoder()

virtual fly::coders::Encoder::~Encoder ( )
virtualdefault

Destructor.

Member Function Documentation

◆ encode_file()

bool fly::coders::Encoder::encode_file ( const std::filesystem::path &  decoded,
const std::filesystem::path &  encoded 
)
virtual

Encode a file.

Parameters
decodedPath holding the contents to encode.
encodedPath to store the encoded contents.
Returns
True if the input file was successfully encoded.

◆ encode_internal()

virtual bool fly::coders::Encoder::encode_internal ( std::istream &  decoded,
std::ostream &  encoded 
)
protectedpure virtual

Encode a stream.

Parameters
decodedStream holding the contents to encode.
encodedStream to store the encoded contents.
Returns
True if the input stream was successfully encoded.

Implemented in fly::coders::Base64Coder, and fly::coders::BinaryEncoder.

◆ encode_string()

bool fly::coders::Encoder::encode_string ( const std::string &  decoded,
std::string &  encoded 
)
virtual

Encode a string.

Parameters
decodedString holding the contents to encode.
encodedString to store the encoded contents.
Returns
True if the input string was successfully encoded.

The documentation for this class was generated from the following files: