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

#include <CompactBinary.h>

+ Inheritance diagram for FCbObjectView:
+ Collaboration diagram for FCbObjectView:

Public Member Functions

 FCbObjectView ()
 
FCbFieldView FindView (FUtf8StringView Name) const
 
FCbFieldView FindViewIgnoreCase (FUtf8StringView Name) const
 
FCbFieldView operator[] (FUtf8StringView Name) const
 
FCbFieldView AsFieldView () const
 
 operator bool () const
 
uint64 GetSize () const
 
FIoHash GetHash () const
 
void AppendHash (FIoHashBuilder &Builder) const
 
bool Equals (const FCbObjectView &Other) const
 
void CopyTo (FMutableMemoryView Buffer) const
 
void CopyTo (FArchive &Ar) const
 
void IterateAttachments (FCbFieldVisitor Visitor) const
 
bool TryGetView (FMemoryView &OutView) const
 
constexpr FCbFieldView ()=default
 
 FCbFieldView (const void *Data, ECbFieldType Type=ECbFieldType::HasFieldType)
 
 FCbFieldView (const FCbValue &Value)
 
FCbFieldViewIterator CreateViewIterator () const
 
FCbFieldViewIterator begin () const
 
constexpr FCbIteratorSentinel end () const
 

Static Public Member Functions

static FCbObjectView FromFieldNoCheck (const FCbFieldView &Field)
 

Private Member Functions

 FCbObjectView (const FCbFieldView &Field)
 

Additional Inherited Members

- Protected Member Functions inherited from FCbFieldView
FMemoryView GetView () const
 
FMemoryView GetViewNoType () const
 
FMemoryView GetValueView () const
 
constexpr ECbFieldType GetType () const
 
constexpr ECbFieldType GetTypeWithFlags () const
 
constexpr const voidGetValueData () const
 
const voidGetValueEnd () const
 
uint64 GetValueSize () const
 
void Assign (const void *InData, const ECbFieldType InType)
 
constexpr FCbFieldView ()=default
 
 FCbFieldView (const void *Data, ECbFieldType Type=ECbFieldType::HasFieldType)
 
 FCbFieldView (const FCbValue &Value)
 
constexpr FCbFieldView RemoveName () const
 
constexpr FUtf8StringView GetName () const
 
FCbValue GetValue () const
 
FCbObjectView AsObjectView ()
 
FCbArrayView AsArrayView ()
 
FMemoryView AsBinaryView (FMemoryView Default=FMemoryView())
 
FUtf8StringView AsString (FUtf8StringView Default=FUtf8StringView())
 
int8 AsInt8 (int8 Default=0)
 
int16 AsInt16 (int16 Default=0)
 
int32 AsInt32 (int32 Default=0)
 
int64 AsInt64 (int64 Default=0)
 
uint8 AsUInt8 (uint8 Default=0)
 
uint16 AsUInt16 (uint16 Default=0)
 
uint32 AsUInt32 (uint32 Default=0)
 
uint64 AsUInt64 (uint64 Default=0)
 
float AsFloat (float Default=0.0f)
 
double AsDouble (double Default=0.0)
 
bool AsBool (bool bDefault=false)
 
FIoHash AsObjectAttachment (const FIoHash &Default=FIoHash())
 
FIoHash AsBinaryAttachment (const FIoHash &Default=FIoHash())
 
FIoHash AsAttachment (const FIoHash &Default=FIoHash())
 
FIoHash AsHash (const FIoHash &Default=FIoHash())
 
FGuid AsUuid ()
 
FGuid AsUuid (const FGuid &Default)
 
int64 AsDateTimeTicks (int64 Default=0)
 
FDateTime AsDateTime ()
 
FDateTime AsDateTime (FDateTime Default)
 
int64 AsTimeSpanTicks (int64 Default=0)
 
FTimespan AsTimeSpan ()
 
FTimespan AsTimeSpan (FTimespan Default)
 
FCbObjectId AsObjectId (const FCbObjectId &Default=FCbObjectId())
 
FCbCustomById AsCustomById (FCbCustomById Default=FCbCustomById())
 
FCbCustomByName AsCustomByName (FCbCustomByName Default=FCbCustomByName())
 
FMemoryView AsCustom (uint64 Id, FMemoryView Default=FMemoryView())
 
FMemoryView AsCustom (FUtf8StringView Name, FMemoryView Default=FMemoryView())
 
constexpr bool HasName () const
 
constexpr bool IsNull () const
 
constexpr bool IsObject () const
 
constexpr bool IsArray () const
 
constexpr bool IsBinary () const
 
constexpr bool IsString () const
 
constexpr bool IsInteger () const
 
constexpr bool IsFloat () const
 
constexpr bool IsBool () const
 
constexpr bool IsObjectAttachment () const
 
constexpr bool IsBinaryAttachment () const
 
constexpr bool IsAttachment () const
 
constexpr bool IsHash () const
 
constexpr bool IsUuid () const
 
constexpr bool IsDateTime () const
 
constexpr bool IsTimeSpan () const
 
constexpr bool IsObjectId () const
 
constexpr bool IsCustomById () const
 
constexpr bool IsCustomByName () const
 
constexpr operator bool () const
 
constexpr bool HasValue () const
 
constexpr bool HasError () const
 
constexpr ECbFieldError GetError () const
 
uint64 GetSize () const
 
FIoHash GetHash () const
 
void AppendHash (FIoHashBuilder &Builder) const
 
bool Equals (const FCbFieldView &Other) const
 
void CopyTo (FMutableMemoryView Buffer) const
 
void CopyTo (FArchive &Ar) const
 
