add file_name() to file_storage

This commit is contained in:
Arvid Norberg 2012-08-31 02:31:37 +00:00
parent 64a56e4581
commit 52f679d5dc
2 changed files with 14 additions and 0 deletions

View File

@ -253,6 +253,7 @@ namespace libtorrent
size_type file_base(int index) const;
void set_file_base(int index, size_type off);
std::string file_path(int index) const;
std::string file_name(int index) const;
size_type file_size(int index) const;
sha1_hash hash(internal_file_entry const& fe) const;
@ -262,6 +263,7 @@ namespace libtorrent
size_type file_base(internal_file_entry const& fe) const;
void set_file_base(internal_file_entry const& fe, size_type off);
std::string file_path(internal_file_entry const& fe) const;
std::string file_name(internal_file_entry const& fe) const;
size_type file_size(internal_file_entry const& fe) const;
#if !defined TORRENT_VERBOSE_LOGGING \

View File

@ -426,6 +426,13 @@ namespace libtorrent
return combine_path(m_paths[fe.path_index], fe.filename());
}
std::string file_storage::file_name(int index) const
{
TORRENT_ASSERT(index >= 0 && index < int(m_files.size()));
internal_file_entry const& fe = m_files[index];
return fe.filename();
}
size_type file_storage::file_size(int index) const
{
TORRENT_ASSERT(index >= 0 && index < int(m_files.size()));
@ -481,6 +488,11 @@ namespace libtorrent
return combine_path(m_paths[fe.path_index], fe.filename());
}
std::string file_storage::file_name(internal_file_entry const& fe) const
{
return fe.filename();
}
size_type file_storage::file_size(internal_file_entry const& fe) const
{
return fe.size;