OSDN Git Service

generic: substitue some Boost types with Qt/std alternatives
authorIvailo Monev <xakepa10@laimg.moc>
Tue, 15 Nov 2016 01:01:17 +0000 (01:01 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Tue, 15 Nov 2016 01:01:17 +0000 (01:01 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
kget/core/scheduler.cpp
kget/core/signature.cpp
kget/core/urlchecker.cpp
libktorrent/examples/ktcli/ktcli.cpp
libktorrent/examples/ktcli/ktcli.h
libktorrent/src/datachecker/tests/datacheckertest.cpp
libktorrent/src/dht/rpcserver.cpp
libktorrent/src/interfaces/chunkselectorinterface.cpp
libktorrent/src/magnet/magnetdownloader.cpp
libktorrent/src/utp/connection.h
libktorrent/src/utp/tests/sockettest.cpp

index 9711add..9ec437b 100644 (file)
@@ -15,7 +15,7 @@
 #include "settings.h"
 
 #include <algorithm>
-#include <boost/bind.hpp>
+#include <functional>
 
 #include <KDebug>
 
@@ -64,7 +64,7 @@ void Scheduler::setHasNetworkConnection(bool hasConnection)
                 m_failureCheckTimer = 0;
             }
             foreach (JobQueue *queue, m_queues) {
-                std::for_each(queue->begin(), queue->end(), boost::bind(&Job::stop, _1));
+                std::for_each(queue->begin(), queue->end(), std::bind(&Job::stop, std::placeholders::_1));
             }
         }
     }
@@ -233,12 +233,12 @@ void Scheduler::jobChangedEvent(Job * job, JobFailure failure)
 
 void Scheduler::start()
 {
-    std::for_each(m_queues.begin(), m_queues.end(), boost::bind(&JobQueue::setStatus, _1, JobQueue::Running));
+    std::for_each(m_queues.begin(), m_queues.end(), std::bind(&JobQueue::setStatus, std::placeholders::_1, JobQueue::Running));
 }
 
 void Scheduler::stop()
 {
-    std::for_each(m_queues.begin(), m_queues.end(), boost::bind(&JobQueue::setStatus, _1, JobQueue::Stopped));
+    std::for_each(m_queues.begin(), m_queues.end(), std::bind(&JobQueue::setStatus, std::placeholders::_1, JobQueue::Stopped));
 }
 
 void Scheduler::updateQueue( JobQueue * queue )
index de68050..cefcd54 100644 (file)
@@ -33,6 +33,8 @@
 #include <qgpgme/dataprovider.h>
 
 #include <QtCore/QFile>
+
+#include <memory> // for std::shared_ptr
 #endif
 
 #ifdef HAVE_QGPGME
@@ -82,7 +84,7 @@ GpgME::VerificationResult SignaturePrivate::verify(const KUrl &dest, const QByte
         return result;
     }
 
-    boost::shared_ptr<QFile> qFile(new QFile(dest.pathOrUrl()));
+    std::shared_ptr<QFile> qFile(new QFile(dest.pathOrUrl()));
     qFile->open(QIODevice::ReadOnly);
     QGpgME::QIODeviceDataProvider *file = new QGpgME::QIODeviceDataProvider(qFile);
     GpgME::Data dFile(file);
index 4fc0f55..15c8318 100644 (file)
@@ -29,7 +29,7 @@
 #include "settings.h"
 
 #include <algorithm>
-#include <boost/bind.hpp>
+#include <functional>
 
 #include <QtCore/QFileInfo>
 #include <QtGui/QCheckBox>
@@ -114,7 +114,8 @@ void UrlChecker::removeDuplicates(KUrl::List &urls)
 {
     std::sort(urls.begin(), urls.end(), lessThan());//sort the urls, to find duplicates fast
     urls.erase(std::unique(urls.begin(), urls.end(),
-               boost::bind(&KUrl::equals, _1, _2, KUrl::CompareWithoutTrailingSlash | KUrl::AllowEmptyPath)), urls.end());
+               std::bind(&KUrl::equals, std::placeholders::_1, std::placeholders::_2,
+                         KUrl::CompareWithoutTrailingSlash | KUrl::AllowEmptyPath)), urls.end());
 }
 
 UrlChecker::UrlError UrlChecker::checkUrl(const KUrl &url, const UrlChecker::UrlType type, bool showNotification)
