Loading...
Searching...
No Matches
base64Layer Class Reference

An output filter layer to write base-64 encoded content. More...

#include <base64Layer.H>

Inheritance diagram for base64Layer:

Public Member Functions

 base64Layer (std::ostream &os) noexcept
 Attach to an output stream.
 base64Layer (const base64Layer &)=delete
 No copy construct.
void operator= (const base64Layer &)=delete
 No copy assignment.
 ~base64Layer ()
 Destructor. Performs close().
void write (const char *s, std::streamsize n)
 Encode the character sequence, writing when possible.
void reset () noexcept
 Restart a new encoding sequence.
bool close ()
 End the encoding sequence, padding the final characters with '='.

Static Public Member Functions

static constexpr std::size_t encodedLength (std::size_t len) noexcept
 The encoded length has 4 bytes out for every 3 bytes and any trailing bytes are padded with '='.

Protected Member Functions

void add (char c)
 Add a character to the group, outputting when the group is full.

Detailed Description

An output filter layer to write base-64 encoded content.

Base64 encoding according to RFC 4648 specification (https://tools.ietf.org/html/rfc4648#page-5). It is the obligation of the caller to avoid using normal output while the base-64 encoding layer is actively used.

Source files

Definition at line 51 of file base64Layer.H.

Constructor & Destructor Documentation

◆ base64Layer() [1/2]

base64Layer ( std::ostream & os)
explicitnoexcept

Attach to an output stream.

Definition at line 99 of file base64Layer.C.

References Foam::noexcept, and os().

Referenced by base64Layer(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ base64Layer() [2/2]

base64Layer ( const base64Layer & )
delete

No copy construct.

References base64Layer().

Here is the call graph for this function:

◆ ~base64Layer()

Destructor. Performs close().

Definition at line 108 of file base64Layer.C.

References close().

Here is the call graph for this function:

Member Function Documentation

◆ add()

void add ( char c)
protected

Add a character to the group, outputting when the group is full.

Definition at line 91 of file base64Layer.C.

◆ operator=()

void operator= ( const base64Layer & )
delete

No copy assignment.

References base64Layer().

Here is the call graph for this function:

◆ encodedLength()

constexpr std::size_t encodedLength ( std::size_t len)
inlinestaticconstexprnoexcept

The encoded length has 4 bytes out for every 3 bytes and any trailing bytes are padded with '='.

The output length is (4*ceil(len / 3.0))

Definition at line 127 of file base64Layer.H.

◆ write()

void write ( const char * s,
std::streamsize n )

Encode the character sequence, writing when possible.

Definition at line 116 of file base64Layer.C.

References n, and s().

Here is the call graph for this function:

◆ reset()

void reset ( )
noexcept

Restart a new encoding sequence.

Definition at line 125 of file base64Layer.C.

References Foam::noexcept.

◆ close()

bool close ( )

End the encoding sequence, padding the final characters with '='.

Returns
false if no encoding was actually performed.

Definition at line 131 of file base64Layer.C.

Referenced by ~base64Layer().

Here is the caller graph for this function:

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