Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
CompactBinarySerialization.h File Reference
#include "Containers/ContainersFwd.h"
#include "Containers/StringFwd.h"
#include "CoreTypes.h"
#include "IO/IoHash.h"
#include "Memory/MemoryFwd.h"
#include "Memory/MemoryView.h"
#include "Memory/SharedBuffer.h"
#include "Serialization/CompactBinary.h"
#include "Templates/Function.h"
+ Include dependency graph for CompactBinarySerialization.h:

Go to the source code of this file.

Namespaces

namespace  UE
 
namespace  UE::Serialization
 
namespace  UE::Serialization::Private
 

Functions

void UE::Serialization::Private::LogFieldTooLargeForArrayWarning (uint64 FieldLength)
 
uint64 MeasureCompactBinary (FMemoryView View, ECbFieldType Type=ECbFieldType::HasFieldType)
 
bool TryMeasureCompactBinary (FMemoryView InView, ECbFieldType &OutType, uint64 &OutSize, ECbFieldType InType=ECbFieldType::HasFieldType)
 
FCbField LoadCompactBinary (FArchive &Ar, FCbBufferAllocator Allocator=FUniqueBuffer::Alloc)
 
void SaveCompactBinary (FArchive &Ar, const FCbFieldView &Field)
 
void SaveCompactBinary (FArchive &Ar, const FCbArrayView &Array)
 
void SaveCompactBinary (FArchive &Ar, const FCbObjectView &Object)
 
FArchiveoperator<< (FArchive &Ar, FCbField &Field)
 
FArchiveoperator<< (FArchive &Ar, FCbArray &Array)
 
FArchiveoperator<< (FArchive &Ar, FCbObject &Object)
 
bool LoadFromCompactBinary (FCbFieldView Field, FUtf8StringBuilderBase &OutValue)
 
bool LoadFromCompactBinary (FCbFieldView Field, FWideStringBuilderBase &OutValue)
 
bool LoadFromCompactBinary (FCbFieldView Field, FString &OutValue)
 
bool LoadFromCompactBinary (FCbFieldView Field, FName &OutValue)
 
bool LoadFromCompactBinary (FCbFieldView Field, int8 &OutValue, const int8 Default=0)
 
bool LoadFromCompactBinary (FCbFieldView Field, int16 &OutValue, const int16 Default=0)
 
bool LoadFromCompactBinary (FCbFieldView Field, int32 &OutValue, const int32 Default=0)
 
bool LoadFromCompactBinary (FCbFieldView Field, int64 &OutValue, const int64 Default=0)
 
bool LoadFromCompactBinary (FCbFieldView Field, uint8 &OutValue, const uint8 Default=0)
 
bool LoadFromCompactBinary (FCbFieldView Field, uint16 &OutValue, const uint16 Default=0)
 
bool LoadFromCompactBinary (FCbFieldView Field, uint32 &OutValue, const uint32 Default=0)
 
bool LoadFromCompactBinary (FCbFieldView Field, uint64 &OutValue, const uint64 Default=0)
 
bool LoadFromCompactBinary (FCbFieldView Field, float &OutValue, const float Default=0.0f)
 
bool LoadFromCompactBinary (FCbFieldView Field, double &OutValue, const double Default=0.0)
 
bool LoadFromCompactBinary (FCbFieldView Field, bool &OutValue, const bool Default=false)
 
bool LoadFromCompactBinary (FCbFieldView Field, FIoHash &OutValue, const FIoHash &Default=FIoHash())
 
bool LoadFromCompactBinary (FCbFieldView Field, FGuid &OutValue)
 
bool LoadFromCompactBinary (FCbFieldView Field, FGuid &OutValue, const FGuid &Default)
 
bool LoadFromCompactBinary (FCbFieldView Field, FCbObjectId &OutValue, const FCbObjectId &Default=FCbObjectId())
 
template<typename T , typename Allocator >
bool LoadFromCompactBinary (FCbFieldView Field, TArray< T, Allocator > &OutValue)
 
void CompactBinaryToJson (const FCbFieldView &Field, FUtf8StringBuilderBase &Builder)
 
void CompactBinaryToJson (const FCbFieldView &Field, FWideStringBuilderBase &Builder)
 
void CompactBinaryToJson (const FCbArrayView &Array, FUtf8StringBuilderBase &Builder)
 
void CompactBinaryToJson (const FCbArrayView &Array, FWideStringBuilderBase &Builder)
 
void CompactBinaryToJson (const FCbObjectView &Object, FUtf8StringBuilderBase &Builder)
 
void CompactBinaryToJson (const FCbObjectView &Object, FWideStringBuilderBase &Builder)
 
void CompactBinaryToCompactJson (const FCbFieldView &Field, FUtf8StringBuilderBase &Builder)
 
