ImFusion SDK 4.3
ImFusion::Encoding Namespace Reference

Functions for encoding and decoding of binary and text data. More...

Detailed Description

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.
 

Function Documentation

◆ base64Encode() [1/2]

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.

See also

◆ base64Decode() [1/2]

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.

See also

◆ base64Encode() [2/2]

template<typename T>
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.

See also
base64Encode(const ByteBufferView&), base64Decode()

◆ base64Decode() [2/2]

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.

The return value indicated if decoding was successful; sizeof(output) has to match the size of the decoded input.

See also
base64Decode(std::string_view), base64Encode()
Search Tab / S to search, Esc to close