UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FCbAttachment Class Reference

#include <CompactBinaryPackage.h>

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)
 
UE_INTERNAL FCbAttachment (const FCompressedBuffer &InValue, const FIoHash &Hash)
 
 FCbAttachment (FCompressedBuffer &&InValue)
 
UE_INTERNAL FCbAttachment (FCompressedBuffer &&InValue, const FIoHash &Hash)
 
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
 
CORE_API FIoHash GetHash () const
 
bool operator== (const FCbAttachment &Attachment) const
 
bool operator!= (const FCbAttachment &Attachment) const
 
bool operator< (const FCbAttachment &Attachment) const
 
CORE_API bool TryLoad (FCbFieldIterator &Fields)
 
CORE_API bool TryLoad (FArchive &Ar, FCbBufferAllocator Allocator=FUniqueBuffer::Alloc)
 
CORE_API void Save (FCbWriter &Writer) const
 
CORE_API void Save (FArchive &Ar) const
 

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.

Constructor & Destructor Documentation

◆ FCbAttachment() [1/11]

FCbAttachment::FCbAttachment ( )
default

Construct a null attachment.

◆ FCbAttachment() [2/11]

FCbAttachment::FCbAttachment ( const FCbObject InValue)
inlineexplicit

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

◆ FCbAttachment() [3/11]

FCbAttachment::FCbAttachment ( FCbObject &&  InValue)
inlineexplicit

◆ FCbAttachment() [4/11]

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

◆ FCbAttachment() [5/11]

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

◆ FCbAttachment() [6/11]

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.

◆ FCbAttachment() [7/11]

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

◆ FCbAttachment() [8/11]

FCbAttachment::FCbAttachment ( const FCompressedBuffer InValue)
inlineexplicit

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

◆ FCbAttachment() [9/11]

UE_INTERNAL FCbAttachment::FCbAttachment ( const FCompressedBuffer InValue,
const FIoHash Hash 
)
inlineexplicit

◆ FCbAttachment() [10/11]

FCbAttachment::FCbAttachment ( FCompressedBuffer &&  InValue)
inlineexplicit

◆ FCbAttachment() [11/11]

UE_INTERNAL FCbAttachment::FCbAttachment ( FCompressedBuffer &&  InValue,
const FIoHash Hash 
)
inlineexplicit

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.

◆ AsCompositeBinary()

const FCompositeBuffer & FCbAttachment::AsCompositeBinary ( ) const
inline

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

◆ AsCompressedBinary()

const FCompressedBuffer & FCbAttachment::AsCompressedBinary ( ) const
inline

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

◆ AsObject()

FCbObject FCbAttachment::AsObject ( ) const
inline

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

◆ 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.

◆ IsCompressedBinary()

bool FCbAttachment::IsCompressedBinary ( ) const
inline

Returns whether the attachment is compressed binary.

◆ IsNull()

bool FCbAttachment::IsNull ( ) const
inline

Whether the attachment has a null value.

◆ IsObject()

bool FCbAttachment::IsObject ( ) const
inline

Returns whether the attachment is an object.

◆ operator bool()

FCbAttachment::operator bool ( ) const
inlineexplicit

Whether the attachment has a non-null value.

◆ operator!=()

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

◆ operator<()

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

◆ operator==()

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

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

◆ Reset()

void FCbAttachment::Reset ( )
inline

Reset this to a null attachment.

◆ 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.


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