61 typedef std::vector<base_type*> list_type;
68 template<
typename... Args>
77template<
typename... Args>
158 std::vector<std::weak_ptr<func_type>> _list;
166 bool validListener()
override;
175 std::shared_ptr<func_type> _ptr{};
181#include <misc/gen/TListener.hpp>
Base class used as container for classes having listeners created by sf::TListener template.
Definition TListener.h:13
size_t cleanupListeners()
Removes all invalid/unused entries. There is no real need call this method explicitly since it is cal...
size_t flushListeners()
Deletes all the linked entries in the list.
size_t removeListener(const base_type *entry)
Removes the given entry from the list.
~ListenerList()
Destructor deleting all entries by calling flushListeners().
Emitter class type for creating an instance which is emitting events to listeners.
Definition TListener.h:112
size_t cleanup()
Removes expired listeners.
TListener * link(ListenerList *list, T *obj, void(T::*method)(Args... args)) const
Assigns a listener instance to this handler instance and also to the passed listener list.
TListener * link(ListenerList *list, const func_type &function) const
Assigns a listener instance to this handler instance and also to the passed listener list.
void flush()
Removes all listeners.
void call(Args... args)
Calls the linked listeners and also cleans up when pointer expired.
~emitter_type()
Destructor clearing all shared pointers.
Template class used to bind listeners to a handler_type instance.
Definition TListener.h:79
~TListener() override
Overridden destructor from ListenerList::base_type in order to delete entries of any instantiated tem...
TListener listener_type
Listener type of the lambda or function. This type is wraps around a std::function.
Definition TListener.h:89
TListener(ListenerList *list, const func_type &lambda)
Constructor.
std::function< void(Args...)> func_type
Function type of the lambda or function.
Definition TListener.h:84
TListener(const TListener &)=delete
Do not allow copying.
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10
Type definition of a class having a virtual destructor used as a base class for sf::TListener.
Definition TListener.h:19
virtual ~base_type()=default
virtual bool validListener()=0
Will be overloaded in template to check the emitter has gone away.