EasyDelegate  2.0
Delegate and deferred callers for C++11.
Public Types | Public Member Functions | List of all members
EasyDelegate::StaticDelegate< returnType, parameters > Class Template Reference

A delegate of a static method. More...

#include <delegates.hpp>

Inheritance diagram for EasyDelegate::StaticDelegate< returnType, parameters >:
EasyDelegate::ITypedDelegate< returnType, parameters...> EasyDelegate::IDelegate

Public Types

typedef StaticMethodPointer< returnType, parameters...> MethodPointer
 Helper typedef referring to a static method pointer that is compatible with this delegate.
 
- Public Types inherited from EasyDelegate::ITypedDelegate< returnType, parameters...>
typedef returnType ReturnType
 Helper typedef referring to the return type of this delegate.
 
typedef StaticDelegate< returnType, parameters...> StaticDelegateType
 Helper typedef for when building static delegates.
 
using MemberDelegateType = MemberDelegate< classType, returnType, parameters...>
 Helper typedef for when building member delegates.
 
typedef StaticMethodPointer< returnType, parameters...> StaticMethodPointerType
 Helper typedef referring to a static function pointer.
 
using MemberDelegateFuncPtr = returnType(classType::*)(parameters...)
 Helper typedef referring to a class member method pointer.
 

Public Member Functions

 StaticDelegate (const MethodPointer methodPointer)
 Constructor accepting a static method. More...
 
 StaticDelegate (const StaticDelegate< returnType, parameters...> *other)
 Standard copy constructor. More...
 
returnType invoke (parameters...params)
 Invokes the StaticDelegate. More...
 
EASYDELEGATE_INLINE bool hasThisPointer (const void *thisPointer) const noexcept
 Returns whether or not this StaticDelegate calls against the given this pointer. More...
 
EASYDELEGATE_INLINE bool callsMethod (const MethodPointer methodPointer) const noexcept
 Returns whether or not this StaticDelegate calls the given static method. More...
 
template<typename otherClass , typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool callsMethod (const MemberMethodPointer< otherClass, otherReturn, otherParams...> methodPointer) const noexcept
 Returns whether or not this StaticDelegate calls the given class member method. More...
 
EASYDELEGATE_INLINE bool hasSameMethodAs (const StaticDelegate< returnType, parameters...> *other) const noexcept
 Returns whether or not this StaticDelegate calls the same method as the StaticDelegate we are checking against. More...
 
template<typename otherClass , typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool hasSameMethodAs (const MemberDelegate< otherClass, otherReturn, otherParams...> *other) const noexcept
 Returns whether or not this StaticDelegate calls against the same method as the MemberDelegate we are checking against. More...
 
template<typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool hasSameMethodAs (const StaticDelegate< otherReturn, otherParams...> *other) const noexcept
 Returns whether or not this StaticDelegate calls against the same method as the StaticDelegate we are checking against. More...
 
template<typename otherClass , typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool hasSameThisPointerAs (const MemberDelegate< otherClass, otherReturn, otherParams...> *other) const noexcept
 Returns whether or not this StaticDelegate uses the same this pointer as the MemberDelegate we are checking against. More...
 
template<typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool hasSameThisPointerAs (const StaticDelegate< otherReturn, otherParams...> *other) const noexcept
 Returns whether or not this StaticDelegate uses the same this pointer as the StaticDelegate we are checking against. More...
 
- Public Member Functions inherited from EasyDelegate::ITypedDelegate< returnType, parameters...>
 ITypedDelegate (const bool &isMemberDelegate) noexcept
 Constructor accepting a boolean. More...
 
bool callsMethod (const MemberDelegateFuncPtr< className > methodPointer) const noexcept
 Returns whether or not this delegate calls the given class member method address. More...
 

Additional Inherited Members

- Public Attributes inherited from EasyDelegate::IDelegate
const bool mIsMemberDelegate
 A boolean representing whether or not this delegate is a member delegate.
 
- Protected Member Functions inherited from EasyDelegate::IDelegate
 IDelegate (const bool &isMemberDelegate) noexcept
 Constructor accepting a boolean. More...
 

Detailed Description

template<typename returnType, typename... parameters>
class EasyDelegate::StaticDelegate< returnType, parameters >

A delegate of a static method.

A static delegate allows you to create a sort of handle to a given static method. This handle can then be used to invoke the method anonymously.

Constructor & Destructor Documentation

template<typename returnType, typename... parameters>
EasyDelegate::StaticDelegate< returnType, parameters >::StaticDelegate ( const MethodPointer  methodPointer)
inline

Constructor accepting a static method.

Parameters
methodPointerThe address of the static method that this delegate is intended to invoke.
template<typename returnType, typename... parameters>
EasyDelegate::StaticDelegate< returnType, parameters >::StaticDelegate ( const StaticDelegate< returnType, parameters...> *  other)
inline

Standard copy constructor.

Parameters
otherA pointer to a StaticDelegate with the same method signature to copy.

Member Function Documentation

