make storage constructor a boost.function for flexibility. Also added some documentation for trackerid

This commit is contained in:
Arvid Norberg 2010-11-18 17:36:11 +00:00
parent a05acc4bac
commit d98a8b04a5
2 changed files with 15 additions and 7 deletions

View File

@ -356,9 +356,9 @@ add_torrent()
::
typedef storage_interface* (&storage_constructor_type)(
file_storage const&, file_storage const*, fs::path const&, file_pool&
, std::vector<boost::uint8_t> const&);
typedef boost::function<storage_interface*(file_storage const&
, file_storage const*, std::string const&, file_pool&
, std::vector<boost::uint8_t> const&) storage_constructor_type;
struct add_torrent_params
{
@ -382,6 +382,7 @@ add_torrent()
bool upload_mode;
std::vector<boost::uint8_t> const* file_priorities;
bool share_mode;
std::string trackerid;
};
torrent_handle add_torrent(add_torrent_params const& params);
@ -514,6 +515,10 @@ a torrent. The semantics are the same as for ``torrent_handle::prioritize_files(
``version`` is filled in by the constructor and should be left untouched. It
is used for forward binary compatibility.
``trackerid`` is the default tracker id to be used when announcing to trackers. By default
this is empty, and no tracker ID is used, since this is an optional argument. If
a tracker returns a tracker ID, that ID is used instead of this.
remove_torrent()
----------------

View File

@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_STORAGE_DEFS_HPP_INCLUDE
#include "libtorrent/config.hpp"
#include <boost/function.hpp>
#include <string>
namespace libtorrent
@ -49,14 +50,16 @@ namespace libtorrent
storage_mode_compact
};
typedef storage_interface* (*storage_constructor_type)(
file_storage const&, file_storage const*, std::string const&, file_pool&, std::vector<boost::uint8_t> const&);
typedef boost::function<storage_interface*(file_storage const&, file_storage const*
, std::string const&, file_pool&, std::vector<boost::uint8_t> const&)> storage_constructor_type;
TORRENT_EXPORT storage_interface* default_storage_constructor(
file_storage const&, file_storage const* mapped, std::string const&, file_pool&, std::vector<boost::uint8_t> const&);
file_storage const&, file_storage const* mapped, std::string const&, file_pool&
, std::vector<boost::uint8_t> const&);
TORRENT_EXPORT storage_interface* disabled_storage_constructor(
file_storage const&, file_storage const* mapped, std::string const&, file_pool&, std::vector<boost::uint8_t> const&);
file_storage const&, file_storage const* mapped, std::string const&, file_pool&
, std::vector<boost::uint8_t> const&);
}