![]() |
XII Release 0.1.0
|
Patch base class for xiiAbstractObjectGraph patches. More...
#include <GraphPatch.h>
Public Types | |
enum class | PatchType : xiiUInt8 { NodePatch , GraphPatch } |
Public Member Functions | |
xiiGraphPatch (xiiStringView sType, xiiUInt32 uiTypeVersion, PatchType type=PatchType::NodePatch) | |
Constructor. pType is the type to patch. uiTypeVersion is the version to patch to. | |
virtual void | Patch (xiiGraphPatchContext &ref_context, xiiAbstractObjectGraph *pGraph, xiiAbstractObjectNode *pNode) const =0 |
Patch function. If type == PatchType::NodePatch, the implementation needs to patch pNode in pGraph to m_uiTypeVersion. If type == PatchType::GraphPatch, pNode will be nullptr and the implementation has to figure out what to patch in pGraph on its own. | |
xiiStringView | GetType () const |
Returns the type to patch. | |
xiiUInt32 | GetTypeVersion () const |
Returns the type version to patch to. | |
PatchType | GetPatchType () const |
XII_DECLARE_ENUMERABLE_CLASS (xiiGraphPatch) | |
Additional Inherited Members | |
![]() | |
static const xiiRTTI * | GetStaticRTTI () |
![]() | |
xiiEnumerable * | m_pNextInstance |
Patch base class for xiiAbstractObjectGraph patches.
Create static instance of derived class to automatically patch graphs on load.
|
strong |
xiiGraphPatch::xiiGraphPatch | ( | xiiStringView | sType, |
xiiUInt32 | uiTypeVersion, | ||
PatchType | type = PatchType::NodePatch ) |
Constructor. pType is the type to patch. uiTypeVersion is the version to patch to.
Patches are executed in order from version uiTypeVersion-1 to uiTypeVersion. If no patch exists for previous versions the input to the patch function can potentially be of a lower version than uiTypeVersion-1. If type is PatchType::NodePatch, the patch is executed for each instance of the given type. If type is PatchType::GraphPatch, the patch is executed once for the entire graph. In this case szType and uiTypeVersion are ignored and the patch function has to figure out what to do by itself.