python binding fix for file_storage

This commit is contained in:
Arvid Norberg 2009-03-01 08:13:26 +00:00
parent 93eda7c7fa
commit a080fdc8fa
1 changed files with 9 additions and 3 deletions

View File

@ -13,12 +13,17 @@ using namespace libtorrent;
void bind_create_torrent() void bind_create_torrent()
{ {
void (file_storage::*add_file0)(file_entry const&) = &file_storage::add_file; void (file_storage::*add_file0)(file_entry const&) = &file_storage::add_file;
void (file_storage::*add_file1)(fs::path const&, size_type) = &file_storage::add_file; void (file_storage::*add_file1)(fs::path const&, size_type, int) = &file_storage::add_file;
void (file_storage::*add_file2)(fs::wpath const&, size_type, int) = &file_storage::add_file;
void (file_storage::*set_name0)(std::string const&) = &file_storage::set_name;
void (file_storage::*set_name1)(std::wstring const&) = &file_storage::set_name;
class_<file_storage>("file_storage") class_<file_storage>("file_storage")
.def("is_valid", &file_storage::is_valid) .def("is_valid", &file_storage::is_valid)
.def("add_file", add_file0) .def("add_file", add_file0)
.def("add_file", add_file1) .def("add_file", add_file1, (arg("path"), arg("size"), arg("flags") = 0))
.def("add_file", add_file2, (arg("path"), arg("size"), arg("flags") = 0))
.def("num_files", &file_storage::num_files) .def("num_files", &file_storage::num_files)
.def("at", &file_storage::at, return_internal_reference<>()) .def("at", &file_storage::at, return_internal_reference<>())
.def("total_size", &file_storage::total_size) .def("total_size", &file_storage::total_size)
@ -27,7 +32,8 @@ void bind_create_torrent()
.def("set_piece_length", &file_storage::set_piece_length) .def("set_piece_length", &file_storage::set_piece_length)
.def("piece_length", &file_storage::piece_length) .def("piece_length", &file_storage::piece_length)
.def("piece_size", &file_storage::piece_size) .def("piece_size", &file_storage::piece_size)
.def("set_name", &file_storage::set_name) .def("set_name", set_name0)
.def("set_name", set_name1)
.def("name", &file_storage::name, return_internal_reference<>()) .def("name", &file_storage::name, return_internal_reference<>())
; ;