From cc43e339c1c46e23797f83b4fef9e83015c7b503 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Fri, 22 Nov 2013 11:53:47 +0000 Subject: [PATCH] Use boost function for compatibility --- ext/libclementine-common/core/closure.cpp | 4 ++-- ext/libclementine-common/core/closure.h | 8 ++++---- tests/closure_test.cpp | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ext/libclementine-common/core/closure.cpp b/ext/libclementine-common/core/closure.cpp index e2c27c13f..ad14c9413 100644 --- a/ext/libclementine-common/core/closure.cpp +++ b/ext/libclementine-common/core/closure.cpp @@ -33,7 +33,7 @@ ClosureBase::~ClosureBase() { CallbackClosure::CallbackClosure( QObject* sender, const char* signal, - std::function callback) + boost::function callback) : ClosureBase(new ObjectHelper(sender, signal, this)), callback_(callback) { } @@ -67,7 +67,7 @@ void Unpack(QList*) {} _detail::ClosureBase* NewClosure( QObject* sender, const char* signal, - std::function callback) { + boost::function callback) { return new _detail::CallbackClosure( sender, signal, callback); } diff --git a/ext/libclementine-common/core/closure.h b/ext/libclementine-common/core/closure.h index 2244a4a69..155df38bd 100644 --- a/ext/libclementine-common/core/closure.h +++ b/ext/libclementine-common/core/closure.h @@ -158,12 +158,12 @@ class CallbackClosure : public ClosureBase { CallbackClosure( QObject* sender, const char* signal, - std::function callback); + boost::function callback); virtual void Invoke(); private: - std::function callback_; + boost::function callback_; }; } // namespace _detail @@ -194,13 +194,13 @@ _detail::ClosureBase* NewClosure( _detail::ClosureBase* NewClosure( QObject* sender, const char* signal, - std::function callback); + boost::function callback); template _detail::ClosureBase* NewClosure( QObject* sender, const char* signal, - std::function callback, + boost::function callback, const Args&... args) { return NewClosure(sender, signal, boost::bind(callback, args...)); } diff --git a/tests/closure_test.cpp b/tests/closure_test.cpp index 3bba20033..7d8f768e9 100644 --- a/tests/closure_test.cpp +++ b/tests/closure_test.cpp @@ -5,6 +5,8 @@ #include #include +#include + #include "config.h" #include "core/closure.h" #include "test_utils.h" @@ -92,7 +94,7 @@ TEST(ClosureTest, ClosureWorksWithStandardFunctions) { bool called = false; int question = 42; int answer = 0; - std::tr1::function callback(&Foo); + boost::function callback(&Foo); NewClosure( &sender, SIGNAL(Emitted()), callback, &called, question, &answer);