template<typename returnType, typename... parameters>
EASYDELEGATE_INLINE bool EasyDelegate::StaticDelegate< returnType, parameters >::callsMethod ( const MethodPointer  methodPointer) const
inlinevirtualnoexcept

Returns whether or not this StaticDelegate calls the given static method.

Parameters
methodPointerA pointer to the static method to be checked against.
Returns
A boolean representing whether or not this StaticDelegate calls the given static method.

Implements EasyDelegate::ITypedDelegate< returnType, parameters...>.

template<typename returnType, typename... parameters>
template<typename otherClass , typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool EasyDelegate::StaticDelegate< returnType, parameters >::callsMethod ( const MemberMethodPointer< otherClass, otherReturn, otherParams...>  methodPointer) const
inlinenoexcept

Returns whether or not this StaticDelegate calls the given class member method.

Parameters
methodPointerA pointer to the class member method to be checked against.
Returns
A boolean representing whether or not this StaticDelegate calls the given class member method.
Note
Always returns false because StaticDelegates don't call class member methods.
template<typename returnType, typename... parameters>
EASYDELEGATE_INLINE bool EasyDelegate::StaticDelegate< returnType, parameters >::hasSameMethodAs ( const StaticDelegate< returnType, parameters...> *  other) const
inlinenoexcept

Returns whether or not this StaticDelegate calls the same method as the StaticDelegate we are checking against.

Parameters
otherThe other StaticDelegate pointer to compare against.
Returns
A boolean representing whether or not this StaticDelegate calls the same method as the StaticDelegate to check against.
template<typename returnType, typename... parameters>
template<typename otherClass , typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool EasyDelegate::StaticDelegate< returnType, parameters >::hasSameMethodAs ( const MemberDelegate< otherClass, otherReturn, otherParams...> *  other) const
inlinenoexcept

Returns whether or not this StaticDelegate calls against the same method as the MemberDelegate we are checking against.

Parameters
otherThe other MemberDelegate pointer to compare against.
Note
Always returns false because a static method and a member method should never share the same address.
template<typename returnType, typename... parameters>
template<typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool EasyDelegate::StaticDelegate< returnType, parameters >::hasSameMethodAs ( const StaticDelegate< otherReturn, otherParams...> *  other) const
inlinenoexcept

Returns whether or not this StaticDelegate calls against the same method as the StaticDelegate we are checking against.

Parameters
otherThe other StaticDelegate pointer to compare against.
Note
Always returns false because this variant of hasSameMethodAs will be called for all other StaticDelegate types whose method signatures do not match our own. Thus, we can't possibly be sharing the same method.
template<typename returnType, typename... parameters>
template<typename otherClass , typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool EasyDelegate::StaticDelegate< returnType, parameters >::hasSameThisPointerAs ( const MemberDelegate< otherClass, otherReturn, otherParams...> *  other) const
inlinenoexcept

Returns whether or not this StaticDelegate uses the same this pointer as the MemberDelegate we are checking against.

Parameters
otherThe other MemberDelegate pointer to compare against.
Returns
A boolean representing whether or not this StaticDelegate uses the same this pointer as the MemberDelegate to check against.
Note
Always returns false because StaticDelegates do not use this pointers.
template<typename returnType, typename... parameters>
template<typename otherReturn , typename... otherParams>
EASYDELEGATE_INLINE bool EasyDelegate::StaticDelegate< returnType, parameters >::hasSameThisPointerAs ( const StaticDelegate< otherReturn, otherParams...> *  other) const
inlinenoexcept

Returns whether or not this StaticDelegate uses the same this pointer as the StaticDelegate we are checking against.

Parameters
otherThe other StaticDelegate pointer to compare against.
Returns
A boolean representing whether or not this StaticDelegate uses the same this pointer as the MemberDelegate to check against.
Note
Always returns false because StaticDelegates do not use this pointers.
template<typename returnType, typename... parameters>
EASYDELEGATE_INLINE bool EasyDelegate::StaticDelegate< returnType, parameters >::hasThisPointer ( const void *  thisPointer) const
inlinevirtualnoexcept

Returns whether or not this StaticDelegate calls against the given this pointer.

Parameters
thisPointerA pointer referring to the object of interest.
Returns
A boolean representing whether or not this StaticDelegate calls a member method against the given this pointer.
Note
Always returns false because StaticDelegates don't use a this pointer.

Implements EasyDelegate::ITypedDelegate< returnType, parameters...>.

template<typename returnType, typename... parameters>
returnType EasyDelegate::StaticDelegate< returnType, parameters >::invoke ( parameters...  params)
inlinevirtual

Invokes the StaticDelegate.

Parameters
paramsAnything; It depends on the method signature specified in the template.
Returns
Anything; It depends on the function signature specified in the template.
Exceptions
EasyDelegate::InvalidMethodPointerExceptionThrown when the static method that this delegate is supposed to be invoking is NULL.
std::exceptionPotentially thrown by the method called by this StaticDelegate.
Note
The call will not throw an exception in any of the EasyDelegate::DelegateException cases but rather assert if assertions are enabled.

Implements EasyDelegate::ITypedDelegate< returnType, parameters...>.


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