Choose your operating system:
Windows
macOS
Linux
| FCbWriter
|
Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Serialization/CompactBinaryWriter.h |
Include |
#include "Serialization/CompactBinaryWriter.h" |
class FCbWriter
A writer for compact binary object, arrays, and fields.
The writer produces a sequence of fields that can be saved to a provided memory buffer or into a new owned buffer. The typical use case is to write a single object, which can be accessed by calling Save().AsObject() or Save(Buffer).AsObjectView().
The writer will assert on most incorrect usage and will always produce valid compact binary if provided with valid input. The writer does not check for invalid UTF-8 string encoding, object fields with duplicate names, or invalid compact binary being copied from another source.
It is most convenient to use the streaming API for the writer, as demonstrated in the example.
When writing a small amount of compact binary data, TCbWriter can be more efficient as it uses a fixed-size stack buffer for storage before spilling onto the heap.
Example:
FCbObject WriteObject() { TCbWriter<256> Writer; Writer.BeginObject();
Writer << "Resize" << true; Writer << "MaxWidth" << 1024; Writer << "MaxHeight" << 1024;
Writer.BeginArray(); Writer << "FormatA" << "FormatB" << "FormatC"; Writer.EndArray();
Writer.EndObject(); return Writer.Save().AsObject(); }
Name | Description | |
---|---|---|
|
FCbWriter() |
|
|
FCbWriter ( |
|
|
FCbWriter ( |
Private flags that are public to work with ENUM_CLASS_FLAGS. |
Name | Description | |
---|---|---|
|
~FCbWriter() |
Name | Description | ||
---|---|---|---|
|
AddArray ( |
||
|
AddArray ( |
||
|
AddArray ( |
Copy the value (not the name) of an existing array. |
|
|
AddArray ( |
Copy the value (not the name) of an existing array. Holds a reference if owned. |
|
|
AddAttachment ( |
||
|
AddAttachment ( |
Write a field referencing the attachment by its hash. |
|
|
AddBinary ( |
Write a binary field by copying Size bytes from Value. |
|
|
AddBinary ( |
||
|
AddBinary ( |
Write a binary field by copying the buffer. Holds a reference if owned. |
|
|
AddBinary ( |
Write a binary field by copying the view. |
|
|
AddBinary ( |
Write a binary field by copying Size bytes from Value. |
|
|
AddBinary ( |
||
|
AddBinary |
||
|
AddBinary ( |
||
|
AddBinaryAttachment ( |
||
|
AddBinaryAttachment ( |
Write a field referencing a binary attachment by its hash. |
|
|
AddBool ( |
||
|
AddBool ( |
Write a bool field. |
|
|
AddCustom ( |
Write a custom field with a string sub-type identifier. |
|
|
AddCustom ( |
Write a custom field with an integer sub-type identifier. |
|
|
AddCustom ( |
||
|
AddCustom ( |
||
|
AddDateTime ( |
Write a date/time field. |
|
|
AddDateTime ( |
Write a date/time field. |
|
|
AddDateTimeTicks ( |
||
|
AddDateTimeTicks ( |
Write a date/time field with the specified count of 100ns ticks since the epoch. |
|
|
AddField ( |
||
|
AddField ( |
Copy the value (not the name) of an existing field. Holds a reference if owned. |
|
|
AddField ( |
Copy the value (not the name) of an existing field. |
|
|
AddField ( |
||
|
AddFloat ( |
||
|
AddFloat ( |
||
|
AddFloat ( |
Write a float field from a 32-bit float value. |
|
|
AddFloat ( |
Write a float field from a 64-bit float value. |
|
|
AddHash ( |
||
|
AddHash ( |
Write a hash field. |
|
|
AddInteger ( |
||
|
AddInteger ( |
Write an integer field. |
|
|
AddInteger ( |
Write an integer field. |
|
|
AddInteger ( |
Write an integer field. |
|
|
AddInteger ( |
||
|
AddInteger ( |
||
|
AddInteger ( |
Write an integer field. |
|
|
AddInteger ( |
||
|
AddNull() |
||
|
AddNull ( |
Write a null field. |
|
|
AddObject ( |
||
|
AddObject ( |
||
|
AddObject ( |
Copy the value (not the name) of an existing object. Holds a reference if owned. |
|
|
AddObject ( |
Copy the value (not the name) of an existing object. |
|
|
AddObjectAttachment ( |
Write a field referencing an object attachment by its hash. |
|
|
AddObjectAttachment ( |
||
|
AddObjectId ( |
||
|
AddObjectId ( |
Write an ObjectId field. |
|
|
AddString ( |
Write a string field by converting the UTF-16 value to UTF-8. |
|
|
AddString ( |
||
|
AddString ( |
||
|
AddString ( |
Write a string field by copying the UTF-8 value. |
|
|
AddTimeSpan ( |
Write a time span field. |
|
|
AddTimeSpan ( |
Write a time span field. |
|
|
AddTimeSpanTicks ( |
||
|
AddTimeSpanTicks ( |
Write a time span field with the specified count of 100ns ticks. |
|
|
AddUuid ( |
Write a UUID field. |
|
|
AddUuid ( |
||
|
BeginArray ( |
Begin a new array. Must have a matching call to EndArray. |
|
|
BeginArray() |
||
|
BeginObject() |
||
|
BeginObject ( |
Begin a new object. Must have a matching call to EndObject. |
|
|
EndArray() |
End an array after its fields have been written. |
|
|
EndObject() |
End an object after its fields have been written. |
|
|
GetSaveSize() |
The size of buffer (in bytes) required to serialize the fields that have been written. |
|
|
Reset() |
Empty the writer without releasing any allocated memory. |
|
|
FCbFieldView... |
Save ( |
Serialize the field(s) to memory. |
|
FCbFieldIter... |
Save() |
Serialize the field(s) to an owned buffer and return it as an iterator. |
|
Save ( |
Serialize the field(s) to an archive. |
|
|
SetName ( |
Sets the name of the next field to be written. |
Name |
Description |
|
---|---|---|
|
EStateFlags |