diff --git a/rak/functional.h b/rak/functional.h index 247bf0035..a8fa8b4fa 100644 --- a/rak/functional.h +++ b/rak/functional.h @@ -445,175 +445,6 @@ bind2nd(const Operation& op, const Type& val) { // be replaced by TR1 stuff later. Requires an object to bind, instead // of using a seperate functor for that. -template -class ptr_fun0 { -public: - typedef Ret result_type; - typedef Ret (*Function)(); - - ptr_fun0() {} - ptr_fun0(Function f) : m_function(f) {} - - bool is_valid() const { return m_function; } - - Ret operator () () { return m_function(); } - -private: - Function m_function; -}; - -template -class mem_fun0 { -public: - typedef Ret result_type; - typedef Ret (Object::*Function)(); - - mem_fun0() : m_object(NULL) {} - mem_fun0(Object* o, Function f) : m_object(o), m_function(f) {} - - bool is_valid() const { return m_object; } - - Ret operator () () { return (m_object->*m_function)(); } - -private: - Object* m_object; - Function m_function; -}; - -template -class const_mem_fun0 { -public: - typedef Ret result_type; - typedef Ret (Object::*Function)() const; - - const_mem_fun0() : m_object(NULL) {} - const_mem_fun0(const Object* o, Function f) : m_object(o), m_function(f) {} - - bool is_valid() const { return m_object; } - - Ret operator () () const { return (m_object->*m_function)(); } - -private: - const Object* m_object; - Function m_function; -}; - -template -class mem_fun1 { -public: - typedef Ret result_type; - typedef Ret (Object::*Function)(Arg1); - - mem_fun1() : m_object(NULL) {} - mem_fun1(Object* o, Function f) : m_object(o), m_function(f) {} - - bool is_valid() const { return m_object; } - - Ret operator () (Arg1 a1) { return (m_object->*m_function)(a1); } - -private: - Object* m_object; - Function m_function; -}; - -template -class const_mem_fun1 { -public: - typedef Ret result_type; - typedef Ret (Object::*Function)(Arg1) const; - - const_mem_fun1() : m_object(NULL) {} - const_mem_fun1(const Object* o, Function f) : m_object(o), m_function(f) {} - - bool is_valid() const { return m_object; } - - Ret operator () (Arg1 a1) const { return (m_object->*m_function)(a1); } - -private: - const Object* m_object; - Function m_function; -}; - -template -class mem_fun2 : public std::binary_function { -public: - typedef Ret result_type; - typedef Ret (Object::*Function)(Arg1, Arg2); - typedef Object object_type; - - mem_fun2() : m_object(NULL) {} - mem_fun2(Object* o, Function f) : m_object(o), m_function(f) {} - - bool is_valid() const { return m_object; } - - object_type* object() { return m_object; } - const object_type* object() const { return m_object; } - - Ret operator () (Arg1 a1, Arg2 a2) { return (m_object->*m_function)(a1, a2); } - -private: - Object* m_object; - Function m_function; -}; - -template -class mem_fun3 { -public: - typedef Ret result_type; - typedef Ret (Object::*Function)(Arg1, Arg2, Arg3); - - mem_fun3() : m_object(NULL) {} - mem_fun3(Object* o, Function f) : m_object(o), m_function(f) {} - - bool is_valid() const { return m_object; } - - Ret operator () (Arg1 a1, Arg2 a2, Arg3 a3) { return (m_object->*m_function)(a1, a2, a3); } - -private: - Object* m_object; - Function m_function; -}; - -template -inline ptr_fun0 -ptr_fun(Ret (*f)()) { return ptr_fun0(f); } - -template -inline mem_fun0 -make_mem_fun(Object* o, Ret (Object::*f)()) { - return mem_fun0(o, f); -} - -template -inline const_mem_fun0 -make_mem_fun(const Object* o, Ret (Object::*f)() const) { - return const_mem_fun0(o, f); -} - -template -inline mem_fun1 -make_mem_fun(Object* o, Ret (Object::*f)(Arg1)) { - return mem_fun1(o, f); -} - -template -inline const_mem_fun1 -make_mem_fun(const Object* o, Ret (Object::*f)(Arg1) const) { - return const_mem_fun1(o, f); -} - -template -inline mem_fun2 -make_mem_fun(Object* o, Ret (Object::*f)(Arg1, Arg2)) { - return mem_fun2(o, f); -} - -template -inline mem_fun3 -make_mem_fun(Object* o, Ret (Object::*f)(Arg1, Arg2, Arg3)) { - return mem_fun3(o, f); -} - template inline void slot_list_call(const Container& slot_list) { diff --git a/src/control.cc b/src/control.cc index abc4b4b65..e42d512eb 100644 --- a/src/control.cc +++ b/src/control.cc @@ -104,9 +104,9 @@ Control::~Control() { void Control::initialize() { display::Canvas::initialize(); - display::Window::slot_schedule(rak::make_mem_fun(m_display, &display::Manager::schedule)); - display::Window::slot_unschedule(rak::make_mem_fun(m_display, &display::Manager::unschedule)); - display::Window::slot_adjust(rak::make_mem_fun(m_display, &display::Manager::adjust_layout)); + display::Window::slot_schedule([this](display::Window* w, rak::timer t) { m_display->schedule(w, t); }); + display::Window::slot_unschedule([this](display::Window* w) { m_display->unschedule(w); }); + display::Window::slot_adjust([this]() { m_display->adjust_layout(); }); m_core->http_stack()->set_user_agent(USER_AGENT); diff --git a/src/display/window.h b/src/display/window.h index 8e310aba9..fc846912f 100644 --- a/src/display/window.h +++ b/src/display/window.h @@ -38,7 +38,7 @@ #define RTORRENT_WINDOW_BASE_H #include -#include +#include #include "canvas.h" #include "globals.h" @@ -46,15 +46,14 @@ namespace display { class Canvas; -class Manager; class Window { public: typedef uint32_t extent_type; - typedef rak::mem_fun0 Slot; - typedef rak::mem_fun1 SlotWindow; - typedef rak::mem_fun2 SlotTimer; + typedef std::function Slot; + typedef std::function SlotWindow; + typedef std::function SlotTimer; static const int flag_active = (1 << 0); static const int flag_offscreen = (1 << 1); diff --git a/src/ui/element_peer_list.cc b/src/ui/element_peer_list.cc index 8e3ff09de..2564e6dbd 100644 --- a/src/ui/element_peer_list.cc +++ b/src/ui/element_peer_list.cc @@ -36,6 +36,8 @@ #include "config.h" +#include + #include #include #include