void CompactBinaryToCompactJson (const FCbFieldView &Field, FWideStringBuilderBase &Builder)
 
void CompactBinaryToCompactJson (const FCbArrayView &Array, FUtf8StringBuilderBase &Builder)
 
void CompactBinaryToCompactJson (const FCbArrayView &Array, FWideStringBuilderBase &Builder)
 
void CompactBinaryToCompactJson (const FCbObjectView &Object, FUtf8StringBuilderBase &Builder)
 
void CompactBinaryToCompactJson (const FCbObjectView &Object, FWideStringBuilderBase &Builder)
 

Function Documentation

◆ CompactBinaryToCompactJson() [1/6]

void CompactBinaryToCompactJson ( const FCbArrayView & Array,
FUtf8StringBuilderBase & Builder )

◆ CompactBinaryToCompactJson() [2/6]

void CompactBinaryToCompactJson ( const FCbArrayView & Array,
FWideStringBuilderBase & Builder )

◆ CompactBinaryToCompactJson() [3/6]

void CompactBinaryToCompactJson ( const FCbFieldView & Field,
FUtf8StringBuilderBase & Builder )

Convert the compact binary to JSON in a compact format with no added whitespace.

◆ CompactBinaryToCompactJson() [4/6]

void CompactBinaryToCompactJson ( const FCbFieldView & Field,
FWideStringBuilderBase & Builder )

◆ CompactBinaryToCompactJson() [5/6]

void CompactBinaryToCompactJson ( const FCbObjectView & Object,
FUtf8StringBuilderBase & Builder )

◆ CompactBinaryToCompactJson() [6/6]

void CompactBinaryToCompactJson ( const FCbObjectView & Object,
FWideStringBuilderBase & Builder )

◆ CompactBinaryToJson() [1/6]

void CompactBinaryToJson ( const FCbArrayView & Array,
FUtf8StringBuilderBase & Builder )

◆ CompactBinaryToJson() [2/6]

void CompactBinaryToJson ( const FCbArrayView & Array,
FWideStringBuilderBase & Builder )

◆ CompactBinaryToJson() [3/6]

void CompactBinaryToJson ( const FCbFieldView & Field,
FUtf8StringBuilderBase & Builder )

Convert the compact binary to JSON in a multi-line format with indentation.

◆ CompactBinaryToJson() [4/6]

void CompactBinaryToJson ( const FCbFieldView & Field,
FWideStringBuilderBase & Builder )

◆ CompactBinaryToJson() [5/6]

void CompactBinaryToJson ( const FCbObjectView & Object,
FUtf8StringBuilderBase & Builder )

◆ CompactBinaryToJson() [6/6]

void CompactBinaryToJson ( const FCbObjectView & Object,
FWideStringBuilderBase & Builder )

◆ LoadCompactBinary()

FCbField LoadCompactBinary ( FArchive & Ar,
FCbBufferAllocator Allocator = FUniqueBuffer::Alloc )

Load a compact binary field from an archive.

The field may be an array or an object, which the caller can convert to by using AsArray or AsObject as appropriate. The buffer allocator is called to provide the buffer for the field to load into once its size has been determined.

Parameters
ArArchive to read the field from. An error state is set on failure.
AllocatorAllocator for the buffer that the field is loaded into.
Returns
A field with a reference to the allocated buffer, or a default field on failure.

◆ LoadFromCompactBinary() [1/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
bool & OutValue,
const bool Default = false )
inline

Definition at line 170 of file CompactBinarySerialization.h.

+ Here is the call graph for this function:

◆ LoadFromCompactBinary() [2/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
double & OutValue,
const double Default = 0.0 )
inline

Definition at line 164 of file CompactBinarySerialization.h.

+ Here is the call graph for this function:

◆ LoadFromCompactBinary() [3/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
FCbObjectId & OutValue,
const FCbObjectId & Default = FCbObjectId() )
inline

Definition at line 185 of file CompactBinarySerialization.h.

+ Here is the call graph for this function:

◆ LoadFromCompactBinary() [4/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
FGuid & OutValue )

◆ LoadFromCompactBinary() [5/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
FGuid & OutValue,
const FGuid & Default )

◆ LoadFromCompactBinary() [6/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
FIoHash & OutValue,
const FIoHash & Default = FIoHash() )
inline

Definition at line 176 of file CompactBinarySerialization.h.

+ Here is the call graph for this function:

◆ LoadFromCompactBinary() [7/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
float & OutValue,
const float Default = 0.0f )
inline

Definition at line 158 of file CompactBinarySerialization.h.

+ Here is the call graph for this function:

◆ LoadFromCompactBinary() [8/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
FName & OutValue )

◆ LoadFromCompactBinary() [9/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
FString & OutValue )

◆ LoadFromCompactBinary() [10/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
FUtf8StringBuilderBase & OutValue )

LoadFromCompactBinary attempts to load the output value from compact binary.

