kanzi::StateManager::TargetObject Class Reference

TargetObject. More...

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

Public Member Functions

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

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

Constructor.

Parameters
rootNodeRoot node for resolving target.
objectPathPath to target relative to root node.
kanzi::StateManager::TargetObject::~TargetObject ( )

Destructor.

Member Function Documentation

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.
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.
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.
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.

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

Destroys TargetObject.

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

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: