torrent_handle::torrent_file returns a const torrent_info pointer

This commit is contained in:
Arvid Norberg 2014-01-01 21:24:15 +00:00
parent dc2243c17e
commit 31e6d54ad2
4 changed files with 13 additions and 11 deletions

View File

@ -727,7 +727,7 @@ namespace libtorrent
torrent_info const& torrent_file() const
{ return *m_torrent_file; }
boost::intrusive_ptr<torrent_info> get_torrent_copy();
boost::intrusive_ptr<torrent_info const> get_torrent_copy();
std::string const& uuid() const { return m_uuid; }
void set_uuid(std::string const& s) { m_uuid = s; }

View File

@ -698,13 +698,14 @@ namespace libtorrent
// storage contructor function that was passed to add_torrent.
storage_interface* get_storage_impl() const;
// Returns a pointer to the torrent_info object associated with this torrent. The
// torrent_info object is a copy of the internal object. If the torrent doesn't
// have metadata, the object being returned will not be fully filled in.
// The torrent may be in a state without metadata only if
// it was started without a .torrent file, e.g. by using the libtorrent extension of
// just supplying a tracker and info-hash.
boost::intrusive_ptr<torrent_info> torrent_file() const;
// Returns a pointer to the torrent_info object associated with this
// torrent. The torrent_info object may be a copy of the internal object.
// If the torrent doesn't have metadata, the pointer will not be
// initialized (i.e. a NULL pointer). The torrent may be in a state
// without metadata only if it was started without a .torrent file, e.g.
// by using the libtorrent extension of just supplying a tracker and
// info-hash.
boost::intrusive_ptr<torrent_info const> torrent_file() const;
#ifndef TORRENT_NO_DEPRECATE

View File

@ -5208,7 +5208,7 @@ namespace libtorrent
}
}
boost::intrusive_ptr<torrent_info> torrent::get_torrent_copy()
boost::intrusive_ptr<torrent_info const> torrent::get_torrent_copy()
{
if (!m_torrent_file->is_valid()) return boost::intrusive_ptr<torrent_info>();

View File

@ -739,9 +739,10 @@ namespace libtorrent
return !m_torrent.expired();
}
boost::intrusive_ptr<torrent_info> torrent_handle::torrent_file() const
boost::intrusive_ptr<torrent_info const> torrent_handle::torrent_file() const
{
TORRENT_SYNC_CALL_RET(boost::intrusive_ptr<torrent_info>, boost::intrusive_ptr<torrent_info>(), get_torrent_copy);
TORRENT_SYNC_CALL_RET(boost::intrusive_ptr<torrent_info const>
, boost::intrusive_ptr<torrent_info const>(), get_torrent_copy);
return r;
}