![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <CompactBinary.h>
Inheritance diagram for FCbFieldView:Protected Member Functions | |
| CORE_API FMemoryView | GetView () const |
| CORE_API FMemoryView | GetViewNoType () const |
| FMemoryView | GetValueView () const |
| constexpr ECbFieldType | GetType () const |
| constexpr ECbFieldType | GetTypeWithFlags () const |
| constexpr const void * | GetValueData () const |
| const void * | GetValueEnd () const |
| CORE_API uint64 | GetValueSize () const |
| void | Assign (const void *InData, const ECbFieldType InType) |
An atom of data in the compact binary format.
Accessing the value of a field is always a safe operation, even if accessed as the wrong type. An invalid access will return a default value for the requested type, and set an error code on the field that can be checked with GetLastError and HasLastError. A valid access will clear an error from a previous invalid access.
A field is encoded in one or more bytes, depending on its type and the type of object or array that contains it. A field of an object or array which is non-uniform encodes its field type in the first byte, and includes the HasFieldName flag for a field in an object. The field name is encoded in a variable-length unsigned integer of its size in bytes, for named fields, followed by that many bytes of the UTF-8 encoding of the name with no null terminator. The remainder of the field is the value which is described in the field type enum. Every field must be uniquely addressable when encoded, which means a zero-byte field is not permitted, and only arises in a uniform array of fields with no value, where the answer is to encode as a non-uniform array.
This type only provides a view into memory and does not perform any memory management itself. Use FCbField to hold a reference to the underlying memory when necessary.
|
constexprdefault |
Construct a field with no name and no value.
|
explicit |
Construct a field from a pointer to its data and an optional externally-provided type.
| Data | Pointer to the start of the field data. |
| Type | HasFieldType means that Data contains the type. Otherwise, use the given type. |
|
inlineexplicit |
Construct a field from a value, without access to the name.
| void FCbFieldView::AppendHash | ( | FIoHashBuilder & | Builder | ) | const |
Append the hash of the field, including the type and name.
| FCbArrayView FCbFieldView::AsArrayView | ( | ) |
Access the field as an array. Defaults to an empty array on error.
Access the field as a hash referencing an attachment. Returns the provided default on error.
Access the field as a hash referencing a binary attachment. Returns the provided default on error.
| FMemoryView FCbFieldView::AsBinaryView | ( | FMemoryView | Default = FMemoryView() | ) |
Access the field as binary. Returns the provided default on error.
Access the field as a bool. Returns the provided default on error.
| FMemoryView FCbFieldView::AsCustom | ( | FUtf8StringView | Name, |
| FMemoryView | Default = FMemoryView() |
||
| ) |
Access the field as a custom sub-type with a string identifier. Returns the provided default on error.
| FMemoryView FCbFieldView::AsCustom | ( | uint64 | Id, |
| FMemoryView | Default = FMemoryView() |
||
| ) |
Access the field as a custom sub-type with an integer identifier. Returns the provided default on error.
| FCbCustomById FCbFieldView::AsCustomById | ( | FCbCustomById | Default = FCbCustomById() | ) |
Access the field as a custom sub-type with an integer identifier. Returns the provided default on error.
| FCbCustomByName FCbFieldView::AsCustomByName | ( | FCbCustomByName | Default = FCbCustomByName() | ) |
Access the field as a custom sub-type with a string identifier. Returns the provided default on error.
| FDateTime FCbFieldView::AsDateTime | ( | ) |
Access the field as a date/time. Returns a date/time at the epoch on error.
Access the field as a date/time. Returns the provided default on error.
Access the field as a date/time tick count. Returns the provided default on error.
Access the field as a double. Returns the provided default on error.
Access the field as a float. Returns the provided default on error.
Access the field as a hash. Returns the provided default on error.
Access the field as an int16. Returns the provided default on error.
Access the field as an int32. Returns the provided default on error.
Access the field as an int64. Returns the provided default on error.
Access the field as an int8. Returns the provided default on error.
Access the field as a hash referencing an object attachment. Returns the provided default on error.
| FCbObjectId FCbFieldView::AsObjectId | ( | const FCbObjectId & | Default = FCbObjectId() | ) |
Access the field as an object identifier. Returns the provided default on error.
| FCbObjectView FCbFieldView::AsObjectView | ( | ) |
Access the field as an object. Defaults to an empty object on error.
|
inlineprotected |
Assign a field from a pointer to its data and an optional externally-provided type.
| FUtf8StringView FCbFieldView::AsString | ( | FUtf8StringView | Default = FUtf8StringView() | ) |
Access the field as a string. Returns the provided default on error.
| FTimespan FCbFieldView::AsTimeSpan | ( | ) |
Access the field as a timespan. Returns an empty timespan on error.
Access the field as a timespan. Returns the provided default on error.
Access the field as a timespan tick count. Returns the provided default on error.
Access the field as a uint16. Returns the provided default on error.
Access the field as a uint32. Returns the provided default on error.
Access the field as a uint64. Returns the provided default on error.
Access the field as a uint8. Returns the provided default on error.
| FGuid FCbFieldView::AsUuid | ( | ) |
Access the field as a UUID. Returns a nil UUID on error.
Access the field as a UUID. Returns the provided default on error.
|
inline |
DO NOT USE DIRECTLY. These functions enable range-based for loop support.
Copy the field into an archive, including its type and name.
| void FCbFieldView::CopyTo | ( | FMutableMemoryView | Buffer | ) | const |
Copy the field into a buffer of exactly GetSize() bytes, including the type and name.
| FCbFieldViewIterator FCbFieldView::CreateViewIterator | ( | ) | const |
Create an iterator for the fields of an array or object, otherwise an empty iterator.
|
inlineconstexpr |
| bool FCbFieldView::Equals | ( | const FCbFieldView & | Other | ) | const |
Whether this field is identical to the other field.
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 performed with ValidateCompactBinary, except for field order and field name case.
|
inlineconstexpr |
The type of error that occurred on the last field access, or None.
| FIoHash FCbFieldView::GetHash | ( | ) | const |
Calculate the hash of the field, including the type and name.
|
inlineconstexpr |
Returns the name of the field if it has a name, otherwise an empty view.
| uint64 FCbFieldView::GetSize | ( | ) | const |
Returns the size of the field in bytes, including the type and name.
|
inlineconstexprprotected |
Returns the type of the field excluding flags.
|
inlineconstexprprotected |
Returns the type of the field including flags.
|
inline |
Returns the value for unchecked access. Prefer the typed accessors below.
Returns the start of the value.
|
inlineprotected |
Returns the end of the value.
|
protected |
Returns the size of the value in bytes, which is the field excluding the type and name.
|
inlineprotected |
Returns a view of the value, which excludes the type and name.
|
protected |
Returns a view of the field, including the type and name when present.
|
protected |
Returns a view of the name and value, which excludes the type.
Whether the last field access encountered an error.
Whether the field has a value.
All fields in a valid object or array have a value. A field with no value is returned when finding a field by name fails or when accessing an iterator past the end.
Whether the field is a float, or integer that supports implicit conversion.
Whether the field is an integer of unspecified range and sign.
| void FCbFieldView::IterateAttachments | ( | FCbFieldVisitor | Visitor | ) | const |
Invoke the visitor for every attachment in the field.
Whether the field has a value.
| FCbFieldView FCbFieldView::operator[] | ( | FUtf8StringView | Name | ) | const |
Find a field of an object by case-sensitive name comparison, otherwise a field with no value.
|
inlineconstexpr |
Returns a copy of the field with the name removed.
|
inline |
Try to get a view of the field as it would be serialized, such as by CopyTo.
A view is available if the field contains its type. Access the equivalent for other fields through FCbField::GetBuffer, FCbField::Clone, or CopyTo.