|
|
| Delegate (std::nullptr_t=nullptr) |
| | 默认构造函数
|
| |
|
| Delegate (const ICallable< TRet(Args...)> &callable) |
| | 构造函数,接受一个可调用对象
|
| |
|
| Delegate (TRet(*func)(Args...)) |
| | 构造函数,接受一个函数指针
|
| |
|
template<typename T , typename std::enable_if<!std::is_base_of< _ICallable, T >::value, int >::type = 0> |
| | Delegate (const T &callable) |
| | 构造函数,接受一个可调用对象
|
| |
|
template<typename T > |
| | Delegate (T &obj, TRet(T::*func)(Args...)) |
| | 构造函数,接受一个成员函数指针
|
| |
|
template<typename T > |
| | Delegate (const T &obj, TRet(T::*func)(Args...) const) |
| | 构造函数,接受一个常量成员函数指针
|
| |
|
| Delegate (const Delegate &other) |
| | 拷贝构造函数
|
| |
|
| Delegate (Delegate &&other) noexcept |
| | 移动构造函数
|
| |
|
Delegate & | operator= (const Delegate &other) |
| | 拷贝赋值运算符
|
| |
|
Delegate & | operator= (Delegate &&other) noexcept |
| | 移动赋值运算符
|
| |
|
void | Add (const ICallable< TRet(Args...)> &callable) |
| | 添加一个可调用对象到委托中
|
| |
|
void | Add (TRet(*func)(Args...)) |
| | 添加一个函数指针到委托中
|
| |
|
template<typename T > |
| std::enable_if<!std::is_base_of< _ICallable, T >::value, void >::type | Add (const T &callable) |
| | 添加一个可调用对象到委托中
|
| |
|
template<typename T > |
| void | Add (T &obj, TRet(T::*func)(Args...)) |
| | 添加一个成员函数指针到委托中
|
| |
|
template<typename T > |
| void | Add (const T &obj, TRet(T::*func)(Args...) const) |
| | 添加一个常量成员函数指针到委托中
|
| |
|
void | Clear () |
| | 清空委托中的所有可调用对象
|
| |
| bool | Remove (const ICallable< TRet(Args...)> &callable) |
| | 移除一个可调用对象
|
| |
| bool | Remove (TRet(*func)(Args...)) |
| | 移除一个函数指针
|
| |
| template<typename T > |
| std::enable_if<!std::is_base_of< _ICallable, T >::value, bool >::type | Remove (const T &callable) |
| | 移除一个可调用对象
|
| |
| template<typename T > |
| bool | Remove (T &obj, TRet(T::*func)(Args...)) |
| | 移除一个成员函数指针
|
| |
| template<typename T > |
| bool | Remove (const T &obj, TRet(T::*func)(Args...) const) |
| | 移除一个常量成员函数指针
|
| |
| TRet | operator() (Args... args) const |
| | 调用委托,执行所有存储的可调用对象
|
| |
| bool | operator== (const Delegate &other) const |
| | 判断当前委托是否等于另一个委托
|
| |
| bool | operator!= (const Delegate &other) const |
| | 判断当前委托是否不等于另一个委托
|
| |
| bool | operator== (std::nullptr_t) const noexcept |
| | 判断当前委托是否等于nullptr
|
| |
| bool | operator!= (std::nullptr_t) const noexcept |
| | 判断当前委托是否不等于nullptr
|
| |
| | operator bool () const noexcept |
| | 判断当前委托是否有效
|
| |
| Delegate & | operator+= (const ICallable< TRet(Args...)> &callable) |
| | 添加一个可调用对象到委托中
|
| |
| Delegate & | operator+= (TRet(*func)(Args...)) |
| | 添加一个函数指针到委托中
|
| |
| template<typename T > |
| std::enable_if<!std::is_base_of< _ICallable, T >::value, Delegate & >::type | operator+= (const T &callable) |
| | 添加一个可调用对象到委托中
|
| |
| Delegate & | operator-= (const ICallable< TRet(Args...)> &callable) |
| | 移除一个可调用对象
|
| |
| Delegate & | operator-= (TRet(*func)(Args...)) |
| | 移除一个函数指针
|
| |
| template<typename T > |
| std::enable_if<!std::is_base_of< _ICallable, T >::value, Delegate & >::type | operator-= (const T &callable) |
| | 移除一个可调用对象
|
| |
| virtual TRet | Invoke (Args... args) const override |
| | 调用委托,执行所有存储的可调用对象
|
| |
| virtual ICallable< TRet(Args...)> * | Clone () const override |
| | 克隆当前委托
|
| |
| virtual std::type_index | GetType () const override |
| | 获取当前委托的类型信息
|
| |
| virtual bool | Equals (const ICallable< TRet(Args...)> &other) const override |
| | 判断当前委托是否与另一个可调用对象相等
|
| |
| template<typename U = TRet> |
| std::enable_if<!std::is_void< U >::value, std::vector< U > >::type | InvokeAll (Args... args) const |
| | 调用所有存储的可调用对象,并返回它们的结果
|
| |
|
virtual | ~ICallable ()=default |
| | 析构函数
|
| |
| virtual bool | Equals (const ICallable &other) const =0 |
| | 判断当前可调用对象是否与另一个可调用对象相等
|
| |
template<typename TRet, typename... Args>
class sw::Delegate< TRet(Args...)>
委托类,类似于C::中的委托,支持存储和调用任意可调用对象