Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FCbAttachment Class Reference

#include <CompactBinaryPackage.h>

+ Collaboration diagram for FCbAttachment:

Classes

struct  FBinaryValue
 
struct  FObjectValue
 

Public Member Functions

 FCbAttachment ()=default
 
 FCbAttachment (const FCbObject &InValue)
 
 FCbAttachment (FCbObject &&InValue)
 
 FCbAttachment (const FCbObject &InValue, const FIoHash &Hash)
 
 FCbAttachment (FCbObject &&InValue, const FIoHash &Hash)
 
template<typename BufferType , decltype(FBinaryValue(DeclVal< BufferType >().MakeOwned())) * = nullptr>
 FCbAttachment (BufferType &&InValue)
 
template<typename BufferType , decltype(FBinaryValue(DeclVal< BufferType >().MakeOwned())) * = nullptr>
 FCbAttachment (BufferType &&InValue, const FIoHash &InHash)
 
 FCbAttachment (const FCompressedBuffer &InValue)
 
 FCbAttachment (FCompressedBuffer &&InValue)
 
void Reset ()
 
FCbObject AsObject () const
 
FSharedBuffer AsBinary () const
 
const FCompositeBufferAsCompositeBinary () const
 
const FCompressedBufferAsCompressedBinary () const
 
 operator bool () const
 
bool IsNull () const
 
bool IsObject () const
 
bool IsBinary () const
 
bool IsCompressedBinary () const
 
FIoHash GetHash () const
 
bool operator== (const FCbAttachment &Attachment) const
 
bool operator!= (const FCbAttachment &Attachment) const
 
bool operator< (const FCbAttachment &Attachment) const
 
bool TryLoad (FCbFieldIterator &Fields)
 
bool TryLoad (FArchive &Ar, FCbBufferAllocator Allocator=FUniqueBuffer::Alloc)
 
void Save (FCbWriter &Writer) const
 
void Save (FArchive &Ar) const
 

Private Member Functions

template<typename... ArgTypes, decltype(FBinaryValue(DeclVal< ArgTypes >()...)) * = nullptr>
 FCbAttachment (TInPlaceType< FBinaryValue >, ArgTypes &&... Args)
 

Private Attributes

TVariant< TYPE_OF_NULLPTR, FObjectValue, FBinaryValue, FCompressedBufferValue
 

Detailed Description

An attachment is either null, raw binary, compressed binary, or an object.

Attachments are always identified by their raw hash, even when stored compressed.

An attachment is serialized as a sequence of compact binary fields with no name. It is invalid to serialize a null attachment. A raw binary attachment is serialized as an empty Binary field when empty, and otherwise as a BinaryAttachment field containing the raw hash, followed by the raw binary data in a Binary field. A compressed binary attachment is serialized as Binary with a compressed buffer as the value. An object is serialized as an empty Object field when empty, and otherwise as an ObjectAttachment field containing the hash, followed by the object data in an Object field.

Definition at line 37 of file CompactBinaryPackage.h.

Constructor & Destructor Documentation

◆ FCbAttachment() [1/10]

template<typename... ArgTypes, decltype(FBinaryValue(DeclVal< ArgTypes >()...)) * = nullptr>
FCbAttachment::FCbAttachment ( TInPlaceType< FBinaryValue > ,
ArgTypes &&... Args )
inlineprivate

Definition at line 69 of file CompactBinaryPackage.h.

◆ FCbAttachment() [2/10]

FCbAttachment::FCbAttachment ( )
default

Construct a null attachment.

+ Here is the caller graph for this function:

◆ FCbAttachment() [3/10]

FCbAttachment::FCbAttachment ( const FCbObject & InValue)
inlineexplicit

Construct an object attachment. Value is cloned if not owned.

Definition at line 83 of file CompactBinaryPackage.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FCbAttachment() [4/10]

FCbAttachment::FCbAttachment ( FCbObject && InValue)
inlineexplicit

Definition at line 85 of file CompactBinaryPackage.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FCbAttachment() [5/10]

FCbAttachment::FCbAttachment ( const FCbObject & InValue,
const FIoHash & Hash )
inlineexplicit

Definition at line 87 of file CompactBinaryPackage.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FCbAttachment() [6/10]

FCbAttachment::FCbAttachment ( FCbObject && InValue,
const FIoHash & Hash )
inlineexplicit

Definition at line 89 of file CompactBinaryPackage.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FCbAttachment() [7/10]

template<typename BufferType , decltype(FBinaryValue(DeclVal< BufferType >().MakeOwned())) * = nullptr>
FCbAttachment::FCbAttachment ( BufferType && InValue)
inlineexplicit

Construct a raw binary attachment from a shared/composite buffer. Value is cloned if not owned.

Definition at line 94 of file CompactBinaryPackage.h.

◆ FCbAttachment() [8/10]

