libdonut  2.3.2
Application framework for cross-platform game development in C++20
Functions
donut::base64 Namespace Reference

Functions

std::string encode (std::string_view data)
 Encode arbitrary data into a Base64 string. More...
 
std::string decode (std::string_view string)
 Decode the original data from a Base64 string. More...
 

Function Documentation

◆ encode()

std::string donut::base64::encode ( std::string_view  data)

Encode arbitrary data into a Base64 string.

Parameters
datainput data to encode.
Returns
a Base64 string containing the encoded representation of the input.
Exceptions
std::length_errorif the length of the encoded string exceeds the maximum supported string size.
std::bad_allocon allocation failure.

◆ decode()

std::string donut::base64::decode ( std::string_view  string)

Decode the original data from a Base64 string.

Parameters
stringBase64 string to decode.
Returns
a byte sequence containing the data decoded from the Base64 string.
Exceptions
std::invalid_argumentif the length of the Base64 string is not divisible by 4.
std::length_errorif the length of the decoded byte sequence exceeds the maximum supported string size.
std::bad_allocon allocation failure.