Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
WLink< TAR > Class Template Reference

#include "stage/model/w-link.hpp"

Description

template<class TAR>
class stage::model::WLink< TAR >

Managed link to a sigc::trackable UI widget, without taking ownership.

Automatically installs a callback to switch this link into detached state when the target (widget) is destroyed.

Template Parameters
TARthe actual target widget type, which can be forward declared, until the point where the widget is actually constructed or attached. This target type must derive from sigc::trackable
Warning
not threadsafe
Note
only EX_SANE, since attaching, detaching and swapping might throw.

Definition at line 79 of file w-link.hpp.

Public Member Functions

 ~WLink ()
 
 WLink () noexcept
 
 WLink (TAR &targetWidget)
 
 WLink (WLink const &r)
 
 WLink (WLink &&rr)
 
WLinkoperator= (WLink other)
 
 operator bool () const
 
TAR & operator* () const
 
TAR * operator-> () const
 
bool isValid () const
 
bool isActive () const
 
void clear ()
 detach and deactivate this link
 
void connect (TAR &otherTarget)
 (re)connect this smart link to the given target.
 

Friends

void swap (WLink &l, WLink &r)
 swap the pointees, including callback registration.
 

Private Member Functions

void __ensureAlive () const
 
TAR * attachTo (TAR &target)
 

Private Attributes

TAR * widget_
 

Constructor & Destructor Documentation

◆ ~WLink()

template<class TAR >
~WLink ( )
inline

Definition at line 86 of file w-link.hpp.

References WLink< TAR >::clear(), and ERROR_LOG_AND_IGNORE.

+ Here is the call graph for this function:

◆ WLink() [1/4]

template<class TAR >
WLink ( )
inlinenoexcept

Definition at line 93 of file w-link.hpp.

◆ WLink() [2/4]

template<class TAR >
WLink ( TAR &  targetWidget)
inlineexplicit

Definition at line 98 of file w-link.hpp.

◆ WLink() [3/4]

template<class TAR >
WLink ( WLink< TAR > const &  r)
inline

Definition at line 102 of file w-link.hpp.

◆ WLink() [4/4]

template<class TAR >
WLink ( WLink< TAR > &&  rr)
inline

Definition at line 106 of file w-link.hpp.

Member Function Documentation

◆ operator=()

template<class TAR >
WLink & operator= ( WLink< TAR >  other)
inline
Parameters
other
Warning
only EX_SANE

Definition at line 113 of file w-link.hpp.

References WLink< TAR >::swap.

◆ operator bool()

template<class TAR >
operator bool ( ) const
inlineexplicit

Definition at line 141 of file w-link.hpp.

References WLink< TAR >::widget_.

◆ operator*()

template<class TAR >
TAR & operator* ( ) const
inline

Definition at line 147 of file w-link.hpp.

References WLink< TAR >::__ensureAlive(), and WLink< TAR >::widget_.

+ Here is the call graph for this function:

◆ operator->()

template<class TAR >
TAR * operator-> ( ) const
inline

Definition at line 154 of file w-link.hpp.

References WLink< TAR >::__ensureAlive(), and WLink< TAR >::widget_.

+ Here is the call graph for this function:

◆ isValid()

template<class TAR >
bool isValid ( ) const
inline

Definition at line 161 of file w-link.hpp.

◆ isActive()

template<class TAR >
bool isActive ( ) const
inline

Definition at line 162 of file w-link.hpp.

◆ clear()

template<class TAR >
void clear ( )
inline

detach and deactivate this link

Note
EX_STRONG (but only under the assumption that also sigc::trackable::remove_destroy_notify_cllback is EX_STRONG)

Definition at line 170 of file w-link.hpp.

References WLink< TAR >::widget_.

Referenced by WLink< TAR >::~WLink(), and WLink< TAR >::connect().

+ Here is the caller graph for this function:

◆ connect()

template<class TAR >
void connect ( TAR &  otherTarget)
inline

(re)connect this smart link to the given target.

Any previously existing link is detached beforehand

Note
EX_SANE only (assuming sigc::trackable is sane) Might leave this WLink in disconnected state when throwing
Exceptions
error::Externalwhen registration with sigc::trackable fails

Definition at line 184 of file w-link.hpp.

References WLink< TAR >::attachTo(), WLink< TAR >::clear(), and WLink< TAR >::widget_.

Referenced by PlayPanel::accessViewer(), and WLink_test::verify_reconnect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __ensureAlive()

template<class TAR >
void __ensureAlive ( ) const
inlineprivate

Definition at line 193 of file w-link.hpp.

References LERR_, and WLink< TAR >::widget_.

Referenced by WLink< TAR >::operator*(), and WLink< TAR >::operator->().

+ Here is the caller graph for this function:

◆ attachTo()

template<class TAR >
TAR * attachTo ( TAR &  target)
inlineprivate

installs the necessary callback to detach this link in case the target is destroyed

Note
EX_STRONG

Definition at line 205 of file w-link.hpp.

References WLink< TAR >::widget_.

Referenced by WLink< TAR >::connect().

+ Here is the caller graph for this function:

Member Data Documentation

◆ widget_

Friends And Related Symbol Documentation

◆ swap

template<class TAR >
void swap ( WLink< TAR > &  l,
WLink< TAR > &  r 
)
friend

swap the pointees, including callback registration.

Warning
only EX_SANE. Might leave the following intermediary states
  • only r was detached
  • both r and l are detached
  • both detached, but only l attached to the former target of r, while the former target of l is now completely detached.

Definition at line 128 of file w-link.hpp.

Referenced by WLink< TAR >::operator=().

+ Inheritance diagram for WLink< TAR >:
+ Collaboration diagram for WLink< TAR >:

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