Implementations of LoadCompactBinary are expected to assign the output even on failure. Implementations may accept an optional default value to assign in case of load failure.

Returns
true if required fields had the values with the correct type and range, otherwise false.

◆ LoadFromCompactBinary() [11/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
FWideStringBuilderBase & OutValue )

◆ LoadFromCompactBinary() [12/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
int16 & OutValue,
const int16 Default = 0 )
inline

Definition at line 116 of file CompactBinarySerialization.h.

+ Here is the call graph for this function:

◆ LoadFromCompactBinary() [13/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
int32 & OutValue,
const int32 Default = 0 )
inline

Definition at line 122 of file CompactBinarySerialization.h.

+ Here is the call graph for this function:

◆ LoadFromCompactBinary() [14/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
int64 & OutValue,
const int64 Default = 0 )
inline

Definition at line 128 of file CompactBinarySerialization.h.

+ Here is the call graph for this function:

◆ LoadFromCompactBinary() [15/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
int8 & OutValue,
const int8 Default = 0 )
inline

Definition at line 110 of file CompactBinarySerialization.h.

+ Here is the call graph for this function:

◆ LoadFromCompactBinary() [16/20]

template<typename T , typename Allocator >
bool LoadFromCompactBinary ( FCbFieldView Field,
TArray< T, Allocator > & OutValue )
inline

Definition at line 192 of file CompactBinarySerialization.h.

◆ LoadFromCompactBinary() [17/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
uint16 & OutValue,
const uint16 Default = 0 )
inline

Definition at line 140 of file CompactBinarySerialization.h.

+ Here is the call graph for this function:

◆ LoadFromCompactBinary() [18/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
uint32 & OutValue,
const uint32 Default = 0 )
inline

Definition at line 146 of file CompactBinarySerialization.h.

+ Here is the call graph for this function:

◆ LoadFromCompactBinary() [19/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
uint64 & OutValue,
const uint64 Default = 0 )
inline

Definition at line 152 of file CompactBinarySerialization.h.

+ Here is the call graph for this function:

◆ LoadFromCompactBinary() [20/20]

bool LoadFromCompactBinary ( FCbFieldView Field,
uint8 & OutValue,
const uint8 Default = 0 )
inline

Definition at line 134 of file CompactBinarySerialization.h.

+ Here is the call graph for this function:

◆ MeasureCompactBinary()

uint64 MeasureCompactBinary ( FMemoryView View,
ECbFieldType Type = ECbFieldType::HasFieldType )

Determine the size in bytes of the compact binary field at the start of the view.

This may be called on an incomplete or invalid field, in which case the returned size is zero. A size can always be extracted from a valid field with no name if a view of at least the first 10 bytes is provided, regardless of field size. For fields with names, the size of view needed to calculate a size is at most 10 + MaxNameLen + MeasureVarUInt(MaxNameLen).

This function can be used when streaming a field, for example, to determine the size of buffer to fill before attempting to construct a field from it.

Parameters
ViewA memory view that may contain the start of a field.
TypeHasFieldType means that View contains the type. Otherwise, use the given type.

◆ operator<<() [1/3]

FArchive & operator<< ( FArchive & Ar,
FCbArray & Array )

◆ operator<<() [2/3]

FArchive & operator<< ( FArchive & Ar,
FCbField & Field )

Serialize a compact binary value to/from an archive.

◆ operator<<() [3/3]

FArchive & operator<< ( FArchive & Ar,
FCbObject & Object )

◆ SaveCompactBinary() [1/3]

void SaveCompactBinary ( FArchive & Ar,
const FCbArrayView & Array )

◆ SaveCompactBinary() [2/3]

void SaveCompactBinary ( FArchive & Ar,
const FCbFieldView & Field )

Save a compact binary value to an archive.

◆ SaveCompactBinary() [3/3]

void SaveCompactBinary ( FArchive & Ar,
const FCbObjectView & Object )

◆ TryMeasureCompactBinary()

bool TryMeasureCompactBinary ( FMemoryView InView,
ECbFieldType & OutType,
uint64 & OutSize,
ECbFieldType InType = ECbFieldType::HasFieldType )

Try to determine the type and size of the compact binary field at the start of the view.

This may be called on an incomplete or invalid field, in which case it will return false, with OutSize being 0 for invalid fields, otherwise the minimum view size necessary to make progress in measuring the field on the next call to this function.

Note
A return of true from this function does not indicate that the entire field is valid.
Parameters
InViewA memory view that may contain the start of a field.
OutTypeThe type (with flags) of the field. None is written until a value is available.
OutSizeThe total field size for a return of true, 0 for invalid fields, or the size to make progress in measuring the field on the next call to this function.
InTypeHasFieldType means that InView contains the type. Otherwise, use the given type.
Returns
true if the size of the field was determined, otherwise false.