![]() |
xtd - Reference Guide
0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
|
#include <delegate.h>
Represents a delegate, which is a data structure that refers to a static method or to a class instance && an instance method of that class.
Inherits xtd::object.
Public Types | |
using | function_t = std::function< result_t()> |
function_t pointer type | |
Public Member Functions | |
delegate ()=default | |
Initializes an empty delegate. | |
delegate (const delegate &delegate) noexcept | |
Initializes a delegate that invokes the specified delegate instance. | |
template<typename object1_t , typename object2_t > | |
delegate (const object1_t &object, result_t(object2_t::*method)() const) noexcept | |
Initializes a delegate that invokes the specified instance method on the specified class instance. | |
template<typename object1_t , typename object2_t > | |
delegate (const object1_t &object, result_t(object2_t::*method)()) noexcept | |
Initializes a delegate that invokes the specified instance method on the specified class instance. | |
void | clear () |
Clear delegates array. | |
const std::vector< function_t > & | functions () const |
Gets the delegates array. | |
result_t | invoke () const |
invokes the method represented by the current delegate. | |
bool | is_empty () const noexcept |
Return if the delegate is empty. | |
bool | operator!= (const delegate &delegate) const |
Determines whether this instance and another specified delegateType object have the same value. | |
result_t | operator() () const |
invokes the method represented by the current delegate. | |
delegate & | operator= (const function_t &function) noexcept |
bool | operator== (const delegate &delegate) const noexcept |
Determines whether this instance and another specified delegateType object have the same value. | |
![]() | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual bool | equals (const object &obj) const noexcept |
Determines whether the specified object is equal to the current object. | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. | |
template<typename object_t > | |
std::unique_ptr< object_t > | memberwise_clone () const |
Gets the type of the current instance. | |
virtual xtd::ustring | to_string () const noexcept |
Returns a std::string that represents the current object. | |
Static Public Member Functions | |
static delegate | combine (const delegate &a, const delegate &b) noexcept |
Concatenates the invocation lists of two delegates. | |
static delegate | combine (const std::vector< delegate > &delegates) noexcept |
Concatenates the invocation lists of an array of delegates. | |
static delegate | remove (const delegate &source, const delegate &value) noexcept |
removes the last occurrence of the invocation list of a delegate from the invocation list of another delegate. | |
static delegate | remove_all (const delegate &source, const delegate &value) noexcept |
removes all occurrences of the invocation list of a delegate from the invocation list of another delegate. | |
![]() | |
static bool | equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are the same instance. | |
using xtd::delegate< result_t()>::function_t = std::function <result_t()> |
function_t pointer type
|
default |
Initializes an empty delegate.
|
inlinenoexcept |
Initializes a delegate that invokes the specified delegate instance.
delegate | The delegate instance. |
|
inlinenoexcept |
Initializes a delegate that invokes the specified instance method on the specified class instance.
object | the class instance. |
function | the method instance. |
|
inlinenoexcept |
Initializes a delegate that invokes the specified instance method on the specified class instance.
object | the class instance. |
function | the method instance. |
|
inline |
Clear delegates array.
|
inlinestaticnoexcept |
Concatenates the invocation lists of two delegates.
a | The delegate whose invocation list comes first. |
b | The delegate whose invocation list comes second. |
|
inlinestaticnoexcept |
Concatenates the invocation lists of an array of delegates.
delegates | The array of delegates to combine. |
|
inline |
Gets the delegates array.
|
inline |
invokes the method represented by the current delegate.
arguments | The parameter list. |
|
inlinenoexcept |
Return if the delegate is empty.
|
inline |
Determines whether this instance and another specified delegateType object have the same value.
value | The delegateType to compare. |
|
inline |
invokes the method represented by the current delegate.
arguments | The parameter list. |
|
inlinenoexcept |
Determines whether this instance and another specified delegateType object have the same value.
value | The delegateType to compare. |
|
inlinestaticnoexcept |
removes the last occurrence of the invocation list of a delegate from the invocation list of another delegate.
source | The delegate from which to remove the invocation list of value. |
value | The delegate that supplies the invocation list to remove from the invocation list of source. |
|
inlinestaticnoexcept |
removes all occurrences of the invocation list of a delegate from the invocation list of another delegate.
source | The delegate from which to remove the invocation list of value. |
value | The delegate that supplies the invocation list to remove from the invocation list of source. |