30#ifndef Pt_ConstMethod_h
31#define Pt_ConstMethod_h
33#include <Pt/Callable.h>
34#include <Pt/Connectable.h>
46template <
typename R,
typename ClassT,
typename... As>
79 return (_object->*_method)(args...);
85 (_object->*_method)(args...);
98 return _object == other._object && _method == other._method;
110template <
typename R,
typename ClassT,
typename... As>
135 _method.object().onConnectionOpen(connection);
141 _method.object().onConnectionClose(connection);
148 return other && _method == other->_method;
160template <
typename R,
typename BaseT,
typename ClassT,
typename... As>
163 return ConstMethod<R, ClassT, As...>(object, method);
171template <
typename R,
typename BaseT,
typename ClassT,
typename... As>
Base type for various "slot" types.
Definition Slot.h:92
An interface for all callable entities.
Definition Callable.h:48
ConstMethod< R, ClassT, As... > callable(ClassT &object, R(BaseT::*method)(As...) const)
Returns a ConstMethod object for the given object/method pair.
Definition ConstMethod.h:161
Represents a connection between a Signal/Delegate and a slot.
Definition Connection.h:96
Wraps ConstMethod objects so that they can act as Slots.
Definition ConstMethod.h:112
virtual bool equals(const Slot &slot) const
Returns true if two slots are equal in value.
Definition ConstMethod.h:145
virtual const Callback * callable() const
Returns the callable converted to the type-erased Callback interface.
Definition ConstMethod.h:127
virtual void onDisconnect(const Connection &connection)
Notifies of disconnects.
Definition ConstMethod.h:139
virtual void onConnect(const Connection &connection)
Notifies of connects.
Definition ConstMethod.h:133
ConstMethodSlot(const ConstMethod< R, ClassT, As... > &method)
Constructs from callable.
Definition ConstMethod.h:116
Slot * clone() const
Clone this object with new.
Definition ConstMethod.h:121
Adapter for const class methods.
Definition ConstMethod.h:48
ClassT & object()
Returns a reference to this object's bound ClassT object.
Definition ConstMethod.h:64
ConstMethod * clone() const
Returns a copy of this instance.
Definition ConstMethod.h:89
R call(As... args) const
Calls the callable entity and returns its result.
Definition ConstMethod.h:77
void invoke(As... args) const
Invokes the invokable entity with the given arguments.
Definition ConstMethod.h:83
R(ClassT::*) MemFuncT(As...) const
The wrapped member function type.
Definition ConstMethod.h:52
const ClassT & object() const
Returns a const reference to this object's bound ClassT object.
Definition ConstMethod.h:71
ConstMethod(ClassT &object, MemFuncT method)
Wraps the given member function of the given object.
Definition ConstMethod.h:57
bool operator==(const ConstMethod &other) const
Returns true if both use the same object and function pointer.
Definition ConstMethod.h:96
Endpoint of a signal/slot connection.
Definition Slot.h:55
ConstMethodSlot< R, ClassT, As... > slot(ClassT &object, R(BaseT::*method)(As...) const)
Definition ConstMethod.h:172
virtual const Callback * callable() const =0
Returns the callable converted to the type-erased Callback interface.
Core module.
Definition Allocator.h:33