void IterateAttachments (FCbFieldVisitor Visitor) const
 
bool TryGetView (FMemoryView &OutView) const
 
FCbFieldView operator[] (FUtf8StringView Name) const
 
FCbFieldViewIterator CreateViewIterator () const
 
FCbFieldViewIterator begin () const
 
constexpr FCbIteratorSentinel end () const
 

Detailed Description

Array of FCbField[View] that have unique names.

Accessing the fields of an object is always a safe operation, even if the requested field does not exist. Fields may be accessed by name or through iteration. When a field is requested that is not found in the object, the field that it returns has no value (evaluates to false) though attempting to access the empty field is also safe, as described by FCbFieldView.

This type only provides a view into memory and does not perform any memory management itself. Use FCbObject to hold a reference to the underlying memory when necessary.

Definition at line 1021 of file CompactBinary.h.

Constructor & Destructor Documentation

◆ FCbObjectView() [1/2]

FCbObjectView::FCbObjectView ( )

Construct an object with no fields.

◆ FCbObjectView() [2/2]

FCbObjectView::FCbObjectView ( const FCbFieldView & Field)
inlineexplicitprivate

Construct an object from an object field. No type check is performed! Use via FromFieldNoCheck.

Definition at line 1102 of file CompactBinary.h.

+ Here is the caller graph for this function:

Member Function Documentation

◆ AppendHash()

void FCbObjectView::AppendHash ( FIoHashBuilder & Builder) const

Append the hash of the object if serialized by itself with no name.

◆ AsFieldView()

FCbFieldView FCbObjectView::AsFieldView ( ) const
inline

Access the object as an object field.

Definition at line 1048 of file CompactBinary.h.

+ Here is the call graph for this function:

◆ begin()

FCbFieldViewIterator FCbFieldView::begin ( ) const
inline

DO NOT USE DIRECTLY. These functions enable range-based for loop support.

Definition at line 822 of file CompactBinary.h.

◆ CopyTo() [1/2]

void FCbObjectView::CopyTo ( FArchive & Ar) const

Copy the object into an archive. This will write GetSize() bytes, with no name.

◆ CopyTo() [2/2]

void FCbObjectView::CopyTo ( FMutableMemoryView Buffer) const

Copy the object into a buffer of exactly GetSize() bytes, with no name.

◆ CreateViewIterator()

FCbFieldViewIterator FCbFieldView::CreateViewIterator ( ) const

◆ end()

constexpr FCbIteratorSentinel FCbFieldView::end ( ) const
inlineconstexpr

Definition at line 823 of file CompactBinary.h.

◆ Equals()

bool FCbObjectView::Equals ( const FCbObjectView & Other) const

Whether this object is identical to the other object.

Performs a deep comparison of any contained arrays or objects and their fields. Comparison assumes that both fields are valid and are written in the canonical format. Fields must be written in the same order in arrays and objects, and name comparison is case sensitive. If these assumptions do not hold, this may return false for equivalent inputs. Validation can be done with the All mode to check these assumptions about the format of the inputs.

◆ FCbFieldView() [1/3]

constexpr FCbFieldView::FCbFieldView ( )
constexprdefault

◆ FCbFieldView() [2/3]

FORCEINLINE FCbFieldView::FCbFieldView ( const FCbValue & Value)
inlineexplicit
See also
FCbFieldView::FCbFieldView

Definition at line 621 of file CompactBinaryValue.h.

◆ FCbFieldView() [3/3]

FCbFieldView::FCbFieldView ( const void * Data,
ECbFieldType Type = ECbFieldType::HasFieldType )
explicit

◆ FindView()

FCbFieldView FCbObjectView::FindView ( FUtf8StringView Name) const

Find a field by case-sensitive name comparison.

The cost of this operation scales linearly with the number of fields in the object. Prefer to iterate over the fields only once when consuming an object.

Parameters
NameThe name of the field.
Returns
The matching field if found, otherwise a field with no value.

◆ FindViewIgnoreCase()

FCbFieldView FCbObjectView::FindViewIgnoreCase ( FUtf8StringView Name) const

Find a field by case-insensitive name comparison.

◆ FromFieldNoCheck()

static FCbObjectView FCbObjectView::FromFieldNoCheck ( const FCbFieldView & Field)
inlinestatic

Construct an object from an object field. No type check is performed!

Definition at line 1051 of file CompactBinary.h.

+ Here is the call graph for this function:

◆ GetHash()

FIoHash FCbObjectView::GetHash ( ) const

Calculate the hash of the object if serialized by itself with no name.

◆ GetSize()

uint64 FCbObjectView::GetSize ( ) const

Returns the size of the object in bytes if serialized by itself with no name.

◆ IterateAttachments()

void FCbObjectView::IterateAttachments ( FCbFieldVisitor Visitor) const
inline

Invoke the visitor for every attachment in the object.

Definition at line 1082 of file CompactBinary.h.

◆ operator bool()

FCbObjectView::operator bool ( ) const
explicit

Whether the object has any fields.

◆ operator[]()

FCbFieldView FCbObjectView::operator[] ( FUtf8StringView Name) const
inline

Find a field by case-sensitive name comparison.

Definition at line 1045 of file CompactBinary.h.

◆ TryGetView()

bool FCbObjectView::TryGetView ( FMemoryView & OutView) const
inline

Try to get a view of the object as it would be serialized, such as by CopyTo.

A view is available if the object contains its type and has no name. Access the equivalent for other objects through FCbObject::GetBuffer, FCbObject::Clone, or CopyTo.

Definition at line 1090 of file CompactBinary.h.


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