Base delegate type.
More...
#include <delegate.h>
|
| template<callable_c< return_t, args_t... > callable_t> |
| delegate_token_type | add_token (callable_t callable, priority ePriority=priority::normal) noexcept |
| | Add a callable using a token with manual unsubscribing. More...
|
| |
| template<class object_t > |
| delegate_token_type | add_token (object_t &object, return_t(object_t::*pMethod)(args_t...), priority ePriority=priority::normal) noexcept |
| | Add a callable using a token with manual unsubscribing. 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.
|
| |
| size_t | size () const noexcept |
| | Get the number of functions bound to this delegate. More...
|
| |
| bool | empty () const noexcept |
| | Check if this delegate is empty. More...
|
| |
|
| template<class... creation_args_t> |
| static derived_t | create_singlecast (creation_args_t... args) noexcept |
| | Create a singlecast delegate. More...
|
| |
|
| template<class invoke_single_t , class invoke_multiple_t > |
| return_t | execute_internal (const invoke_single_t &invokeSingle, const invoke_multiple_t &invokeMultiple) const noexcept |
| | Execute all callables. More...
|
| |
template<class derived_t, class return_t, class... args_t>
class qx::details::base_delegate< derived_t, return_t, args_t >
Base delegate type.
- 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
- 17.02.2026
Definition at line 83 of file delegate.h.
◆ add_destruction_callback() [1/2]
template<class derived_t , class 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 103 of file delegate.inl.
◆ add_destruction_callback() [2/2]
template<class derived_t , class 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 113 of file delegate.inl.
◆ add_token() [1/2]
template<class derived_t , class return_t , class... args_t>
template<callable_c< return_t, args_t... > callable_t>
Add a callable using a token with manual unsubscribing.
- Warning
- If you capture
this in the lambda passed and the object becomes invalid, it'll crash. You must unsubscribe manually using remove() Consider using add_destruction_callback or add_weak.
- 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 75 of file delegate.inl.
◆ add_token() [2/2]
template<class derived_t , class return_t , class... args_t>
template<class object_t >
Add a callable using a token with manual unsubscribing.
- Warning
- If you capture
this in the lambda passed and the object becomes invalid, it'll crash. You must unsubscribe manually using remove() Consider using add_destruction_callback or add_weak.
- 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
-
| - | a token that can be used to remove this callable from the delegate |
Definition at line 87 of file delegate.inl.
◆ add_weak() [1/2]
template<class derived_t , class 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 129 of file delegate.inl.
◆ add_weak() [2/2]
template<class derived_t , class 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 148 of file delegate.inl.
◆ create_singlecast()
template<class derived_t , class return_t , class... args_t>
template<class... creation_args_t>
Create a singlecast delegate.
- Template Parameters
-
| creation_args_t | - any arguments that can be used in add_weak or add_token |
- Parameters
-
| args | - template parameter pack |
- Return values
-
Definition at line 60 of file delegate.inl.
◆ empty()
template<class derived_t , class return_t , class... args_t>
Check if this delegate is empty.
- Return values
-
| - | true if this delegate is empty |
Definition at line 230 of file delegate.inl.
◆ execute_internal()
template<class derived_t , class return_t , class... args_t>
template<class invoke_single_t , class invoke_multiple_t >
| return_t qx::details::base_delegate< derived_t, return_t, args_t >::execute_internal |
( |
const invoke_single_t & |
invokeSingle, |
|
|
const invoke_multiple_t & |
invokeMultiple |
|
) |
| const |
|
protectednoexcept |
Execute all callables.
- Template Parameters
-
| invoke_single_t | - a callable type that executes a delegate callable by moving args into it |
| invoke_multiple_t | - a callable type that executes a delegate callable by copying args into it |
- Parameters
-
| invokeSingle | - invoke_single_t object |
| invokeMultiple | - invoke_multiple_t object |
- Return values
-
| - | void or piping result of all delegate callables |
Definition at line 237 of file delegate.inl.
◆ remove()
template<class derived_t , class return_t , class... args_t>
Remove a callable using its token.
- Parameters
-
- Return values
-
| - | true is a callable was deleted |
Definition at line 166 of file delegate.inl.
◆ size()
template<class derived_t , class return_t , class... args_t>
Get the number of functions bound to this delegate.
- Return values
-
| - | the number of functions bound to this delegate |
Definition at line 204 of file delegate.inl.
The documentation for this class was generated from the following files: