Kanzi Framework  3.9.0
Kanzi Engine API
kanzi::StateManager::TargetObject Class Reference

TargetObject. More...

#include <kanzi/core.ui/state_manager/state_manager.hpp>

Public Member Functions

void destroy ()
 Destroys TargetObject. More...
 
Objectget ()
 Gets acquired target. More...
 
ObjectgetBaseObject ()
 Gets acquired target. More...
 
bool hasClonedTargetResource () const
 Tells if there is a cloned target resource. More...
 
void registerStateObjectRuntime (StateObjectRuntimeSharedPtr stateObjectRuntime)
 Register state object runtime which should be notified when target is acquired or lost. More...
 
void sync ()
 Refreshes target. More...
 
 TargetObject (Node *rootNode, string_view objectPath)
 Constructor. More...
 
 ~TargetObject ()
 Destructor. More...
 

Detailed Description

TargetObject.

TargetObject is responsible for keeping track of a target object (node or resource) to which state object runtimes apply their styles. TargetObject also notifies referencing state object runtimes when target becomes acquired or lost.

Constructor & Destructor Documentation

◆ TargetObject()

kanzi::StateManager::TargetObject::TargetObject ( Node rootNode,
string_view  objectPath 
)
explicit

Constructor.

Parameters
rootNodeRoot node for resolving target.
objectPathPath to target relative to root node.

◆ ~TargetObject()

kanzi::StateManager::TargetObject::~TargetObject ( )

Destructor.

Member Function Documentation

◆ registerStateObjectRuntime()

void kanzi::StateManager::TargetObject::registerStateObjectRuntime ( StateObjectRuntimeSharedPtr  stateObjectRuntime)

Register state object runtime which should be notified when target is acquired or lost.

Parameters
stateObjectRuntimeState object runtime which should be notified.

◆ get()

Object* kanzi::StateManager::TargetObject::get ( )

Gets acquired target.

If target is not found, null pointer is returned. This always returns the cloned object if a clone has been made.

Returns
Acquired target or null pointer.

◆ getBaseObject()

Object* kanzi::StateManager::TargetObject::getBaseObject ( )

Gets acquired target.

If target is not found, null pointer is returned. Gets the base object even if clone has been made.

Returns
Acquired target or null pointer.

◆ sync()

void kanzi::StateManager::TargetObject::sync ( )

Refreshes target.

Currently TargetObject is not able to automatically detect when target is acquired, so this function should be manually called. Calling this function might trigger notification about acquiring the target.

◆ destroy()

void kanzi::StateManager::TargetObject::destroy ( )

Destroys TargetObject.

After TargetObject is destroyed, it does not track its target and get() function always returns null pointer.

◆ hasClonedTargetResource()

bool kanzi::StateManager::TargetObject::hasClonedTargetResource ( ) const
inline

Tells if there is a cloned target resource.

Returns
True if clone exists, false if not.

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