![]() |
ImFusion SDK 4.3
|
Functions for encoding and decoding of binary and text data. More...
Functions for encoding and decoding of binary and text data.
Functions | |
std::string | base64Encode (const ByteBufferView &input) |
Encodes any number of input bytes to a regular string using the Base64 encoding scheme. | |
ByteBuffer | base64Decode (std::string_view input) |
Decodes a Base64-encoded string back to the original binary data. | |
template<typename T> | |
std::string | base64Encode (const T *value) |
Convenience overload to directly encode a trivially copyable type to a Base64 encoded string. | |
template<typename T> | |
bool | base64Decode (std::string_view input, T &output) |
Convenience overload to directly decode a Base64 encoded string to a trivially copyable type. | |
std::string base64Encode | ( | const ByteBufferView & | input | ) |
Encodes any number of input bytes to a regular string using the Base64 encoding scheme.
Uses the regular alphabet ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
as specified in RFC 4648.
ByteBuffer base64Decode | ( | std::string_view | input | ) |
Decodes a Base64-encoded string back to the original binary data.
Uses the regular alphabet ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
as specified in RFC 4648. Will return an empty ByteBuffer if the input buffer size is not a multiple of 4. If the input buffer contains invalid characters the result is undefined.
std::string base64Encode | ( | const T * | value | ) |
Convenience overload to directly encode a trivially copyable type to a Base64 encoded string.
value is taken by pointer to clearly distinguish this function from the const ByteBufferView& overload. Will return the empty string if nullptr
.
bool base64Decode | ( | std::string_view | input, |
T & | output ) |
Convenience overload to directly decode a Base64 encoded string to a trivially copyable type.
The return value indicated if decoding was successful; sizeof(output)
has to match the size of the decoded input.