Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FBase64 Struct Reference

#include <Base64.h>

Static Public Member Functions

static FString Encode (const FString &Source, EBase64Mode Mode=EBase64Mode::Standard)
 
static FString Encode (const TArray< uint8 > &Source, EBase64Mode Mode=EBase64Mode::Standard)
 
static FString Encode (const uint8 *Source, uint32 Length, EBase64Mode Mode=EBase64Mode::Standard)
 
template<typename CharType >
static uint32 Encode (const uint8 *Source, uint32 Length, CharType *Dest, EBase64Mode Mode=EBase64Mode::Standard)
 
static constexpr uint32 GetEncodedDataSize (uint32 NumBytes)
 
static bool Decode (const FString &Source, FString &OutDest, EBase64Mode Mode=EBase64Mode::Standard)
 
static bool Decode (const FString &Source, TArray< uint8 > &Dest, EBase64Mode Mode=EBase64Mode::Standard)
 
template<typename CharType >
static bool Decode (const CharType *Source, uint32 Length, uint8 *Dest, EBase64Mode Mode=EBase64Mode::Standard)
 
static uint32 GetDecodedDataSize (const FString &Source)
 
template<typename CharType >
static uint32 GetDecodedDataSize (const CharType *Source, uint32 Length)
 
static constexpr uint32 GetMaxDecodedDataSize (uint32 NumChars)
 

Detailed Description

Class for encoding/decoding Base64 data (RFC 4648)

Definition at line 22 of file Base64.h.

Member Function Documentation

◆ Decode() [1/3]

template<typename CharType >
static bool FBase64::Decode ( const CharType * Source,
uint32 Length,
uint8 * Dest,
EBase64Mode Mode = EBase64Mode::Standard )
static

Decodes a Base64 string into a preallocated buffer

Parameters
SourceThe Base64 encoded string
LengthLength of the Base64 encoded string
DestBuffer to receive the decoded data
ModeThe mode to use for decoding. Default is EBase64Mode::Standard
Returns
true if the buffer was decoded, false if it was invalid.

◆ Decode() [2/3]

static bool FBase64::Decode ( const FString & Source,
FString & OutDest,
EBase64Mode Mode = EBase64Mode::Standard )
static

Decodes a Base64 string into a FString

Parameters
SourceThe Base64 encoded string
OutDestReceives the decoded string data
ModeThe mode to use for decoding. Default is EBase64Mode::Standard
Returns
true if the buffer was decoded, false if it was invalid.

◆ Decode() [3/3]

static bool FBase64::Decode ( const FString & Source,
TArray< uint8 > & Dest,
EBase64Mode Mode = EBase64Mode::Standard )
static

Decodes a Base64 string into an array of bytes

Parameters
SourceThe Base64 encoded string
DestArray to receive the decoded data
ModeThe mode to use for decoding. Default is EBase64Mode::Standard
Returns
true if the buffer was decoded, false if it was invalid.

◆ Encode() [1/4]

static FString FBase64::Encode ( const FString & Source,
EBase64Mode Mode = EBase64Mode::Standard )
static

Encodes a FString into a Base64 string

Parameters
SourceThe string data to convert
ModeThe mode to use for encoding. Default is EBase64Mode::Standard
Returns
A string that encodes the binary data in a way that can be safely transmitted via various Internet protocols

◆ Encode() [2/4]

static FString FBase64::Encode ( const TArray< uint8 > & Source,
EBase64Mode Mode = EBase64Mode::Standard )
static

Encodes a binary uint8 array into a Base64 string

Parameters
SourceThe binary data to convert
ModeThe mode to use for encoding. Default is EBase64Mode::Standard
Returns
A string that encodes the binary data in a way that can be safely transmitted via various Internet protocols

◆ Encode() [3/4]

template<typename CharType >
static uint32 FBase64::Encode ( const uint8 * Source,
uint32 Length,
CharType * Dest,
EBase64Mode Mode = EBase64Mode::Standard )
static

Encodes the source into a Base64 string, storing it in a preallocated buffer.

Parameters
SourceThe binary data to encode
LengthLength of the binary data to be encoded
DestBuffer to receive the encoded data. Must be large enough to contain the entire output data (see GetEncodedDataSize()).
ModeThe mode to use for encoding. Default is EBase64Mode::Standard
Returns
The length of the encoded data

◆ Encode() [4/4]

static FString FBase64::Encode ( const uint8 * Source,
uint32 Length,
EBase64Mode Mode = EBase64Mode::Standard )
static

Encodes the source into a Base64 string

Parameters
SourceThe binary data to encode
LengthLength of the binary data to be encoded
ModeThe mode to use for encoding. Default is EBase64Mode::Standard
Returns
Base64 encoded string containing the binary data.

◆ GetDecodedDataSize() [1/2]

template<typename CharType >
static uint32 FBase64::GetDecodedDataSize ( const CharType * Source,
uint32 Length )
static

Determine the decoded data size for the incoming base64 encoded string

Parameters
SourceThe Base64 encoded string
LengthLength of the Base64 encoded string
Returns
The size in bytes of the decoded data

◆ GetDecodedDataSize() [2/2]

static uint32 FBase64::GetDecodedDataSize ( const FString & Source)
static

Determine the decoded data size for the incoming base64 encoded string

Parameters
SourceThe Base64 encoded string
Returns
The size in bytes of the decoded data

◆ GetEncodedDataSize()

static constexpr uint32 FBase64::GetEncodedDataSize ( uint32 NumBytes)
inlinestaticconstexpr

Get the encoded data size for the given number of bytes.

Parameters
NumBytesThe number of bytes of input
Returns
The number of characters in the encoded data.

Definition at line 74 of file Base64.h.

◆ GetMaxDecodedDataSize()

static constexpr uint32 FBase64::GetMaxDecodedDataSize ( uint32 NumChars)
inlinestaticconstexpr

Get the maximum decoded data size for the given number of input characters.

Parameters
LengthThe number of input characters.
Returns
The maximum number of bytes that can be decoded from this input stream. The actual number of characters decoded may be less if the data contains padding characters. Call GetDecodedDataSize() with the input data to find the exact length.

Definition at line 139 of file Base64.h.


The documentation for this struct was generated from the following file: