From f98898ab1a6952e0c3a5d235963a27eba2e19e46 Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Sun, 3 Apr 2016 04:52:16 -0800 Subject: Cpp / Qt: Reduce boost usage (memory and tuple) * cpp/src/assuanresult.h, cpp/src/configuration.cpp, cpp/src/configuration.h, cpp/src/data.h, cpp/src/decryptionresult.h, cpp/src/defaultassuantransaction.cpp, cpp/src/encryptionresult.cpp, cpp/src/encryptionresult.h, cpp/src/engineinfo.h, cpp/src/gpgagentgetinfoassuantransaction.cpp, cpp/src/gpgsignkeyeditinteractor.cpp, cpp/src/importresult.cpp, cpp/src/importresult.h, cpp/src/key.h, cpp/src/keygenerationresult.h, cpp/src/keylistresult.h, cpp/src/notation.h, cpp/src/signingresult.cpp, cpp/src/signingresult.h, cpp/src/verificationresult.cpp, cpp/src/verificationresult.h, cpp/src/vfsmountresult.h, qt/src/dataprovider.cpp, qt/src/dataprovider.h, qt/src/decryptjob.h, qt/src/decryptverifyjob.h, qt/src/downloadjob.h, qt/src/encryptjob.h, qt/src/qgpgmeadduseridjob.cpp, qt/src/qgpgmechangeexpiryjob.cpp, qt/src/qgpgmechangeownertrustjob.cpp, qt/src/qgpgmechangepasswdjob.cpp, qt/src/qgpgmedecryptjob.cpp, qt/src/qgpgmedecryptjob.h, qt/src/qgpgmedecryptverifyjob.cpp, qt/src/qgpgmedecryptverifyjob.h, qt/src/qgpgmedeletejob.cpp, qt/src/qgpgmedownloadjob.cpp, qt/src/qgpgmedownloadjob.h, qt/src/qgpgmeencryptjob.cpp, qt/src/qgpgmeencryptjob.h, qt/src/qgpgmeexportjob.cpp, qt/src/qgpgmeexportjob.h, qt/src/qgpgmeimportfromkeyserverjob.cpp, qt/src/qgpgmeimportfromkeyserverjob.h, qt/src/qgpgmeimportjob.cpp, qt/src/qgpgmeimportjob.h, qt/src/qgpgmekeygenerationjob.cpp, qt/src/qgpgmekeygenerationjob.h, qt/src/qgpgmekeylistjob.cpp, qt/src/qgpgmekeylistjob.h, qt/src/qgpgmelistallkeysjob.cpp, qt/src/qgpgmelistallkeysjob.h, qt/src/qgpgmenewcryptoconfig.cpp, qt/src/qgpgmenewcryptoconfig.h, qt/src/qgpgmesignencryptjob.cpp, qt/src/qgpgmesignencryptjob.h, qt/src/qgpgmesignjob.cpp, qt/src/qgpgmesignjob.h, qt/src/qgpgmesignkeyjob.cpp, qt/src/qgpgmeverifydetachedjob.cpp, qt/src/qgpgmeverifydetachedjob.h, qt/src/qgpgmeverifyopaquejob.cpp, qt/src/qgpgmeverifyopaquejob.h, qt/src/signencryptjob.h, qt/src/signjob.h, qt/src/threadedjobmixin.h, qt/src/verifydetachedjob.h, qt/src/verifyopaquejob.h: Reduce boost usage. -- This was mostly done with search and replace to change the templates / classes from memory and tuple to their c++11 equivalents. --- lang/qt/src/threadedjobmixin.h | 52 +++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'lang/qt/src/threadedjobmixin.h') diff --git a/lang/qt/src/threadedjobmixin.h b/lang/qt/src/threadedjobmixin.h index 2421439c..6bea871e 100644 --- a/lang/qt/src/threadedjobmixin.h +++ b/lang/qt/src/threadedjobmixin.h @@ -86,7 +86,7 @@ class ToThreadMover public: ToThreadMover(QObject *o, QThread *t) : m_object(o), m_thread(t) {} ToThreadMover(QObject &o, QThread *t) : m_object(&o), m_thread(t) {} - ToThreadMover(const boost::shared_ptr &o, QThread *t) : m_object(o.get()), m_thread(t) {} + ToThreadMover(const std::shared_ptr &o, QThread *t) : m_object(o.get()), m_thread(t) {} ~ToThreadMover() { if (m_object && m_thread) { @@ -124,7 +124,7 @@ private: T_result m_result; }; -template > +template > class ThreadedJobMixin : public T_base, public GpgME::ProgressProvider { public: @@ -132,20 +132,20 @@ public: typedef T_result result_type; protected: - BOOST_STATIC_ASSERT((boost::tuples::length::value > 2)); + BOOST_STATIC_ASSERT((std::tuple_size::value > 2)); BOOST_STATIC_ASSERT(( - boost::is_same < - typename boost::tuples::element < - boost::tuples::length::value - 2, + std::is_same < + typename std::tuple_element < + std::tuple_size::value - 2, T_result >::type, QString >::value )); BOOST_STATIC_ASSERT(( - boost::is_same < - typename boost::tuples::element < - boost::tuples::length::value - 1, + std::is_same < + typename std::tuple_element < + std::tuple_size::value - 1, T_result >::type, GpgME::Error @@ -172,7 +172,7 @@ protected: m_thread.start(); } template - void run(const T_binder &func, const boost::shared_ptr &io) + void run(const T_binder &func, const std::shared_ptr &io) { if (io) { io->moveToThread(&m_thread); @@ -180,12 +180,12 @@ protected: // the arguments passed here to the functor are stored in a QThread, and are not // necessarily destroyed (living outside the UI thread) at the time the result signal // is emitted and the signal receiver wants to clean up IO devices. - // To avoid such races, we pass weak_ptr's to the functor. - m_thread.setFunction(boost::bind(func, this->context(), this->thread(), boost::weak_ptr(io))); + // To avoid such races, we pass std::weak_ptr's to the functor. + m_thread.setFunction(boost::bind(func, this->context(), this->thread(), std::weak_ptr(io))); m_thread.start(); } template - void run(const T_binder &func, const boost::shared_ptr &io1, const boost::shared_ptr &io2) + void run(const T_binder &func, const std::shared_ptr &io1, const std::shared_ptr &io2) { if (io1) { io1->moveToThread(&m_thread); @@ -196,8 +196,8 @@ protected: // the arguments passed here to the functor are stored in a QThread, and are not // necessarily destroyed (living outside the UI thread) at the time the result signal // is emitted and the signal receiver wants to clean up IO devices. - // To avoid such races, we pass weak_ptr's to the functor. - m_thread.setFunction(boost::bind(func, this->context(), this->thread(), boost::weak_ptr(io1), boost::weak_ptr(io2))); + // To avoid such races, we pass std::weak_ptr's to the functor. + m_thread.setFunction(boost::bind(func, this->context(), this->thread(), std::weak_ptr(io1), std::weak_ptr(io2))); m_thread.start(); } GpgME::Context *context() const @@ -210,8 +210,8 @@ protected: void slotFinished() { const T_result r = m_thread.result(); - m_auditLog = boost::get < boost::tuples::length::value - 2 > (r); - m_auditLogError = boost::get < boost::tuples::length::value - 1 > (r); + m_auditLog = std::get < std::tuple_size::value - 2 > (r); + m_auditLogError = std::get < std::tuple_size::value - 1 > (r); resultHook(r); Q_EMIT this->done(); doEmitResult(r); @@ -244,31 +244,31 @@ protected: } private: template - void doEmitResult(const boost::tuple &tuple) + void doEmitResult(const std::tuple &tuple) { - Q_EMIT this->result(boost::get<0>(tuple), boost::get<1>(tuple)); + Q_EMIT this->result(std::get<0>(tuple), std::get<1>(tuple)); } template - void doEmitResult(const boost::tuple &tuple) + void doEmitResult(const std::tuple &tuple) { - Q_EMIT this->result(boost::get<0>(tuple), boost::get<1>(tuple), boost::get<2>(tuple)); + Q_EMIT this->result(std::get<0>(tuple), std::get<1>(tuple), std::get<2>(tuple)); } template - void doEmitResult(const boost::tuple &tuple) + void doEmitResult(const std::tuple &tuple) { - Q_EMIT this->result(boost::get<0>(tuple), boost::get<1>(tuple), boost::get<2>(tuple), boost::get<3>(tuple)); + Q_EMIT this->result(std::get<0>(tuple), std::get<1>(tuple), std::get<2>(tuple), std::get<3>(tuple)); } template - void doEmitResult(const boost::tuple &tuple) + void doEmitResult(const std::tuple &tuple) { - Q_EMIT this->result(boost::get<0>(tuple), boost::get<1>(tuple), boost::get<2>(tuple), boost::get<3>(tuple), boost::get<4>(tuple)); + Q_EMIT this->result(std::get<0>(tuple), std::get<1>(tuple), std::get<2>(tuple), std::get<3>(tuple), std::get<4>(tuple)); } private: - boost::shared_ptr m_ctx; + std::shared_ptr m_ctx; Thread m_thread; QString m_auditLog; GpgME::Error m_auditLogError; -- cgit v1.2.3