FCbAttachment

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

Choose your operating system:

Windows

macOS

Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Serialization/CompactBinaryPackage.h

Include

#include "Serialization/CompactBinaryPackage.h"

Syntax

class FCbAttachment

Remarks

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.

Constructors

Name Description

Public function

FCbAttachment()

Construct a null attachment.

Public function

FCbAttachment

(
    BufferType&& InValue,
    const FIoHash& InHash
)

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

Public function

FCbAttachment

(
    const FCbObject& InValue
)

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

Public function

FCbAttachment

(
    FCbObject&& InValue
)

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

Public function

FCbAttachment

(
    BufferType&& InValue
)

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

Public function

FCbAttachment

(
    const FCompressedBuffer& InValue
)

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

Public function

FCbAttachment

(
    FCompressedBuffer&& InValue
)

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

Public function

FCbAttachment

(
    const FCbObject& InValue,
    const FIoHash& Hash
)

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

Public function

FCbAttachment

(
    FCbObject&& InValue,
    const FIoHash& Hash
)

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

Functions

Name Description

Public function Const

FSharedBuffe...

 

AsBinary()

Access the attachment as raw binary in a single contiguous buffer.

Public function Const

const FCompo...

 

AsCompositeBinary()

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

Public function Const

const FCompr...

 

AsCompressedBinary()

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

Public function Const

FCbObject

 

AsObject()

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

Public function Const

FIoHash

 

GetHash()

Returns the hash of the attachment value.

Public function Const

bool

 

IsBinary()

Returns whether the attachment is raw binary.

Public function Const

bool

 

IsCompressedBinary()

Returns whether the attachment is compressed binary.

Public function Const

bool

 

IsNull()

Whether the attachment has a null value.

Public function Const

bool

 

IsObject()

Returns whether the attachment is an object.

Public function

void

 

Reset()

Reset this to a null attachment.

Public function Const

void

 

Save

(
    FCbWriter& Writer
)

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

Public function Const

void

 

Save

(
    FArchive& Ar
)

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

Public function

bool

 

TryLoad

(
    FCbFieldIterator& Fields
)

Load the attachment from compact binary as written by Save.

Public function

bool

 

TryLoad

(
    FArchive& Ar,
    FCbBufferAllocator Allocator
)

Load the attachment from compact binary as written by Save.

Operators

Name Description

Public function Const

 

operator bool()

Whether the attachment has a non-null value.

Public function Const

bool

 

operator!=

(
    const FCbAttachment& Attachment
)

Public function Const

bool

 

operator<

(
    const FCbAttachment& Attachment
)

Public function Const

bool

 

operator==

(
    const FCbAttachment& Attachment
)

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