base64Layer Class Reference

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

Inheritance diagram for base64Layer:
[legend]

Public Member Functions

 base64Layer (std::ostream &os)
 Construct and attach to an output stream. More...
 
 ~base64Layer ()
 Destructor. Performs close() More...
 
void write (const char *s, std::streamsize n)
 Encode the character sequence, writing when possible. More...
 
void reset ()
 Restart a new encoding sequence. More...
 
bool close ()
 End the encoding sequence, padding the final characters with '='. More...
 

Static Public Member Functions

static std::size_t encodedLength (std::size_t n)
 The encoded length has 4 bytes out for every 3 bytes in. More...
 

Protected Member Functions

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

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 55 of file base64Layer.H.

Constructor & Destructor Documentation

◆ base64Layer()

base64Layer ( std::ostream &  os)
explicit

Construct and attach to an output stream.

Definition at line 105 of file base64Layer.C.

◆ ~base64Layer()

Destructor. Performs close()

Definition at line 116 of file base64Layer.C.

Member Function Documentation

◆ add()

void add ( char  c)
protected

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

Definition at line 83 of file base64Layer.C.

References Foam::constant::universal::c.

Referenced by foamVtkBase64Layer::write().

Here is the caller graph for this function:

◆ encodedLength()

std::size_t encodedLength ( std::size_t  n)
static

The encoded length has 4 bytes out for every 3 bytes in.

Definition at line 50 of file base64Layer.C.

References n.

Referenced by foamVtkBase64Layer::encodedLength().

Here is the caller graph for this function:

◆ write()

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

Encode the character sequence, writing when possible.

Definition at line 124 of file base64Layer.C.

References Foam::add(), n, and s.

Here is the call graph for this function:

◆ reset()

void reset ( )

Restart a new encoding sequence.

Definition at line 133 of file base64Layer.C.

◆ close()

bool close ( )

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

Returns
false if no encoding was actually performed.

Definition at line 140 of file base64Layer.C.

Referenced by base64Formatter::flush(), foamVtkBase64Layer::flush(), appendBase64Formatter::~appendBase64Formatter(), base64Formatter::~base64Formatter(), and foamVtkBase64Layer::~foamVtkBase64Layer().

Here is the caller graph for this function:

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