Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FChange Class Referenceabstract

#include <Change.h>

+ Inheritance diagram for FChange:

Public Types

enum class  EChangeStyle { InPlaceSwap , CommandPattern }
 

Public Member Functions

virtual EChangeStyle GetChangeType ()=0
 
virtual TUniquePtr< FChangeExecute (UObject *Object)=0
 
virtual void Apply (UObject *Object)=0
 
virtual void Revert (UObject *Object)=0
 
virtual bool HasExpired (UObject *Object) const
 
virtual void AddReferencedObjects (FReferenceCollector &Collector)
 
virtual FString ToString () const =0
 
virtual void PrintToLog (FFeedbackContext &FeedbackContext, const int32 IndentLevel=0)
 
virtual ~FChange ()
 

Protected Member Functions

 FChange ()
 

Private Member Functions

 FChange (const FChange &)=delete
 
FChangeoperator= (const FChange &)=delete
 

Detailed Description

FChange modifies a UObject and is meant to be used to implement undo/redo. The change is embedded in an FTransaction which executes it instead of the standard serialization transaction (cannot be combined - see FTransaction).

The original FChange style (used by MeshEditor) was that calling Execute() would return a new FChange that applies the opposite action, and FTransaction would swap the two at each undo/redo step (eg a "DeleteObject" FChange would return a "CreateObject" FChange)

The alternative "Command Pattern"-style FChange calls Apply() and Revert() on a single FChange.

FChange may eventually be deprecated. You should subclass FSwapChange and FCommandChange to implement these different styles.

Definition at line 31 of file Change.h.

Member Enumeration Documentation

◆ EChangeStyle

Enumerator
InPlaceSwap 
CommandPattern 

Definition at line 35 of file Change.h.

Constructor & Destructor Documentation

◆ ~FChange()

virtual FChange::~FChange ( )
inlinevirtual

Virtual destructor

Definition at line 66 of file Change.h.

◆ FChange() [1/2]

FChange::FChange ( )
inlineprotected

Protected default constructor

Definition at line 73 of file Change.h.

◆ FChange() [2/2]

FChange::FChange ( const FChange & )
privatedelete

Member Function Documentation

◆ AddReferencedObjects()

virtual void FChange::AddReferencedObjects ( FReferenceCollector & Collector)
inlinevirtual

Used by GC to collect referenced objects.

Definition at line 57 of file Change.h.

◆ Apply()

virtual void FChange::Apply ( UObject * Object)
pure virtual

Makes the change to the object

Implemented in FSwapChange.

◆ Execute()

virtual TUniquePtr< FChange > FChange::Execute ( UObject * Object)
pure virtual

Makes the change to the object, returning a new change that can be used to perfectly roll back this change

Implemented in FCommandChange, and FCompoundChange.

◆ GetChangeType()

virtual EChangeStyle FChange::GetChangeType ( )
pure virtual

What style of change is this

Implemented in FSwapChange, and FCommandChange.

◆ HasExpired()

virtual bool FChange::HasExpired ( UObject * Object) const
inlinevirtual
Returns
true if this Change has Expired, ie it will no longer have any effect and could be skipped by undo/redo

Definition at line 54 of file Change.h.

◆ operator=()

FChange & FChange::operator= ( const FChange & )
privatedelete

◆ PrintToLog()

virtual void FChange::PrintToLog ( FFeedbackContext & FeedbackContext,
const int32 IndentLevel = 0 )
virtual

Prints this change to the log, including sub-changes if there are any. For compound changes, there might be multiple lines. You should not need to override this function.

Reimplemented in FCompoundChange.

◆ Revert()

virtual void FChange::Revert ( UObject * Object)
pure virtual

Reverts change to the object

Implemented in FSwapChange.

◆ ToString()

virtual FString FChange::ToString ( ) const
pure virtual

Describes this change (for debugging)

Implemented in FCompoundChange.


The documentation for this class was generated from the following file: