mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-15 06:32:31 +00:00
Converted sigc++ slots to std::tr1::function.
This commit is contained in:
@@ -40,7 +40,6 @@
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include <curl/curl.h>
|
||||
#include <sigc++/signal.h>
|
||||
#include <torrent/http.h>
|
||||
|
||||
#include "rak/priority_queue_default.h"
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <curl/multi.h>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <torrent/exceptions.h>
|
||||
|
||||
#include "rak/functional.h"
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <sigc++/functors/slot.h>
|
||||
|
||||
#include "rak/priority_queue_default.h"
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ DownloadFactory::receive_success() {
|
||||
if (download == NULL) {
|
||||
// core::Manager should already have added the error message to
|
||||
// the log.
|
||||
m_slotFinished();
|
||||
m_slot_finished();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ DownloadFactory::receive_success() {
|
||||
// ATM doesn't really ever get here.
|
||||
delete download;
|
||||
|
||||
m_slotFinished();
|
||||
m_slot_finished();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ DownloadFactory::receive_success() {
|
||||
}
|
||||
}
|
||||
|
||||
m_slotFinished();
|
||||
m_slot_finished();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -376,7 +376,7 @@ DownloadFactory::receive_failed(const std::string& msg) {
|
||||
if (m_printLog)
|
||||
m_manager->push_log_std(msg + ": \"" + m_uri + "\"");
|
||||
|
||||
m_slotFinished();
|
||||
m_slot_finished();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -42,9 +42,9 @@
|
||||
#define RTORRENT_CORE_DOWNLOAD_FACTORY_H
|
||||
|
||||
#include <iosfwd>
|
||||
#include <sigc++/functors/slot.h>
|
||||
#include <rak/priority_queue_default.h>
|
||||
#include <torrent/object.h>
|
||||
#include <tr1/functional>
|
||||
|
||||
#include "http_queue.h"
|
||||
|
||||
@@ -54,7 +54,7 @@ class Manager;
|
||||
|
||||
class DownloadFactory {
|
||||
public:
|
||||
typedef sigc::slot<void> Slot;
|
||||
typedef std::tr1::function<void ()> slot_void;
|
||||
typedef std::vector<std::string> command_list_type;
|
||||
|
||||
// Do not destroy this object while it is in a HttpQueue.
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
bool print_log() const { return m_printLog; }
|
||||
void set_print_log(bool v) { m_printLog = v; }
|
||||
|
||||
void slot_finished(Slot s) { m_slotFinished = s; }
|
||||
void slot_finished(slot_void s) { m_slot_finished = s; }
|
||||
|
||||
private:
|
||||
void receive_load();
|
||||
@@ -109,7 +109,7 @@ private:
|
||||
command_list_type m_commands;
|
||||
torrent::Object::map_type m_variables;
|
||||
|
||||
Slot m_slotFinished;
|
||||
slot_void m_slot_finished;
|
||||
rak::priority_item m_taskLoad;
|
||||
rak::priority_item m_taskCommit;
|
||||
};
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <rak/functional.h>
|
||||
#include <rak/string_manip.h>
|
||||
#include <torrent/data/file.h>
|
||||
|
||||
@@ -39,19 +39,19 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <sigc++/functors/slot.h>
|
||||
#include <tr1/functional>
|
||||
|
||||
#include "download.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class DownloadSlotMap : public std::map<std::string, sigc::slot1<void, Download*> > {
|
||||
class DownloadSlotMap : public std::map<std::string, std::tr1::function<void (Download*)> > {
|
||||
public:
|
||||
typedef sigc::slot1<void, Download*> SlotDownload;
|
||||
typedef std::map<std::string, SlotDownload> Base;
|
||||
typedef std::tr1::function<void (Download*)> slot_download;
|
||||
typedef std::map<std::string, slot_download> Base;
|
||||
|
||||
void insert(const std::string& key, SlotDownload s) { Base::operator[](key) = s; }
|
||||
void erase(const std::string& key) { Base::erase(key); }
|
||||
void insert(const std::string& key, slot_download s) { Base::operator[](key) = s; }
|
||||
void erase(const std::string& key) { Base::erase(key); }
|
||||
|
||||
void for_each(Download* d);
|
||||
};
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <sigc++/adaptors/hide.h>
|
||||
#include <torrent/http.h>
|
||||
|
||||
#include "rak/functional.h"
|
||||
@@ -50,7 +48,7 @@ namespace core {
|
||||
|
||||
HttpQueue::iterator
|
||||
HttpQueue::insert(const std::string& url, std::iostream* s) {
|
||||
std::auto_ptr<CurlGet> h(m_slotFactory());
|
||||
std::auto_ptr<CurlGet> h(m_slot_factory());
|
||||
|
||||
h->set_url(url);
|
||||
h->set_stream(s);
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <list>
|
||||
#include <iosfwd>
|
||||
#include <sigc++/signal.h>
|
||||
#include <tr1/functional>
|
||||
|
||||
namespace core {
|
||||
|
||||
@@ -47,9 +48,9 @@ class CurlGet;
|
||||
|
||||
class HttpQueue : private std::list<CurlGet*> {
|
||||
public:
|
||||
typedef std::list<CurlGet*> Base;
|
||||
typedef sigc::signal1<void, CurlGet*> SignalHttp;
|
||||
typedef sigc::slot0<CurlGet*> SlotFactory;
|
||||
typedef std::list<CurlGet*> Base;
|
||||
typedef sigc::signal1<void, CurlGet*> SignalHttp;
|
||||
typedef std::tr1::function<CurlGet* ()> slot_factory;
|
||||
|
||||
using Base::iterator;
|
||||
using Base::const_iterator;
|
||||
@@ -77,13 +78,13 @@ public:
|
||||
|
||||
void clear();
|
||||
|
||||
void slot_factory(SlotFactory s) { m_slotFactory = s; }
|
||||
void set_slot_factory(slot_factory s) { m_slot_factory = s; }
|
||||
|
||||
SignalHttp& signal_insert() { return m_signalInsert; }
|
||||
SignalHttp& signal_erase() { return m_signalErase; }
|
||||
SignalHttp& signal_insert() { return m_signalInsert; }
|
||||
SignalHttp& signal_erase() { return m_signalErase; }
|
||||
|
||||
private:
|
||||
SlotFactory m_slotFactory;
|
||||
slot_factory m_slot_factory;
|
||||
SignalHttp m_signalInsert;
|
||||
SignalHttp m_signalErase;
|
||||
};
|
||||
|
||||
+3
-3
@@ -147,7 +147,7 @@ Manager::get_address_throttle(const sockaddr* addr) {
|
||||
void
|
||||
Manager::initialize_second() {
|
||||
torrent::Http::slot_factory() = std::tr1::bind(&CurlStack::new_object, m_httpStack);
|
||||
m_httpQueue->slot_factory(sigc::mem_fun(m_httpStack, &CurlStack::new_object));
|
||||
m_httpQueue->set_slot_factory(std::tr1::bind(&CurlStack::new_object, m_httpStack));
|
||||
|
||||
CurlStack::global_init();
|
||||
}
|
||||
@@ -332,7 +332,7 @@ Manager::try_create_download(const std::string& uri, int flags, const command_li
|
||||
|
||||
f->set_start(flags & create_start);
|
||||
f->set_print_log(!(flags & create_quiet));
|
||||
f->slot_finished(sigc::bind(sigc::ptr_fun(&rak::call_delete_func<core::DownloadFactory>), f));
|
||||
f->slot_finished(std::tr1::bind(&rak::call_delete_func<core::DownloadFactory>, f));
|
||||
|
||||
if (flags & create_raw_data)
|
||||
f->load_raw_data(uri);
|
||||
@@ -356,7 +356,7 @@ Manager::try_create_download_from_meta_download(torrent::Object* bencode, const
|
||||
|
||||
f->set_start(meta.get_key_value("start"));
|
||||
f->set_print_log(meta.get_key_value("print_log"));
|
||||
f->slot_finished(sigc::bind(sigc::ptr_fun(&rak::call_delete_func<core::DownloadFactory>), f));
|
||||
f->slot_finished(std::tr1::bind(&rak::call_delete_func<core::DownloadFactory>, f));
|
||||
|
||||
// Bit of a waste to create the bencode repesentation here
|
||||
// only to have the DownloadFactory decode it.
|
||||
|
||||
+2
-2
@@ -69,8 +69,8 @@ public:
|
||||
typedef DownloadList::iterator DListItr;
|
||||
typedef utils::FileStatusCache FileStatusCache;
|
||||
|
||||
typedef sigc::slot1<void, DownloadList::iterator> SlotReady;
|
||||
typedef sigc::slot0<void> SlotFailed;
|
||||
// typedef std::tr1::function<void (DownloadList::iterator)> slot_ready;
|
||||
// typedef std::tr1::function<void ()> slot_void;
|
||||
|
||||
Manager();
|
||||
~Manager();
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include <functional>
|
||||
#include <rak/functional.h>
|
||||
#include <rak/functional_fun.h>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <torrent/download.h>
|
||||
#include <torrent/exceptions.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user