template<typename BufferType , decltype(FBinaryValue(DeclVal< BufferType >().MakeOwned())) * = nullptr>
FCbAttachment::FCbAttachment ( BufferType && InValue,
const FIoHash & InHash )
inlineexplicit

Definition at line 97 of file CompactBinaryPackage.h.

◆ FCbAttachment() [9/10]

FCbAttachment::FCbAttachment ( const FCompressedBuffer & InValue)
inlineexplicit

Construct a compressed binary attachment. Value is cloned if not owned.

Definition at line 101 of file CompactBinaryPackage.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FCbAttachment() [10/10]

FCbAttachment::FCbAttachment ( FCompressedBuffer && InValue)
inlineexplicit

Construct a compressed binary attachment. Value is cloned if not owned.

Definition at line 111 of file CompactBinaryPackage.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ AsBinary()

FSharedBuffer FCbAttachment::AsBinary ( ) const
inline

Access the attachment as raw binary in a single contiguous buffer. Defaults to a null buffer on error.

Definition at line 426 of file CompactBinaryPackage.h.

◆ AsCompositeBinary()

const FCompositeBuffer & FCbAttachment::AsCompositeBinary ( ) const
inline

Access the attachment as raw binary. Defaults to a null buffer on error.

Definition at line 435 of file CompactBinaryPackage.h.

◆ AsCompressedBinary()

const FCompressedBuffer & FCbAttachment::AsCompressedBinary ( ) const
inline

Access the attachment as compressed binary. Defaults to a null buffer on error.

Definition at line 444 of file CompactBinaryPackage.h.

◆ AsObject()

FCbObject FCbAttachment::AsObject ( ) const
inline

Access the attachment as an object. Defaults to an empty object on error.

Definition at line 417 of file CompactBinaryPackage.h.

◆ GetHash()

FIoHash FCbAttachment::GetHash ( ) const

Returns the hash of the attachment value.

◆ IsBinary()

bool FCbAttachment::IsBinary ( ) const
inline

Returns whether the attachment is raw binary.

Definition at line 145 of file CompactBinaryPackage.h.

◆ IsCompressedBinary()

bool FCbAttachment::IsCompressedBinary ( ) const
inline

Returns whether the attachment is compressed binary.

Definition at line 148 of file CompactBinaryPackage.h.

◆ IsNull()

bool FCbAttachment::IsNull ( ) const
inline

Whether the attachment has a null value.

Definition at line 139 of file CompactBinaryPackage.h.

+ Here is the caller graph for this function:

◆ IsObject()

bool FCbAttachment::IsObject ( ) const
inline

Returns whether the attachment is an object.

Definition at line 142 of file CompactBinaryPackage.h.

◆ operator bool()

FCbAttachment::operator bool ( ) const
inlineexplicit

Whether the attachment has a non-null value.

Definition at line 136 of file CompactBinaryPackage.h.

+ Here is the call graph for this function:

◆ operator!=()

bool FCbAttachment::operator!= ( const FCbAttachment & Attachment) const
inline

Definition at line 155 of file CompactBinaryPackage.h.

◆ operator<()

bool FCbAttachment::operator< ( const FCbAttachment & Attachment) const
inline

Definition at line 156 of file CompactBinaryPackage.h.

◆ operator==()

bool FCbAttachment::operator== ( const FCbAttachment & Attachment) const
inline

Compares attachments by their hash. Any discrepancy in type must be handled externally.

Definition at line 154 of file CompactBinaryPackage.h.

◆ Reset()

void FCbAttachment::Reset ( )
inline

Reset this to a null attachment.

Definition at line 121 of file CompactBinaryPackage.h.

+ Here is the call graph for this function:

◆ Save() [1/2]

void FCbAttachment::Save ( FArchive & Ar) const

Save the attachment into the archive as a stream of compact binary fields.

◆ Save() [2/2]

void FCbAttachment::Save ( FCbWriter & Writer) const

Save the attachment into the writer as a stream of compact binary fields.

◆ TryLoad() [1/2]

bool FCbAttachment::TryLoad ( FArchive & Ar,
FCbBufferAllocator Allocator = FUniqueBuffer::Alloc )

Load the attachment from compact binary as written by Save.

The attachments value will be loaded into an owned buffer.

Parameters
ArArchive to read the attachment from. An error state is set on failure.
AllocatorAllocator for the attachment value buffer.
Note
Allocated buffers will be cloned if they are not owned.

◆ TryLoad() [2/2]

bool FCbAttachment::TryLoad ( FCbFieldIterator & Fields)

Load the attachment from compact binary as written by Save.

The attachment references the input iterator if it is owned, and otherwise clones the value.

The iterator is advanced as attachment fields are consumed from it.

Member Data Documentation

◆ Value

Definition at line 185 of file CompactBinaryPackage.h.


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