diff --git a/src/command_download.cc b/src/command_download.cc index bc58b9ac..35e177e4 100644 --- a/src/command_download.cc +++ b/src/command_download.cc @@ -347,7 +347,7 @@ f_multicall(core::Download* download, const torrent::Object::list_type& args) { if (args.front().is_list()) std::transform(args.front().as_list().begin(), args.front().as_list().end(), std::back_inserter(regex_list), - std::bind(&torrent::Object::as_string_c, std::placeholders::_1)); + tr1::bind(&torrent::Object::as_string_c, std::placeholders::_1)); else if (args.front().is_string() && !args.front().as_string().empty()) regex_list.push_back(args.front().as_string()); else @@ -356,7 +356,7 @@ f_multicall(core::Download* download, const torrent::Object::list_type& args) { for (torrent::FileList::const_iterator itr = download->file_list()->begin(), last = download->file_list()->end(); itr != last; itr++) { if (use_regex && std::find_if(regex_list.begin(), regex_list.end(), - std::bind(&rak::regex::operator(), std::placeholders::_1, (*itr)->path()->as_string())) == regex_list.end()) + tr1::bind(&rak::regex::operator(), std::placeholders::_1, (*itr)->path()->as_string())) == regex_list.end()) continue; torrent::Object::list_type& row = result.insert(result.end(), torrent::Object::create_list())->as_list(); @@ -572,51 +572,51 @@ d_list_remove(core::Download* download, const torrent::Object& rawArgs, const ch return torrent::Object(); } -#define CMD2_ON_INFO(func) std::bind(&torrent::DownloadInfo::func, std::bind(&core::Download::info, std::placeholders::_1)) -#define CMD2_ON_DATA(func) std::bind(&torrent::download_data::func, std::bind(&core::Download::data, 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_ON_INFO(func) tr1::bind(&torrent::DownloadInfo::func, tr1::bind(&core::Download::info, std::placeholders::_1)) +#define CMD2_ON_DATA(func) tr1::bind(&torrent::download_data::func, tr1::bind(&core::Download::data, std::placeholders::_1)) +#define CMD2_ON_DL(func) tr1::bind(&torrent::Download::func, tr1::bind(&core::Download::download, std::placeholders::_1)) +#define CMD2_ON_FL(func) tr1::bind(&torrent::FileList::func, tr1::bind(&core::Download::file_list, std::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_BIND_TC std::bind(&core::Download::tracker_controller, std::placeholders::_1) +#define CMD2_BIND_DL tr1::bind(&core::Download::download, std::placeholders::_1) +#define CMD2_BIND_CL tr1::bind(&core::Download::connection_list, std::placeholders::_1) +#define CMD2_BIND_FL tr1::bind(&core::Download::file_list, std::placeholders::_1) +#define CMD2_BIND_PL tr1::bind(&core::Download::c_peer_list, std::placeholders::_1) +#define CMD2_BIND_TL tr1::bind(&core::Download::tracker_list, std::placeholders::_1) +#define CMD2_BIND_TC tr1::bind(&core::Download::tracker_controller, std::placeholders::_1) -#define CMD2_BIND_INFO std::bind(&core::Download::info, std::placeholders::_1) -#define CMD2_BIND_DATA std::bind(&core::Download::data, std::placeholders::_1) +#define CMD2_BIND_INFO tr1::bind(&core::Download::info, std::placeholders::_1) +#define CMD2_BIND_DATA tr1::bind(&core::Download::data, std::placeholders::_1) #define CMD2_DL_VAR_VALUE(key, first_key, second_key) \ - 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, \ + CMD2_DL(key, tr1::bind(&download_get_variable, std::placeholders::_1, first_key, second_key)); \ + CMD2_DL_VALUE_P(key ".set", tr1::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::bind(&download_get_variable, std::placeholders::_1, first_key, second_key)); \ - CMD2_DL_VALUE(key ".set", std::bind(&download_set_variable_value, \ + CMD2_DL(key, tr1::bind(&download_get_variable, std::placeholders::_1, first_key, second_key)); \ + CMD2_DL_VALUE(key ".set", tr1::bind(&download_set_variable_value, \ std::placeholders::_1, std::placeholders::_2, \ first_key, second_key)); #define CMD2_DL_TIMESTAMP(key, first_key, second_key) \ - 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, \ + CMD2_DL(key, tr1::bind(&download_get_variable, std::placeholders::_1, first_key, second_key)); \ + CMD2_DL_VALUE_P(key ".set", tr1::bind(&download_set_variable_value, \ std::placeholders::_1, std::placeholders::_2, \ first_key, second_key)); \ - CMD2_DL_VALUE_P(key ".set_if_z", std::bind(&download_set_variable_value_ifz, \ + CMD2_DL_VALUE_P(key ".set_if_z", tr1::bind(&download_set_variable_value_ifz, \ std::placeholders::_1, std::placeholders::_2, \ first_key, second_key)); \ #define CMD2_DL_VAR_STRING(key, first_key, second_key) \ - 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, \ + CMD2_DL(key, tr1::bind(&download_get_variable, std::placeholders::_1, first_key, second_key)); \ + CMD2_DL_STRING_P(key ".set", tr1::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::bind(&download_get_variable, std::placeholders::_1, first_key, second_key)); \ - CMD2_DL_STRING(key ".set", std::bind(&download_set_variable_string, \ + CMD2_DL(key, tr1::bind(&download_get_variable, std::placeholders::_1, first_key, second_key)); \ + CMD2_DL_STRING(key ".set", tr1::bind(&download_set_variable_string, \ std::placeholders::_1, std::placeholders::_2, \ first_key, second_key)); @@ -626,12 +626,12 @@ void cg_d_group_set(core::Download* download, const torrent::Objec void initialize_command_download() { - 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.hash", tr1::bind(&rak::transform_hex_str, CMD2_ON_INFO(hash))); + CMD2_DL("d.local_id", tr1::bind(&rak::transform_hex_str, CMD2_ON_INFO(local_id))); + CMD2_DL("d.local_id_html", tr1::bind(&rak::copy_escape_html_str, CMD2_ON_INFO(local_id))); + CMD2_DL("d.bitfield", tr1::bind(&retrieve_d_bitfield, std::placeholders::_1)); + CMD2_DL("d.base_path", tr1::bind(&retrieve_d_base_path, std::placeholders::_1)); + CMD2_DL("d.base_filename", tr1::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)); @@ -641,19 +641,19 @@ initialize_command_download() { // Network related: // - 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.up.rate", tr1::bind(&torrent::Rate::rate, CMD2_ON_INFO(up_rate))); + CMD2_DL ("d.up.total", tr1::bind(&torrent::Rate::total, CMD2_ON_INFO(up_rate))); + CMD2_DL ("d.down.rate", tr1::bind(&torrent::Rate::rate, CMD2_ON_INFO(down_rate))); + CMD2_DL ("d.down.total", tr1::bind(&torrent::Rate::total, CMD2_ON_INFO(down_rate))); + CMD2_DL ("d.skip.rate", tr1::bind(&torrent::Rate::rate, CMD2_ON_INFO(skip_rate))); + CMD2_DL ("d.skip.total", tr1::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::bind(&torrent::Download::set_pex_enabled, CMD2_BIND_DL, std::placeholders::_2)); + CMD2_DL_VALUE_V ("d.peer_exchange.set", tr1::bind(&torrent::Download::set_pex_enabled, CMD2_BIND_DL, std::placeholders::_2)); - 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_DL_LIST ("d.create_link", tr1::bind(&apply_d_change_link, std::placeholders::_1, std::placeholders::_2, 0)); + CMD2_DL_LIST ("d.delete_link", tr1::bind(&apply_d_change_link, std::placeholders::_1, std::placeholders::_2, 1)); + CMD2_DL ("d.delete_tied", tr1::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"); @@ -667,36 +667,36 @@ 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::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_hash_checked", tr1::bind(&torrent::Download::is_hash_checked, CMD2_BIND_DL)); + CMD2_DL ("d.is_hash_checking", tr1::bind(&torrent::Download::is_hash_checking, CMD2_BIND_DL)); + CMD2_DL ("d.is_multi_file", tr1::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 ("d.is_partially_done", CMD2_ON_DATA(is_partially_done)); CMD2_DL ("d.is_not_partially_done", CMD2_ON_DATA(is_not_partially_done)); - 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.close.directly", std::bind(&core::DownloadList::close_directly, 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_V ("d.resume", tr1::bind(&core::DownloadList::resume_default, control->core()->download_list(), std::placeholders::_1)); + CMD2_DL_V ("d.pause", tr1::bind(&core::DownloadList::pause_default, control->core()->download_list(), std::placeholders::_1)); + CMD2_DL_V ("d.open", tr1::bind(&core::DownloadList::open_throw, control->core()->download_list(), std::placeholders::_1)); + CMD2_DL_V ("d.close", tr1::bind(&core::DownloadList::close_throw, control->core()->download_list(), std::placeholders::_1)); + CMD2_DL_V ("d.close.directly", tr1::bind(&core::DownloadList::close_directly, control->core()->download_list(), std::placeholders::_1)); + CMD2_DL_V ("d.erase", tr1::bind(&core::DownloadList::erase_ptr, control->core()->download_list(), std::placeholders::_1)); + CMD2_DL_V ("d.check_hash", tr1::bind(&core::DownloadList::check_hash, control->core()->download_list(), std::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 ("d.save_resume", tr1::bind(&core::DownloadStore::save_resume, control->core()->download_store(), std::placeholders::_1)); + CMD2_DL ("d.save_full_session", tr1::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_STRING_V("add_peer", std::bind(&apply_d_add_peer, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_STRING_V("add_peer", tr1::bind(&apply_d_add_peer, std::placeholders::_1, std::placeholders::_2)); // // Custom settings: // - 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_STRING("d.custom", tr1::bind(&retrieve_d_custom, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_STRING("d.custom_throw", tr1::bind(&retrieve_d_custom_throw, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_LIST ("d.custom.set", tr1::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"); @@ -741,68 +741,68 @@ initialize_command_download() { CMD2_DL_TIMESTAMP("d.timestamp.started", "rtorrent", "timestamp.started"); CMD2_DL_TIMESTAMP("d.timestamp.finished", "rtorrent", "timestamp.finished"); - 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 ("d.connection_current", tr1::bind(&torrent::option_as_string, torrent::OPTION_CONNECTION_TYPE, CMD2_ON_DL(connection_type))); + CMD2_DL_STRING("d.connection_current.set", tr1::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::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 ("d.up.choke_heuristics", tr1::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, CMD2_ON_DL(upload_choke_heuristic))); + CMD2_DL_STRING("d.up.choke_heuristics.set", tr1::bind(&apply_d_choke_heuristics, std::placeholders::_1, std::placeholders::_2, false)); + CMD2_DL ("d.down.choke_heuristics", tr1::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, CMD2_ON_DL(download_choke_heuristic))); + CMD2_DL_STRING("d.down.choke_heuristics.set", tr1::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::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.hashing_failed", tr1::bind(&core::Download::is_hash_failed, std::placeholders::_1)); + CMD2_DL_VALUE_V ("d.hashing_failed.set", tr1::bind(&core::Download::set_hash_failed, std::placeholders::_1, std::placeholders::_2)); - 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")); + CMD2_DL ("d.views", tr1::bind(&download_get_variable, std::placeholders::_1, "rtorrent", "views")); + CMD2_DL ("d.views.has", tr1::bind(&d_list_has, std::placeholders::_1, std::placeholders::_2, "rtorrent", "views")); + CMD2_DL ("d.views.remove", tr1::bind(&d_list_remove, std::placeholders::_1, std::placeholders::_2, "rtorrent", "views")); + CMD2_DL ("d.views.push_back", tr1::bind(&d_list_push_back, std::placeholders::_1, std::placeholders::_2, "rtorrent", "views")); + CMD2_DL ("d.views.push_back_unique", tr1::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::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.message", tr1::bind(&core::Download::message, std::placeholders::_1)); + CMD2_DL_STRING_V("d.message.set", tr1::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::bind(&torrent::FileList::set_max_file_size, CMD2_BIND_FL, std::placeholders::_2)); + CMD2_DL_VALUE_V ("d.max_file_size.set", tr1::bind(&torrent::FileList::set_max_file_size, CMD2_BIND_FL, std::placeholders::_2)); - 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.uploads_min", std::bind(&torrent::Download::uploads_min, CMD2_BIND_DL)); - CMD2_DL_VALUE_V ("d.uploads_min.set", std::bind(&torrent::Download::set_uploads_min, CMD2_BIND_DL, std::placeholders::_2)); - CMD2_DL ("d.downloads_max", std::bind(&torrent::Download::downloads_max, CMD2_BIND_DL)); - CMD2_DL_VALUE_V ("d.downloads_max.set", std::bind(&torrent::Download::set_downloads_max, CMD2_BIND_DL, std::placeholders::_2)); - CMD2_DL ("d.downloads_min", std::bind(&torrent::Download::downloads_min, CMD2_BIND_DL)); - CMD2_DL_VALUE_V ("d.downloads_min.set", std::bind(&torrent::Download::set_downloads_min, 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_min", tr1::bind(&torrent::ConnectionList::min_size, CMD2_BIND_CL)); + CMD2_DL_VALUE_V ("d.peers_min.set", tr1::bind(&torrent::ConnectionList::set_min_size, CMD2_BIND_CL, std::placeholders::_2)); + CMD2_DL ("d.peers_max", tr1::bind(&torrent::ConnectionList::max_size, CMD2_BIND_CL)); + CMD2_DL_VALUE_V ("d.peers_max.set", tr1::bind(&torrent::ConnectionList::set_max_size, CMD2_BIND_CL, std::placeholders::_2)); + CMD2_DL ("d.uploads_max", tr1::bind(&torrent::Download::uploads_max, CMD2_BIND_DL)); + CMD2_DL_VALUE_V ("d.uploads_max.set", tr1::bind(&torrent::Download::set_uploads_max, CMD2_BIND_DL, std::placeholders::_2)); + CMD2_DL ("d.uploads_min", tr1::bind(&torrent::Download::uploads_min, CMD2_BIND_DL)); + CMD2_DL_VALUE_V ("d.uploads_min.set", tr1::bind(&torrent::Download::set_uploads_min, CMD2_BIND_DL, std::placeholders::_2)); + CMD2_DL ("d.downloads_max", tr1::bind(&torrent::Download::downloads_max, CMD2_BIND_DL)); + CMD2_DL_VALUE_V ("d.downloads_max.set", tr1::bind(&torrent::Download::set_downloads_max, CMD2_BIND_DL, std::placeholders::_2)); + CMD2_DL ("d.downloads_min", tr1::bind(&torrent::Download::downloads_min, CMD2_BIND_DL)); + CMD2_DL_VALUE_V ("d.downloads_min.set", tr1::bind(&torrent::Download::set_downloads_min, CMD2_BIND_DL, std::placeholders::_2)); + CMD2_DL ("d.peers_connected", tr1::bind(&torrent::ConnectionList::size, CMD2_BIND_CL)); + CMD2_DL ("d.peers_not_connected", tr1::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_V ("d.disconnect.seeders", std::bind(&torrent::ConnectionList::erase_seeders, CMD2_BIND_CL)); + CMD2_DL_V ("d.disconnect.seeders", tr1::bind(&torrent::ConnectionList::erase_seeders, CMD2_BIND_CL)); CMD2_DL ("d.accepting_seeders", CMD2_ON_INFO(is_accepting_seeders)); - CMD2_DL_V ("d.accepting_seeders.enable", std::bind(&torrent::DownloadInfo::public_set_flags, CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders)); - CMD2_DL_V ("d.accepting_seeders.disable", std::bind(&torrent::DownloadInfo::public_unset_flags, CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders)); + CMD2_DL_V ("d.accepting_seeders.enable", tr1::bind(&torrent::DownloadInfo::public_set_flags, CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders)); + CMD2_DL_V ("d.accepting_seeders.disable", tr1::bind(&torrent::DownloadInfo::public_unset_flags, CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders)); - 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.throttle_name", tr1::bind(&download_get_variable, std::placeholders::_1, "rtorrent", "throttle_name")); + CMD2_DL_STRING_V("d.throttle_name.set", tr1::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::bind(&retrieve_d_ratio, std::placeholders::_1)); + CMD2_DL ("d.ratio", tr1::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)); @@ -819,44 +819,44 @@ initialize_command_download() { CMD2_DL ("d.wanted_chunks", CMD2_ON_DATA(wanted_chunks)); - CMD2_DL_V ("d.tracker_announce", std::bind(&torrent::Download::manual_request, CMD2_BIND_DL, false)); - 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_V ("d.tracker_announce", tr1::bind(&torrent::Download::manual_request, CMD2_BIND_DL, false)); + CMD2_DL ("d.tracker_numwant", tr1::bind(&torrent::TrackerList::numwant, CMD2_BIND_TL)); + CMD2_DL_VALUE_V ("d.tracker_numwant.set", tr1::bind(&torrent::TrackerList::set_numwant, CMD2_BIND_TL, std::placeholders::_2)); // TODO: Deprecate 'd.tracker_focus'. - CMD2_DL ("d.tracker_focus", std::bind(&core::Download::tracker_list_size, std::placeholders::_1)); - CMD2_DL ("d.tracker_size", std::bind(&core::Download::tracker_list_size, std::placeholders::_1)); + CMD2_DL ("d.tracker_focus", tr1::bind(&core::Download::tracker_list_size, std::placeholders::_1)); + CMD2_DL ("d.tracker_size", tr1::bind(&core::Download::tracker_list_size, std::placeholders::_1)); - CMD2_DL_LIST ("d.tracker.insert", std::bind(&download_tracker_insert, std::placeholders::_1, std::placeholders::_2)); - CMD2_DL_VALUE_V ("d.tracker.send_scrape", std::bind(&torrent::TrackerController::scrape_request, CMD2_BIND_TC, std::placeholders::_2)); + CMD2_DL_LIST ("d.tracker.insert", tr1::bind(&download_tracker_insert, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_VALUE_V ("d.tracker.send_scrape", tr1::bind(&torrent::TrackerController::scrape_request, CMD2_BIND_TC, std::placeholders::_2)); CMD2_DL ("d.directory", CMD2_ON_FL(root_dir)); - CMD2_DL_STRING_V("d.directory.set", std::bind(&apply_d_directory, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_STRING_V("d.directory.set", tr1::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::bind(&core::Download::set_root_directory, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_STRING_V("d.directory_base.set", tr1::bind(&core::Download::set_root_directory, std::placeholders::_1, std::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.priority", tr1::bind(&core::Download::priority, std::placeholders::_1)); + CMD2_DL ("d.priority_str", tr1::bind(&retrieve_d_priority_str, std::placeholders::_1)); + CMD2_DL_VALUE_V ("d.priority.set", tr1::bind(&core::Download::set_priority, std::placeholders::_1, std::placeholders::_2)); - // CMD2_DL ("d.group", std::bind(&torrent::resource_manager_entry::group, - // std::bind(&torrent::ResourceManager::entry_at, torrent::resource_manager(), - // std::bind(&core::Download::main, std::placeholders::_1)))); + // CMD2_DL ("d.group", tr1::bind(&torrent::resource_manager_entry::group, + // tr1::bind(&torrent::ResourceManager::entry_at, torrent::resource_manager(), + // tr1::bind(&core::Download::main, std::placeholders::_1)))); - // CMD2_DL_V ("d.group.set", std::bind(&torrent::ResourceManager::set_group, + // CMD2_DL_V ("d.group.set", tr1::bind(&torrent::ResourceManager::set_group, // torrent::resource_manager(), - // std::bind(&torrent::ResourceManager::find_throw, torrent::resource_manager(), - // std::bind(&core::Download::main, std::placeholders::_1)), + // tr1::bind(&torrent::ResourceManager::find_throw, torrent::resource_manager(), + // tr1::bind(&core::Download::main, std::placeholders::_1)), // CG_GROUP_INDEX())); - CMD2_DL ("d.group", std::bind(&cg_d_group, std::placeholders::_1)); - CMD2_DL ("d.group.name", std::bind(&cg_d_group, std::placeholders::_1)); - CMD2_DL_V ("d.group.set", std::bind(&cg_d_group_set, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL ("d.group", tr1::bind(&cg_d_group, std::placeholders::_1)); + CMD2_DL ("d.group.name", tr1::bind(&cg_d_group, std::placeholders::_1)); + CMD2_DL_V ("d.group.set", tr1::bind(&cg_d_group_set, std::placeholders::_1, std::placeholders::_2)); - CMD2_DL ("d.initialize_logs", std::bind(&cmd_d_initialize_logs, std::placeholders::_1)); + CMD2_DL ("d.initialize_logs", tr1::bind(&cmd_d_initialize_logs, std::placeholders::_1)); - 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_DL_LIST ("f.multicall", tr1::bind(&f_multicall, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_LIST ("p.multicall", tr1::bind(&p_multicall, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_LIST ("t.multicall", tr1::bind(&t_multicall, std::placeholders::_1, std::placeholders::_2)); - CMD2_ANY_LIST ("p.call_target", std::bind(&p_call_target, std::placeholders::_2)); + CMD2_ANY_LIST ("p.call_target", tr1::bind(&p_call_target, std::placeholders::_2)); } diff --git a/src/command_dynamic.cc b/src/command_dynamic.cc index 013f855e..891405e4 100644 --- a/src/command_dynamic.cc +++ b/src/command_dynamic.cc @@ -157,7 +157,7 @@ system_method_insert_object(const torrent::Object::list_type& args, int flags) { rpc::commands.insert_slot >::type> (create_new_key(rawKey), - std::bind(&rpc::object_storage::call_function_str, control->object_storage(), + tr1::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); @@ -165,7 +165,7 @@ system_method_insert_object(const torrent::Object::list_type& args, int flags) { } else { rpc::commands.insert_slot >::type> (create_new_key(rawKey), - std::bind(&rpc::object_storage::get_str, control->object_storage(), rawKey), + tr1::bind(&rpc::object_storage::get_str, control->object_storage(), rawKey), &rpc::command_base_call, cmd_flags, NULL, NULL); } @@ -174,7 +174,7 @@ system_method_insert_object(const torrent::Object::list_type& args, int flags) { // if (flags & rpc::object_storage::flag_rlookup) { // rpc::commands.insert_slot >::type> // (create_new_key<9>(rawKey, ".rlookup"), - // std::bind(&rpc::object_storage::rlookup_obj_list, control->object_storage(), rawKey), + // tr1::bind(&rpc::object_storage::rlookup_obj_list, control->object_storage(), rawKey), // &rpc::command_base_call_string, // cmd_flags, NULL, NULL); // } @@ -188,21 +188,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::bind(&rpc::object_storage::set_str_bool, control->object_storage(), rawKey, std::placeholders::_2), + tr1::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::bind(&rpc::object_storage::set_str_value, control->object_storage(), rawKey, std::placeholders::_2), + tr1::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::bind(&rpc::object_storage::set_str_string, control->object_storage(), rawKey, std::placeholders::_2), + tr1::bind(&rpc::object_storage::set_str_string, control->object_storage(), rawKey, std::placeholders::_2), &rpc::command_base_call_string, cmd_flags, NULL, NULL); break; @@ -423,36 +423,36 @@ system_method_list_keys(const torrent::Object::string_type& args) { } #define CMD2_METHOD_INSERT(key, flags) \ - CMD2_ANY_LIST(key, std::bind(&system_method_insert_object, std::placeholders::_2, flags)); + CMD2_ANY_LIST(key, tr1::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::bind(&system_method_insert, std::placeholders::_2)); - CMD2_ANY_LIST ("method.insert.value", std::bind(&system_method_insert_object, std::placeholders::_2, rpc::object_storage::flag_value_type)); + CMD2_ANY_LIST ("method.insert", tr1::bind(&system_method_insert, std::placeholders::_2)); + CMD2_ANY_LIST ("method.insert.value", tr1::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); CMD2_METHOD_INSERT("method.insert.c_simple", rpc::object_storage::flag_constant | rpc::object_storage::flag_function_type); 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::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(), + CMD2_ANY_STRING ("method.erase", tr1::bind(&system_method_erase, std::placeholders::_2)); + CMD2_ANY_LIST ("method.redirect", tr1::bind(&system_method_redirect, std::placeholders::_2)); + CMD2_ANY_STRING ("method.get", tr1::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.set", tr1::bind(&system_method_set_function, std::placeholders::_2)); - CMD2_ANY_STRING ("method.const", std::bind(&rpc::object_storage::has_flag_str, control->object_storage(), + CMD2_ANY_STRING ("method.const", tr1::bind(&rpc::object_storage::has_flag_str, control->object_storage(), std::placeholders::_2, rpc::object_storage::flag_constant)); - CMD2_ANY_STRING_V("method.const.enable", std::bind(&rpc::object_storage::enable_flag_str, control->object_storage(), + CMD2_ANY_STRING_V("method.const.enable", tr1::bind(&rpc::object_storage::enable_flag_str, control->object_storage(), std::placeholders::_2, rpc::object_storage::flag_constant)); - 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)); + CMD2_ANY_LIST ("method.has_key", tr1::bind(&system_method_has_key, std::placeholders::_2)); + CMD2_ANY_LIST ("method.set_key", tr1::bind(&system_method_set_key, std::placeholders::_2)); + CMD2_ANY_STRING ("method.list_keys", tr1::bind(&system_method_list_keys, std::placeholders::_2)); - CMD2_ANY_STRING ("method.rlookup", std::bind(&rpc::object_storage::rlookup_obj_list, control->object_storage(), std::placeholders::_2)); - CMD2_ANY_STRING_V("method.rlookup.clear", std::bind(&rpc::object_storage::rlookup_clear, control->object_storage(), std::placeholders::_2)); + CMD2_ANY_STRING ("method.rlookup", tr1::bind(&rpc::object_storage::rlookup_obj_list, control->object_storage(), std::placeholders::_2)); + CMD2_ANY_STRING_V("method.rlookup.clear", tr1::bind(&rpc::object_storage::rlookup_clear, control->object_storage(), std::placeholders::_2)); } diff --git a/src/command_events.cc b/src/command_events.cc index a05a36bf..1e81f2cb 100644 --- a/src/command_events.cc +++ b/src/command_events.cc @@ -308,31 +308,31 @@ d_multicall(const torrent::Object::list_type& args) { void initialize_command_events() { - CMD2_ANY_STRING ("on_ratio", std::bind(&apply_on_ratio, std::placeholders::_2)); + CMD2_ANY_STRING ("on_ratio", tr1::bind(&apply_on_ratio, std::placeholders::_2)); - 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 ("start_tied", tr1::bind(&apply_start_tied)); + CMD2_ANY ("stop_untied", tr1::bind(&apply_stop_untied)); + CMD2_ANY ("close_untied", tr1::bind(&apply_close_untied)); + CMD2_ANY ("remove_untied", tr1::bind(&apply_remove_untied)); - 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_LIST ("schedule2", tr1::bind(&apply_schedule, std::placeholders::_2)); + CMD2_ANY_STRING_V("schedule_remove2", tr1::bind(&rpc::CommandScheduler::erase_str, control->command_scheduler(), std::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_STRING_V("import", tr1::bind(&apply_import, std::placeholders::_2)); + CMD2_ANY_STRING_V("try_import", tr1::bind(&apply_try_import, std::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, + CMD2_ANY_LIST ("load.normal", tr1::bind(&apply_load, std::placeholders::_2, core::Manager::create_quiet | core::Manager::create_tied)); + CMD2_ANY_LIST ("load.verbose", tr1::bind(&apply_load, std::placeholders::_2, core::Manager::create_tied)); + CMD2_ANY_LIST ("load.start", tr1::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::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, + CMD2_ANY_LIST ("load.start_verbose", tr1::bind(&apply_load, std::placeholders::_2, core::Manager::create_tied | core::Manager::create_start)); + CMD2_ANY_LIST ("load.raw", tr1::bind(&apply_load, std::placeholders::_2, core::Manager::create_quiet | core::Manager::create_raw_data)); + CMD2_ANY_LIST ("load.raw_verbose", tr1::bind(&apply_load, std::placeholders::_2, core::Manager::create_raw_data)); + CMD2_ANY_LIST ("load.raw_start", tr1::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::bind(&apply_close_low_diskspace, std::placeholders::_2)); + CMD2_ANY_VALUE ("close_low_diskspace", tr1::bind(&apply_close_low_diskspace, std::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)); + CMD2_ANY_LIST ("download_list", tr1::bind(&apply_download_list, std::placeholders::_2)); + CMD2_ANY_LIST ("d.multicall2", tr1::bind(&d_multicall, std::placeholders::_2)); } diff --git a/src/command_file.cc b/src/command_file.cc index 9852ad20..13a588bc 100644 --- a/src/command_file.cc +++ b/src/command_file.cc @@ -100,45 +100,45 @@ apply_fi_filename_last(torrent::FileListIterator* itr) { void initialize_command_file() { - 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_created", tr1::bind(&torrent::File::is_created, std::placeholders::_1)); + CMD2_FILE("f.is_open", tr1::bind(&torrent::File::is_open, std::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("f.is_create_queued", tr1::bind(&torrent::File::is_create_queued, std::placeholders::_1)); + CMD2_FILE("f.is_resize_queued", tr1::bind(&torrent::File::is_resize_queued, std::placeholders::_1)); - 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_VALUE_V("f.set_create_queued", tr1::bind(&torrent::File::set_flags, std::placeholders::_1, torrent::File::flag_create_queued)); + CMD2_FILE_VALUE_V("f.set_resize_queued", tr1::bind(&torrent::File::set_flags, std::placeholders::_1, torrent::File::flag_resize_queued)); + CMD2_FILE_VALUE_V("f.unset_create_queued", tr1::bind(&torrent::File::unset_flags, std::placeholders::_1, torrent::File::flag_create_queued)); + CMD2_FILE_VALUE_V("f.unset_resize_queued", tr1::bind(&torrent::File::unset_flags, std::placeholders::_1, torrent::File::flag_resize_queued)); - CMD2_FILE ("f.prioritize_first", std::bind(&torrent::File::has_flags, std::placeholders::_1, torrent::File::flag_prioritize_first)); - CMD2_FILE_V("f.prioritize_first.enable", std::bind(&torrent::File::set_flags, std::placeholders::_1, torrent::File::flag_prioritize_first)); - CMD2_FILE_V("f.prioritize_first.disable", std::bind(&torrent::File::unset_flags, std::placeholders::_1, torrent::File::flag_prioritize_first)); - CMD2_FILE ("f.prioritize_last", std::bind(&torrent::File::has_flags, std::placeholders::_1, torrent::File::flag_prioritize_last)); - CMD2_FILE_V("f.prioritize_last.enable", std::bind(&torrent::File::set_flags, std::placeholders::_1, torrent::File::flag_prioritize_last)); - CMD2_FILE_V("f.prioritize_last.disable", std::bind(&torrent::File::unset_flags, std::placeholders::_1, torrent::File::flag_prioritize_last)); + CMD2_FILE ("f.prioritize_first", tr1::bind(&torrent::File::has_flags, std::placeholders::_1, torrent::File::flag_prioritize_first)); + CMD2_FILE_V("f.prioritize_first.enable", tr1::bind(&torrent::File::set_flags, std::placeholders::_1, torrent::File::flag_prioritize_first)); + CMD2_FILE_V("f.prioritize_first.disable", tr1::bind(&torrent::File::unset_flags, std::placeholders::_1, torrent::File::flag_prioritize_first)); + CMD2_FILE ("f.prioritize_last", tr1::bind(&torrent::File::has_flags, std::placeholders::_1, torrent::File::flag_prioritize_last)); + CMD2_FILE_V("f.prioritize_last.enable", tr1::bind(&torrent::File::set_flags, std::placeholders::_1, torrent::File::flag_prioritize_last)); + CMD2_FILE_V("f.prioritize_last.disable", tr1::bind(&torrent::File::unset_flags, std::placeholders::_1, torrent::File::flag_prioritize_last)); - 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.size_bytes", tr1::bind(&torrent::File::size_bytes, std::placeholders::_1)); + CMD2_FILE("f.size_chunks", tr1::bind(&torrent::File::size_chunks, std::placeholders::_1)); + CMD2_FILE("f.completed_chunks", tr1::bind(&torrent::File::completed_chunks, std::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.offset", tr1::bind(&torrent::File::offset, std::placeholders::_1)); + CMD2_FILE("f.range_first", tr1::bind(&torrent::File::range_first, std::placeholders::_1)); + CMD2_FILE("f.range_second", tr1::bind(&torrent::File::range_second, std::placeholders::_1)); - 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.priority", tr1::bind(&torrent::File::priority, std::placeholders::_1)); + CMD2_FILE_VALUE_V("f.priority.set", tr1::bind(&apply_f_set_priority, std::placeholders::_1, std::placeholders::_2)); - 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.path", tr1::bind(&apply_f_path, std::placeholders::_1)); + CMD2_FILE("f.path_components", tr1::bind(&apply_f_path_components, std::placeholders::_1)); + CMD2_FILE("f.path_depth", tr1::bind(&apply_f_path_depth, std::placeholders::_1)); + CMD2_FILE("f.frozen_path", tr1::bind(&torrent::File::frozen_path, std::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.match_depth_prev", tr1::bind(&torrent::File::match_depth_prev, std::placeholders::_1)); + CMD2_FILE("f.match_depth_next", tr1::bind(&torrent::File::match_depth_next, std::placeholders::_1)); - CMD2_FILE("f.last_touched", std::bind(&torrent::File::last_touched, std::placeholders::_1)); + CMD2_FILE("f.last_touched", tr1::bind(&torrent::File::last_touched, std::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)); + CMD2_FILEITR("fi.filename_last", tr1::bind(&apply_fi_filename_last, std::placeholders::_1)); + CMD2_FILEITR("fi.is_file", tr1::bind(&torrent::FileListIterator::is_file, std::placeholders::_1)); } diff --git a/src/command_groups.cc b/src/command_groups.cc index 6440564a..b0d958ee 100644 --- a/src/command_groups.cc +++ b/src/command_groups.cc @@ -264,8 +264,8 @@ apply_cg_tracker_mode_set(const torrent::Object::list_type& args) { return torrent::Object(); } -#define CG_GROUP_AT() std::bind(&cg_get_group, std::placeholders::_2) -#define CHOKE_GROUP(direction) std::bind(direction, CG_GROUP_AT()) +#define CG_GROUP_AT() tr1::bind(&cg_get_group, std::placeholders::_2) +#define CHOKE_GROUP(direction) tr1::bind(direction, CG_GROUP_AT()) /* @@ -336,54 +336,54 @@ options. void initialize_command_groups() { // Move somewhere else? - CMD2_ANY ("strings.choke_heuristics", std::bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS)); - CMD2_ANY ("strings.choke_heuristics.upload", std::bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS_UPLOAD)); - CMD2_ANY ("strings.choke_heuristics.download", std::bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS_DOWNLOAD)); - CMD2_ANY ("strings.tracker_mode", std::bind(&torrent::option_list_strings, torrent::OPTION_TRACKER_MODE)); + CMD2_ANY ("strings.choke_heuristics", tr1::bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS)); + CMD2_ANY ("strings.choke_heuristics.upload", tr1::bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS_UPLOAD)); + CMD2_ANY ("strings.choke_heuristics.download", tr1::bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS_DOWNLOAD)); + CMD2_ANY ("strings.tracker_mode", tr1::bind(&torrent::option_list_strings, torrent::OPTION_TRACKER_MODE)); - CMD2_ANY ("choke_group.list", std::bind(&apply_cg_list)); - CMD2_ANY_STRING ("choke_group.insert", std::bind(&apply_cg_insert, std::placeholders::_2)); + CMD2_ANY ("choke_group.list", tr1::bind(&apply_cg_list)); + CMD2_ANY_STRING ("choke_group.insert", tr1::bind(&apply_cg_insert, std::placeholders::_2)); #if USE_CHOKE_GROUP - CMD2_ANY ("choke_group.size", std::bind(&torrent::ResourceManager::group_size, torrent::resource_manager())); - CMD2_ANY_STRING ("choke_group.index_of", std::bind(&torrent::ResourceManager::group_index_of, torrent::resource_manager(), std::placeholders::_2)); + CMD2_ANY ("choke_group.size", tr1::bind(&torrent::ResourceManager::group_size, torrent::resource_manager())); + CMD2_ANY_STRING ("choke_group.index_of", tr1::bind(&torrent::ResourceManager::group_index_of, torrent::resource_manager(), std::placeholders::_2)); #else apply_cg_insert("default"); - CMD2_ANY ("choke_group.size", std::bind(&std::vector::size, cg_list_hack)); - CMD2_ANY_STRING ("choke_group.index_of", std::bind(&apply_cg_index_of, std::placeholders::_2)); + CMD2_ANY ("choke_group.size", tr1::bind(&std::vector::size, cg_list_hack)); + CMD2_ANY_STRING ("choke_group.index_of", tr1::bind(&apply_cg_index_of, std::placeholders::_2)); #endif // Commands specific for a group. Supports as the first argument the // name, the index or a negative index. - CMD2_ANY ("choke_group.general.size", std::bind(&torrent::choke_group::size, CG_GROUP_AT())); + CMD2_ANY ("choke_group.general.size", tr1::bind(&torrent::choke_group::size, CG_GROUP_AT())); - CMD2_ANY ("choke_group.tracker.mode", std::bind(&torrent::option_as_string, torrent::OPTION_TRACKER_MODE, - std::bind(&torrent::choke_group::tracker_mode, CG_GROUP_AT()))); - CMD2_ANY_LIST ("choke_group.tracker.mode.set", std::bind(&apply_cg_tracker_mode_set, std::placeholders::_2)); + CMD2_ANY ("choke_group.tracker.mode", tr1::bind(&torrent::option_as_string, torrent::OPTION_TRACKER_MODE, + tr1::bind(&torrent::choke_group::tracker_mode, CG_GROUP_AT()))); + CMD2_ANY_LIST ("choke_group.tracker.mode.set", tr1::bind(&apply_cg_tracker_mode_set, std::placeholders::_2)); - CMD2_ANY ("choke_group.up.rate", std::bind(&torrent::choke_group::up_rate, CG_GROUP_AT())); - CMD2_ANY ("choke_group.down.rate", std::bind(&torrent::choke_group::down_rate, CG_GROUP_AT())); + CMD2_ANY ("choke_group.up.rate", tr1::bind(&torrent::choke_group::up_rate, CG_GROUP_AT())); + CMD2_ANY ("choke_group.down.rate", tr1::bind(&torrent::choke_group::down_rate, CG_GROUP_AT())); - CMD2_ANY ("choke_group.up.max.unlimited", std::bind(&torrent::choke_queue::is_unlimited, CHOKE_GROUP(&torrent::choke_group::up_queue))); - CMD2_ANY ("choke_group.up.max", std::bind(&torrent::choke_queue::max_unchoked_signed, CHOKE_GROUP(&torrent::choke_group::up_queue))); - CMD2_ANY_LIST ("choke_group.up.max.set", std::bind(&apply_cg_max_set, std::placeholders::_2, true)); + CMD2_ANY ("choke_group.up.max.unlimited", tr1::bind(&torrent::choke_queue::is_unlimited, CHOKE_GROUP(&torrent::choke_group::up_queue))); + CMD2_ANY ("choke_group.up.max", tr1::bind(&torrent::choke_queue::max_unchoked_signed, CHOKE_GROUP(&torrent::choke_group::up_queue))); + CMD2_ANY_LIST ("choke_group.up.max.set", tr1::bind(&apply_cg_max_set, std::placeholders::_2, true)); - CMD2_ANY ("choke_group.up.total", std::bind(&torrent::choke_queue::size_total, CHOKE_GROUP(&torrent::choke_group::up_queue))); - CMD2_ANY ("choke_group.up.queued", std::bind(&torrent::choke_queue::size_queued, CHOKE_GROUP(&torrent::choke_group::up_queue))); - CMD2_ANY ("choke_group.up.unchoked", std::bind(&torrent::choke_queue::size_unchoked, CHOKE_GROUP(&torrent::choke_group::up_queue))); - CMD2_ANY ("choke_group.up.heuristics", std::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, - std::bind(&torrent::choke_queue::heuristics, CHOKE_GROUP(&torrent::choke_group::up_queue)))); - CMD2_ANY_LIST ("choke_group.up.heuristics.set", std::bind(&apply_cg_heuristics_set, std::placeholders::_2, true)); + CMD2_ANY ("choke_group.up.total", tr1::bind(&torrent::choke_queue::size_total, CHOKE_GROUP(&torrent::choke_group::up_queue))); + CMD2_ANY ("choke_group.up.queued", tr1::bind(&torrent::choke_queue::size_queued, CHOKE_GROUP(&torrent::choke_group::up_queue))); + CMD2_ANY ("choke_group.up.unchoked", tr1::bind(&torrent::choke_queue::size_unchoked, CHOKE_GROUP(&torrent::choke_group::up_queue))); + CMD2_ANY ("choke_group.up.heuristics", tr1::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, + tr1::bind(&torrent::choke_queue::heuristics, CHOKE_GROUP(&torrent::choke_group::up_queue)))); + CMD2_ANY_LIST ("choke_group.up.heuristics.set", tr1::bind(&apply_cg_heuristics_set, std::placeholders::_2, true)); - CMD2_ANY ("choke_group.down.max.unlimited", std::bind(&torrent::choke_queue::is_unlimited, CHOKE_GROUP(&torrent::choke_group::down_queue))); - CMD2_ANY ("choke_group.down.max", std::bind(&torrent::choke_queue::max_unchoked_signed, CHOKE_GROUP(&torrent::choke_group::down_queue))); - CMD2_ANY_LIST ("choke_group.down.max.set", std::bind(&apply_cg_max_set, std::placeholders::_2, false)); + CMD2_ANY ("choke_group.down.max.unlimited", tr1::bind(&torrent::choke_queue::is_unlimited, CHOKE_GROUP(&torrent::choke_group::down_queue))); + CMD2_ANY ("choke_group.down.max", tr1::bind(&torrent::choke_queue::max_unchoked_signed, CHOKE_GROUP(&torrent::choke_group::down_queue))); + CMD2_ANY_LIST ("choke_group.down.max.set", tr1::bind(&apply_cg_max_set, std::placeholders::_2, false)); - CMD2_ANY ("choke_group.down.total", std::bind(&torrent::choke_queue::size_total, CHOKE_GROUP(&torrent::choke_group::down_queue))); - CMD2_ANY ("choke_group.down.queued", std::bind(&torrent::choke_queue::size_queued, CHOKE_GROUP(&torrent::choke_group::down_queue))); - CMD2_ANY ("choke_group.down.unchoked", std::bind(&torrent::choke_queue::size_unchoked, CHOKE_GROUP(&torrent::choke_group::down_queue))); - CMD2_ANY ("choke_group.down.heuristics", std::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, - std::bind(&torrent::choke_queue::heuristics, CHOKE_GROUP(&torrent::choke_group::down_queue)))); - CMD2_ANY_LIST ("choke_group.down.heuristics.set", std::bind(&apply_cg_heuristics_set, std::placeholders::_2, false)); + CMD2_ANY ("choke_group.down.total", tr1::bind(&torrent::choke_queue::size_total, CHOKE_GROUP(&torrent::choke_group::down_queue))); + CMD2_ANY ("choke_group.down.queued", tr1::bind(&torrent::choke_queue::size_queued, CHOKE_GROUP(&torrent::choke_group::down_queue))); + CMD2_ANY ("choke_group.down.unchoked", tr1::bind(&torrent::choke_queue::size_unchoked, CHOKE_GROUP(&torrent::choke_group::down_queue))); + CMD2_ANY ("choke_group.down.heuristics", tr1::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, + tr1::bind(&torrent::choke_queue::heuristics, CHOKE_GROUP(&torrent::choke_group::down_queue)))); + CMD2_ANY_LIST ("choke_group.down.heuristics.set", tr1::bind(&apply_cg_heuristics_set, std::placeholders::_2, false)); } diff --git a/src/command_helpers.h b/src/command_helpers.h index b215ec2e..6e41799a 100644 --- a/src/command_helpers.h +++ b/src/command_helpers.h @@ -45,6 +45,8 @@ namespace std { using namespace tr1; } #endif +namespace tr1 { using namespace std::tr1; } + void initialize_commands(); // @@ -102,42 +104,42 @@ 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::bind(&rpc::object_storage::get, control->object_storage(), \ + CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \ torrent::raw_string::from_c_str(key))); \ - CMD2_ANY_VALUE(key ".set", std::bind(&rpc::object_storage::set_bool, control->object_storage(), \ + CMD2_ANY_VALUE(key ".set", tr1::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::bind(&rpc::object_storage::get, control->object_storage(), \ + CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \ torrent::raw_string::from_c_str(key))); \ - CMD2_ANY_VALUE(key ".set", std::bind(&rpc::object_storage::set_value, control->object_storage(), \ + CMD2_ANY_VALUE(key ".set", tr1::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::bind(&rpc::object_storage::get, control->object_storage(), \ + CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \ torrent::raw_string::from_c_str(key))); \ - CMD2_ANY_STRING(key ".set", std::bind(&rpc::object_storage::set_string, control->object_storage(), \ + CMD2_ANY_STRING(key ".set", tr1::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::bind(&rpc::object_storage::get, control->object_storage(), \ + CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \ torrent::raw_string::from_c_str(key))); #define CMD2_VAR_LIST(key) \ control->object_storage()->insert_c_str(key, torrent::Object::create_list(), rpc::object_storage::flag_list_type); \ - CMD2_ANY(key, std::bind(&rpc::object_storage::get, control->object_storage(), \ + CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \ torrent::raw_string::from_c_str(key))); \ - CMD2_ANY_LIST(key ".set", std::bind(&rpc::object_storage::set_list, control->object_storage(), \ + CMD2_ANY_LIST(key ".set", tr1::bind(&rpc::object_storage::set_list, control->object_storage(), \ torrent::raw_string::from_c_str(key), std::placeholders::_2)); \ - CMD2_ANY_VOID(key ".push_back", std::bind(&rpc::object_storage::list_push_back, control->object_storage(), \ + CMD2_ANY_VOID(key ".push_back", tr1::bind(&rpc::object_storage::list_push_back, control->object_storage(), \ torrent::raw_string::from_c_str(key), std::placeholders::_2)); #define CMD2_FUNC_SINGLE(key, cmds) \ - CMD2_ANY(key, std::bind(&rpc::command_function_call, torrent::raw_string::from_c_str(cmds), \ + CMD2_ANY(key, tr1::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) \ diff --git a/src/command_ip.cc b/src/command_ip.cc index bc5fa4b0..9178fa66 100644 --- a/src/command_ip.cc +++ b/src/command_ip.cc @@ -287,17 +287,17 @@ apply_ipv4_filter_dump() { void initialize_command_ip() { - CMD2_ANY ("strings.ip_filter", std::bind(&torrent::option_list_strings, torrent::OPTION_IP_FILTER)); - CMD2_ANY ("strings.ip_tos", std::bind(&torrent::option_list_strings, torrent::OPTION_IP_TOS)); + CMD2_ANY ("strings.ip_filter", tr1::bind(&torrent::option_list_strings, torrent::OPTION_IP_FILTER)); + CMD2_ANY ("strings.ip_tos", tr1::bind(&torrent::option_list_strings, torrent::OPTION_IP_TOS)); - CMD2_ANY_STRING ("ip_tables.insert_table", std::bind(&apply_ip_tables_insert_table, std::placeholders::_2)); - CMD2_ANY_STRING ("ip_tables.size_data", std::bind(&apply_ip_tables_size_data, 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_STRING ("ip_tables.insert_table", tr1::bind(&apply_ip_tables_insert_table, std::placeholders::_2)); + CMD2_ANY_STRING ("ip_tables.size_data", tr1::bind(&apply_ip_tables_size_data, std::placeholders::_2)); + CMD2_ANY_LIST ("ip_tables.get", tr1::bind(&apply_ip_tables_get, std::placeholders::_2)); + CMD2_ANY_LIST ("ip_tables.add_address", tr1::bind(&apply_ip_tables_add_address, std::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_LIST ("ipv4_filter.dump", std::bind(&apply_ipv4_filter_dump)); + CMD2_ANY ("ipv4_filter.size_data", tr1::bind(&apply_ipv4_filter_size_data)); + CMD2_ANY_STRING ("ipv4_filter.get", tr1::bind(&apply_ipv4_filter_get, std::placeholders::_2)); + CMD2_ANY_LIST ("ipv4_filter.add_address", tr1::bind(&apply_ipv4_filter_add_address, std::placeholders::_2)); + CMD2_ANY_LIST ("ipv4_filter.load", tr1::bind(&apply_ipv4_filter_load, std::placeholders::_2)); + CMD2_ANY_LIST ("ipv4_filter.dump", tr1::bind(&apply_ipv4_filter_dump)); } diff --git a/src/command_local.cc b/src/command_local.cc index 9ca9a77c..5b61d63b 100644 --- a/src/command_local.cc +++ b/src/command_local.cc @@ -325,8 +325,8 @@ initialize_command_local() { core::DownloadList* dList = control->core()->download_list(); core::DownloadStore* dStore = control->core()->download_store(); - CMD2_ANY ("system.hostname", std::bind(&system_hostname)); - CMD2_ANY ("system.pid", std::bind(&getpid)); + CMD2_ANY ("system.hostname", tr1::bind(&system_hostname)); + CMD2_ANY ("system.pid", tr1::bind(&getpid)); CMD2_VAR_C_STRING("system.api_version", (int64_t)API_VERSION); CMD2_VAR_C_STRING("system.client_version", PACKAGE_VERSION); @@ -336,54 +336,54 @@ 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::bind(&utils::FileStatusCache::size, + CMD2_ANY ("system.file_status_cache.size", tr1::bind(&utils::FileStatusCache::size, (utils::FileStatusCache::base_type*)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_V ("system.file_status_cache.prune", tr1::bind(&utils::FileStatusCache::prune, control->core()->file_status_cache())); CMD2_VAR_BOOL ("file.prioritize_toc", 0); CMD2_VAR_LIST ("file.prioritize_toc.first"); CMD2_VAR_LIST ("file.prioritize_toc.last"); - 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.files.opened_counter", tr1::bind(&FM_t::files_opened_counter, fileManager)); + CMD2_ANY ("system.files.closed_counter", tr1::bind(&FM_t::files_closed_counter, fileManager)); + CMD2_ANY ("system.files.failed_counter", tr1::bind(&FM_t::files_failed_counter, fileManager)); - 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 ("system.time", tr1::bind(&rak::timer::seconds, &cachedTime)); + CMD2_ANY ("system.time_seconds", tr1::bind(&rak::timer::current_seconds)); + CMD2_ANY ("system.time_usec", tr1::bind(&rak::timer::current_usec)); - CMD2_ANY_VALUE_V ("system.umask.set", std::bind(&umask, std::placeholders::_2)); + CMD2_ANY_VALUE_V ("system.umask.set", tr1::bind(&umask, std::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 ("system.cwd", tr1::bind(&system_get_cwd)); + CMD2_ANY_STRING ("system.cwd.set", tr1::bind(&system_set_cwd, std::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.sync.queue_size", std::bind(&CM_t::sync_queue_size, chunkManager)); + CMD2_ANY ("pieces.sync.always_safe", tr1::bind(&CM_t::safe_sync, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.sync.always_safe.set", tr1::bind(&CM_t::set_safe_sync, chunkManager, std::placeholders::_2)); + CMD2_ANY ("pieces.sync.safe_free_diskspace", tr1::bind(&CM_t::safe_free_diskspace, chunkManager)); + CMD2_ANY ("pieces.sync.timeout", tr1::bind(&CM_t::timeout_sync, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.sync.timeout.set", tr1::bind(&CM_t::set_timeout_sync, chunkManager, std::placeholders::_2)); + CMD2_ANY ("pieces.sync.timeout_safe", tr1::bind(&CM_t::timeout_safe_sync, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.sync.timeout_safe.set", tr1::bind(&CM_t::set_timeout_safe_sync, chunkManager, std::placeholders::_2)); + CMD2_ANY ("pieces.sync.queue_size", tr1::bind(&CM_t::sync_queue_size, chunkManager)); - 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.preload.type", tr1::bind(&CM_t::preload_type, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.preload.type.set", tr1::bind(&CM_t::set_preload_type, chunkManager, std::placeholders::_2)); + CMD2_ANY ("pieces.preload.min_size", tr1::bind(&CM_t::preload_min_size, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.preload.min_size.set", tr1::bind(&CM_t::set_preload_min_size, chunkManager, std::placeholders::_2)); + CMD2_ANY ("pieces.preload.min_rate", tr1::bind(&CM_t::preload_required_rate, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.preload.min_rate.set", tr1::bind(&CM_t::set_preload_required_rate, chunkManager, std::placeholders::_2)); - CMD2_ANY ("pieces.memory.current", std::bind(&CM_t::memory_usage, chunkManager)); - CMD2_ANY ("pieces.memory.sync_queue", std::bind(&CM_t::sync_queue_memory_usage, chunkManager)); - CMD2_ANY ("pieces.memory.block_count", std::bind(&CM_t::memory_block_count, 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_ANY ("pieces.memory.current", tr1::bind(&CM_t::memory_usage, chunkManager)); + CMD2_ANY ("pieces.memory.sync_queue", tr1::bind(&CM_t::sync_queue_memory_usage, chunkManager)); + CMD2_ANY ("pieces.memory.block_count", tr1::bind(&CM_t::memory_block_count, chunkManager)); + CMD2_ANY ("pieces.memory.max", tr1::bind(&CM_t::max_memory_usage, chunkManager)); + CMD2_ANY_VALUE_V ("pieces.memory.max.set", tr1::bind(&CM_t::set_max_memory_usage, chunkManager, std::placeholders::_2)); + CMD2_ANY ("pieces.stats_preloaded", tr1::bind(&CM_t::stats_preloaded, chunkManager)); + CMD2_ANY ("pieces.stats_not_preloaded", tr1::bind(&CM_t::stats_not_preloaded, chunkManager)); - CMD2_ANY ("pieces.stats.total_size", std::bind(&apply_pieces_stats_total_size)); + CMD2_ANY ("pieces.stats.total_size", tr1::bind(&apply_pieces_stats_total_size)); - CMD2_ANY ("pieces.hash.queue_size", std::bind(&torrent::hash_queue_size)); + CMD2_ANY ("pieces.hash.queue_size", tr1::bind(&torrent::hash_queue_size)); CMD2_VAR_BOOL ("pieces.hash.on_completion", true); CMD2_VAR_STRING ("directory.default", "./"); @@ -392,13 +392,13 @@ initialize_command_local() { CMD2_VAR_BOOL ("session.use_lock", true); CMD2_VAR_BOOL ("session.on_completion", true); - 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 ("session.path", tr1::bind(&core::DownloadStore::path, dStore)); + CMD2_ANY_STRING_V("session.path.set", tr1::bind(&core::DownloadStore::set_path, dStore, std::placeholders::_2)); - CMD2_ANY_V ("session.save", std::bind(&core::DownloadList::session_save, dList)); + CMD2_ANY_V ("session.save", tr1::bind(&core::DownloadList::session_save, dList)); #define CMD2_EXECUTE(key, flags) \ - CMD2_ANY(key, std::bind(&rpc::ExecFile::execute_object, &rpc::execFile, std::placeholders::_2, flags)); + CMD2_ANY(key, tr1::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); @@ -412,25 +412,25 @@ 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_LIST ("log.open_file", std::bind(&apply_log_open_file, std::placeholders::_2)); - CMD2_ANY_LIST ("log.add_output", std::bind(&apply_log_add_output, std::placeholders::_2)); + CMD2_ANY_LIST ("log.open_file", tr1::bind(&apply_log_open_file, std::placeholders::_2)); + CMD2_ANY_LIST ("log.add_output", tr1::bind(&apply_log_add_output, std::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::bind(&apply_log_libtorrent, std::placeholders::_2)); + CMD2_ANY_STRING ("log.execute", tr1::bind(&apply_log, std::placeholders::_2, 0)); + CMD2_ANY_STRING ("log.vmmap.dump", tr1::bind(&log_vmmap_dump, std::placeholders::_2)); + CMD2_ANY_STRING_V("log.xmlrpc", tr1::bind(&ThreadWorker::set_xmlrpc_log, worker_thread, std::placeholders::_2)); + CMD2_ANY_LIST ("log.libtorrent", tr1::bind(&apply_log_libtorrent, std::placeholders::_2)); - CMD2_ANY_LIST ("file.append", std::bind(&cmd_file_append, std::placeholders::_2)); + CMD2_ANY_LIST ("file.append", tr1::bind(&cmd_file_append, 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::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_P("argument.0", tr1::bind(&rpc::command_base::argument_ref, 0)); + CMD2_ANY_P("argument.1", tr1::bind(&rpc::command_base::argument_ref, 1)); + CMD2_ANY_P("argument.2", tr1::bind(&rpc::command_base::argument_ref, 2)); + CMD2_ANY_P("argument.3", tr1::bind(&rpc::command_base::argument_ref, 3)); - CMD2_ANY_LIST ("group.insert", std::bind(&group_insert, std::placeholders::_2)); + CMD2_ANY_LIST ("group.insert", tr1::bind(&group_insert, std::placeholders::_2)); } diff --git a/src/command_network.cc b/src/command_network.cc index ca2911b9..cb0ff8b9 100644 --- a/src/command_network.cc +++ b/src/command_network.cc @@ -236,23 +236,23 @@ initialize_command_network() { torrent::FileManager* fileManager = torrent::file_manager(); core::CurlStack* httpStack = control->core()->http_stack(); - CMD2_ANY ("strings.connection_type", std::bind(&torrent::option_list_strings, torrent::OPTION_CONNECTION_TYPE)); - CMD2_ANY ("strings.encryption", std::bind(&torrent::option_list_strings, torrent::OPTION_ENCRYPTION)); + CMD2_ANY ("strings.connection_type", tr1::bind(&torrent::option_list_strings, torrent::OPTION_CONNECTION_TYPE)); + CMD2_ANY ("strings.encryption", tr1::bind(&torrent::option_list_strings, torrent::OPTION_ENCRYPTION)); CMD2_VAR_BOOL ("log.handshake", false); - // 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)); + // CMD2_ANY_STRING ("encoding_list", tr1::bind(&apply_encoding_list, std::placeholders::_2)); + CMD2_ANY_STRING ("encoding.add", tr1::bind(&apply_encoding_list, std::placeholders::_2)); // Isn't port_open used? CMD2_VAR_BOOL ("network.port_open", true); CMD2_VAR_BOOL ("network.port_random", true); CMD2_VAR_STRING ("network.port_range", "6881-6999"); - CMD2_ANY ("network.listen.port", std::bind(&torrent::ConnectionManager::listen_port, cm)); + CMD2_ANY ("network.listen.port", tr1::bind(&torrent::ConnectionManager::listen_port, cm)); CMD2_VAR_BOOL ("protocol.pex", true); - CMD2_ANY_LIST ("protocol.encryption.set", std::bind(&apply_encryption, std::placeholders::_2)); + CMD2_ANY_LIST ("protocol.encryption.set", tr1::bind(&apply_encryption, std::placeholders::_2)); CMD2_VAR_STRING ("protocol.connection.leech", "leech"); CMD2_VAR_STRING ("protocol.connection.seed", "seed"); @@ -262,43 +262,43 @@ 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 ("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.http.ssl_verify_peer", std::bind(&core::CurlStack::ssl_verify_peer, httpStack)); - CMD2_ANY_VALUE_V ("network.http.ssl_verify_peer.set", std::bind(&core::CurlStack::set_ssl_verify_peer, httpStack, std::placeholders::_2)); - CMD2_ANY ("network.http.dns_cache_timeout", std::bind(&core::CurlStack::dns_timeout, httpStack)); - CMD2_ANY_VALUE_V ("network.http.dns_cache_timeout.set", std::bind(&core::CurlStack::set_dns_timeout, httpStack, std::placeholders::_2)); + CMD2_ANY ("network.http.capath", tr1::bind(&core::CurlStack::http_capath, httpStack)); + CMD2_ANY_STRING_V("network.http.capath.set", tr1::bind(&core::CurlStack::set_http_capath, httpStack, std::placeholders::_2)); + CMD2_ANY ("network.http.cacert", tr1::bind(&core::CurlStack::http_cacert, httpStack)); + CMD2_ANY_STRING_V("network.http.cacert.set", tr1::bind(&core::CurlStack::set_http_cacert, httpStack, std::placeholders::_2)); + CMD2_ANY ("network.http.proxy_address", tr1::bind(&core::CurlStack::http_proxy, httpStack)); + CMD2_ANY_STRING_V("network.http.proxy_address.set", tr1::bind(&core::CurlStack::set_http_proxy, httpStack, std::placeholders::_2)); + CMD2_ANY ("network.http.max_open", tr1::bind(&core::CurlStack::max_active, httpStack)); + CMD2_ANY_VALUE_V ("network.http.max_open.set", tr1::bind(&core::CurlStack::set_max_active, httpStack, std::placeholders::_2)); + CMD2_ANY ("network.http.ssl_verify_peer", tr1::bind(&core::CurlStack::ssl_verify_peer, httpStack)); + CMD2_ANY_VALUE_V ("network.http.ssl_verify_peer.set", tr1::bind(&core::CurlStack::set_ssl_verify_peer, httpStack, std::placeholders::_2)); + CMD2_ANY ("network.http.dns_cache_timeout", tr1::bind(&core::CurlStack::dns_timeout, httpStack)); + CMD2_ANY_VALUE_V ("network.http.dns_cache_timeout.set", tr1::bind(&core::CurlStack::set_dns_timeout, httpStack, std::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.send_buffer.size", tr1::bind(&torrent::ConnectionManager::send_buffer_size, cm)); + CMD2_ANY_VALUE_V ("network.send_buffer.size.set", tr1::bind(&torrent::ConnectionManager::set_send_buffer_size, cm, std::placeholders::_2)); + CMD2_ANY ("network.receive_buffer.size", tr1::bind(&torrent::ConnectionManager::receive_buffer_size, cm)); + CMD2_ANY_VALUE_V ("network.receive_buffer.size.set", tr1::bind(&torrent::ConnectionManager::set_receive_buffer_size, cm, std::placeholders::_2)); + CMD2_ANY_STRING ("network.tos.set", tr1::bind(&apply_tos, std::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.bind_address", tr1::bind(&core::Manager::bind_address, control->core())); + CMD2_ANY_STRING_V("network.bind_address.set", tr1::bind(&core::Manager::set_bind_address, control->core(), std::placeholders::_2)); + CMD2_ANY ("network.local_address", tr1::bind(&core::Manager::local_address, control->core())); + CMD2_ANY_STRING_V("network.local_address.set", tr1::bind(&core::Manager::set_local_address, control->core(), std::placeholders::_2)); + CMD2_ANY ("network.proxy_address", tr1::bind(&core::Manager::proxy_address, control->core())); + CMD2_ANY_STRING_V("network.proxy_address.set", tr1::bind(&core::Manager::set_proxy_address, control->core(), std::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.open_sockets", std::bind(&torrent::ConnectionManager::size, cm)); - 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 ("network.max_open_files", tr1::bind(&torrent::FileManager::max_open_files, fileManager)); + CMD2_ANY_VALUE_V ("network.max_open_files.set", tr1::bind(&torrent::FileManager::set_max_open_files, fileManager, std::placeholders::_2)); + CMD2_ANY ("network.open_sockets", tr1::bind(&torrent::ConnectionManager::size, cm)); + CMD2_ANY ("network.max_open_sockets", tr1::bind(&torrent::ConnectionManager::max_size, cm)); + CMD2_ANY_VALUE_V ("network.max_open_sockets.set", tr1::bind(&torrent::ConnectionManager::set_max_size, cm, std::placeholders::_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_ANY_STRING ("network.scgi.open_port", tr1::bind(&apply_scgi, std::placeholders::_2, 1)); + CMD2_ANY_STRING ("network.scgi.open_local", tr1::bind(&apply_scgi, std::placeholders::_2, 2)); CMD2_VAR_BOOL ("network.scgi.dont_route", false); - 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_STRING ("network.xmlrpc.dialect.set", tr1::bind(&apply_xmlrpc_dialect, std::placeholders::_2)); + CMD2_ANY ("network.xmlrpc.size_limit", tr1::bind(&rpc::XmlRpc::size_limit)); + CMD2_ANY_VALUE_V ("network.xmlrpc.size_limit.set", tr1::bind(&rpc::XmlRpc::set_size_limit, std::placeholders::_2)); } diff --git a/src/command_peer.cc b/src/command_peer.cc index 0cf103b5..8d4fabd4 100644 --- a/src/command_peer.cc +++ b/src/command_peer.cc @@ -97,37 +97,37 @@ retrieve_p_completed_percent(torrent::Peer* peer) { void initialize_command_peer() { - 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.id", tr1::bind(&retrieve_p_id, std::placeholders::_1)); + CMD2_PEER("p.id_html", tr1::bind(&retrieve_p_id_html, std::placeholders::_1)); + CMD2_PEER("p.client_version", tr1::bind(&retrieve_p_client_version, std::placeholders::_1)); - CMD2_PEER("p.options_str", std::bind(&retrieve_p_options_str, std::placeholders::_1)); + CMD2_PEER("p.options_str", tr1::bind(&retrieve_p_options_str, std::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.is_encrypted", tr1::bind(&torrent::Peer::is_encrypted, std::placeholders::_1)); + CMD2_PEER("p.is_incoming", tr1::bind(&torrent::Peer::is_incoming, std::placeholders::_1)); + CMD2_PEER("p.is_obfuscated", tr1::bind(&torrent::Peer::is_obfuscated, std::placeholders::_1)); + CMD2_PEER("p.is_snubbed", tr1::bind(&torrent::Peer::is_snubbed, std::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.is_unwanted", tr1::bind(&torrent::PeerInfo::is_unwanted, tr1::bind(&torrent::Peer::peer_info, std::placeholders::_1))); + CMD2_PEER("p.is_preferred", tr1::bind(&torrent::PeerInfo::is_preferred, tr1::bind(&torrent::Peer::peer_info, std::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.address", tr1::bind(&retrieve_p_address, std::placeholders::_1)); + CMD2_PEER("p.port", tr1::bind(&retrieve_p_port, std::placeholders::_1)); - CMD2_PEER("p.completed_percent", std::bind(&retrieve_p_completed_percent, std::placeholders::_1)); + CMD2_PEER("p.completed_percent", tr1::bind(&retrieve_p_completed_percent, std::placeholders::_1)); - 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("p.up_rate", tr1::bind(&torrent::Rate::rate, tr1::bind(&torrent::Peer::up_rate, std::placeholders::_1))); + CMD2_PEER("p.up_total", tr1::bind(&torrent::Rate::total, tr1::bind(&torrent::Peer::up_rate, std::placeholders::_1))); + CMD2_PEER("p.down_rate", tr1::bind(&torrent::Rate::rate, tr1::bind(&torrent::Peer::down_rate, std::placeholders::_1))); + CMD2_PEER("p.down_total", tr1::bind(&torrent::Rate::total, tr1::bind(&torrent::Peer::down_rate, std::placeholders::_1))); + CMD2_PEER("p.peer_rate", tr1::bind(&torrent::Rate::rate, tr1::bind(&torrent::Peer::peer_rate, std::placeholders::_1))); + CMD2_PEER("p.peer_total", tr1::bind(&torrent::Rate::total, tr1::bind(&torrent::Peer::peer_rate, std::placeholders::_1))); - 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 ("p.snubbed", tr1::bind(&torrent::Peer::is_snubbed, std::placeholders::_1)); + CMD2_PEER_VALUE_V("p.snubbed.set", tr1::bind(&torrent::Peer::set_snubbed, std::placeholders::_1, std::placeholders::_2)); + CMD2_PEER ("p.banned", tr1::bind(&torrent::Peer::is_banned, std::placeholders::_1)); + CMD2_PEER_VALUE_V("p.banned.set", tr1::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)); + CMD2_PEER_V("p.disconnect", tr1::bind(&torrent::Peer::disconnect, std::placeholders::_1, 0)); + CMD2_PEER_V("p.disconnect_delayed", tr1::bind(&torrent::Peer::disconnect, std::placeholders::_1, torrent::ConnectionList::disconnect_delayed)); } diff --git a/src/command_scheduler.cc b/src/command_scheduler.cc index a2c92684..476e869f 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::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)); + CMD2_DL("scheduler.simple.added", tr1::bind(&cmd_scheduler_simple_added, std::placeholders::_1)); + CMD2_DL("scheduler.simple.removed", tr1::bind(&cmd_scheduler_simple_removed, std::placeholders::_1)); + CMD2_DL("scheduler.simple.update", tr1::bind(&cmd_scheduler_simple_update, std::placeholders::_1)); } diff --git a/src/command_throttle.cc b/src/command_throttle.cc index c2c6344c..ef64a838 100644 --- a/src/command_throttle.cc +++ b/src/command_throttle.cc @@ -164,8 +164,8 @@ apply_address_throttle(const torrent::Object::list_type& args) { void initialize_command_throttle() { - CMD2_ANY ("throttle.unchoked_uploads", std::bind(&torrent::ResourceManager::currently_upload_unchoked, torrent::resource_manager())); - CMD2_ANY ("throttle.unchoked_downloads", std::bind(&torrent::ResourceManager::currently_download_unchoked, torrent::resource_manager())); + CMD2_ANY ("throttle.unchoked_uploads", tr1::bind(&torrent::ResourceManager::currently_upload_unchoked, torrent::resource_manager())); + CMD2_ANY ("throttle.unchoked_downloads", tr1::bind(&torrent::ResourceManager::currently_download_unchoked, torrent::resource_manager())); CMD2_VAR_VALUE ("throttle.min_peers.normal", 100); CMD2_VAR_VALUE ("throttle.max_peers.normal", 200); @@ -183,25 +183,25 @@ initialize_command_throttle() { CMD2_VAR_VALUE ("throttle.max_downloads.global", 0); // TODO: Move the logic into some libtorrent function. - 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)); + CMD2_ANY ("throttle.global_up.rate", tr1::bind(&torrent::Rate::rate, torrent::up_rate())); + CMD2_ANY ("throttle.global_up.total", tr1::bind(&torrent::Rate::total, torrent::up_rate())); + CMD2_ANY ("throttle.global_up.max_rate", tr1::bind(&torrent::Throttle::max_rate, torrent::up_throttle_global())); + CMD2_ANY_VALUE_V ("throttle.global_up.max_rate.set", tr1::bind(&ui::Root::set_up_throttle_i64, control->ui(), std::placeholders::_2)); + CMD2_ANY_VALUE_KB("throttle.global_up.max_rate.set_kb", tr1::bind(&ui::Root::set_up_throttle_i64, control->ui(), std::placeholders::_2)); + CMD2_ANY ("throttle.global_down.rate", tr1::bind(&torrent::Rate::rate, torrent::down_rate())); + CMD2_ANY ("throttle.global_down.total", tr1::bind(&torrent::Rate::total, torrent::down_rate())); + CMD2_ANY ("throttle.global_down.max_rate", tr1::bind(&torrent::Throttle::max_rate, torrent::down_throttle_global())); + CMD2_ANY_VALUE_V ("throttle.global_down.max_rate.set", tr1::bind(&ui::Root::set_down_throttle_i64, control->ui(), std::placeholders::_2)); + CMD2_ANY_VALUE_KB("throttle.global_down.max_rate.set_kb", tr1::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::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_LIST ("throttle.up", tr1::bind(&apply_throttle, std::placeholders::_2, true)); + CMD2_ANY_LIST ("throttle.down", tr1::bind(&apply_throttle, std::placeholders::_2, false)); + CMD2_ANY_LIST ("throttle.ip", tr1::bind(&apply_address_throttle, std::placeholders::_2)); - 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_STRING ("throttle.up.max", tr1::bind(&retrieve_throttle_info, std::placeholders::_2, throttle_info_up | throttle_info_max)); + CMD2_ANY_STRING ("throttle.up.rate", tr1::bind(&retrieve_throttle_info, std::placeholders::_2, throttle_info_up | throttle_info_rate)); + CMD2_ANY_STRING ("throttle.down.max", tr1::bind(&retrieve_throttle_info, std::placeholders::_2, throttle_info_down | throttle_info_max)); + CMD2_ANY_STRING ("throttle.down.rate", tr1::bind(&retrieve_throttle_info, std::placeholders::_2, throttle_info_down | throttle_info_rate)); } diff --git a/src/command_tracker.cc b/src/command_tracker.cc index e6f226aa..b0854979 100644 --- a/src/command_tracker.cc +++ b/src/command_tracker.cc @@ -111,48 +111,48 @@ apply_enable_trackers(int64_t arg) { void initialize_command_tracker() { - 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(&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.is_open", tr1::bind(&torrent::Tracker::is_busy, std::placeholders::_1)); + CMD2_TRACKER ("t.is_enabled", tr1::bind(&torrent::Tracker::is_enabled, std::placeholders::_1)); + CMD2_TRACKER_VALUE_V("t.is_enabled.set", tr1::bind(&tracker_set_enabled, std::placeholders::_1, std::placeholders::_2)); + CMD2_TRACKER_V ("t.enable", tr1::bind(&torrent::Tracker::enable, std::placeholders::_1)); + CMD2_TRACKER_V ("t.disable", tr1::bind(&torrent::Tracker::disable, std::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.url", tr1::bind(&torrent::Tracker::url, std::placeholders::_1)); + CMD2_TRACKER ("t.group", tr1::bind(&torrent::Tracker::group, std::placeholders::_1)); + CMD2_TRACKER ("t.type", tr1::bind(&torrent::Tracker::type, std::placeholders::_1)); + CMD2_TRACKER ("t.id", tr1::bind(&torrent::Tracker::tracker_id, std::placeholders::_1)); - CMD2_TRACKER ("t.latest_event", std::bind(&torrent::Tracker::latest_event, std::placeholders::_1)); - CMD2_TRACKER ("t.latest_new_peers", std::bind(&torrent::Tracker::latest_new_peers, std::placeholders::_1)); - CMD2_TRACKER ("t.latest_sum_peers", std::bind(&torrent::Tracker::latest_sum_peers, std::placeholders::_1)); + CMD2_TRACKER ("t.latest_event", tr1::bind(&torrent::Tracker::latest_event, std::placeholders::_1)); + CMD2_TRACKER ("t.latest_new_peers", tr1::bind(&torrent::Tracker::latest_new_peers, std::placeholders::_1)); + CMD2_TRACKER ("t.latest_sum_peers", tr1::bind(&torrent::Tracker::latest_sum_peers, std::placeholders::_1)); // Time since last connection, connection attempt. - 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.normal_interval", tr1::bind(&torrent::Tracker::normal_interval, std::placeholders::_1)); + CMD2_TRACKER ("t.min_interval", tr1::bind(&torrent::Tracker::min_interval, std::placeholders::_1)); - CMD2_TRACKER ("t.success_time_last", std::bind(&torrent::Tracker::success_time_last, std::placeholders::_1)); - CMD2_TRACKER ("t.success_counter", std::bind(&torrent::Tracker::success_counter, std::placeholders::_1)); + CMD2_TRACKER ("t.success_time_last", tr1::bind(&torrent::Tracker::success_time_last, std::placeholders::_1)); + CMD2_TRACKER ("t.success_counter", tr1::bind(&torrent::Tracker::success_counter, std::placeholders::_1)); - CMD2_TRACKER ("t.failed_time_last", std::bind(&torrent::Tracker::failed_time_last, std::placeholders::_1)); - CMD2_TRACKER ("t.failed_counter", std::bind(&torrent::Tracker::failed_counter, std::placeholders::_1)); + CMD2_TRACKER ("t.failed_time_last", tr1::bind(&torrent::Tracker::failed_time_last, std::placeholders::_1)); + CMD2_TRACKER ("t.failed_counter", tr1::bind(&torrent::Tracker::failed_counter, std::placeholders::_1)); - CMD2_TRACKER ("t.scrape_time_last", std::bind(&torrent::Tracker::scrape_time_last, std::placeholders::_1)); - CMD2_TRACKER ("t.scrape_counter", std::bind(&torrent::Tracker::scrape_counter, std::placeholders::_1)); + CMD2_TRACKER ("t.scrape_time_last", tr1::bind(&torrent::Tracker::scrape_time_last, std::placeholders::_1)); + CMD2_TRACKER ("t.scrape_counter", tr1::bind(&torrent::Tracker::scrape_counter, 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)); + CMD2_TRACKER ("t.scrape_complete", tr1::bind(&torrent::Tracker::scrape_complete, std::placeholders::_1)); + CMD2_TRACKER ("t.scrape_incomplete", tr1::bind(&torrent::Tracker::scrape_incomplete, std::placeholders::_1)); + CMD2_TRACKER ("t.scrape_downloaded", tr1::bind(&torrent::Tracker::scrape_downloaded, std::placeholders::_1)); - 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_ANY_VALUE ("trackers.enable", tr1::bind(&apply_enable_trackers, int64_t(1))); + CMD2_ANY_VALUE ("trackers.disable", tr1::bind(&apply_enable_trackers, int64_t(0))); CMD2_VAR_VALUE ("trackers.numwant", -1); CMD2_VAR_BOOL ("trackers.use_udp", true); - CMD2_ANY_STRING_V ("dht.mode.set", std::bind(&core::DhtManager::set_mode, control->dht_manager(), std::placeholders::_2)); + CMD2_ANY_STRING_V ("dht.mode.set", tr1::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::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)); + CMD2_ANY_STRING ("dht.add_node", tr1::bind(&apply_dht_add_node, std::placeholders::_2)); + CMD2_ANY ("dht.statistics", tr1::bind(&core::DhtManager::dht_statistics, control->dht_manager())); + CMD2_ANY ("dht.throttle.name", tr1::bind(&core::DhtManager::throttle_name, control->dht_manager())); + CMD2_ANY_STRING_V ("dht.throttle.name.set", tr1::bind(&core::DhtManager::set_throttle_name, control->dht_manager(), std::placeholders::_2)); } diff --git a/src/command_ui.cc b/src/command_ui.cc index 7884959e..e88b5826 100644 --- a/src/command_ui.cc +++ b/src/command_ui.cc @@ -541,41 +541,41 @@ void initialize_command_ui() { CMD2_VAR_STRING("keys.layout", "qwerty"); - CMD2_ANY_STRING("view.add", object_convert_void(std::bind(&core::ViewManager::insert_throw, control->view_manager(), std::placeholders::_2))); + CMD2_ANY_STRING("view.add", object_convert_void(tr1::bind(&core::ViewManager::insert_throw, control->view_manager(), std::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_L ("view.list", tr1::bind(&apply_view_list)); + CMD2_ANY_LIST("view.set", tr1::bind(&apply_view_set, std::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.filter", tr1::bind(&apply_view_cfilter, &core::ViewManager::set_filter, std::placeholders::_2)); + CMD2_ANY_LIST("view.filter_on", tr1::bind(&apply_view_filter_on, std::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.sort", tr1::bind(&apply_view_sort, std::placeholders::_2)); + CMD2_ANY_LIST("view.sort_new", tr1::bind(&apply_view_cfilter, &core::ViewManager::set_sort_new, std::placeholders::_2)); + CMD2_ANY_LIST("view.sort_current", tr1::bind(&apply_view_cfilter, &core::ViewManager::set_sort_current, std::placeholders::_2)); - CMD2_ANY_LIST("view.event_added", std::bind(&apply_view_event, &core::ViewManager::set_event_added, std::placeholders::_2)); - CMD2_ANY_LIST("view.event_removed", std::bind(&apply_view_event, &core::ViewManager::set_event_removed, std::placeholders::_2)); + CMD2_ANY_LIST("view.event_added", tr1::bind(&apply_view_event, &core::ViewManager::set_event_added, std::placeholders::_2)); + CMD2_ANY_LIST("view.event_removed", tr1::bind(&apply_view_event, &core::ViewManager::set_event_removed, std::placeholders::_2)); // Cleanup and add . to view. - 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_ANY_STRING("view.size", tr1::bind(&cmd_view_size, std::placeholders::_2)); + CMD2_ANY_STRING("view.size_not_visible", tr1::bind(&cmd_view_size_not_visible, std::placeholders::_2)); + CMD2_ANY_STRING("view.persistent", tr1::bind(&cmd_view_persistent, std::placeholders::_2)); - CMD2_ANY_STRING_V("view.filter_all", std::bind(&core::View::filter, std::bind(&core::ViewManager::find_ptr_throw, control->view_manager(), std::placeholders::_2))); + CMD2_ANY_STRING_V("view.filter_all", tr1::bind(&core::View::filter, tr1::bind(&core::ViewManager::find_ptr_throw, control->view_manager(), std::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)); + CMD2_DL_STRING ("view.filter_download", tr1::bind(&cmd_view_filter_download, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_STRING ("view.set_visible", tr1::bind(&cmd_view_set_visible, std::placeholders::_1, std::placeholders::_2)); + CMD2_DL_STRING ("view.set_not_visible", tr1::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::bind(&cmd_ui_unfocus_download, std::placeholders::_1)); - CMD2_ANY_STRING("ui.current_view.set", std::bind(&cmd_ui_set_view, std::placeholders::_2)); + CMD2_DL ("ui.unfocus_download", tr1::bind(&cmd_ui_unfocus_download, std::placeholders::_1)); + CMD2_ANY_STRING("ui.current_view.set", tr1::bind(&cmd_ui_set_view, std::placeholders::_2)); // Move. CMD2_ANY("print", &apply_print); CMD2_ANY("cat", &apply_cat); - CMD2_ANY("if", std::bind(&apply_if, std::placeholders::_1, std::placeholders::_2, 0)); + CMD2_ANY("if", tr1::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); @@ -583,22 +583,22 @@ initialize_command_ui() { // A temporary command for handling stuff until we get proper // support for seperation of commands and literals. - CMD2_ANY("branch", std::bind(&apply_if, std::placeholders::_1, std::placeholders::_2, 1)); + CMD2_ANY("branch", tr1::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::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)); + CMD2_ANY_VALUE("convert.gm_time", tr1::bind(&apply_to_time, std::placeholders::_2, 0)); + CMD2_ANY_VALUE("convert.gm_date", tr1::bind(&apply_to_time, std::placeholders::_2, 0x2)); + CMD2_ANY_VALUE("convert.time", tr1::bind(&apply_to_time, std::placeholders::_2, 0x1)); + CMD2_ANY_VALUE("convert.date", tr1::bind(&apply_to_time, std::placeholders::_2, 0x1 | 0x2)); + CMD2_ANY_VALUE("convert.elapsed_time", tr1::bind(&apply_to_elapsed_time, std::placeholders::_2)); + CMD2_ANY_VALUE("convert.kb", tr1::bind(&apply_to_kb, std::placeholders::_2)); + CMD2_ANY_VALUE("convert.mb", tr1::bind(&apply_to_mb, std::placeholders::_2)); + CMD2_ANY_VALUE("convert.xb", tr1::bind(&apply_to_xb, std::placeholders::_2)); + CMD2_ANY_VALUE("convert.throttle", tr1::bind(&apply_to_throttle, std::placeholders::_2)); - CMD2_ANY_LIST ("elapsed.less", std::bind(&apply_elapsed_less, std::placeholders::_2)); - CMD2_ANY_LIST ("elapsed.greater", std::bind(&apply_elapsed_greater, std::placeholders::_2)); + CMD2_ANY_LIST ("elapsed.less", tr1::bind(&apply_elapsed_less, std::placeholders::_2)); + CMD2_ANY_LIST ("elapsed.greater", tr1::bind(&apply_elapsed_greater, std::placeholders::_2)); } diff --git a/test/rpc/command_map_test.cc b/test/rpc/command_map_test.cc index 95fd44e7..71673a13 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::bind(&cmd_test_map_b, std::placeholders::_1, std::placeholders::_2, (uint64_t)2)); + CMD2_ANY("test_b", tr1::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);