Kanzi  3.9.4
Kanzi Engine API
kanzi::ContentReference< TResourceType > Class Template Reference

#include <kanzi/core.ui/node/content_reference.hpp>

Inheritance diagram for kanzi::ContentReference< TResourceType >:
[legend]

Public Types

typedef function< void()> CallbackType
 
typedef shared_ptr< TResourceType > ResourceTypePtr
 

Public Member Functions

void attachOverride () override
 Attaches the content reference. More...
 
 ContentReference (Node &thisObject)
 
 ContentReference (Node &thisObject, const ResourceID &id)
 
void detachOverride () override
 Detaches the content reference. More...
 
ResourceTypePtr get () const
 
ResourceSharedPtr getResource () override
 
ResourceID getResourceId () const
 Gets the resource ID the content reference is tracking. More...
 
ResourceTypePtr getUserResource () const
 Access user resource. More...
 
ResourceTypePtr makeLocal ()
 Clone reference to be an internal copy. More...
 
void onResourceChangeOverride () override
 This method is called when the resource referenced by the existing resource-ID is changed. More...
 
 operator bool_type () const
 
TResourceType & operator* () const
 
TResourceType * operator-> () const
 
void resetUserResource ()
 Clear user resource. More...
 
void setCallback (CallbackType callback)
 
void setResource (const ResourceID &id)
 Sets the resource-ID of the content reference. More...
 
void setUserResource (ResourceTypePtr userResource)
 Set user resource. More...
 
 ~ContentReference () override
 
- Public Member Functions inherited from kanzi::AbstractResourceReference
bool isAttached () const
 Indicates whether this resource reference has been attached. More...
 

Protected Member Functions

void notifyCallback ()
 
ResourceTypePtrresolve ()
 
const ResourceTypePtrresolve () const
 
void updateChangeFlags () const
 
void updateResolveNotify (bool onDetach)
 
void updateResource ()
 
- Protected Member Functions inherited from kanzi::AbstractResourceReference
virtual ~AbstractResourceReference ()=default
 Destructor. More...
 

Additional Inherited Members

- Protected Attributes inherited from kanzi::AbstractResourceReference
bool m_attached
 Current resource reference state. Note that attach() is only called once. More...
 

Member Typedef Documentation

◆ CallbackType

template<typename TResourceType >
typedef function<void()> kanzi::ContentReference< TResourceType >::CallbackType

◆ ResourceTypePtr

template<typename TResourceType >
typedef shared_ptr<TResourceType> kanzi::ContentReference< TResourceType >::ResourceTypePtr

Constructor & Destructor Documentation

◆ ContentReference() [1/2]

template<typename TResourceType >
kanzi::ContentReference< TResourceType >::ContentReference ( Node thisObject)
explicit

◆ ContentReference() [2/2]

template<typename TResourceType >
kanzi::ContentReference< TResourceType >::ContentReference ( Node thisObject,
const ResourceID id 
)
explicit

◆ ~ContentReference()

template<typename TResourceType >
kanzi::ContentReference< TResourceType >::~ContentReference ( )
override

Member Function Documentation

◆ operator bool_type()

template<typename TResourceType >
kanzi::ContentReference< TResourceType >::operator bool_type ( ) const
inline

◆ setResource()

template<typename TResourceType >
void kanzi::ContentReference< TResourceType >::setResource ( const ResourceID id)
inline

Sets the resource-ID of the content reference.

If the current reference is attached, acquires the resource.

◆ getResourceId()

template<typename TResourceType >
ResourceID kanzi::ContentReference< TResourceType >::getResourceId ( ) const
inline

Gets the resource ID the content reference is tracking.

Returns
Resource ID being tracked.

◆ attachOverride()

template<typename TResourceType >
void kanzi::ContentReference< TResourceType >::attachOverride ( )
inlineoverridevirtual

Attaches the content reference.

Acquires the resource referenced by the resource ID.

Note: The attach() is only called once.

Implements kanzi::AbstractResourceReference.

◆ onResourceChangeOverride()

template<typename TResourceType >
void kanzi::ContentReference< TResourceType >::onResourceChangeOverride ( )
inlineoverridevirtual

This method is called when the resource referenced by the existing resource-ID is changed.

Acquires the new resource and executes the callback only if the the new resource is not the same as before.

Note: This method is only called on attached resource references.

Implements kanzi::AbstractResourceReference.

◆ detachOverride()

template<typename TResourceType >
void kanzi::ContentReference< TResourceType >::detachOverride ( )
inlineoverridevirtual

Detaches the content reference.

Resets the referenced resource.

Note: The detach() is only called once.

Implements kanzi::AbstractResourceReference.

◆ getResource()

template<typename TResourceType >
ResourceSharedPtr kanzi::ContentReference< TResourceType >::getResource ( )
inlineoverridevirtual

◆ makeLocal()

template<typename TResourceType >
ResourceTypePtr kanzi::ContentReference< TResourceType >::makeLocal ( )
inline

Clone reference to be an internal copy.

Default implementation clones nothing, and returns an empty shared pointer.

◆ getUserResource()

template<typename TResourceType >
ResourceTypePtr kanzi::ContentReference< TResourceType >::getUserResource ( ) const
inline

Access user resource.

Returns
User resource shared pointer.

◆ resetUserResource()

template<typename TResourceType >
void kanzi::ContentReference< TResourceType >::resetUserResource ( )
inline

Clear user resource.

◆ setUserResource()

template<typename TResourceType >
void kanzi::ContentReference< TResourceType >::setUserResource ( ResourceTypePtr  userResource)
inline

Set user resource.

Parameters
userResourceNew user resource.

◆ setCallback()

template<typename TResourceType >
void kanzi::ContentReference< TResourceType >::setCallback ( CallbackType  callback)
inline

◆ get()

template<typename TResourceType >
ResourceTypePtr kanzi::ContentReference< TResourceType >::get ( ) const
inline

◆ operator->()

template<typename TResourceType >
TResourceType* kanzi::ContentReference< TResourceType >::operator-> ( ) const
inline

◆ operator*()

template<typename TResourceType >
TResourceType& kanzi::ContentReference< TResourceType >::operator* ( ) const
inline

◆ resolve() [1/2]

template<typename TResourceType >
ResourceTypePtr& kanzi::ContentReference< TResourceType >::resolve ( )
inlineprotected

◆ resolve() [2/2]

template<typename TResourceType >
const ResourceTypePtr& kanzi::ContentReference< TResourceType >::resolve ( ) const
inlineprotected

◆ updateResource()

template<typename TResourceType >
void kanzi::ContentReference< TResourceType >::updateResource ( )
protected

◆ updateChangeFlags()

template<typename TResourceType >
void kanzi::ContentReference< TResourceType >::updateChangeFlags ( ) const
protected

◆ notifyCallback()

template<typename TResourceType >
void kanzi::ContentReference< TResourceType >::notifyCallback ( )
inlineprotected

◆ updateResolveNotify()

template<typename TResourceType >
void kanzi::ContentReference< TResourceType >::updateResolveNotify ( bool  onDetach)
inlineprotected

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