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