33#include <Pt/Callable.h>
34#include <Pt/Connectable.h>
46template <
typename R,
typename ClassT,
typename... As>
86 return (_object->*_method)(args...);
92 (_object->*_method)(args...);
103 _object = other._object;
104 _method = other._method;
112 return _object == other._object && _method == other._method;
124template <
typename R,
typename ClassT,
typename... As>
149 _method.object().onConnectionOpen(connection);
155 _method.object().onConnectionClose(connection);
162 return other && _method == other->_method;
166 Method<R, ClassT, As...> _method;
174template <
typename R,
typename BaseT,
typename ClassT,
typename... As>
177 return Method<R, ClassT, As...>(object, method);
185template <
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
Method< R, ClassT, As... > callable(ClassT &object, R(BaseT::*method)(As...))
Returns a Method object for the given object/method pair.
Definition Method.h:175
Represents a connection between a Signal/Delegate and a slot.
Definition Connection.h:96
Wraps Method objects so that they can act as Slots.
Definition Method.h:126
virtual bool equals(const Slot &slot) const
Returns true if two slots are equal in value.
Definition Method.h:159
virtual const Callback * callable() const
Returns the callable converted to the type-erased Callback interface.
Definition Method.h:141
virtual void onDisconnect(const Connection &connection)
Notifies of disconnects.
Definition Method.h:153
virtual void onConnect(const Connection &connection)
Notifies of connects.
Definition Method.h:147
MethodSlot(const Method< R, ClassT, As... > &method)
Constructs from callable.
Definition Method.h:130
Slot * clone() const
Clone this object with new.
Definition Method.h:135
Adapter for class methods.
Definition Method.h:48
ClassT & object()
Returns a reference to this object's wrapped ClassT object.
Definition Method.h:64
const MemFuncT & method() const
Returns a reference to the wrapped member function.
Definition Method.h:78
R(ClassT::*) MemFuncT(As...)
The wrapped member function signature.
Definition Method.h:52
bool operator==(const Method &other) const
Returns true if both use the same object and function pointer.
Definition Method.h:110
Method * clone() const
Returns a copy of this instance.
Definition Method.h:96
Method(ClassT &object, MemFuncT method)
Wraps the given object/member pair.
Definition Method.h:57
R call(As... args) const
Calls the callable entity and returns its result.
Definition Method.h:84
void invoke(As... args) const
Invokes the invokable entity with the given arguments.
Definition Method.h:90
const ClassT & object() const
Returns a const reference to the wrapped ClassT object.
Definition Method.h:71
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.
MethodSlot< R, ClassT, As... > slot(ClassT &object, R(BaseT::*method)(As...))
Returns a slot object for the given object/member pair.
Definition Method.h:186
Core module.
Definition Allocator.h:33