restore in-class flag types, for backwards compatibility with libtorrent-1.1

This commit is contained in:
arvidn 2020-03-03 10:01:50 +01:00 committed by Arvid Norberg
parent 14d5c99a18
commit ee38106465
7 changed files with 34 additions and 5 deletions

View File

@ -94,6 +94,8 @@ namespace libtorrent {
#if TORRENT_ABI_VERSION == 1
// only here for backwards compatibility
enum TORRENT_DEPRECATED_ENUM severity_t { debug, info, warning, critical, fatal, none };
using category_t = alert_category_t;
#endif
// Enables alerts that report an error. This includes:

View File

@ -101,6 +101,9 @@ namespace libtorrent {
// .torrent file using bencode().
struct TORRENT_EXPORT create_torrent
{
#if TORRENT_ABI_VERSION == 1
using flags_t = create_flags_t;
#endif
// This will insert pad files to align the files to piece boundaries, for
// optimized disk-I/O. This will minimize the number of bytes of pad-
// files, to keep the impact down for clients that don't support
@ -160,7 +163,7 @@ namespace libtorrent {
// have any affect.
//
// The ``flags`` arguments specifies options for the torrent creation. It can
// be any combination of the flags defined by create_torrent::flags_t.
// be any combination of the flags defined by create_flags_t.
//
// ``alignment`` is used when pad files are enabled. This is the size
// eligible files are aligned to. The default is -1, which means the

View File

@ -188,6 +188,10 @@ namespace libtorrent {
// hidden
virtual ~plugin() {}
#if TORRENT_ABI_VERSION == 1
using feature_flags_t = libtorrent::feature_flags_t;
#endif
// include this bit if your plugin needs to alter the order of the
// optimistic unchoke of peers. i.e. have the on_optimistic_unchoke()
// callback be called.
@ -277,6 +281,10 @@ namespace libtorrent {
// hidden
virtual ~torrent_plugin() {}
#if TORRENT_ABI_VERSION == 1
using flags_t = libtorrent::add_peer_flags_t;
#endif
// This function is called each time a new peer is connected to the torrent. You
// may choose to ignore this by just returning a default constructed
// ``shared_ptr`` (in which case you don't need to override this member
@ -332,10 +340,6 @@ namespace libtorrent {
// enum members
virtual void on_state(torrent_status::state_t) {}
// called every time policy::add_peer is called
// src is a bitmask of which sources this peer
// has been seen from. flags is a bitmask of:
// this is the first time we see this peer
static constexpr add_peer_flags_t first_time = 1_bit;

View File

@ -229,6 +229,7 @@ namespace libtorrent {
bool is_valid() const { return m_piece_length > 0; }
#if TORRENT_ABI_VERSION == 1
using flags_t = file_flags_t;
static constexpr file_flags_t TORRENT_DEPRECATED_MEMBER pad_file = 0_bit;
static constexpr file_flags_t TORRENT_DEPRECATED_MEMBER attribute_hidden = 1_bit;
static constexpr file_flags_t TORRENT_DEPRECATED_MEMBER attribute_executable = 2_bit;

View File

@ -90,6 +90,11 @@ TORRENT_VERSION_NAMESPACE_2
// the time until all blocks in the request queue will be downloaded
time_duration download_queue_time;
#if TORRENT_ABI_VERSION == 1
using peer_flags_t = libtorrent::peer_flags_t;
using peer_source_flags = libtorrent::peer_source_flags_t;
#endif
// **we** are interested in pieces from this peer.
static constexpr peer_flags_t interesting = 0_bit;

View File

@ -83,6 +83,11 @@ namespace libtorrent {
session_handle& operator=(session_handle const&) = default;
session_handle& operator=(session_handle&&) noexcept = default;
#if TORRENT_ABI_VERSION == 1
using save_state_flags_t = libtorrent::save_state_flags_t;
using session_flags_t = libtorrent::session_flags_t;
#endif
// returns true if this handle refers to a valid session object. If the
// session has been destroyed, all session_handle objects will expire and
// not be valid.

View File

@ -254,6 +254,15 @@ namespace aux {
torrent_handle& operator=(torrent_handle const&) = default;
torrent_handle& operator=(torrent_handle&&) noexcept = default;
#if TORRENT_ABI_VERSION == 1
using flags_t = add_piece_flags_t;
using status_flags_t = libtorrent::status_flags_t;
using pause_flags_t = libtorrent::pause_flags_t;
using save_resume_flags_t = libtorrent::resume_data_flags_t;
using reannounce_flags_t = libtorrent::reannounce_flags_t;
#endif
// instruct libtorrent to overwrite any data that may already have been
// downloaded with the data of the new piece being added.
static constexpr add_piece_flags_t overwrite_existing = 0_bit;