diff --git a/rak/string_manip.h b/rak/string_manip.h index 68211f73..f8d3f590 100644 --- a/rak/string_manip.h +++ b/rak/string_manip.h @@ -238,7 +238,7 @@ copy_escape_html(Iterator first, Iterator last) { } template -Sequence +inline Sequence copy_escape_html(const Sequence& src) { Sequence dest; copy_escape_html(src.begin(), src.end(), std::back_inserter(dest)); @@ -246,6 +246,15 @@ copy_escape_html(const Sequence& src) { return dest; } +template +inline std::string +copy_escape_html_str(const Sequence& src) { + std::string dest; + copy_escape_html(src.begin(), src.end(), std::back_inserter(dest)); + + return dest; +} + // Consider support for larger than char type. template OutputIterator @@ -291,6 +300,15 @@ transform_hex(Iterator first, Iterator last) { return dest; } +template +inline std::string +transform_hex_str(const Sequence& seq) { + std::string dest; + transform_hex(seq.begin(), seq.end(), std::back_inserter(dest)); + + return dest; +} + template Sequence generate_random(size_t length) { diff --git a/src/command_download.cc b/src/command_download.cc index 6299c799..5bc7190b 100644 --- a/src/command_download.cc +++ b/src/command_download.cc @@ -188,11 +188,6 @@ apply_d_connection_type(core::Download* download, const std::string& name) { return torrent::Object(); } -const char* -retrieve_d_connection_type(core::Download* download) { - return torrent::option_as_string(torrent::OPTION_CONNECTION_TYPE, download->download()->connection_type()); -} - torrent::Object apply_d_choke_heuristics(core::Download* download, const std::string& name, bool is_down) { torrent::Download::HeuristicType t = @@ -206,15 +201,6 @@ apply_d_choke_heuristics(core::Download* download, const std::string& name, bool return torrent::Object(); } -const char* -retrieve_d_choke_heuristics(core::Download* download, bool is_down) { - torrent::Download::HeuristicType t = is_down ? - download->download()->download_choke_heuristic() : - download->download()->upload_choke_heuristic(); - - return torrent::option_as_string(torrent::OPTION_CHOKE_HEURISTICS, t); -} - const char* retrieve_d_priority_str(core::Download* download) { switch (download->priority()) { @@ -242,27 +228,6 @@ retrieve_d_ratio(core::Download* download) { return bytesDone > 0 ? (1000 * upTotal) / bytesDone : 0; } -torrent::Object -retrieve_d_hash(core::Download* download) { - const torrent::HashString* hashString = &download->info()->hash(); - - return torrent::Object(rak::transform_hex(hashString->begin(), hashString->end())); -} - -torrent::Object -retrieve_d_local_id(core::Download* download) { - const torrent::HashString* hashString = &download->info()->local_id(); - - return torrent::Object(rak::transform_hex(hashString->begin(), hashString->end())); -} - -torrent::Object -retrieve_d_local_id_html(core::Download* download) { - const torrent::HashString* hashString = &download->info()->local_id(); - - return torrent::Object(rak::copy_escape_html(hashString->begin(), hashString->end())); -} - torrent::Object apply_d_custom(core::Download* download, const torrent::Object::list_type& args) { torrent::Object::list_const_iterator itr = args.begin(); @@ -556,51 +521,50 @@ d_list_remove(core::Download* download, const torrent::Object& rawArgs, const ch #define CMD_ON_INFO(func) rak::on(std::mem_fun(&core::Download::info), std::mem_fun(&torrent::DownloadInfo::func)) -#define CMD2_ON_INFO(func) std::tr1::bind(&torrent::DownloadInfo::func, std::tr1::bind(&core::Download::info, std::tr1::placeholders::_1)) -#define CMD2_ON_DL(func) std::tr1::bind(&torrent::Download::func, std::tr1::bind(&core::Download::download, std::tr1::placeholders::_1)) -#define CMD2_ON_FL(func) std::tr1::bind(&torrent::FileList::func, std::tr1::bind(&core::Download::file_list, std::tr1::placeholders::_1)) +#define CMD2_ON_INFO(func) std::bind(&torrent::DownloadInfo::func, std::bind(&core::Download::info, std::placeholders::_1)) +#define CMD2_ON_DL(func) std::bind(&torrent::Download::func, std::bind(&core::Download::download, std::placeholders::_1)) +#define CMD2_ON_FL(func) std::bind(&torrent::FileList::func, std::bind(&core::Download::file_list, std::placeholders::_1)) -#define CMD2_BIND_DL std::tr1::bind(&core::Download::download, std::tr1::placeholders::_1) -#define CMD2_BIND_CL std::tr1::bind(&core::Download::connection_list, std::tr1::placeholders::_1) -#define CMD2_BIND_FL std::tr1::bind(&core::Download::file_list, std::tr1::placeholders::_1) -#define CMD2_BIND_PL std::tr1::bind(&core::Download::c_peer_list, std::tr1::placeholders::_1) -#define CMD2_BIND_TL std::tr1::bind(&core::Download::tracker_list, std::tr1::placeholders::_1) +#define CMD2_BIND_DL std::bind(&core::Download::download, std::placeholders::_1) +#define CMD2_BIND_CL std::bind(&core::Download::connection_list, std::placeholders::_1) +#define CMD2_BIND_FL std::bind(&core::Download::file_list, std::placeholders::_1) +#define CMD2_BIND_PL std::bind(&core::Download::c_peer_list, std::placeholders::_1) +#define CMD2_BIND_TL std::bind(&core::Download::tracker_list, std::placeholders::_1) #define CMD2_DL_VAR_VALUE(key, first_key, second_key) \ - CMD2_DL(key, std::tr1::bind(&download_get_variable, std::tr1::placeholders::_1, first_key, second_key)); \ - CMD2_DL_VALUE_P(key ".set", std::tr1::bind(&download_set_variable_value, \ - std::tr1::placeholders::_1, std::tr1::placeholders::_2, \ + CMD2_DL(key, std::bind(&download_get_variable, std::placeholders::_1, first_key, second_key)); \ + CMD2_DL_VALUE_P(key ".set", std::bind(&download_set_variable_value, \ + std::placeholders::_1, std::placeholders::_2, \ first_key, second_key)); #define CMD2_DL_VAR_VALUE_PUBLIC(key, first_key, second_key) \ - CMD2_DL(key, std::tr1::bind(&download_get_variable, std::tr1::placeholders::_1, first_key, second_key)); \ - CMD2_DL_VALUE(key ".set", std::tr1::bind(&download_set_variable_value, \ - std::tr1::placeholders::_1, std::tr1::placeholders::_2, \ + CMD2_DL(key, std::bind(&download_get_variable, std::placeholders::_1, first_key, second_key)); \ + CMD2_DL_VALUE(key ".set", std::bind(&download_set_variable_value, \ + std::placeholders::_1, std::placeholders::_2, \ first_key, second_key)); #define CMD2_DL_VAR_STRING(key, first_key, second_key) \ - CMD2_DL(key, std::tr1::bind(&download_get_variable, std::tr1::placeholders::_1, first_key, second_key)); \ - CMD2_DL_STRING_P(key ".set", std::tr1::bind(&download_set_variable_string, \ - std::tr1::placeholders::_1, std::tr1::placeholders::_2, \ + CMD2_DL(key, std::bind(&download_get_variable, std::placeholders::_1, first_key, second_key)); \ + CMD2_DL_STRING_P(key ".set", std::bind(&download_set_variable_string, \ + std::placeholders::_1, std::placeholders::_2, \ first_key, second_key)); #define CMD2_DL_VAR_STRING_PUBLIC(key, first_key, second_key) \ - CMD2_DL(key, std::tr1::bind(&download_get_variable, std::tr1::placeholders::_1, first_key, second_key)); \ - CMD2_DL_STRING(key ".set", std::tr1::bind(&download_set_variable_string, \ - std::tr1::placeholders::_1, std::tr1::placeholders::_2, \ + CMD2_DL(key, std::bind(&download_get_variable, std::placeholders::_1, first_key, second_key)); \ + CMD2_DL_STRING(key ".set", std::bind(&download_set_variable_string, \ + std::placeholders::_1, std::placeholders::_2, \ first_key, second_key)); void initialize_command_download() { - CMD2_DL("d.hash", std::tr1::bind(&retrieve_d_hash, std::tr1::placeholders::_1)); - CMD2_DL("d.local_id", std::tr1::bind(&retrieve_d_local_id, std::tr1::placeholders::_1)); - CMD2_DL("d.local_id_html", std::tr1::bind(&retrieve_d_local_id_html, std::tr1::placeholders::_1)); - CMD2_DL("d.bitfield", std::tr1::bind(&retrieve_d_bitfield, std::tr1::placeholders::_1)); - CMD2_DL("d.base_path", std::tr1::bind(&retrieve_d_base_path, std::tr1::placeholders::_1)); - CMD2_DL("d.base_filename", std::tr1::bind(&retrieve_d_base_filename, std::tr1::placeholders::_1)); + CMD2_DL("d.hash", std::bind(&rak::transform_hex_str, CMD2_ON_INFO(hash))); + CMD2_DL("d.local_id", std::bind(&rak::transform_hex_str, CMD2_ON_INFO(local_id))); + CMD2_DL("d.local_id_html", std::bind(&rak::copy_escape_html_str, CMD2_ON_INFO(local_id))); + CMD2_DL("d.bitfield", std::bind(&retrieve_d_bitfield, std::placeholders::_1)); + CMD2_DL("d.base_path", std::bind(&retrieve_d_base_path, std::placeholders::_1)); + CMD2_DL("d.base_filename", std::bind(&retrieve_d_base_filename, std::placeholders::_1)); CMD2_DL("d.name", CMD2_ON_INFO(name)); - CMD2_DL("d.creation_date", CMD2_ON_INFO(creation_date)); CMD2_DL("d.load_date", CMD2_ON_INFO(load_date)); @@ -608,19 +572,19 @@ initialize_command_download() { // Network related: // - CMD2_DL ("d.up.rate", std::tr1::bind(&torrent::Rate::rate, CMD2_ON_INFO(up_rate))); - CMD2_DL ("d.up.total", std::tr1::bind(&torrent::Rate::total, CMD2_ON_INFO(up_rate))); - CMD2_DL ("d.down.rate", std::tr1::bind(&torrent::Rate::rate, CMD2_ON_INFO(down_rate))); - CMD2_DL ("d.down.total", std::tr1::bind(&torrent::Rate::total, CMD2_ON_INFO(down_rate))); - CMD2_DL ("d.skip.rate", std::tr1::bind(&torrent::Rate::rate, CMD2_ON_INFO(skip_rate))); - CMD2_DL ("d.skip.total", std::tr1::bind(&torrent::Rate::total, CMD2_ON_INFO(skip_rate))); + CMD2_DL ("d.up.rate", std::bind(&torrent::Rate::rate, CMD2_ON_INFO(up_rate))); + CMD2_DL ("d.up.total", std::bind(&torrent::Rate::total, CMD2_ON_INFO(up_rate))); + CMD2_DL ("d.down.rate", std::bind(&torrent::Rate::rate, CMD2_ON_INFO(down_rate))); + CMD2_DL ("d.down.total", std::bind(&torrent::Rate::total, CMD2_ON_INFO(down_rate))); + CMD2_DL ("d.skip.rate", std::bind(&torrent::Rate::rate, CMD2_ON_INFO(skip_rate))); + CMD2_DL ("d.skip.total", std::bind(&torrent::Rate::total, CMD2_ON_INFO(skip_rate))); - CMD2_DL ("d.peer_exchange", CMD2_ON_INFO(is_pex_enabled)); - CMD2_DL_VALUE_V ("d.peer_exchange.set", std::tr1::bind(&torrent::Download::set_pex_enabled, CMD2_BIND_DL, std::tr1::placeholders::_2)); + CMD2_DL ("d.peer_exchange", CMD2_ON_INFO(is_pex_enabled)); + CMD2_DL_VALUE_V ("d.peer_exchange.set", std::bind(&torrent::Download::set_pex_enabled, CMD2_BIND_DL, std::placeholders::_2)); - CMD2_DL_LIST ("d.create_link", std::tr1::bind(&apply_d_change_link, std::tr1::placeholders::_1, std::tr1::placeholders::_2, 0)); - CMD2_DL_LIST ("d.delete_link", std::tr1::bind(&apply_d_change_link, std::tr1::placeholders::_1, std::tr1::placeholders::_2, 1)); - CMD2_DL ("d.delete_tied", std::tr1::bind(&apply_d_delete_tied, std::tr1::placeholders::_1)); + CMD2_DL_LIST ("d.create_link", std::bind(&apply_d_change_link, std::placeholders::_1, std::placeholders::_2, 0)); + CMD2_DL_LIST ("d.delete_link", std::bind(&apply_d_change_link, std::placeholders::_1, std::placeholders::_2, 1)); + CMD2_DL ("d.delete_tied", std::bind(&apply_d_delete_tied, std::placeholders::_1)); CMD2_FUNC_SINGLE("d.start", "d.hashing_failed.set=0 ;view.set_visible=started"); CMD2_FUNC_SINGLE("d.stop", "view.set_visible=stopped"); @@ -634,33 +598,33 @@ initialize_command_download() { CMD2_DL ("d.is_open", CMD2_ON_INFO(is_open)); CMD2_DL ("d.is_active", CMD2_ON_INFO(is_active)); - CMD2_DL ("d.is_hash_checked", std::tr1::bind(&torrent::Download::is_hash_checked, CMD2_BIND_DL)); - CMD2_DL ("d.is_hash_checking", std::tr1::bind(&torrent::Download::is_hash_checking, CMD2_BIND_DL)); - CMD2_DL ("d.is_multi_file", std::tr1::bind(&torrent::FileList::is_multi_file, CMD2_BIND_FL)); + CMD2_DL ("d.is_hash_checked", std::bind(&torrent::Download::is_hash_checked, CMD2_BIND_DL)); + CMD2_DL ("d.is_hash_checking", std::bind(&torrent::Download::is_hash_checking, CMD2_BIND_DL)); + CMD2_DL ("d.is_multi_file", std::bind(&torrent::FileList::is_multi_file, CMD2_BIND_FL)); CMD2_DL ("d.is_private", CMD2_ON_INFO(is_private)); CMD2_DL ("d.is_pex_active", CMD2_ON_INFO(is_pex_active)); - CMD2_DL_V("d.resume", std::tr1::bind(&core::DownloadList::resume_default, control->core()->download_list(), std::tr1::placeholders::_1)); - CMD2_DL_V("d.pause", std::tr1::bind(&core::DownloadList::pause_default, control->core()->download_list(), std::tr1::placeholders::_1)); - CMD2_DL_V("d.open", std::tr1::bind(&core::DownloadList::open_throw, control->core()->download_list(), std::tr1::placeholders::_1)); - CMD2_DL_V("d.close", std::tr1::bind(&core::DownloadList::close_throw, control->core()->download_list(), std::tr1::placeholders::_1)); - CMD2_DL_V("d.erase", std::tr1::bind(&core::DownloadList::erase_ptr, control->core()->download_list(), std::tr1::placeholders::_1)); - CMD2_DL_V("d.check_hash", std::tr1::bind(&core::DownloadList::check_hash, control->core()->download_list(), std::tr1::placeholders::_1)); + CMD2_DL_V ("d.resume", std::bind(&core::DownloadList::resume_default, control->core()->download_list(), std::placeholders::_1)); + CMD2_DL_V ("d.pause", std::bind(&core::DownloadList::pause_default, control->core()->download_list(), std::placeholders::_1)); + CMD2_DL_V ("d.open", std::bind(&core::DownloadList::open_throw, control->core()->download_list(), std::placeholders::_1)); + CMD2_DL_V ("d.close", std::bind(&core::DownloadList::close_throw, control->core()->download_list(), std::placeholders::_1)); + CMD2_DL_V ("d.erase", std::bind(&core::DownloadList::erase_ptr, control->core()->download_list(), std::placeholders::_1)); + CMD2_DL_V ("d.check_hash", std::bind(&core::DownloadList::check_hash, control->core()->download_list(), std::placeholders::_1)); - CMD2_DL ("d.save_resume", std::tr1::bind(&core::DownloadStore::save_resume, control->core()->download_store(), std::tr1::placeholders::_1)); - CMD2_DL ("d.save_full_session", std::tr1::bind(&core::DownloadStore::save_full, control->core()->download_store(), std::tr1::placeholders::_1)); + CMD2_DL ("d.save_resume", std::bind(&core::DownloadStore::save_resume, control->core()->download_store(), std::placeholders::_1)); + CMD2_DL ("d.save_full_session", std::bind(&core::DownloadStore::save_full, control->core()->download_store(), std::placeholders::_1)); - CMD2_DL_V("d.update_priorities", CMD2_ON_DL(update_priorities)); + CMD2_DL_V ("d.update_priorities", CMD2_ON_DL(update_priorities)); - CMD2_DL_STRING_V("add_peer", std::tr1::bind(&apply_d_add_peer, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_DL_STRING_V("add_peer", std::bind(&apply_d_add_peer, std::placeholders::_1, std::placeholders::_2)); // // Custom settings: // - CMD2_DL_STRING("d.custom", std::tr1::bind(&retrieve_d_custom, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); - CMD2_DL_STRING("d.custom_throw", std::tr1::bind(&retrieve_d_custom_throw, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); - CMD2_DL_LIST ("d.custom.set", std::tr1::bind(&apply_d_custom, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_DL_STRING("d.custom", std::bind(&retrieve_d_custom, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_STRING("d.custom_throw", std::bind(&retrieve_d_custom_throw, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_LIST ("d.custom.set", std::bind(&apply_d_custom, std::placeholders::_1, std::placeholders::_2)); CMD2_DL_VAR_STRING_PUBLIC("d.custom1", "rtorrent", "custom1"); CMD2_DL_VAR_STRING_PUBLIC("d.custom2", "rtorrent", "custom2"); @@ -700,56 +664,56 @@ initialize_command_download() { CMD2_DL_VAR_VALUE("d.state_counter", "rtorrent", "state_counter"); CMD2_DL_VAR_VALUE_PUBLIC("d.ignore_commands", "rtorrent", "ignore_commands"); - CMD2_DL ("d.connection_current", std::tr1::bind(&retrieve_d_connection_type, std::tr1::placeholders::_1)); - CMD2_DL_STRING("d.connection_current.set", std::tr1::bind(&apply_d_connection_type, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_DL ("d.connection_current", std::bind(&torrent::option_as_string, torrent::OPTION_CONNECTION_TYPE, CMD2_ON_DL(connection_type))); + CMD2_DL_STRING("d.connection_current.set", std::bind(&apply_d_connection_type, std::placeholders::_1, std::placeholders::_2)); CMD2_DL_VAR_STRING("d.connection_leech", "rtorrent", "connection_leech"); CMD2_DL_VAR_STRING("d.connection_seed", "rtorrent", "connection_seed"); - CMD2_DL ("d.up.choke_heuristics", std::tr1::bind(&retrieve_d_choke_heuristics, std::tr1::placeholders::_1, false)); - CMD2_DL_STRING("d.up.choke_heuristics.set", std::tr1::bind(&apply_d_choke_heuristics, std::tr1::placeholders::_1, std::tr1::placeholders::_2, false)); - CMD2_DL ("d.down.choke_heuristics", std::tr1::bind(&retrieve_d_choke_heuristics, std::tr1::placeholders::_1, true)); - CMD2_DL_STRING("d.down.choke_heuristics.set", std::tr1::bind(&apply_d_choke_heuristics, std::tr1::placeholders::_1, std::tr1::placeholders::_2, true)); + CMD2_DL ("d.up.choke_heuristics", std::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, CMD2_ON_DL(upload_choke_heuristic))); + CMD2_DL_STRING("d.up.choke_heuristics.set", std::bind(&apply_d_choke_heuristics, std::placeholders::_1, std::placeholders::_2, false)); + CMD2_DL ("d.down.choke_heuristics", std::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, CMD2_ON_DL(download_choke_heuristic))); + CMD2_DL_STRING("d.down.choke_heuristics.set", std::bind(&apply_d_choke_heuristics, std::placeholders::_1, std::placeholders::_2, true)); CMD2_DL_VAR_STRING("d.up.choke_heuristics.leech", "rtorrent", "choke_heuristics.up.leech"); CMD2_DL_VAR_STRING("d.up.choke_heuristics.seed", "rtorrent", "choke_heuristics.up.seed"); CMD2_DL_VAR_STRING("d.down.choke_heuristics.leech", "rtorrent", "choke_heuristics.down.leech"); CMD2_DL_VAR_STRING("d.down.choke_heuristics.seed", "rtorrent", "choke_heuristics.down.seed"); - CMD2_DL ("d.hashing_failed", std::tr1::bind(&core::Download::is_hash_failed, std::tr1::placeholders::_1)); - CMD2_DL_VALUE_V("d.hashing_failed.set", std::tr1::bind(&core::Download::set_hash_failed, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_DL ("d.hashing_failed", std::bind(&core::Download::is_hash_failed, std::placeholders::_1)); + CMD2_DL_VALUE_V ("d.hashing_failed.set", std::bind(&core::Download::set_hash_failed, std::placeholders::_1, std::placeholders::_2)); - CMD2_DL ("d.views", std::tr1::bind(&download_get_variable, std::tr1::placeholders::_1, "rtorrent", "views")); - CMD2_DL ("d.views.has", std::tr1::bind(&d_list_has, std::tr1::placeholders::_1, std::tr1::placeholders::_2, "rtorrent", "views")); - CMD2_DL ("d.views.remove", std::tr1::bind(&d_list_remove, std::tr1::placeholders::_1, std::tr1::placeholders::_2, "rtorrent", "views")); - CMD2_DL ("d.views.push_back", std::tr1::bind(&d_list_push_back, std::tr1::placeholders::_1, std::tr1::placeholders::_2, "rtorrent", "views")); - CMD2_DL ("d.views.push_back_unique", std::tr1::bind(&d_list_push_back_unique, std::tr1::placeholders::_1, std::tr1::placeholders::_2, "rtorrent", "views")); + CMD2_DL ("d.views", std::bind(&download_get_variable, std::placeholders::_1, "rtorrent", "views")); + CMD2_DL ("d.views.has", std::bind(&d_list_has, std::placeholders::_1, std::placeholders::_2, "rtorrent", "views")); + CMD2_DL ("d.views.remove", std::bind(&d_list_remove, std::placeholders::_1, std::placeholders::_2, "rtorrent", "views")); + CMD2_DL ("d.views.push_back", std::bind(&d_list_push_back, std::placeholders::_1, std::placeholders::_2, "rtorrent", "views")); + CMD2_DL ("d.views.push_back_unique", std::bind(&d_list_push_back_unique, std::placeholders::_1, std::placeholders::_2, "rtorrent", "views")); // This command really needs to be improved, so we have proper // logging support. - CMD2_DL ("d.message", std::tr1::bind(&core::Download::message, std::tr1::placeholders::_1)); - CMD2_DL_STRING_V("d.message.set", std::tr1::bind(&core::Download::set_message, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_DL ("d.message", std::bind(&core::Download::message, std::placeholders::_1)); + CMD2_DL_STRING_V("d.message.set", std::bind(&core::Download::set_message, std::placeholders::_1, std::placeholders::_2)); - CMD2_DL ("d.max_file_size", CMD2_ON_FL(max_file_size)); - CMD2_DL_VALUE_V ("d.max_file_size.set", std::tr1::bind(&torrent::FileList::set_max_file_size, CMD2_BIND_FL, std::tr1::placeholders::_2)); + CMD2_DL ("d.max_file_size", CMD2_ON_FL(max_file_size)); + CMD2_DL_VALUE_V ("d.max_file_size.set", std::bind(&torrent::FileList::set_max_file_size, CMD2_BIND_FL, std::placeholders::_2)); - CMD2_DL ("d.peers_min", std::tr1::bind(&torrent::ConnectionList::min_size, CMD2_BIND_CL)); - CMD2_DL_VALUE_V ("d.peers_min.set", std::tr1::bind(&torrent::ConnectionList::set_min_size, CMD2_BIND_CL, std::tr1::placeholders::_2)); - CMD2_DL ("d.peers_max", std::tr1::bind(&torrent::ConnectionList::max_size, CMD2_BIND_CL)); - CMD2_DL_VALUE_V ("d.peers_max.set", std::tr1::bind(&torrent::ConnectionList::set_max_size, CMD2_BIND_CL, std::tr1::placeholders::_2)); - CMD2_DL ("d.uploads_max", std::tr1::bind(&torrent::Download::uploads_max, CMD2_BIND_DL)); - CMD2_DL_VALUE_V ("d.uploads_max.set", std::tr1::bind(&torrent::Download::set_uploads_max, CMD2_BIND_DL, std::tr1::placeholders::_2)); - CMD2_DL ("d.peers_connected", std::tr1::bind(&torrent::ConnectionList::size, CMD2_BIND_CL)); - CMD2_DL ("d.peers_not_connected", std::tr1::bind(&torrent::PeerList::available_list_size, CMD2_BIND_PL)); + CMD2_DL ("d.peers_min", std::bind(&torrent::ConnectionList::min_size, CMD2_BIND_CL)); + CMD2_DL_VALUE_V ("d.peers_min.set", std::bind(&torrent::ConnectionList::set_min_size, CMD2_BIND_CL, std::placeholders::_2)); + CMD2_DL ("d.peers_max", std::bind(&torrent::ConnectionList::max_size, CMD2_BIND_CL)); + CMD2_DL_VALUE_V ("d.peers_max.set", std::bind(&torrent::ConnectionList::set_max_size, CMD2_BIND_CL, std::placeholders::_2)); + CMD2_DL ("d.uploads_max", std::bind(&torrent::Download::uploads_max, CMD2_BIND_DL)); + CMD2_DL_VALUE_V ("d.uploads_max.set", std::bind(&torrent::Download::set_uploads_max, CMD2_BIND_DL, std::placeholders::_2)); + CMD2_DL ("d.peers_connected", std::bind(&torrent::ConnectionList::size, CMD2_BIND_CL)); + CMD2_DL ("d.peers_not_connected", std::bind(&torrent::PeerList::available_list_size, CMD2_BIND_PL)); - CMD2_DL ("d.peers_complete", CMD2_ON_DL(peers_complete)); - CMD2_DL ("d.peers_accounted", CMD2_ON_DL(peers_accounted)); + CMD2_DL ("d.peers_complete", CMD2_ON_DL(peers_complete)); + CMD2_DL ("d.peers_accounted", CMD2_ON_DL(peers_accounted)); - CMD2_DL ("d.throttle_name", std::tr1::bind(&download_get_variable, std::tr1::placeholders::_1, "rtorrent", "throttle_name")); - CMD2_DL_STRING_V("d.throttle_name.set", std::tr1::bind(&core::Download::set_throttle_name, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_DL ("d.throttle_name", std::bind(&download_get_variable, std::placeholders::_1, "rtorrent", "throttle_name")); + CMD2_DL_STRING_V("d.throttle_name.set", std::bind(&core::Download::set_throttle_name, std::placeholders::_1, std::placeholders::_2)); CMD2_DL ("d.bytes_done", CMD2_ON_DL(bytes_done)); - CMD2_DL ("d.ratio", std::tr1::bind(&retrieve_d_ratio, std::tr1::placeholders::_1)); + CMD2_DL ("d.ratio", std::bind(&retrieve_d_ratio, std::placeholders::_1)); CMD2_DL ("d.chunks_hashed", CMD2_ON_DL(chunks_hashed)); CMD2_DL ("d.free_diskspace", CMD2_ON_FL(free_diskspace)); @@ -764,25 +728,25 @@ initialize_command_download() { CMD2_DL ("d.completed_chunks", CMD2_ON_FL(completed_chunks)); CMD2_DL ("d.left_bytes", CMD2_ON_FL(left_bytes)); - CMD2_DL ("d.tracker_numwant", std::tr1::bind(&torrent::TrackerList::numwant, CMD2_BIND_TL)); - CMD2_DL_VALUE_V ("d.tracker_numwant.set", std::tr1::bind(&torrent::TrackerList::set_numwant, CMD2_BIND_TL, std::tr1::placeholders::_2)); - CMD2_DL ("d.tracker_focus", std::tr1::bind(&torrent::TrackerList::focus_index, CMD2_BIND_TL)); - CMD2_DL ("d.tracker_size", std::tr1::bind(&core::Download::tracker_list_size, std::tr1::placeholders::_1)); + CMD2_DL ("d.tracker_numwant", std::bind(&torrent::TrackerList::numwant, CMD2_BIND_TL)); + CMD2_DL_VALUE_V ("d.tracker_numwant.set", std::bind(&torrent::TrackerList::set_numwant, CMD2_BIND_TL, std::placeholders::_2)); + CMD2_DL ("d.tracker_focus", std::bind(&torrent::TrackerList::focus_index, CMD2_BIND_TL)); + CMD2_DL ("d.tracker_size", std::bind(&core::Download::tracker_list_size, std::placeholders::_1)); CMD2_DL ("d.directory", CMD2_ON_FL(root_dir)); - CMD2_DL_STRING_V("d.directory.set", std::tr1::bind(&apply_d_directory, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_DL_STRING_V("d.directory.set", std::bind(&apply_d_directory, std::placeholders::_1, std::placeholders::_2)); CMD2_DL ("d.directory_base", CMD2_ON_FL(root_dir)); - CMD2_DL_STRING_V("d.directory_base.set", std::tr1::bind(&core::Download::set_root_directory, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_DL_STRING_V("d.directory_base.set", std::bind(&core::Download::set_root_directory, std::placeholders::_1, std::placeholders::_2)); - CMD2_DL ("d.priority", std::tr1::bind(&core::Download::priority, std::tr1::placeholders::_1)); - CMD2_DL ("d.priority_str", std::tr1::bind(&retrieve_d_priority_str, std::tr1::placeholders::_1)); - CMD2_DL_VALUE_V ("d.priority.set", std::tr1::bind(&core::Download::set_priority, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_DL ("d.priority", std::bind(&core::Download::priority, std::placeholders::_1)); + CMD2_DL ("d.priority_str", std::bind(&retrieve_d_priority_str, std::placeholders::_1)); + CMD2_DL_VALUE_V ("d.priority.set", std::bind(&core::Download::set_priority, std::placeholders::_1, std::placeholders::_2)); - CMD2_DL ("d.initialize_logs", std::tr1::bind(&cmd_d_initialize_logs, std::tr1::placeholders::_1)); + CMD2_DL ("d.initialize_logs", std::bind(&cmd_d_initialize_logs, std::placeholders::_1)); - CMD2_DL_LIST ("f.multicall", std::tr1::bind(&f_multicall, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); - CMD2_DL_LIST ("p.multicall", std::tr1::bind(&p_multicall, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); - CMD2_DL_LIST ("t.multicall", std::tr1::bind(&t_multicall, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_DL_LIST ("f.multicall", std::bind(&f_multicall, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_LIST ("p.multicall", std::bind(&p_multicall, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_LIST ("t.multicall", std::bind(&t_multicall, std::placeholders::_1, std::placeholders::_2)); - CMD2_ANY_LIST ("p.call_target", std::tr1::bind(&p_call_target, std::tr1::placeholders::_2)); + CMD2_ANY_LIST ("p.call_target", std::bind(&p_call_target, std::placeholders::_2)); } diff --git a/src/command_dynamic.cc b/src/command_dynamic.cc index b8d25f1b..5cab378d 100644 --- a/src/command_dynamic.cc +++ b/src/command_dynamic.cc @@ -157,15 +157,15 @@ system_method_insert_object(const torrent::Object::list_type& args, int flags) { rpc::commands.insert_slot >::type> (create_new_key<0>(rawKey, ""), - std::tr1::bind(&rpc::object_storage::call_function_str, control->object_storage(), - rawKey, std::tr1::placeholders::_1, std::tr1::placeholders::_2), + std::bind(&rpc::object_storage::call_function_str, control->object_storage(), + rawKey, std::placeholders::_1, std::placeholders::_2), &rpc::command_base_call, cmd_flags, NULL, NULL); } else { rpc::commands.insert_slot >::type> (create_new_key<0>(rawKey, ""), - std::tr1::bind(&rpc::object_storage::get_str, control->object_storage(), rawKey), + std::bind(&rpc::object_storage::get_str, control->object_storage(), rawKey), &rpc::command_base_call, cmd_flags, NULL, NULL); } @@ -179,21 +179,21 @@ system_method_insert_object(const torrent::Object::list_type& args, int flags) { case rpc::object_storage::flag_bool_type: rpc::commands.insert_slot >::type> (create_new_key<5>(rawKey, ".set"), - std::tr1::bind(&rpc::object_storage::set_str_bool, control->object_storage(), rawKey, std::tr1::placeholders::_2), + std::bind(&rpc::object_storage::set_str_bool, control->object_storage(), rawKey, std::placeholders::_2), &rpc::command_base_call_value, cmd_flags, NULL, NULL); break; case rpc::object_storage::flag_value_type: rpc::commands.insert_slot >::type> (create_new_key<5>(rawKey, ".set"), - std::tr1::bind(&rpc::object_storage::set_str_value, control->object_storage(), rawKey, std::tr1::placeholders::_2), + std::bind(&rpc::object_storage::set_str_value, control->object_storage(), rawKey, std::placeholders::_2), &rpc::command_base_call_value, cmd_flags, NULL, NULL); break; case rpc::object_storage::flag_string_type: rpc::commands.insert_slot >::type> (create_new_key<5>(rawKey, ".set"), - std::tr1::bind(&rpc::object_storage::set_str_string, control->object_storage(), rawKey, std::tr1::placeholders::_2), + std::bind(&rpc::object_storage::set_str_string, control->object_storage(), rawKey, std::placeholders::_2), &rpc::command_base_call_string, cmd_flags, NULL, NULL); break; @@ -405,16 +405,16 @@ system_method_list_keys(const torrent::Object::string_type& args) { } #define CMD2_METHOD_INSERT(key, flags) \ - CMD2_ANY_LIST(key, std::tr1::bind(&system_method_insert_object, std::tr1::placeholders::_2, flags)); + CMD2_ANY_LIST(key, std::bind(&system_method_insert_object, std::placeholders::_2, flags)); void initialize_command_dynamic() { CMD2_VAR_BOOL ("method.use_deprecated", true); CMD2_VAR_VALUE ("method.use_intermediate", 1); - CMD2_ANY_LIST ("method.insert", std::tr1::bind(&system_method_insert, std::tr1::placeholders::_2)); + CMD2_ANY_LIST ("method.insert", std::bind(&system_method_insert, std::placeholders::_2)); - CMD2_ANY_LIST ("method.insert.value", std::tr1::bind(&system_method_insert_object, std::tr1::placeholders::_2, + CMD2_ANY_LIST ("method.insert.value", std::bind(&system_method_insert_object, std::placeholders::_2, rpc::object_storage::flag_value_type)); CMD2_METHOD_INSERT("method.insert.simple", rpc::object_storage::flag_function_type); @@ -422,13 +422,13 @@ initialize_command_dynamic() { CMD2_METHOD_INSERT("method.insert.s_c_simple", rpc::object_storage::flag_static | rpc::object_storage::flag_constant |rpc::object_storage::flag_function_type); - CMD2_ANY_STRING ("method.erase", std::tr1::bind(&system_method_erase, std::tr1::placeholders::_2)); - CMD2_ANY_LIST ("method.redirect", std::tr1::bind(&system_method_redirect, std::tr1::placeholders::_2)); - CMD2_ANY_STRING ("method.get", std::tr1::bind(&rpc::object_storage::get_str, control->object_storage(), - std::tr1::placeholders::_2)); - CMD2_ANY_LIST ("method.set", std::tr1::bind(&system_method_set_function, std::tr1::placeholders::_2)); + CMD2_ANY_STRING ("method.erase", std::bind(&system_method_erase, std::placeholders::_2)); + CMD2_ANY_LIST ("method.redirect", std::bind(&system_method_redirect, std::placeholders::_2)); + CMD2_ANY_STRING ("method.get", std::bind(&rpc::object_storage::get_str, control->object_storage(), + std::placeholders::_2)); + CMD2_ANY_LIST ("method.set", std::bind(&system_method_set_function, std::placeholders::_2)); - CMD2_ANY_LIST ("method.has_key", std::tr1::bind(&system_method_has_key, std::tr1::placeholders::_2)); - CMD2_ANY_LIST ("method.set_key", std::tr1::bind(&system_method_set_key, std::tr1::placeholders::_2)); - CMD2_ANY_STRING ("method.list_keys", std::tr1::bind(&system_method_list_keys, std::tr1::placeholders::_2)); + CMD2_ANY_LIST ("method.has_key", std::bind(&system_method_has_key, std::placeholders::_2)); + CMD2_ANY_LIST ("method.set_key", std::bind(&system_method_set_key, std::placeholders::_2)); + CMD2_ANY_STRING ("method.list_keys", std::bind(&system_method_list_keys, std::placeholders::_2)); } diff --git a/src/command_events.cc b/src/command_events.cc index 5a9a967e..2c5928fe 100644 --- a/src/command_events.cc +++ b/src/command_events.cc @@ -309,33 +309,33 @@ test_thread_locking() { void initialize_command_events() { - CMD2_ANY("test.thread_locking", std::tr1::bind(&test_thread_locking)); + CMD2_ANY("test.thread_locking", std::bind(&test_thread_locking)); - CMD2_ANY_STRING ("on_ratio", std::tr1::bind(&apply_on_ratio, std::tr1::placeholders::_2)); + CMD2_ANY_STRING ("on_ratio", std::bind(&apply_on_ratio, std::placeholders::_2)); - CMD2_ANY ("start_tied", std::tr1::bind(&apply_start_tied)); - CMD2_ANY ("stop_untied", std::tr1::bind(&apply_stop_untied)); - CMD2_ANY ("close_untied", std::tr1::bind(&apply_close_untied)); - CMD2_ANY ("remove_untied", std::tr1::bind(&apply_remove_untied)); + CMD2_ANY ("start_tied", std::bind(&apply_start_tied)); + CMD2_ANY ("stop_untied", std::bind(&apply_stop_untied)); + CMD2_ANY ("close_untied", std::bind(&apply_close_untied)); + CMD2_ANY ("remove_untied", std::bind(&apply_remove_untied)); - CMD2_ANY_LIST ("schedule2", std::tr1::bind(&apply_schedule, std::tr1::placeholders::_2)); - CMD2_ANY_STRING_V("schedule_remove2", std::tr1::bind(&rpc::CommandScheduler::erase_str, control->command_scheduler(), std::tr1::placeholders::_2)); + CMD2_ANY_LIST ("schedule2", std::bind(&apply_schedule, std::placeholders::_2)); + CMD2_ANY_STRING_V("schedule_remove2", std::bind(&rpc::CommandScheduler::erase_str, control->command_scheduler(), std::placeholders::_2)); - CMD2_ANY_STRING_V("import", std::tr1::bind(&apply_import, std::tr1::placeholders::_2)); - CMD2_ANY_STRING_V("try_import", std::tr1::bind(&apply_try_import, std::tr1::placeholders::_2)); + CMD2_ANY_STRING_V("import", std::bind(&apply_import, std::placeholders::_2)); + CMD2_ANY_STRING_V("try_import", std::bind(&apply_try_import, std::placeholders::_2)); - CMD2_ANY_LIST ("load.normal", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, core::Manager::create_quiet | core::Manager::create_tied)); - CMD2_ANY_LIST ("load.verbose", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, core::Manager::create_tied)); - CMD2_ANY_LIST ("load.start", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, + CMD2_ANY_LIST ("load.normal", std::bind(&apply_load, std::placeholders::_2, core::Manager::create_quiet | core::Manager::create_tied)); + CMD2_ANY_LIST ("load.verbose", std::bind(&apply_load, std::placeholders::_2, core::Manager::create_tied)); + CMD2_ANY_LIST ("load.start", std::bind(&apply_load, std::placeholders::_2, core::Manager::create_quiet | core::Manager::create_tied | core::Manager::create_start)); - CMD2_ANY_LIST ("load.start_verbose", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, core::Manager::create_tied | core::Manager::create_start)); - CMD2_ANY_LIST ("load.raw", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, core::Manager::create_quiet | core::Manager::create_raw_data)); - CMD2_ANY_LIST ("load.raw_verbose", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, core::Manager::create_raw_data)); - CMD2_ANY_LIST ("load.raw_start", std::tr1::bind(&apply_load, std::tr1::placeholders::_2, + CMD2_ANY_LIST ("load.start_verbose", std::bind(&apply_load, std::placeholders::_2, core::Manager::create_tied | core::Manager::create_start)); + CMD2_ANY_LIST ("load.raw", std::bind(&apply_load, std::placeholders::_2, core::Manager::create_quiet | core::Manager::create_raw_data)); + CMD2_ANY_LIST ("load.raw_verbose", std::bind(&apply_load, std::placeholders::_2, core::Manager::create_raw_data)); + CMD2_ANY_LIST ("load.raw_start", std::bind(&apply_load, std::placeholders::_2, core::Manager::create_quiet | core::Manager::create_start | core::Manager::create_raw_data)); - CMD2_ANY_VALUE ("close_low_diskspace", std::tr1::bind(&apply_close_low_diskspace, std::tr1::placeholders::_2)); + CMD2_ANY_VALUE ("close_low_diskspace", std::bind(&apply_close_low_diskspace, std::placeholders::_2)); - CMD2_ANY_LIST ("download_list", std::tr1::bind(&apply_download_list, std::tr1::placeholders::_2)); - CMD2_ANY_LIST ("d.multicall2", std::tr1::bind(&d_multicall, std::tr1::placeholders::_2)); + CMD2_ANY_LIST ("download_list", std::bind(&apply_download_list, std::placeholders::_2)); + CMD2_ANY_LIST ("d.multicall2", std::bind(&d_multicall, std::placeholders::_2)); } diff --git a/src/command_file.cc b/src/command_file.cc index 4a0e9f84..56004a87 100644 --- a/src/command_file.cc +++ b/src/command_file.cc @@ -99,38 +99,38 @@ apply_fi_filename_last(torrent::FileListIterator* itr) { void initialize_command_file() { - CMD2_FILE("f.is_created", std::tr1::bind(&torrent::File::is_created, std::tr1::placeholders::_1)); - CMD2_FILE("f.is_open", std::tr1::bind(&torrent::File::is_open, std::tr1::placeholders::_1)); + CMD2_FILE("f.is_created", std::bind(&torrent::File::is_created, std::placeholders::_1)); + CMD2_FILE("f.is_open", std::bind(&torrent::File::is_open, std::placeholders::_1)); - CMD2_FILE("f.is_create_queued", std::tr1::bind(&torrent::File::is_create_queued, std::tr1::placeholders::_1)); - CMD2_FILE("f.is_resize_queued", std::tr1::bind(&torrent::File::is_resize_queued, std::tr1::placeholders::_1)); + CMD2_FILE("f.is_create_queued", std::bind(&torrent::File::is_create_queued, std::placeholders::_1)); + CMD2_FILE("f.is_resize_queued", std::bind(&torrent::File::is_resize_queued, std::placeholders::_1)); - CMD2_FILE_VALUE_V("f.set_create_queued", std::tr1::bind(&torrent::File::set_flags, std::tr1::placeholders::_1, torrent::File::flag_create_queued)); - CMD2_FILE_VALUE_V("f.set_resize_queued", std::tr1::bind(&torrent::File::set_flags, std::tr1::placeholders::_1, torrent::File::flag_resize_queued)); - CMD2_FILE_VALUE_V("f.unset_create_queued", std::tr1::bind(&torrent::File::unset_flags, std::tr1::placeholders::_1, torrent::File::flag_create_queued)); - CMD2_FILE_VALUE_V("f.unset_resize_queued", std::tr1::bind(&torrent::File::unset_flags, std::tr1::placeholders::_1, torrent::File::flag_resize_queued)); + CMD2_FILE_VALUE_V("f.set_create_queued", std::bind(&torrent::File::set_flags, std::placeholders::_1, torrent::File::flag_create_queued)); + CMD2_FILE_VALUE_V("f.set_resize_queued", std::bind(&torrent::File::set_flags, std::placeholders::_1, torrent::File::flag_resize_queued)); + CMD2_FILE_VALUE_V("f.unset_create_queued", std::bind(&torrent::File::unset_flags, std::placeholders::_1, torrent::File::flag_create_queued)); + CMD2_FILE_VALUE_V("f.unset_resize_queued", std::bind(&torrent::File::unset_flags, std::placeholders::_1, torrent::File::flag_resize_queued)); - CMD2_FILE("f.size_bytes", std::tr1::bind(&torrent::File::size_bytes, std::tr1::placeholders::_1)); - CMD2_FILE("f.size_chunks", std::tr1::bind(&torrent::File::size_chunks, std::tr1::placeholders::_1)); - CMD2_FILE("f.completed_chunks", std::tr1::bind(&torrent::File::completed_chunks, std::tr1::placeholders::_1)); + CMD2_FILE("f.size_bytes", std::bind(&torrent::File::size_bytes, std::placeholders::_1)); + CMD2_FILE("f.size_chunks", std::bind(&torrent::File::size_chunks, std::placeholders::_1)); + CMD2_FILE("f.completed_chunks", std::bind(&torrent::File::completed_chunks, std::placeholders::_1)); - CMD2_FILE("f.offset", std::tr1::bind(&torrent::File::offset, std::tr1::placeholders::_1)); - CMD2_FILE("f.range_first", std::tr1::bind(&torrent::File::range_first, std::tr1::placeholders::_1)); - CMD2_FILE("f.range_second", std::tr1::bind(&torrent::File::range_second, std::tr1::placeholders::_1)); + CMD2_FILE("f.offset", std::bind(&torrent::File::offset, std::placeholders::_1)); + CMD2_FILE("f.range_first", std::bind(&torrent::File::range_first, std::placeholders::_1)); + CMD2_FILE("f.range_second", std::bind(&torrent::File::range_second, std::placeholders::_1)); - CMD2_FILE("f.priority", std::tr1::bind(&torrent::File::priority, std::tr1::placeholders::_1)); - CMD2_FILE_VALUE_V("f.priority.set", std::tr1::bind(&apply_f_set_priority, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_FILE("f.priority", std::bind(&torrent::File::priority, std::placeholders::_1)); + CMD2_FILE_VALUE_V("f.priority.set", std::bind(&apply_f_set_priority, std::placeholders::_1, std::placeholders::_2)); - CMD2_FILE("f.path", std::tr1::bind(&apply_f_path, std::tr1::placeholders::_1)); - CMD2_FILE("f.path_components", std::tr1::bind(&apply_f_path_components, std::tr1::placeholders::_1)); - CMD2_FILE("f.path_depth", std::tr1::bind(&apply_f_path_depth, std::tr1::placeholders::_1)); - CMD2_FILE("f.frozen_path", std::tr1::bind(&torrent::File::frozen_path, std::tr1::placeholders::_1)); + CMD2_FILE("f.path", std::bind(&apply_f_path, std::placeholders::_1)); + CMD2_FILE("f.path_components", std::bind(&apply_f_path_components, std::placeholders::_1)); + CMD2_FILE("f.path_depth", std::bind(&apply_f_path_depth, std::placeholders::_1)); + CMD2_FILE("f.frozen_path", std::bind(&torrent::File::frozen_path, std::placeholders::_1)); - CMD2_FILE("f.match_depth_prev", std::tr1::bind(&torrent::File::match_depth_prev, std::tr1::placeholders::_1)); - CMD2_FILE("f.match_depth_next", std::tr1::bind(&torrent::File::match_depth_next, std::tr1::placeholders::_1)); + CMD2_FILE("f.match_depth_prev", std::bind(&torrent::File::match_depth_prev, std::placeholders::_1)); + CMD2_FILE("f.match_depth_next", std::bind(&torrent::File::match_depth_next, std::placeholders::_1)); - CMD2_FILE("f.last_touched", std::tr1::bind(&torrent::File::last_touched, std::tr1::placeholders::_1)); + CMD2_FILE("f.last_touched", std::bind(&torrent::File::last_touched, std::placeholders::_1)); - CMD2_FILEITR("fi.filename_last", std::tr1::bind(&apply_fi_filename_last, std::tr1::placeholders::_1)); - CMD2_FILEITR("fi.is_file", std::tr1::bind(&torrent::FileListIterator::is_file, std::tr1::placeholders::_1)); + CMD2_FILEITR("fi.filename_last", std::bind(&apply_fi_filename_last, std::placeholders::_1)); + CMD2_FILEITR("fi.is_file", std::bind(&torrent::FileListIterator::is_file, std::placeholders::_1)); } diff --git a/src/command_helpers.h b/src/command_helpers.h index c7e74884..de0446f0 100644 --- a/src/command_helpers.h +++ b/src/command_helpers.h @@ -97,34 +97,34 @@ void initialize_commands(); #define CMD2_VAR_BOOL(key, value) \ control->object_storage()->insert_c_str(key, int64_t(value), rpc::object_storage::flag_bool_type); \ - CMD2_ANY(key, std::tr1::bind(&rpc::object_storage::get, control->object_storage(), \ + CMD2_ANY(key, std::bind(&rpc::object_storage::get, control->object_storage(), \ torrent::raw_string::from_c_str(key))); \ - CMD2_ANY_VALUE(key ".set", std::tr1::bind(&rpc::object_storage::set_bool, control->object_storage(), \ - torrent::raw_string::from_c_str(key), std::tr1::placeholders::_2)); + CMD2_ANY_VALUE(key ".set", std::bind(&rpc::object_storage::set_bool, control->object_storage(), \ + torrent::raw_string::from_c_str(key), std::placeholders::_2)); #define CMD2_VAR_VALUE(key, value) \ control->object_storage()->insert_c_str(key, int64_t(value), rpc::object_storage::flag_value_type); \ - CMD2_ANY(key, std::tr1::bind(&rpc::object_storage::get, control->object_storage(), \ + CMD2_ANY(key, std::bind(&rpc::object_storage::get, control->object_storage(), \ torrent::raw_string::from_c_str(key))); \ - CMD2_ANY_VALUE(key ".set", std::tr1::bind(&rpc::object_storage::set_value, control->object_storage(), \ - torrent::raw_string::from_c_str(key), std::tr1::placeholders::_2)); + CMD2_ANY_VALUE(key ".set", std::bind(&rpc::object_storage::set_value, control->object_storage(), \ + torrent::raw_string::from_c_str(key), std::placeholders::_2)); #define CMD2_VAR_STRING(key, value) \ control->object_storage()->insert_c_str(key, value, rpc::object_storage::flag_string_type); \ - CMD2_ANY(key, std::tr1::bind(&rpc::object_storage::get, control->object_storage(), \ + CMD2_ANY(key, std::bind(&rpc::object_storage::get, control->object_storage(), \ torrent::raw_string::from_c_str(key))); \ - CMD2_ANY_STRING(key ".set", std::tr1::bind(&rpc::object_storage::set_string, control->object_storage(), \ - torrent::raw_string::from_c_str(key), std::tr1::placeholders::_2)); + CMD2_ANY_STRING(key ".set", std::bind(&rpc::object_storage::set_string, control->object_storage(), \ + torrent::raw_string::from_c_str(key), std::placeholders::_2)); #define CMD2_VAR_C_STRING(key, value) \ control->object_storage()->insert_c_str(key, value, rpc::object_storage::flag_string_type); \ - CMD2_ANY(key, std::tr1::bind(&rpc::object_storage::get, control->object_storage(), \ + CMD2_ANY(key, std::bind(&rpc::object_storage::get, control->object_storage(), \ torrent::raw_string::from_c_str(key))); #define CMD2_FUNC_SINGLE(key, cmds) \ - CMD2_ANY(key, std::tr1::bind(&rpc::command_function_call, torrent::raw_string::from_c_str(cmds), \ - std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_ANY(key, std::bind(&rpc::command_function_call, torrent::raw_string::from_c_str(cmds), \ + std::placeholders::_1, std::placeholders::_2)); #define CMD2_REDIRECT(from_key, to_key) \ rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_dont_delete); diff --git a/src/command_local.cc b/src/command_local.cc index 972f770f..4462d8b8 100644 --- a/src/command_local.cc +++ b/src/command_local.cc @@ -247,8 +247,8 @@ initialize_command_local() { core::DownloadList* dList = control->core()->download_list(); core::DownloadStore* dStore = control->core()->download_store(); - CMD2_ANY ("system.hostname", std::tr1::bind(&system_hostname)); - CMD2_ANY ("system.pid", std::tr1::bind(&getpid)); + CMD2_ANY ("system.hostname", std::bind(&system_hostname)); + CMD2_ANY ("system.pid", std::bind(&getpid)); CMD2_VAR_C_STRING("system.client_version", PACKAGE_VERSION); CMD2_VAR_C_STRING("system.library_version", torrent::version()); @@ -257,43 +257,43 @@ initialize_command_local() { CMD2_VAR_VALUE ("system.file.split_size", -1); CMD2_VAR_STRING ("system.file.split_suffix", ".part"); - CMD2_ANY ("system.file_status_cache.size", std::tr1::bind(&utils::FileStatusCache::size, + CMD2_ANY ("system.file_status_cache.size", std::bind(&utils::FileStatusCache::size, (utils::FileStatusCache::base_type*)control->core()->file_status_cache())); - CMD2_ANY_V ("system.file_status_cache.prune", std::tr1::bind(&utils::FileStatusCache::prune, control->core()->file_status_cache())); + CMD2_ANY_V ("system.file_status_cache.prune", std::bind(&utils::FileStatusCache::prune, control->core()->file_status_cache())); - CMD2_ANY ("system.files.opened_counter", std::tr1::bind(&FM_t::files_opened_counter, fileManager)); - CMD2_ANY ("system.files.closed_counter", std::tr1::bind(&FM_t::files_closed_counter, fileManager)); - CMD2_ANY ("system.files.failed_counter", std::tr1::bind(&FM_t::files_failed_counter, fileManager)); + CMD2_ANY ("system.files.opened_counter", std::bind(&FM_t::files_opened_counter, fileManager)); + CMD2_ANY ("system.files.closed_counter", std::bind(&FM_t::files_closed_counter, fileManager)); + CMD2_ANY ("system.files.failed_counter", std::bind(&FM_t::files_failed_counter, fileManager)); - CMD2_ANY ("system.time", std::tr1::bind(&rak::timer::seconds, &cachedTime)); - CMD2_ANY ("system.time_seconds", std::tr1::bind(&rak::timer::current_seconds)); - CMD2_ANY ("system.time_usec", std::tr1::bind(&rak::timer::current_usec)); + CMD2_ANY ("system.time", std::bind(&rak::timer::seconds, &cachedTime)); + CMD2_ANY ("system.time_seconds", std::bind(&rak::timer::current_seconds)); + CMD2_ANY ("system.time_usec", std::bind(&rak::timer::current_usec)); - CMD2_ANY_VALUE_V ("system.umask.set", std::tr1::bind(&umask, std::tr1::placeholders::_2)); + CMD2_ANY_VALUE_V ("system.umask.set", std::bind(&umask, std::placeholders::_2)); - CMD2_ANY ("system.cwd", std::tr1::bind(&system_get_cwd)); - CMD2_ANY_STRING ("system.cwd.set", std::tr1::bind(&system_set_cwd, std::tr1::placeholders::_2)); + CMD2_ANY ("system.cwd", std::bind(&system_get_cwd)); + CMD2_ANY_STRING ("system.cwd.set", std::bind(&system_set_cwd, std::placeholders::_2)); - CMD2_ANY ("pieces.sync.always_safe", std::tr1::bind(&CM_t::safe_sync, chunkManager)); - CMD2_ANY_VALUE_V ("pieces.sync.always_safe.set", std::tr1::bind(&CM_t::set_safe_sync, chunkManager, std::tr1::placeholders::_2)); - CMD2_ANY ("pieces.sync.safe_free_diskspace", std::tr1::bind(&CM_t::safe_free_diskspace, chunkManager)); - CMD2_ANY ("pieces.sync.timeout", std::tr1::bind(&CM_t::timeout_sync, chunkManager)); - CMD2_ANY_VALUE_V ("pieces.sync.timeout.set", std::tr1::bind(&CM_t::set_timeout_sync, chunkManager, std::tr1::placeholders::_2)); - CMD2_ANY ("pieces.sync.timeout_safe", std::tr1::bind(&CM_t::timeout_safe_sync, chunkManager)); - CMD2_ANY_VALUE_V ("pieces.sync.timeout_safe.set", std::tr1::bind(&CM_t::set_timeout_safe_sync, chunkManager, std::tr1::placeholders::_2)); + CMD2_ANY ("pieces.sync.always_safe", std::bind(&CM_t::safe_sync, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.sync.always_safe.set", std::bind(&CM_t::set_safe_sync, chunkManager, std::placeholders::_2)); + CMD2_ANY ("pieces.sync.safe_free_diskspace", std::bind(&CM_t::safe_free_diskspace, chunkManager)); + CMD2_ANY ("pieces.sync.timeout", std::bind(&CM_t::timeout_sync, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.sync.timeout.set", std::bind(&CM_t::set_timeout_sync, chunkManager, std::placeholders::_2)); + CMD2_ANY ("pieces.sync.timeout_safe", std::bind(&CM_t::timeout_safe_sync, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.sync.timeout_safe.set", std::bind(&CM_t::set_timeout_safe_sync, chunkManager, std::placeholders::_2)); - CMD2_ANY ("pieces.preload.type", std::tr1::bind(&CM_t::preload_type, chunkManager)); - CMD2_ANY_VALUE_V ("pieces.preload.type.set", std::tr1::bind(&CM_t::set_preload_type, chunkManager, std::tr1::placeholders::_2)); - CMD2_ANY ("pieces.preload.min_size", std::tr1::bind(&CM_t::preload_min_size, chunkManager)); - CMD2_ANY_VALUE_V ("pieces.preload.min_size.set", std::tr1::bind(&CM_t::set_preload_min_size, chunkManager, std::tr1::placeholders::_2)); - CMD2_ANY ("pieces.preload.min_rate", std::tr1::bind(&CM_t::preload_required_rate, chunkManager)); - CMD2_ANY_VALUE_V ("pieces.preload.min_rate.set", std::tr1::bind(&CM_t::set_preload_required_rate, chunkManager, std::tr1::placeholders::_2)); + CMD2_ANY ("pieces.preload.type", std::bind(&CM_t::preload_type, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.preload.type.set", std::bind(&CM_t::set_preload_type, chunkManager, std::placeholders::_2)); + CMD2_ANY ("pieces.preload.min_size", std::bind(&CM_t::preload_min_size, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.preload.min_size.set", std::bind(&CM_t::set_preload_min_size, chunkManager, std::placeholders::_2)); + CMD2_ANY ("pieces.preload.min_rate", std::bind(&CM_t::preload_required_rate, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.preload.min_rate.set", std::bind(&CM_t::set_preload_required_rate, chunkManager, std::placeholders::_2)); - CMD2_ANY ("pieces.memory.current", std::tr1::bind(&CM_t::memory_usage, chunkManager)); - CMD2_ANY ("pieces.memory.max", std::tr1::bind(&CM_t::max_memory_usage, chunkManager)); - CMD2_ANY_VALUE_V ("pieces.memory.max.set", std::tr1::bind(&CM_t::set_max_memory_usage, chunkManager, std::tr1::placeholders::_2)); - CMD2_ANY ("pieces.stats_preloaded", std::tr1::bind(&CM_t::stats_preloaded, chunkManager)); - CMD2_ANY ("pieces.stats_not_preloaded", std::tr1::bind(&CM_t::stats_not_preloaded, chunkManager)); + CMD2_ANY ("pieces.memory.current", std::bind(&CM_t::memory_usage, chunkManager)); + CMD2_ANY ("pieces.memory.max", std::bind(&CM_t::max_memory_usage, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.memory.max.set", std::bind(&CM_t::set_max_memory_usage, chunkManager, std::placeholders::_2)); + CMD2_ANY ("pieces.stats_preloaded", std::bind(&CM_t::stats_preloaded, chunkManager)); + CMD2_ANY ("pieces.stats_not_preloaded", std::bind(&CM_t::stats_not_preloaded, chunkManager)); CMD2_VAR_BOOL ("pieces.hash.on_completion", true); @@ -303,13 +303,13 @@ initialize_command_local() { CMD2_VAR_BOOL ("session.use_lock", true); CMD2_VAR_BOOL ("session.on_completion", true); - CMD2_ANY ("session.path", std::tr1::bind(&core::DownloadStore::path, dStore)); - CMD2_ANY_STRING_V("session.path.set", std::tr1::bind(&core::DownloadStore::set_path, dStore, std::tr1::placeholders::_2)); + CMD2_ANY ("session.path", std::bind(&core::DownloadStore::path, dStore)); + CMD2_ANY_STRING_V("session.path.set", std::bind(&core::DownloadStore::set_path, dStore, std::placeholders::_2)); - CMD2_ANY_V ("session.save", std::tr1::bind(&core::DownloadList::session_save, dList)); + CMD2_ANY_V ("session.save", std::bind(&core::DownloadList::session_save, dList)); #define CMD2_EXECUTE(key, flags) \ - CMD2_ANY(key, std::tr1::bind(&rpc::ExecFile::execute_object, &rpc::execFile, std::tr1::placeholders::_2, flags)); + CMD2_ANY(key, std::bind(&rpc::ExecFile::execute_object, &rpc::execFile, std::placeholders::_2, flags)); CMD2_EXECUTE ("execute2", rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_throw); CMD2_EXECUTE ("execute.throw", rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_throw); @@ -319,21 +319,21 @@ initialize_command_local() { CMD2_EXECUTE ("execute.capture", rpc::ExecFile::flag_throw | rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_capture); CMD2_EXECUTE ("execute.capture_nothrow", rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_capture); - CMD2_ANY_STRING ("log.execute", std::tr1::bind(&apply_log, std::tr1::placeholders::_2, 0)); - CMD2_ANY_STRING ("log.vmmap.dump", std::tr1::bind(&log_vmmap_dump, std::tr1::placeholders::_2)); - CMD2_ANY_STRING_V("log.xmlrpc", std::tr1::bind(&ThreadWorker::set_xmlrpc_log, worker_thread, std::tr1::placeholders::_2)); + CMD2_ANY_STRING ("log.execute", std::bind(&apply_log, std::placeholders::_2, 0)); + CMD2_ANY_STRING ("log.vmmap.dump", std::bind(&log_vmmap_dump, std::placeholders::_2)); + CMD2_ANY_STRING_V("log.xmlrpc", std::bind(&ThreadWorker::set_xmlrpc_log, worker_thread, std::placeholders::_2)); - CMD2_ANY_LIST ("log.libtorrent", std::tr1::bind(&apply_log_libtorrent, std::tr1::placeholders::_2)); + CMD2_ANY_LIST ("log.libtorrent", std::bind(&apply_log_libtorrent, std::placeholders::_2)); // TODO: Convert to new command types: *rpc::command_base::argument(0) = "placeholder.0"; *rpc::command_base::argument(1) = "placeholder.1"; *rpc::command_base::argument(2) = "placeholder.2"; *rpc::command_base::argument(3) = "placeholder.3"; - CMD2_ANY_P("argument.0", std::tr1::bind(&rpc::command_base::argument_ref, 0)); - CMD2_ANY_P("argument.1", std::tr1::bind(&rpc::command_base::argument_ref, 1)); - CMD2_ANY_P("argument.2", std::tr1::bind(&rpc::command_base::argument_ref, 2)); - CMD2_ANY_P("argument.3", std::tr1::bind(&rpc::command_base::argument_ref, 3)); + CMD2_ANY_P("argument.0", std::bind(&rpc::command_base::argument_ref, 0)); + CMD2_ANY_P("argument.1", std::bind(&rpc::command_base::argument_ref, 1)); + CMD2_ANY_P("argument.2", std::bind(&rpc::command_base::argument_ref, 2)); + CMD2_ANY_P("argument.3", std::bind(&rpc::command_base::argument_ref, 3)); - CMD2_ANY_LIST ("group.insert", std::tr1::bind(&group_insert, std::tr1::placeholders::_2)); + CMD2_ANY_LIST ("group.insert", std::bind(&group_insert, std::placeholders::_2)); } diff --git a/src/command_network.cc b/src/command_network.cc index 2af332de..f2adcf93 100644 --- a/src/command_network.cc +++ b/src/command_network.cc @@ -598,8 +598,9 @@ apply_ipv4_filter_load(const torrent::Object::list_type& args) { throw torrent::input_error(buffer); } - snprintf(buffer, 2048, "Loaded %u address blocks (%u kb in-memory) from '%s'.", + snprintf(buffer, 2048, "Loaded %u %s address blocks (%u kb in-memory) from '%s'.", lineNumber, + args.back().as_string().c_str(), torrent::PeerList::ipv4_filter()->sizeof_data() / 1024, args.front().as_string().c_str()); control->core()->push_log(buffer); @@ -616,8 +617,8 @@ initialize_command_network() { CMD2_VAR_BOOL ("log.handshake", false); CMD2_VAR_STRING ("log.tracker", ""); - // CMD2_ANY_STRING ("encoding_list", std::tr1::bind(&apply_encoding_list, std::tr1::placeholders::_2)); - CMD2_ANY_STRING ("encoding.add", std::tr1::bind(&apply_encoding_list, std::tr1::placeholders::_2)); + // CMD2_ANY_STRING ("encoding_list", std::bind(&apply_encoding_list, std::placeholders::_2)); + CMD2_ANY_STRING ("encoding.add", std::bind(&apply_encoding_list, std::placeholders::_2)); // Isn't port_open used? CMD2_VAR_BOOL ("network.port_open", true); @@ -625,7 +626,7 @@ initialize_command_network() { CMD2_VAR_STRING ("network.port_range", "6881-6999"); CMD2_VAR_BOOL ("protocol.pex", true); - CMD2_ANY_LIST ("protocol.encryption.set", std::tr1::bind(&apply_encryption, std::tr1::placeholders::_2)); + CMD2_ANY_LIST ("protocol.encryption.set", std::bind(&apply_encryption, std::placeholders::_2)); CMD2_VAR_STRING ("protocol.connection.leech", "leech"); CMD2_VAR_STRING ("protocol.connection.seed", "seed"); @@ -635,8 +636,8 @@ initialize_command_network() { CMD2_VAR_STRING ("protocol.choke_heuristics.down.leech", "download_leech"); CMD2_VAR_STRING ("protocol.choke_heuristics.down.seed", "download_leech"); - CMD2_ANY ("throttle.unchoked_uploads", std::tr1::bind(&torrent::currently_unchoked)); - CMD2_ANY ("throttle.unchoked_downloads", std::tr1::bind(&torrent::download_unchoked)); + CMD2_ANY ("throttle.unchoked_uploads", std::bind(&torrent::currently_unchoked)); + CMD2_ANY ("throttle.unchoked_downloads", std::bind(&torrent::download_unchoked)); CMD2_VAR_VALUE ("throttle.min_peers.normal", 40); CMD2_VAR_VALUE ("throttle.max_peers.normal", 100); @@ -651,90 +652,90 @@ initialize_command_network() { CMD2_VAR_VALUE ("throttle.max_downloads.global", 0); // TODO: Move the logic into some libtorrent function. - CMD2_ANY ("throttle.global_up.rate", std::tr1::bind(&torrent::Rate::rate, torrent::up_rate())); - CMD2_ANY ("throttle.global_up.total", std::tr1::bind(&torrent::Rate::total, torrent::up_rate())); - CMD2_ANY ("throttle.global_up.max_rate", std::tr1::bind(&torrent::Throttle::max_rate, torrent::up_throttle_global())); - CMD2_ANY_VALUE_V ("throttle.global_up.max_rate.set", std::tr1::bind(&ui::Root::set_up_throttle_i64, control->ui(), std::tr1::placeholders::_2)); - CMD2_ANY_VALUE_KB("throttle.global_up.max_rate.set_kb", std::tr1::bind(&ui::Root::set_up_throttle_i64, control->ui(), std::tr1::placeholders::_2)); - CMD2_ANY ("throttle.global_down.rate", std::tr1::bind(&torrent::Rate::rate, torrent::down_rate())); - CMD2_ANY ("throttle.global_down.total", std::tr1::bind(&torrent::Rate::total, torrent::down_rate())); - CMD2_ANY ("throttle.global_down.max_rate", std::tr1::bind(&torrent::Throttle::max_rate, torrent::down_throttle_global())); - CMD2_ANY_VALUE_V ("throttle.global_down.max_rate.set", std::tr1::bind(&ui::Root::set_down_throttle_i64, control->ui(), std::tr1::placeholders::_2)); - CMD2_ANY_VALUE_KB("throttle.global_down.max_rate.set_kb", std::tr1::bind(&ui::Root::set_down_throttle_i64, control->ui(), std::tr1::placeholders::_2)); + CMD2_ANY ("throttle.global_up.rate", std::bind(&torrent::Rate::rate, torrent::up_rate())); + CMD2_ANY ("throttle.global_up.total", std::bind(&torrent::Rate::total, torrent::up_rate())); + CMD2_ANY ("throttle.global_up.max_rate", std::bind(&torrent::Throttle::max_rate, torrent::up_throttle_global())); + CMD2_ANY_VALUE_V ("throttle.global_up.max_rate.set", std::bind(&ui::Root::set_up_throttle_i64, control->ui(), std::placeholders::_2)); + CMD2_ANY_VALUE_KB("throttle.global_up.max_rate.set_kb", std::bind(&ui::Root::set_up_throttle_i64, control->ui(), std::placeholders::_2)); + CMD2_ANY ("throttle.global_down.rate", std::bind(&torrent::Rate::rate, torrent::down_rate())); + CMD2_ANY ("throttle.global_down.total", std::bind(&torrent::Rate::total, torrent::down_rate())); + CMD2_ANY ("throttle.global_down.max_rate", std::bind(&torrent::Throttle::max_rate, torrent::down_throttle_global())); + CMD2_ANY_VALUE_V ("throttle.global_down.max_rate.set", std::bind(&ui::Root::set_down_throttle_i64, control->ui(), std::placeholders::_2)); + CMD2_ANY_VALUE_KB("throttle.global_down.max_rate.set_kb", std::bind(&ui::Root::set_down_throttle_i64, control->ui(), std::placeholders::_2)); // Temporary names, need to change this to accept real rates rather // than kB. - CMD2_ANY_LIST ("throttle.up", std::tr1::bind(&apply_throttle, std::tr1::placeholders::_2, true)); - CMD2_ANY_LIST ("throttle.down", std::tr1::bind(&apply_throttle, std::tr1::placeholders::_2, false)); - CMD2_ANY_LIST ("throttle.ip", std::tr1::bind(&apply_address_throttle, std::tr1::placeholders::_2)); + CMD2_ANY_LIST ("throttle.up", std::bind(&apply_throttle, std::placeholders::_2, true)); + CMD2_ANY_LIST ("throttle.down", std::bind(&apply_throttle, std::placeholders::_2, false)); + CMD2_ANY_LIST ("throttle.ip", std::bind(&apply_address_throttle, std::placeholders::_2)); - CMD2_ANY_STRING ("throttle.up.max", std::tr1::bind(&retrieve_throttle_info, std::tr1::placeholders::_2, throttle_info_up | throttle_info_max)); - CMD2_ANY_STRING ("throttle.up.rate", std::tr1::bind(&retrieve_throttle_info, std::tr1::placeholders::_2, throttle_info_up | throttle_info_rate)); - CMD2_ANY_STRING ("throttle.down.max", std::tr1::bind(&retrieve_throttle_info, std::tr1::placeholders::_2, throttle_info_down | throttle_info_max)); - CMD2_ANY_STRING ("throttle.down.rate", std::tr1::bind(&retrieve_throttle_info, std::tr1::placeholders::_2, throttle_info_down | throttle_info_rate)); + CMD2_ANY_STRING ("throttle.up.max", std::bind(&retrieve_throttle_info, std::placeholders::_2, throttle_info_up | throttle_info_max)); + CMD2_ANY_STRING ("throttle.up.rate", std::bind(&retrieve_throttle_info, std::placeholders::_2, throttle_info_up | throttle_info_rate)); + CMD2_ANY_STRING ("throttle.down.max", std::bind(&retrieve_throttle_info, std::placeholders::_2, throttle_info_down | throttle_info_max)); + CMD2_ANY_STRING ("throttle.down.rate", std::bind(&retrieve_throttle_info, std::placeholders::_2, throttle_info_down | throttle_info_rate)); - CMD2_ANY ("network.http.capath", std::tr1::bind(&core::CurlStack::http_capath, httpStack)); - CMD2_ANY_STRING_V("network.http.capath.set", std::tr1::bind(&core::CurlStack::set_http_capath, httpStack, std::tr1::placeholders::_2)); - CMD2_ANY ("network.http.cacert", std::tr1::bind(&core::CurlStack::http_cacert, httpStack)); - CMD2_ANY_STRING_V("network.http.cacert.set", std::tr1::bind(&core::CurlStack::set_http_cacert, httpStack, std::tr1::placeholders::_2)); - CMD2_ANY ("network.http.proxy_address", std::tr1::bind(&core::CurlStack::http_proxy, httpStack)); - CMD2_ANY_STRING_V("network.http.proxy_address.set", std::tr1::bind(&core::CurlStack::set_http_proxy, httpStack, std::tr1::placeholders::_2)); - CMD2_ANY ("network.http.max_open", std::tr1::bind(&core::CurlStack::max_active, httpStack)); - CMD2_ANY_VALUE_V ("network.http.max_open.set", std::tr1::bind(&core::CurlStack::set_max_active, httpStack, std::tr1::placeholders::_2)); + CMD2_ANY ("network.http.capath", std::bind(&core::CurlStack::http_capath, httpStack)); + CMD2_ANY_STRING_V("network.http.capath.set", std::bind(&core::CurlStack::set_http_capath, httpStack, std::placeholders::_2)); + CMD2_ANY ("network.http.cacert", std::bind(&core::CurlStack::http_cacert, httpStack)); + CMD2_ANY_STRING_V("network.http.cacert.set", std::bind(&core::CurlStack::set_http_cacert, httpStack, std::placeholders::_2)); + CMD2_ANY ("network.http.proxy_address", std::bind(&core::CurlStack::http_proxy, httpStack)); + CMD2_ANY_STRING_V("network.http.proxy_address.set", std::bind(&core::CurlStack::set_http_proxy, httpStack, std::placeholders::_2)); + CMD2_ANY ("network.http.max_open", std::bind(&core::CurlStack::max_active, httpStack)); + CMD2_ANY_VALUE_V ("network.http.max_open.set", std::bind(&core::CurlStack::set_max_active, httpStack, std::placeholders::_2)); - CMD2_ANY ("network.send_buffer.size", std::tr1::bind(&torrent::ConnectionManager::send_buffer_size, cm)); - CMD2_ANY_VALUE_V ("network.send_buffer.size.set", std::tr1::bind(&torrent::ConnectionManager::set_send_buffer_size, cm, std::tr1::placeholders::_2)); - CMD2_ANY ("network.receive_buffer.size", std::tr1::bind(&torrent::ConnectionManager::receive_buffer_size, cm)); - CMD2_ANY_VALUE_V ("network.receive_buffer.size.set", std::tr1::bind(&torrent::ConnectionManager::set_receive_buffer_size, cm, std::tr1::placeholders::_2)); - CMD2_ANY_STRING ("network.tos.set", std::tr1::bind(&apply_tos, std::tr1::placeholders::_2)); + CMD2_ANY ("network.send_buffer.size", std::bind(&torrent::ConnectionManager::send_buffer_size, cm)); + CMD2_ANY_VALUE_V ("network.send_buffer.size.set", std::bind(&torrent::ConnectionManager::set_send_buffer_size, cm, std::placeholders::_2)); + CMD2_ANY ("network.receive_buffer.size", std::bind(&torrent::ConnectionManager::receive_buffer_size, cm)); + CMD2_ANY_VALUE_V ("network.receive_buffer.size.set", std::bind(&torrent::ConnectionManager::set_receive_buffer_size, cm, std::placeholders::_2)); + CMD2_ANY_STRING ("network.tos.set", std::bind(&apply_tos, std::placeholders::_2)); - CMD2_ANY ("network.bind_address", std::tr1::bind(&core::Manager::bind_address, control->core())); - CMD2_ANY_STRING_V("network.bind_address.set", std::tr1::bind(&core::Manager::set_bind_address, control->core(), std::tr1::placeholders::_2)); - CMD2_ANY ("network.local_address", std::tr1::bind(&core::Manager::local_address, control->core())); - CMD2_ANY_STRING_V("network.local_address.set", std::tr1::bind(&core::Manager::set_local_address, control->core(), std::tr1::placeholders::_2)); - CMD2_ANY ("network.proxy_address", std::tr1::bind(&core::Manager::proxy_address, control->core())); - CMD2_ANY_STRING_V("network.proxy_address.set", std::tr1::bind(&core::Manager::set_proxy_address, control->core(), std::tr1::placeholders::_2)); + CMD2_ANY ("network.bind_address", std::bind(&core::Manager::bind_address, control->core())); + CMD2_ANY_STRING_V("network.bind_address.set", std::bind(&core::Manager::set_bind_address, control->core(), std::placeholders::_2)); + CMD2_ANY ("network.local_address", std::bind(&core::Manager::local_address, control->core())); + CMD2_ANY_STRING_V("network.local_address.set", std::bind(&core::Manager::set_local_address, control->core(), std::placeholders::_2)); + CMD2_ANY ("network.proxy_address", std::bind(&core::Manager::proxy_address, control->core())); + CMD2_ANY_STRING_V("network.proxy_address.set", std::bind(&core::Manager::set_proxy_address, control->core(), std::placeholders::_2)); - CMD2_ANY ("network.max_open_files", std::tr1::bind(&torrent::FileManager::max_open_files, fileManager)); - CMD2_ANY_VALUE_V ("network.max_open_files.set", std::tr1::bind(&torrent::FileManager::set_max_open_files, fileManager, std::tr1::placeholders::_2)); - CMD2_ANY ("network.max_open_sockets", std::tr1::bind(&torrent::ConnectionManager::max_size, cm)); - CMD2_ANY_VALUE_V ("network.max_open_sockets.set", std::tr1::bind(&torrent::ConnectionManager::set_max_size, cm, std::tr1::placeholders::_2)); + CMD2_ANY ("network.max_open_files", std::bind(&torrent::FileManager::max_open_files, fileManager)); + CMD2_ANY_VALUE_V ("network.max_open_files.set", std::bind(&torrent::FileManager::set_max_open_files, fileManager, std::placeholders::_2)); + CMD2_ANY ("network.max_open_sockets", std::bind(&torrent::ConnectionManager::max_size, cm)); + CMD2_ANY_VALUE_V ("network.max_open_sockets.set", std::bind(&torrent::ConnectionManager::set_max_size, cm, std::placeholders::_2)); - CMD2_ANY_STRING ("network.scgi.open_port", std::tr1::bind(&apply_scgi, std::tr1::placeholders::_2, 1)); - CMD2_ANY_STRING ("network.scgi.open_local", std::tr1::bind(&apply_scgi, std::tr1::placeholders::_2, 2)); + CMD2_ANY_STRING ("network.scgi.open_port", std::bind(&apply_scgi, std::placeholders::_2, 1)); + CMD2_ANY_STRING ("network.scgi.open_local", std::bind(&apply_scgi, std::placeholders::_2, 2)); CMD2_VAR_BOOL ("network.scgi.dont_route", false); - CMD2_ANY_STRING ("network.xmlrpc.dialect.set", std::tr1::bind(&apply_xmlrpc_dialect, std::tr1::placeholders::_2)); - CMD2_ANY ("network.xmlrpc.size_limit", std::tr1::bind(&rpc::XmlRpc::size_limit)); - CMD2_ANY_VALUE_V ("network.xmlrpc.size_limit.set", std::tr1::bind(&rpc::XmlRpc::set_size_limit, std::tr1::placeholders::_2)); + CMD2_ANY_STRING ("network.xmlrpc.dialect.set", std::bind(&apply_xmlrpc_dialect, std::placeholders::_2)); + CMD2_ANY ("network.xmlrpc.size_limit", std::bind(&rpc::XmlRpc::size_limit)); + CMD2_ANY_VALUE_V ("network.xmlrpc.size_limit.set", std::bind(&rpc::XmlRpc::set_size_limit, std::placeholders::_2)); - CMD2_ANY ("system.hash.read_ahead", std::tr1::bind(&torrent::hash_read_ahead)); - CMD2_ANY_VALUE_V ("system.hash.read_ahead.set", std::tr1::bind(&apply_hash_read_ahead, std::tr1::placeholders::_2)); - CMD2_ANY ("system.hash.interval", std::tr1::bind(&torrent::hash_interval)); - CMD2_ANY_VALUE_V ("system.hash.interval.set", std::tr1::bind(&apply_hash_interval, std::tr1::placeholders::_2)); - CMD2_ANY ("system.hash.max_tries", std::tr1::bind(&torrent::hash_max_tries)); - CMD2_ANY_VALUE_V ("system.hash.max_tries.set", std::tr1::bind(&torrent::set_hash_max_tries, std::tr1::placeholders::_2)); + CMD2_ANY ("system.hash.read_ahead", std::bind(&torrent::hash_read_ahead)); + CMD2_ANY_VALUE_V ("system.hash.read_ahead.set", std::bind(&apply_hash_read_ahead, std::placeholders::_2)); + CMD2_ANY ("system.hash.interval", std::bind(&torrent::hash_interval)); + CMD2_ANY_VALUE_V ("system.hash.interval.set", std::bind(&apply_hash_interval, std::placeholders::_2)); + CMD2_ANY ("system.hash.max_tries", std::bind(&torrent::hash_max_tries)); + CMD2_ANY_VALUE_V ("system.hash.max_tries.set", std::bind(&torrent::set_hash_max_tries, std::placeholders::_2)); - CMD2_ANY_VALUE ("trackers.enable", std::tr1::bind(&apply_enable_trackers, int64_t(1))); - CMD2_ANY_VALUE ("trackers.disable", std::tr1::bind(&apply_enable_trackers, int64_t(0))); + CMD2_ANY_VALUE ("trackers.enable", std::bind(&apply_enable_trackers, int64_t(1))); + CMD2_ANY_VALUE ("trackers.disable", std::bind(&apply_enable_trackers, int64_t(0))); CMD2_VAR_VALUE ("trackers.numwant", -1); CMD2_VAR_BOOL ("trackers.use_udp", true); - CMD2_ANY_STRING ("ip_tables.insert_table", std::tr1::bind(&apply_ip_tables_insert_table, std::tr1::placeholders::_2)); - CMD2_ANY_LIST ("ip_tables.get", std::tr1::bind(&apply_ip_tables_get, std::tr1::placeholders::_2)); - CMD2_ANY_LIST ("ip_tables.add_address", std::tr1::bind(&apply_ip_tables_add_address, std::tr1::placeholders::_2)); + CMD2_ANY_STRING ("ip_tables.insert_table", std::bind(&apply_ip_tables_insert_table, std::placeholders::_2)); + CMD2_ANY_LIST ("ip_tables.get", std::bind(&apply_ip_tables_get, std::placeholders::_2)); + CMD2_ANY_LIST ("ip_tables.add_address", std::bind(&apply_ip_tables_add_address, std::placeholders::_2)); - CMD2_ANY ("ipv4_filter.size_data", std::tr1::bind(&apply_ipv4_filter_size_data)); - CMD2_ANY_STRING ("ipv4_filter.get", std::tr1::bind(&apply_ipv4_filter_get, std::tr1::placeholders::_2)); - CMD2_ANY_LIST ("ipv4_filter.add_address", std::tr1::bind(&apply_ipv4_filter_add_address, std::tr1::placeholders::_2)); - CMD2_ANY_LIST ("ipv4_filter.load", std::tr1::bind(&apply_ipv4_filter_load, std::tr1::placeholders::_2)); + CMD2_ANY ("ipv4_filter.size_data", std::bind(&apply_ipv4_filter_size_data)); + CMD2_ANY_STRING ("ipv4_filter.get", std::bind(&apply_ipv4_filter_get, std::placeholders::_2)); + CMD2_ANY_LIST ("ipv4_filter.add_address", std::bind(&apply_ipv4_filter_add_address, std::placeholders::_2)); + CMD2_ANY_LIST ("ipv4_filter.load", std::bind(&apply_ipv4_filter_load, std::placeholders::_2)); -// CMD2_ANY_V ("dht.enable", std::tr1::bind(&core::DhtManager::set_start, control->dht_manager())); -// CMD2_ANY_V ("dht.disable", std::tr1::bind(&core::DhtManager::set_stop, control->dht_manager())); - CMD2_ANY_STRING_V("dht.mode.set", std::tr1::bind(&core::DhtManager::set_mode, control->dht_manager(), std::tr1::placeholders::_2)); +// CMD2_ANY_V ("dht.enable", std::bind(&core::DhtManager::set_start, control->dht_manager())); +// CMD2_ANY_V ("dht.disable", std::bind(&core::DhtManager::set_stop, control->dht_manager())); + CMD2_ANY_STRING_V("dht.mode.set", std::bind(&core::DhtManager::set_mode, control->dht_manager(), std::placeholders::_2)); CMD2_VAR_VALUE ("dht.port", int64_t(6881)); - CMD2_ANY_STRING ("dht.add_node", std::tr1::bind(&apply_dht_add_node, std::tr1::placeholders::_2)); - CMD2_ANY ("dht.statistics", std::tr1::bind(&core::DhtManager::dht_statistics, control->dht_manager())); - CMD2_ANY ("dht.throttle.name", std::tr1::bind(&core::DhtManager::throttle_name, control->dht_manager())); - CMD2_ANY_STRING_V("dht.throttle.name.set", std::tr1::bind(&core::DhtManager::set_throttle_name, control->dht_manager(), std::tr1::placeholders::_2)); + CMD2_ANY_STRING ("dht.add_node", std::bind(&apply_dht_add_node, std::placeholders::_2)); + CMD2_ANY ("dht.statistics", std::bind(&core::DhtManager::dht_statistics, control->dht_manager())); + CMD2_ANY ("dht.throttle.name", std::bind(&core::DhtManager::throttle_name, control->dht_manager())); + CMD2_ANY_STRING_V("dht.throttle.name.set", std::bind(&core::DhtManager::set_throttle_name, control->dht_manager(), std::placeholders::_2)); } diff --git a/src/command_peer.cc b/src/command_peer.cc index 9cdb51c3..d497ae56 100644 --- a/src/command_peer.cc +++ b/src/command_peer.cc @@ -97,34 +97,37 @@ retrieve_p_completed_percent(torrent::Peer* peer) { void initialize_command_peer() { - CMD2_PEER("p.id", std::tr1::bind(&retrieve_p_id, std::tr1::placeholders::_1)); - CMD2_PEER("p.id_html", std::tr1::bind(&retrieve_p_id_html, std::tr1::placeholders::_1)); - CMD2_PEER("p.client_version", std::tr1::bind(&retrieve_p_client_version, std::tr1::placeholders::_1)); + CMD2_PEER("p.id", std::bind(&retrieve_p_id, std::placeholders::_1)); + CMD2_PEER("p.id_html", std::bind(&retrieve_p_id_html, std::placeholders::_1)); + CMD2_PEER("p.client_version", std::bind(&retrieve_p_client_version, std::placeholders::_1)); - CMD2_PEER("p.options_str", std::tr1::bind(&retrieve_p_options_str, std::tr1::placeholders::_1)); + CMD2_PEER("p.options_str", std::bind(&retrieve_p_options_str, std::placeholders::_1)); - CMD2_PEER("p.is_encrypted", std::tr1::bind(&torrent::Peer::is_encrypted, std::tr1::placeholders::_1)); - CMD2_PEER("p.is_incoming", std::tr1::bind(&torrent::Peer::is_incoming, std::tr1::placeholders::_1)); - CMD2_PEER("p.is_obfuscated", std::tr1::bind(&torrent::Peer::is_obfuscated, std::tr1::placeholders::_1)); - CMD2_PEER("p.is_snubbed", std::tr1::bind(&torrent::Peer::is_snubbed, std::tr1::placeholders::_1)); + CMD2_PEER("p.is_encrypted", std::bind(&torrent::Peer::is_encrypted, std::placeholders::_1)); + CMD2_PEER("p.is_incoming", std::bind(&torrent::Peer::is_incoming, std::placeholders::_1)); + CMD2_PEER("p.is_obfuscated", std::bind(&torrent::Peer::is_obfuscated, std::placeholders::_1)); + CMD2_PEER("p.is_snubbed", std::bind(&torrent::Peer::is_snubbed, std::placeholders::_1)); - CMD2_PEER("p.address", std::tr1::bind(&retrieve_p_address, std::tr1::placeholders::_1)); - CMD2_PEER("p.port", std::tr1::bind(&retrieve_p_port, std::tr1::placeholders::_1)); + CMD2_PEER("p.is_unwanted", std::bind(&torrent::PeerInfo::is_unwanted, std::bind(&torrent::Peer::peer_info, std::placeholders::_1))); + CMD2_PEER("p.is_preferred", std::bind(&torrent::PeerInfo::is_preferred, std::bind(&torrent::Peer::peer_info, std::placeholders::_1))); - CMD2_PEER("p.completed_percent", std::tr1::bind(&retrieve_p_completed_percent, std::tr1::placeholders::_1)); + CMD2_PEER("p.address", std::bind(&retrieve_p_address, std::placeholders::_1)); + CMD2_PEER("p.port", std::bind(&retrieve_p_port, std::placeholders::_1)); - CMD2_PEER("p.up_rate", std::tr1::bind(&torrent::Rate::rate, std::tr1::bind(&torrent::Peer::up_rate, std::tr1::placeholders::_1))); - CMD2_PEER("p.up_total", std::tr1::bind(&torrent::Rate::total, std::tr1::bind(&torrent::Peer::up_rate, std::tr1::placeholders::_1))); - CMD2_PEER("p.down_rate", std::tr1::bind(&torrent::Rate::rate, std::tr1::bind(&torrent::Peer::down_rate, std::tr1::placeholders::_1))); - CMD2_PEER("p.down_total", std::tr1::bind(&torrent::Rate::total, std::tr1::bind(&torrent::Peer::down_rate, std::tr1::placeholders::_1))); - CMD2_PEER("p.peer_rate", std::tr1::bind(&torrent::Rate::rate, std::tr1::bind(&torrent::Peer::peer_rate, std::tr1::placeholders::_1))); - CMD2_PEER("p.peer_total", std::tr1::bind(&torrent::Rate::total, std::tr1::bind(&torrent::Peer::peer_rate, std::tr1::placeholders::_1))); + CMD2_PEER("p.completed_percent", std::bind(&retrieve_p_completed_percent, std::placeholders::_1)); - CMD2_PEER ("p.snubbed", std::tr1::bind(&torrent::Peer::is_snubbed, std::tr1::placeholders::_1)); - CMD2_PEER_VALUE_V("p.snubbed.set", std::tr1::bind(&torrent::Peer::set_snubbed, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); - CMD2_PEER ("p.banned", std::tr1::bind(&torrent::Peer::is_banned, std::tr1::placeholders::_1)); - CMD2_PEER_VALUE_V("p.banned.set", std::tr1::bind(&torrent::Peer::set_banned, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_PEER("p.up_rate", std::bind(&torrent::Rate::rate, std::bind(&torrent::Peer::up_rate, std::placeholders::_1))); + CMD2_PEER("p.up_total", std::bind(&torrent::Rate::total, std::bind(&torrent::Peer::up_rate, std::placeholders::_1))); + CMD2_PEER("p.down_rate", std::bind(&torrent::Rate::rate, std::bind(&torrent::Peer::down_rate, std::placeholders::_1))); + CMD2_PEER("p.down_total", std::bind(&torrent::Rate::total, std::bind(&torrent::Peer::down_rate, std::placeholders::_1))); + CMD2_PEER("p.peer_rate", std::bind(&torrent::Rate::rate, std::bind(&torrent::Peer::peer_rate, std::placeholders::_1))); + CMD2_PEER("p.peer_total", std::bind(&torrent::Rate::total, std::bind(&torrent::Peer::peer_rate, std::placeholders::_1))); - CMD2_PEER_V("p.disconnect", std::tr1::bind(&torrent::Peer::disconnect, std::tr1::placeholders::_1, 0)); - CMD2_PEER_V("p.disconnect_delayed", std::tr1::bind(&torrent::Peer::disconnect, std::tr1::placeholders::_1, torrent::ConnectionList::disconnect_delayed)); + CMD2_PEER ("p.snubbed", std::bind(&torrent::Peer::is_snubbed, std::placeholders::_1)); + CMD2_PEER_VALUE_V("p.snubbed.set", std::bind(&torrent::Peer::set_snubbed, std::placeholders::_1, std::placeholders::_2)); + CMD2_PEER ("p.banned", std::bind(&torrent::Peer::is_banned, std::placeholders::_1)); + CMD2_PEER_VALUE_V("p.banned.set", std::bind(&torrent::Peer::set_banned, std::placeholders::_1, std::placeholders::_2)); + + CMD2_PEER_V("p.disconnect", std::bind(&torrent::Peer::disconnect, std::placeholders::_1, 0)); + CMD2_PEER_V("p.disconnect_delayed", std::bind(&torrent::Peer::disconnect, std::placeholders::_1, torrent::ConnectionList::disconnect_delayed)); } diff --git a/src/command_scheduler.cc b/src/command_scheduler.cc index 887d10f7..e6900d7f 100644 --- a/src/command_scheduler.cc +++ b/src/command_scheduler.cc @@ -115,7 +115,7 @@ void initialize_command_scheduler() { CMD2_VAR_VALUE("scheduler.max_active", int64_t(-1)); - CMD2_DL("scheduler.simple.added", std::tr1::bind(&cmd_scheduler_simple_added, std::tr1::placeholders::_1)); - CMD2_DL("scheduler.simple.removed", std::tr1::bind(&cmd_scheduler_simple_removed, std::tr1::placeholders::_1)); - CMD2_DL("scheduler.simple.update", std::tr1::bind(&cmd_scheduler_simple_update, std::tr1::placeholders::_1)); + CMD2_DL("scheduler.simple.added", std::bind(&cmd_scheduler_simple_added, std::placeholders::_1)); + CMD2_DL("scheduler.simple.removed", std::bind(&cmd_scheduler_simple_removed, std::placeholders::_1)); + CMD2_DL("scheduler.simple.update", std::bind(&cmd_scheduler_simple_update, std::placeholders::_1)); } diff --git a/src/command_tracker.cc b/src/command_tracker.cc index bbb2f7d6..d5f8d799 100644 --- a/src/command_tracker.cc +++ b/src/command_tracker.cc @@ -47,21 +47,21 @@ void initialize_command_tracker() { - CMD2_TRACKER ("t.is_open", std::tr1::bind(&torrent::Tracker::is_busy, std::tr1::placeholders::_1)); - CMD2_TRACKER ("t.is_enabled", std::tr1::bind(&torrent::Tracker::is_enabled, std::tr1::placeholders::_1)); - CMD2_TRACKER_VALUE_V("t.is_enabled.set", std::tr1::bind(&torrent::Tracker::set_enabled, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); - CMD2_TRACKER_V ("t.enable", std::tr1::bind(&torrent::Tracker::enable, std::tr1::placeholders::_1)); - CMD2_TRACKER_V ("t.disable", std::tr1::bind(&torrent::Tracker::disable, std::tr1::placeholders::_1)); + CMD2_TRACKER ("t.is_open", std::bind(&torrent::Tracker::is_busy, std::placeholders::_1)); + CMD2_TRACKER ("t.is_enabled", std::bind(&torrent::Tracker::is_enabled, std::placeholders::_1)); + CMD2_TRACKER_VALUE_V("t.is_enabled.set", std::bind(&torrent::Tracker::set_enabled, std::placeholders::_1, std::placeholders::_2)); + CMD2_TRACKER_V ("t.enable", std::bind(&torrent::Tracker::enable, std::placeholders::_1)); + CMD2_TRACKER_V ("t.disable", std::bind(&torrent::Tracker::disable, std::placeholders::_1)); - CMD2_TRACKER ("t.url", std::tr1::bind(&torrent::Tracker::url, std::tr1::placeholders::_1)); - CMD2_TRACKER ("t.group", std::tr1::bind(&torrent::Tracker::group, std::tr1::placeholders::_1)); - CMD2_TRACKER ("t.type", std::tr1::bind(&torrent::Tracker::type, std::tr1::placeholders::_1)); - CMD2_TRACKER ("t.id", std::tr1::bind(&torrent::Tracker::tracker_id, std::tr1::placeholders::_1)); + CMD2_TRACKER ("t.url", std::bind(&torrent::Tracker::url, std::placeholders::_1)); + CMD2_TRACKER ("t.group", std::bind(&torrent::Tracker::group, std::placeholders::_1)); + CMD2_TRACKER ("t.type", std::bind(&torrent::Tracker::type, std::placeholders::_1)); + CMD2_TRACKER ("t.id", std::bind(&torrent::Tracker::tracker_id, std::placeholders::_1)); - CMD2_TRACKER ("t.normal_interval", std::tr1::bind(&torrent::Tracker::normal_interval, std::tr1::placeholders::_1)); - CMD2_TRACKER ("t.min_interval", std::tr1::bind(&torrent::Tracker::min_interval, std::tr1::placeholders::_1)); - CMD2_TRACKER ("t.scrape_time_last", std::tr1::bind(&torrent::Tracker::scrape_time_last, std::tr1::placeholders::_1)); - CMD2_TRACKER ("t.scrape_complete", std::tr1::bind(&torrent::Tracker::scrape_complete, std::tr1::placeholders::_1)); - CMD2_TRACKER ("t.scrape_incomplete", std::tr1::bind(&torrent::Tracker::scrape_incomplete, std::tr1::placeholders::_1)); - CMD2_TRACKER ("t.scrape_downloaded", std::tr1::bind(&torrent::Tracker::scrape_downloaded, std::tr1::placeholders::_1)); + CMD2_TRACKER ("t.normal_interval", std::bind(&torrent::Tracker::normal_interval, std::placeholders::_1)); + CMD2_TRACKER ("t.min_interval", std::bind(&torrent::Tracker::min_interval, std::placeholders::_1)); + CMD2_TRACKER ("t.scrape_time_last", std::bind(&torrent::Tracker::scrape_time_last, std::placeholders::_1)); + CMD2_TRACKER ("t.scrape_complete", std::bind(&torrent::Tracker::scrape_complete, std::placeholders::_1)); + CMD2_TRACKER ("t.scrape_incomplete", std::bind(&torrent::Tracker::scrape_incomplete, std::placeholders::_1)); + CMD2_TRACKER ("t.scrape_downloaded", std::bind(&torrent::Tracker::scrape_downloaded, std::placeholders::_1)); } diff --git a/src/command_ui.cc b/src/command_ui.cc index 73467568..0922b2e6 100644 --- a/src/command_ui.cc +++ b/src/command_ui.cc @@ -459,39 +459,39 @@ void initialize_command_ui() { CMD2_VAR_STRING("keys.layout", "qwerty"); - CMD2_ANY_STRING("view.add", object_convert_void(std::tr1::bind(&core::ViewManager::insert_throw, control->view_manager(), std::tr1::placeholders::_2))); + CMD2_ANY_STRING("view.add", object_convert_void(std::bind(&core::ViewManager::insert_throw, control->view_manager(), std::placeholders::_2))); - CMD2_ANY_L ("view.list", std::tr1::bind(&apply_view_list)); - CMD2_ANY_LIST("view.set", std::tr1::bind(&apply_view_set, std::tr1::placeholders::_2)); + CMD2_ANY_L ("view.list", std::bind(&apply_view_list)); + CMD2_ANY_LIST("view.set", std::bind(&apply_view_set, std::placeholders::_2)); - CMD2_ANY_LIST("view.filter", std::tr1::bind(&apply_view_cfilter, &core::ViewManager::set_filter, std::tr1::placeholders::_2)); - CMD2_ANY_LIST("view.filter_on", std::tr1::bind(&apply_view_filter_on, std::tr1::placeholders::_2)); + CMD2_ANY_LIST("view.filter", std::bind(&apply_view_cfilter, &core::ViewManager::set_filter, std::placeholders::_2)); + CMD2_ANY_LIST("view.filter_on", std::bind(&apply_view_filter_on, std::placeholders::_2)); - CMD2_ANY_LIST("view.sort", std::tr1::bind(&apply_view_sort, std::tr1::placeholders::_2)); - CMD2_ANY_LIST("view.sort_new", std::tr1::bind(&apply_view_cfilter, &core::ViewManager::set_sort_new, std::tr1::placeholders::_2)); - CMD2_ANY_LIST("view.sort_current", std::tr1::bind(&apply_view_cfilter, &core::ViewManager::set_sort_current, std::tr1::placeholders::_2)); + CMD2_ANY_LIST("view.sort", std::bind(&apply_view_sort, std::placeholders::_2)); + CMD2_ANY_LIST("view.sort_new", std::bind(&apply_view_cfilter, &core::ViewManager::set_sort_new, std::placeholders::_2)); + CMD2_ANY_LIST("view.sort_current", std::bind(&apply_view_cfilter, &core::ViewManager::set_sort_current, std::placeholders::_2)); - CMD2_ANY_LIST("view.event_added", std::tr1::bind(&apply_view_cfilter, &core::ViewManager::set_event_added, std::tr1::placeholders::_2)); - CMD2_ANY_LIST("view.event_removed", std::tr1::bind(&apply_view_cfilter, &core::ViewManager::set_event_removed, std::tr1::placeholders::_2)); + CMD2_ANY_LIST("view.event_added", std::bind(&apply_view_cfilter, &core::ViewManager::set_event_added, std::placeholders::_2)); + CMD2_ANY_LIST("view.event_removed", std::bind(&apply_view_cfilter, &core::ViewManager::set_event_removed, std::placeholders::_2)); // Cleanup and add . to view. - CMD2_ANY_STRING("view.size", std::tr1::bind(&cmd_view_size, std::tr1::placeholders::_2)); - CMD2_ANY_STRING("view.size_not_visible", std::tr1::bind(&cmd_view_size_not_visible, std::tr1::placeholders::_2)); - CMD2_ANY_STRING("view.persistent", std::tr1::bind(&cmd_view_persistent, std::tr1::placeholders::_2)); + CMD2_ANY_STRING("view.size", std::bind(&cmd_view_size, std::placeholders::_2)); + CMD2_ANY_STRING("view.size_not_visible", std::bind(&cmd_view_size_not_visible, std::placeholders::_2)); + CMD2_ANY_STRING("view.persistent", std::bind(&cmd_view_persistent, std::placeholders::_2)); - CMD2_DL_STRING ("view.filter_download", std::tr1::bind(&cmd_view_filter_download, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); - CMD2_DL_STRING ("view.set_visible", std::tr1::bind(&cmd_view_set_visible, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); - CMD2_DL_STRING ("view.set_not_visible", std::tr1::bind(&cmd_view_set_not_visible, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); + CMD2_DL_STRING ("view.filter_download", std::bind(&cmd_view_filter_download, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_STRING ("view.set_visible", std::bind(&cmd_view_set_visible, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_STRING ("view.set_not_visible", std::bind(&cmd_view_set_not_visible, std::placeholders::_1, std::placeholders::_2)); // Commands that affect the default rtorrent UI. - CMD2_DL ("ui.unfocus_download", std::tr1::bind(&cmd_ui_unfocus_download, std::tr1::placeholders::_1)); - CMD2_ANY_STRING("ui.current_view.set", std::tr1::bind(&cmd_ui_set_view, std::tr1::placeholders::_2)); + CMD2_DL ("ui.unfocus_download", std::bind(&cmd_ui_unfocus_download, std::placeholders::_1)); + CMD2_ANY_STRING("ui.current_view.set", std::bind(&cmd_ui_set_view, std::placeholders::_2)); // Move. CMD2_ANY("print", &apply_print); CMD2_ANY("cat", &apply_cat); - CMD2_ANY("if", std::tr1::bind(&apply_if, std::tr1::placeholders::_1, std::tr1::placeholders::_2, 0)); + CMD2_ANY("if", std::bind(&apply_if, std::placeholders::_1, std::placeholders::_2, 0)); CMD2_ANY("not", &apply_not); CMD2_ANY("false", &apply_false); CMD2_ANY("and", &apply_and); @@ -499,19 +499,19 @@ initialize_command_ui() { // A temporary command for handling stuff until we get proper // support for seperation of commands and literals. - CMD2_ANY("branch", std::tr1::bind(&apply_if, std::tr1::placeholders::_1, std::tr1::placeholders::_2, 1)); + CMD2_ANY("branch", std::bind(&apply_if, std::placeholders::_1, std::placeholders::_2, 1)); CMD2_ANY_LIST("less", &apply_less); CMD2_ANY_LIST("greater", &apply_greater); CMD2_ANY_LIST("equal", &apply_equal); - CMD2_ANY_VALUE("convert.gm_time", std::tr1::bind(&apply_to_time, std::tr1::placeholders::_2, 0)); - CMD2_ANY_VALUE("convert.gm_date", std::tr1::bind(&apply_to_time, std::tr1::placeholders::_2, 0x2)); - CMD2_ANY_VALUE("convert.time", std::tr1::bind(&apply_to_time, std::tr1::placeholders::_2, 0x1)); - CMD2_ANY_VALUE("convert.date", std::tr1::bind(&apply_to_time, std::tr1::placeholders::_2, 0x1 | 0x2)); - CMD2_ANY_VALUE("convert.elapsed_time", std::tr1::bind(&apply_to_elapsed_time, std::tr1::placeholders::_2)); - CMD2_ANY_VALUE("convert.kb", std::tr1::bind(&apply_to_kb, std::tr1::placeholders::_2)); - CMD2_ANY_VALUE("convert.mb", std::tr1::bind(&apply_to_mb, std::tr1::placeholders::_2)); - CMD2_ANY_VALUE("convert.xb", std::tr1::bind(&apply_to_xb, std::tr1::placeholders::_2)); - CMD2_ANY_VALUE("convert.throttle", std::tr1::bind(&apply_to_throttle, std::tr1::placeholders::_2)); + CMD2_ANY_VALUE("convert.gm_time", std::bind(&apply_to_time, std::placeholders::_2, 0)); + CMD2_ANY_VALUE("convert.gm_date", std::bind(&apply_to_time, std::placeholders::_2, 0x2)); + CMD2_ANY_VALUE("convert.time", std::bind(&apply_to_time, std::placeholders::_2, 0x1)); + CMD2_ANY_VALUE("convert.date", std::bind(&apply_to_time, std::placeholders::_2, 0x1 | 0x2)); + CMD2_ANY_VALUE("convert.elapsed_time", std::bind(&apply_to_elapsed_time, std::placeholders::_2)); + CMD2_ANY_VALUE("convert.kb", std::bind(&apply_to_kb, std::placeholders::_2)); + CMD2_ANY_VALUE("convert.mb", std::bind(&apply_to_mb, std::placeholders::_2)); + CMD2_ANY_VALUE("convert.xb", std::bind(&apply_to_xb, std::placeholders::_2)); + CMD2_ANY_VALUE("convert.throttle", std::bind(&apply_to_throttle, std::placeholders::_2)); } diff --git a/src/rpc/command.h b/src/rpc/command.h index 5e63b572..f7a89657 100644 --- a/src/rpc/command.h +++ b/src/rpc/command.h @@ -46,6 +46,11 @@ #include #include +// Move into config.h or something. +namespace std { + using namespace tr1; +} + namespace core { class Download; } @@ -108,7 +113,7 @@ typedef rt_triple target_type; class command_base; typedef const torrent::Object (*command_base_call_type)(command_base*, target_type, const torrent::Object&); -typedef std::tr1::function base_function; +typedef std::function base_function; template struct command_base_is_valid {}; template struct command_base_is_type {}; @@ -240,7 +245,7 @@ command_base::_call(command_base* cmd, target_type target, Args args) { } #define COMMAND_BASE_TEMPLATE_TYPE(func_type, func_parm) \ - template ::proper_type> struct func_type { typedef std::tr1::function type; }; \ + template ::proper_type> struct func_type { typedef std::function type; }; \ \ template <> struct command_base_is_valid::type> { static const int value = 1; }; \ template <> struct command_base_is_valid::type> { static const int value = 1; }; \ diff --git a/src/rpc/object_storage.h b/src/rpc/object_storage.h index 056a6884..381be144 100644 --- a/src/rpc/object_storage.h +++ b/src/rpc/object_storage.h @@ -55,9 +55,9 @@ struct object_storage_node { char flags; }; -class object_storage : private std::tr1::unordered_map, object_storage_node, hash_fixed_key_type> { +class object_storage : private std::unordered_map, object_storage_node, hash_fixed_key_type> { public: - typedef std::tr1::unordered_map, object_storage_node, hash_fixed_key_type> base_type; + typedef std::unordered_map, object_storage_node, hash_fixed_key_type> base_type; using base_type::key_type; using base_type::value_type; diff --git a/test/rpc/command_map_test.cc b/test/rpc/command_map_test.cc index eb0b07d0..08022fcd 100644 --- a/test/rpc/command_map_test.cc +++ b/test/rpc/command_map_test.cc @@ -21,7 +21,7 @@ torrent::Object cmd_test_any_string(__UNUSED rpc::target_type target, const std: void CommandMapTest::test_basics() { CMD2_ANY("test_a", &cmd_test_map_a); - CMD2_ANY("test_b", std::tr1::bind(&cmd_test_map_b, std::tr1::placeholders::_1, std::tr1::placeholders::_2, (uint64_t)2)); + CMD2_ANY("test_b", std::bind(&cmd_test_map_b, std::placeholders::_1, std::placeholders::_2, (uint64_t)2)); CMD2_ANY_STRING("any_string", &cmd_test_any_string); CPPUNIT_ASSERT(m_map.call_command("test_a", (int64_t)1).as_value() == 1); diff --git a/test/rpc/command_slot_test.cc b/test/rpc/command_slot_test.cc index cb88df44..c968644e 100644 --- a/test/rpc/command_slot_test.cc +++ b/test/rpc/command_slot_test.cc @@ -25,7 +25,7 @@ CommandSlotTest::test_basics() { // test_any.set_function(&cmd_test_a); // CPPUNIT_ASSERT(rpc::command_base_call_any(&test_any, rpc::make_target(), (int64_t)1).as_value() == 1); -// test_any.set_function(std::tr1::bind(&cmd_test_b, std::tr1::placeholders::_1, std::tr1::placeholders::_2, (uint64_t)2)); +// test_any.set_function(std::bind(&cmd_test_b, std::placeholders::_1, std::placeholders::_2, (uint64_t)2)); // CPPUNIT_ASSERT(rpc::command_base_call_any(&test_any, rpc::make_target(), (int64_t)1).as_value() == 2); // test_any.set_function(&cmd_test_list);