XII Release 0.1.0
Loading...
Searching...
No Matches
xiiRttiConverterWriter Class Reference

This class is used to convert native C++ objects into xiiAbstractObjectGraphs. It is used by the xiiDocument system to serialize native objects into documents. More...

#include <RttiConverter.h>

Public Types

using FilterFunction = xiiDelegate<bool(const void* pObject, const xiiAbstractProperty* pProperty)>
 This filter function is used to determine whether a given property of a given object should be serialized or not. It is called for each property of each object that is being converted. The default implementation of the converter uses a filter function that returns true for all properties, but you can provide your own filter function to exclude certain properties from serialization, e.g. to exclude read-only properties or owner pointers.

Public Member Functions

 xiiRttiConverterWriter (xiiAbstractObjectGraph *pGraph, xiiRttiConverterContext *pContext, bool bSerializeReadOnly, bool bSerializeOwnerPtrs)
 Creates a new converter that writes to the given graph and uses the given context. The filter function is used to determine which properties should be serialized. If bSerializeReadOnly is true, read-only properties will be serialized. If bSerializeOwnerPtrs is true, owner pointers will be serialized. These two options are commonly used together to serialize complete object hierarchies, but you can also use them separately or provide your own filter function for more fine-grained control.
 xiiRttiConverterWriter (xiiAbstractObjectGraph *pGraph, xiiRttiConverterContext *pContext, FilterFunction filter)
 Creates a new converter that writes to the given graph and uses the given context. The filter function is used to determine which properties should be serialized. It is called for each property of each object that is being converted and should return true if the property should be serialized or false if it should be excluded from serialization.
XII_ALWAYS_INLINE xiiAbstractObjectNode * AddObjectToGraph (xiiReflectedClass *pObject, xiiStringView sNodeName={})
 Converts the given object into a graph node and adds it to the graph. The type of the object is determined by its dynamic RTTI type. The node name can be optionally specified, otherwise the type name will be used as node name. The properties of the object will be added as child nodes of the created node. If the object has sub-objects that are not currently instantiated, but only exist as graph nodes, they will be enqueued for later creation and added as child nodes with their guid as node name.
xiiAbstractObjectNode * AddObjectToGraph (const xiiRTTI *pRtti, const void *pObject, xiiStringView sNodeName={})
 Converts the given object into a graph node and adds it to the graph. The type of the object is determined by the given RTTI type. The node name can be optionally specified, otherwise the type name will be used as node name. The properties of the object will be added as child nodes of the created node. If the object has sub-objects that are not currently instantiated, but only exist as graph nodes, they will be enqueued for later creation and added as child nodes with their guid as node name.
void AddProperty (xiiAbstractObjectNode *pNode, const xiiAbstractProperty *pProperty, const void *pObject)
 Adds a property of the given object as a child node of the given node. The property is identified by the given RTTI property. The value of the property is read from the given object and stored in the child node. If the property is an object pointer that is not currently instantiated, but only exists as a graph node, it will be enqueued for later creation and added as a child node with its guid as node name.
void AddProperties (xiiAbstractObjectNode *pNode, const xiiRTTI *pRtti, const void *pObject)
 Adds a property of the given object as a child node of the given node. The property is identified by the given property name. The value of the property is read from the given object and stored in the child node. If the property is an object pointer that is not currently instantiated, but only exists as graph node, it will be enqueued for later creation and added as a child node with its guid as node name.
xiiAbstractObjectNode * AddSubObjectToGraph (const xiiRTTI *pRtti, const void *pObject, const xiiUuid &guid, xiiStringView sNodeName)
 Adds a sub-object of the given object as a child node of the given node. The sub-object is identified by the given RTTI property. The value of the sub-object is read from the given object and stored in the child node. If the sub-object is not currently instantiated, but only exists as a graph node, it will be enqueued for later creation and added as a child node with its guid as node name.

Detailed Description

This class is used to convert native C++ objects into xiiAbstractObjectGraphs. It is used by the xiiDocument system to serialize native objects into documents.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Serialization/RttiConverter.h
  • /home/runner/work/XII/XII/Source/Engine/Foundation/Serialization/Implementation/RttiConverterWriter.cpp