add rename_file and name to filestorage in python binding

This commit is contained in:
Arvid Norberg 2012-03-22 03:33:54 +00:00
parent bc851d317f
commit a63ae0650f
2 changed files with 16 additions and 7 deletions

View File

@ -14,10 +14,12 @@ rule libtorrent_linking ( properties * )
result += <fpic>on ;
}
# if <toolset>gcc in $(properties) || <toolset>darwin in $(properties)
# {
# result += <visibility>hidden ;
# }
if <toolset>gcc in $(properties)
|| <toolset>darwin in $(properties)
|| <toolset>clang in $(properties)
{
result += <cxxflags>-fvisibility=hidden ;
}
# when building peer_plugin.cpp on msvc-7.1 it fails
# running out of internal heap space. Don't add it
@ -35,11 +37,11 @@ rule libtorrent_linking ( properties * )
{
if <boost-link>static in $(properties) || <link>static in $(properties)
{
result += <library>/boost/python//boost_python/<boost-link>static ;
result += <library>/boost/python//boost_python/<link>static ;
}
else
{
result += <library>/boost/python//boost_python/<boost-link>shared ;
result += <library>/boost/python//boost_python/<link>shared ;
}
}
else

View File

@ -52,6 +52,9 @@ namespace
{
ct.add_file(fe);
}
char const* filestorage_name(file_storage const& fs)
{ return fs.name().c_str(); }
}
void bind_create_torrent()
@ -62,8 +65,10 @@ void bind_create_torrent()
#endif
void (file_storage::*set_name0)(std::string const&) = &file_storage::set_name;
void (file_storage::*rename_file0)(int, std::string const&) = &file_storage::rename_file;
#if TORRENT_USE_WSTRING
void (file_storage::*set_name1)(std::wstring const&) = &file_storage::set_name;
void (file_storage::*rename_file1)(int, std::wstring const&) = &file_storage::rename_file;
#endif
#ifndef BOOST_NO_EXCEPTIONS
@ -95,10 +100,12 @@ void bind_create_torrent()
.def("piece_length", &file_storage::piece_length)
.def("piece_size", &file_storage::piece_size)
.def("set_name", set_name0)
.def("rename_file", rename_file0)
#if TORRENT_USE_WSTRING
.def("set_name", set_name1)
.def("rename_file", rename_file1)
#endif
.def("name", &file_storage::name, return_internal_reference<>())
.def("name", &filestorage_name)
;
class_<create_torrent>("create_torrent", no_init)