index 849de79..4f80cac 100644 (file)
@@ -42,12 +42,13 @@ KTCLI::KTCLI() : tc(new TorrentControl()),updates(0)
        qsrand(time(0));
        bt::SetClientInfo("ktcli",bt::MAJOR,bt::MINOR,bt::RELEASE,bt::NORMAL,"KT");
        bt::InitLog("ktcli.log",false,true,false);
-       connect(tc.get(),SIGNAL(finished(bt::TorrentInterface*)),this,SLOT(finished(bt::TorrentInterface*)));
+       connect(tc,SIGNAL(finished(bt::TorrentInterface*)),this,SLOT(finished(bt::TorrentInterface*)));
        connect(this,SIGNAL(aboutToQuit()),this,SLOT(shutdown()));
 }
 
 KTCLI::~KTCLI()
 {
+    delete tc;
 }
 
 bool KTCLI::start()
index ea4eccb..2171ec3 100644 (file)
 
 #include <QTimer>
 #include <KApplication>
-#include <boost/scoped_ptr.hpp>
 #include <torrent/torrentcontrol.h>
 #include <interfaces/queuemanagerinterface.h>
 
 class KUrl;
 
-typedef boost::scoped_ptr<bt::TorrentControl> TorrentControlPtr;
-
 class KTCLI : public KApplication,public bt::QueueManagerInterface
 {
        Q_OBJECT
@@ -59,7 +56,7 @@ public slots:
        
 private:
        QTimer timer;
-       TorrentControlPtr tc;
+       bt::TorrentControl* tc;
        int updates;
 };
 
index 9a0c877..c7c2b87 100644 (file)
@@ -13,7 +13,6 @@
 #include <datachecker/singledatachecker.h>
 #include <datachecker/multidatachecker.h>
 #include <testlib/dummytorrentcreator.h>
-#include <boost/concept_check.hpp>
 
 
 using namespace bt;
index 4b2de3f..cfd3adf 100644 (file)
@@ -20,9 +20,9 @@
 #include "rpcserver.h"
 #include <QHostAddress>
 #include <QThread>
+#include <QScopedPointer>
 #include <unistd.h>
 #include <string.h>
-#include <boost/scoped_ptr.hpp>
 #include <net/portlist.h>
 #include <util/log.h>
 #include <util/error.h>
@@ -88,13 +88,13 @@ namespace dht
                        {
                                // read and decode the packet
                                BDecoder bdec(ptr->get(), ptr->size(), false);
-                               boost::scoped_ptr<BNode> n(bdec.decode());
+                               QScopedPointer<BNode> n(bdec.decode());
 
-                               if (!n || n->getType() != BNode::DICT)
+                               if (!n || n.data()->getType() != BNode::DICT)
                                        return;
 
                                // try to make a RPCMsg of it
-                               RPCMsg::Ptr msg = factory.build((BDictNode*)n.get(), this);
+                               RPCMsg::Ptr msg = factory.build((BDictNode*)n.data(), this);
                                if (msg)
                                {
                                        if (addr.ipVersion() == 6 && addr.isIPv4Mapped())
index 953c83f..ef8722f 100644 (file)
@@ -19,8 +19,6 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
  ***************************************************************************/
 #include "chunkselectorinterface.h"
-#include <boost/concept_check.hpp>
-#include <boost/concept_check.hpp>
 
 namespace bt
 {
index 5f71986..d5c3eb7 100644 (file)
@@ -31,7 +31,6 @@
 #include "bcodec/bdecoder.h"
 #include "bcodec/bnode.h"
 #include "util/error.h"
-#include <boost/concept_check.hpp>
 
 namespace bt
 {
index 5d46e2c..79cbe02 100644 (file)
@@ -32,9 +32,6 @@
 #include <util/circularbuffer.h>
 #include <util/timer.h>
 #include <utp/remotewindow.h>
-#include <boost/concept_check.hpp>
-
-
 
 
 namespace utp
index 7040db5..b076053 100644 (file)
@@ -24,7 +24,6 @@
 #include <utp/utpserver.h>
 #include <utp/utpsocket.h>
 #include <torrent/globals.h>
-#include <boost/concept_check.hpp>
 
 using namespace utp;