#include <rtti/linkresolver.h>
Public Member Functions | |
virtual | ~LinkResolver ()=default |
bool | resolveLinks (const UnresolvedPointerList &unresolvedPointers, utility::ErrorState &errorState) |
Protected Types | |
enum | EInvalidLinkBehaviour { TreatAsError, Ignore } |
Protected Member Functions | |
virtual Object * | findTarget (const std::string &targetID)=0 |
virtual EInvalidLinkBehaviour | onInvalidLink (const UnresolvedPointer &unresolvedPointer)=0 |
Base class for resolving links after deserialization. The base class contains logic for determining target ID. The derived class should perform the lookup of the target object in its data structures. Custom pointers are supported through exposed RTTI functions on pointer objects: a static function 'translateTargetID' will convert any ID to a target ID and the member function 'assign' will assign the pointer value to the pointer object.
|
strongprotected |
|
virtualdefault |
|
protectedpure virtual |
Called by resolveLinks to resolve a target ID to target object. Derived classes should implement this to perform the lookup.
targetID | The ID to resolve. This ID could be retrieved straight from deserialization or transformed through the static translateTargetID function on the type. |
|
protectedpure virtual |
Called when an invalid link is encountered. The return value determines what kind of behavior to exhibit for an unresolved link.
unresolvedPointer | The UnresolvedPointer that could not be resolved. Can be used to notify the user of this event |
bool resolveLinks | ( | const UnresolvedPointerList & | unresolvedPointers, |
utility::ErrorState & | errorState | ||
) |
Performs the resolving of pointers. Will call findTarget for each pointer.
unresolvedPointers | The pointers to resolve |
errorState | Contains error information if the function returns false. |