Choose your operating system:
Windows
macOS
Linux
| FCbFieldView
|
Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Serialization/CompactBinary.h |
Include |
#include "Serialization/CompactBinary.h" |
class FCbFieldView
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.
Name | Description | |
---|---|---|
|
FCbFieldView() |
Construct a field with no name and no value. |
|
FCbFieldView ( |
Construct a field from a value, without access to the name. |
|
FCbFieldView ( |
Construct a field from a pointer to its data and an optional externally-provided type. |
Name | Description | ||
---|---|---|---|
|
AppendHash ( |
Append the hash of the field, including the type and name. |
|
|
AsArrayView() |
Access the field as an array. Defaults to an empty array on error. |
|
|
AsAttachment ( |
Access the field as a hash referencing an attachment. Returns the provided default on error. |
|
|
AsBinaryAttachment ( |
Access the field as a hash referencing a binary attachment. Returns the provided default on error. |
|
|
AsBinaryView ( |
Access the field as binary. Returns the provided default on error. |
|
|
AsBool ( |
Access the field as a bool. Returns the provided default on error. |
|
|
AsCustom ( |
Access the field as a custom sub-type with a string identifier. |
|
|
AsCustom ( |
Access the field as a custom sub-type with an integer identifier. |
|
|
FCbCustomByI... |
AsCustomById ( |
Access the field as a custom sub-type with an integer identifier. |
|
FCbCustomByN... |
AsCustomByName ( |
Access the field as a custom sub-type with a string identifier. |
|
AsDateTime() |
Access the field as a date/time. Returns a date/time at the epoch on error. |
|
|
AsDateTime ( |
Access the field as a date/time. Returns the provided default on error. |
|
|
AsDateTimeTicks ( |
Access the field as a date/time tick count. Returns the provided default on error. |
|
|
double |
AsDouble ( |
Access the field as a double. Returns the provided default on error. |
|
float |
AsFloat ( |
Access the field as a float. Returns the provided default on error. |
|
AsHash ( |
Access the field as a hash. Returns the provided default on error. |
|
|
AsInt16 ( |
Access the field as an int16. Returns the provided default on error. |
|
|
AsInt32 ( |
Access the field as an int32. Returns the provided default on error. |
|
|
AsInt64 ( |
Access the field as an int64. Returns the provided default on error. |
|
|
AsInt8 ( |
Access the field as an int8. Returns the provided default on error. |
|
|
AsObjectAttachment ( |
Access the field as a hash referencing an object attachment. Returns the provided default on error. |
|
|
AsObjectId ( |
Access the field as an object identifier. Returns the provided default on error. |
|
|
FCbObjectVie... |
AsObjectView() |
Access the field as an object. Defaults to an empty object on error. |
|
Assign ( |
Assign a field from a pointer to its data and an optional externally-provided type. |
|
|
FUtf8StringV... |
AsString ( |
Access the field as a string. Returns the provided default on error. |
|
AsTimeSpan ( |
Access the field as a timespan. Returns the provided default on error. |
|
|
AsTimeSpan() |
Access the field as a timespan. Returns an empty timespan on error. |
|
|
AsTimeSpanTicks ( |
Access the field as a timespan tick count. Returns the provided default on error. |
|
|
AsUInt16 ( |
Access the field as a uint16. Returns the provided default on error. |
|
|
AsUInt32 ( |
Access the field as a uint32. Returns the provided default on error. |
|
|
AsUInt64 ( |
Access the field as a uint64. Returns the provided default on error. |
|
|
AsUInt8 ( |
Access the field as a uint8. Returns the provided default on error. |
|
|
AsUuid ( |
Access the field as a UUID. Returns the provided default on error. |
|
|
AsUuid() |
Access the field as a UUID. Returns a nil UUID on error. |
|
|
FCbFieldView... |
begin() |
DO NOT USE DIRECTLY. These functions enable range-based for loop support. |
|
CopyTo ( |
Copy the field into an archive, including its type and name. |
|
|
CopyTo ( |
Copy the field into a buffer of exactly GetSize() bytes, including the type and name. |
|
|
FCbFieldView... |
CreateViewIterator() |
Create an iterator for the fields of an array or object, otherwise an empty iterator. |
|
constexpr FC... |
end() |
|
|
Equals ( |
Whether this field is identical to the other field. |
|
|
constexpr EC... |
GetError() |
The type of error that occurred on the last field access, or None. |
|
GetHash() |
Calculate the hash of the field, including the type and name. |
|
|
constexpr FU... |
GetName() |
Returns the name of the field if it has a name, otherwise an empty view. |
|
GetSize() |
Returns the size of the field in bytes, including the type and name. |
|
|
constexpr EC... |
GetType() |
Returns the type of the field excluding flags. |
|
constexpr EC... |
GetTypeWithFlags() |
Returns the type of the field including flags. |
|
GetValue() |
Returns the value for unchecked access. Prefer the typed accessors below. |
|
|
constexpr co... |
GetValueData() |
Returns the start of the value. |
|
const void &... |
GetValueEnd() |
Returns the end of the value. |
|
GetValueSize() |
Returns the size of the value in bytes, which is the field excluding the type and name. |
|
|
GetValueView() |
Returns a view of the value, which excludes the type and name. |
|
|
GetView() |
Returns a view of the field, including the type and name when present. |
|
|
GetViewNoType() |
Returns a view of the name and value, which excludes the type. |
|
|
constexpr bo... |
HasError() |
Whether the last field access encountered an error. |
|
constexpr bo... |
HasName() |
True if the field has a name. |
|
constexpr bo... |
HasValue() |
Whether the field has a value. |
|
constexpr bo... |
IsArray() |
|
|
constexpr bo... |
IsAttachment() |
|
|
constexpr bo... |
IsBinary() |
|
|
constexpr bo... |
IsBinaryAttachment() |
|
|
constexpr bo... |
IsBool() |
|
|
constexpr bo... |
IsCustomById() |
|
|
constexpr bo... |
IsCustomByName() |
|
|
constexpr bo... |
IsDateTime() |
|
|
constexpr bo... |
IsFloat() |
Whether the field is a float, or integer that supports implicit conversion. |
|
constexpr bo... |
IsHash() |
|
|
constexpr bo... |
IsInteger() |
Whether the field is an integer of unspecified range and sign. |
|
constexpr bo... |
IsNull() |
|
|
constexpr bo... |
IsObject() |
|
|
constexpr bo... |
IsObjectAttachment() |
|
|
constexpr bo... |
IsObjectId() |
|
|
constexpr bo... |
IsString() |
|
|
constexpr bo... |
IsTimeSpan() |
|
|
constexpr bo... |
IsUuid() |
|
|
IterateAttachments ( |
Invoke the visitor for every attachment in the field. |
|
|
TryGetView ( |
Try to get a view of the field as it would be serialized, such as by CopyTo. |
Name | Description | ||
---|---|---|---|
|
constexpr |
operator bool() |
Whether the field has a value. |
|
operator[] ( |
Find a field of an object by case-sensitive name comparison, otherwise a field with no value. |