|
template<callable_c< return_t, args_t... > callable_t> |
delegate_token_type | add_free (callable_t callable, priority ePriority=priority::normal) noexcept |
| Add a callable without any protection. More...
|
|
template<callable_c< return_t, args_t... > callable_t> |
destruction_callback | add_destruction_callback (callable_t callable, priority ePriority=priority::normal) noexcept |
| Add a callable that will be removed from the delegate when its destruction callback is destroyed. More...
|
|
template<class object_t > |
destruction_callback | add_destruction_callback (object_t &object, return_t(object_t::*pMethod)(args_t...), priority ePriority=priority::normal) noexcept |
| Add a callable that will be removed from the delegate when its destruction callback is destroyed. More...
|
|
template<class object_t , callable_c< return_t, args_t... > callable_t> |
delegate_token_type | add_weak (std::weak_ptr< object_t > pWeakObject, callable_t callable, priority ePriority=priority::normal) noexcept |
| Add a callable that will be executed only if the appropriate weak object is valid. More...
|
|
template<class object_t > |
delegate_token_type | add_weak (std::weak_ptr< object_t > pWeakObject, return_t(object_t::*pMethod)(args_t...), priority ePriority=priority::normal) noexcept |
| Add a callable that will be executed only if the appropriate weak object is valid. More...
|
|
bool | remove (delegate_token_type token) noexcept |
| Remove a callable using its token. More...
|
|
void | clear () noexcept |
| Clear all the callables in this delegate.
|
|
template<class derived_t, delegate_return_c return_t, class... args_t>
class qx::base_delegate< derived_t, return_t, args_t >
Single or multicast delegate. Use the qx::delegate<> class in your code.
For a singlecast version:
- Create with qx::delegate<...>::create_singlecast(...)
- Call delegate.execute(...) For a multicast version:
- Default construct
- All various callbacks with delegate.add_xxx(...)
- Call delegate.execute(...)
- Template Parameters
-
derived_t | - CRTP derived class type |
return_t | - the exact type that all the passed callables and execute() should return |
args_t | - the exact type that all the passed callables and execute() should take |
- Author
- Khrapov
- Date
- 4.07.2025
Definition at line 53 of file delegate.h.
template<class derived_t , delegate_return_c return_t, class... args_t>
template<callable_c< return_t, args_t... > callable_t>
Add a callable that will be removed from the delegate when its destruction callback is destroyed.
- Template Parameters
-
callable_t | - any callable type: lambda, function, static method pointer, ect |
- Parameters
-
callable | - callable object |
ePriority | - callable priority. Callables will be called in order of priority, from highest to lowest, and in the order they were added. |
- Return values
-
- | an object that removes this callable from the delegate on its destruction |
Definition at line 88 of file delegate.inl.
template<class derived_t , delegate_return_c return_t, class... args_t>
template<class object_t >
Add a callable that will be removed from the delegate when its destruction callback is destroyed.
- Template Parameters
-
- Parameters
-
object | - object reference |
pMethod | - object's method pointer |
ePriority | - callable priority. Callables will be called in order of priority, from highest to lowest, and in the order they were added. |
- Return values
-
- | an object that removes this callable from the delegate on its destruction |
Definition at line 97 of file delegate.inl.
template<class derived_t , delegate_return_c return_t, class... args_t>
template<callable_c< return_t, args_t... > callable_t>
Add a callable without any protection.
- Warning
- If you capture
this
in the lambda passed and the object becomes invalid, it'll crash. Consider add_destruction_callback or add_weak in this case.
- Template Parameters
-
callable_t | - any callable type: lambda, function, static method pointer, ect |
- Parameters
-
callable | - callable object |
ePriority | - callable priority. Callables will be called in order of priority, from highest to lowest, and in the order they were added. |
- Return values
-
- | a token that can be used to remove this callable from the delegate |
Definition at line 77 of file delegate.inl.
template<class derived_t , delegate_return_c return_t, class... args_t>
template<class object_t , callable_c< return_t, args_t... > callable_t>
Add a callable that will be executed only if the appropriate weak object is valid.
- Template Parameters
-
object_t | - object type |
callable_t | - any callable type: lambda, function, static method pointer, ect |
- Parameters
-
pWeakObject | - an object to track |
callable | - callable object |
ePriority | - callable priority. Callables will be called in order of priority, from highest to lowest, and in the order they were added. |
- Return values
-
- | a token that can be used to remove this callable from the delegate |
Definition at line 130 of file delegate.inl.
template<class derived_t , delegate_return_c return_t, class... args_t>
template<class object_t >
Add a callable that will be executed only if the appropriate weak object is valid.
- Template Parameters
-
- Parameters
-
pWeakObject | - an object to track and to apply the method to |
pMethod | - object's method pointer |
ePriority | - callable priority. Callables will be called in order of priority, from highest to lowest, and in the order they were added. |
- Return values
-
- | a token that can be used to remove this callable from the delegate |
Definition at line 112 of file delegate.inl.
template<class derived_t , delegate_return_c return_t, class... args_t>
template<class... creation_args_t>
derived_t qx::base_delegate< derived_t, return_t, args_t >::create_singlecast |
( |
creation_args_t... |
args | ) |
|
|
staticnoexcept |
Create a singlecast delegate.
- Template Parameters
-
creation_args_t | - any arguments that can be used in add_weak or add_free |
- Parameters
-
args | - template parameter pack |
- Return values
-
Definition at line 62 of file delegate.inl.