declare tag types in-line

This commit is contained in:
arvidn 2018-03-22 23:28:55 +01:00 committed by Arvid Norberg
parent 9df4d4b7f8
commit 5413eae900
29 changed files with 49 additions and 112 deletions

View File

@ -68,8 +68,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
// hidden
struct alert_category_tag;
using alert_category_t = flags::bitfield_flag<std::uint32_t, alert_category_tag>;
using alert_category_t = flags::bitfield_flag<std::uint32_t, struct alert_category_tag>;
// The ``alert`` class is the base class that specific messages are derived from.
// alert types are not copyable, and cannot be constructed by the client. The

View File

@ -2552,8 +2552,7 @@ namespace libtorrent {
};
// hidden
struct picker_flags_tag;
using picker_flags_t = flags::bitfield_flag<std::uint32_t, picker_flags_tag>;
using picker_flags_t = flags::bitfield_flag<std::uint32_t, struct picker_flags_tag>;
// this is posted when one or more blocks are picked by the piece picker,
// assuming the verbose piece picker logging is enabled (see

View File

@ -42,8 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
// hidden
struct encode_string_flags_tag;
using encode_string_flags_t = flags::bitfield_flag<std::uint8_t, encode_string_flags_tag>;
using encode_string_flags_t = flags::bitfield_flag<std::uint8_t, struct encode_string_flags_tag>;
namespace string
{

View File

@ -89,8 +89,7 @@ namespace libtorrent {
struct resolver_interface;
// hidden
struct queue_position_tag;
using queue_position_t = aux::strong_typedef<int, queue_position_tag>;
using queue_position_t = aux::strong_typedef<int, struct queue_position_tag>;
constexpr queue_position_t no_pos{-1};
constexpr queue_position_t last_pos{(std::numeric_limits<int>::max)()};
@ -110,8 +109,7 @@ namespace aux {
struct session_settings;
struct socket_type;
struct ip_source_tag;
using ip_source_t = flags::bitfield_flag<std::uint8_t, ip_source_tag>;
using ip_source_t = flags::bitfield_flag<std::uint8_t, struct ip_source_tag>;
#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
// This is the basic logging and debug interface offered by the session.

View File

@ -93,8 +93,7 @@ namespace libtorrent {
class torrent_info;
// hidden
struct create_flags_tag;
using create_flags_t = flags::bitfield_flag<std::uint32_t, create_flags_tag>;
using create_flags_t = flags::bitfield_flag<std::uint32_t, struct create_flags_tag>;
// This class holds state for creating a torrent. After having added
// all information to it, call create_torrent::generate() to generate

View File

@ -64,8 +64,7 @@ namespace libtorrent {
struct storage_holder;
struct file_open_mode_tag;
using file_open_mode_t = flags::bitfield_flag<std::uint8_t, file_open_mode_tag>;
using file_open_mode_t = flags::bitfield_flag<std::uint8_t, struct file_open_mode_tag>;
// this is a bittorrent constant
constexpr int default_block_size = 0x4000;
@ -128,8 +127,7 @@ namespace libtorrent {
using pool_file_status = open_file_state;
#endif
struct disk_job_flags_tag;
using disk_job_flags_t = flags::bitfield_flag<std::uint8_t, disk_job_flags_tag>;
using disk_job_flags_t = flags::bitfield_flag<std::uint8_t, struct disk_job_flags_tag>;
struct TORRENT_EXTRA_EXPORT disk_interface
{

View File

@ -37,8 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct download_priority_tag;
using download_priority_t = aux::strong_typedef<std::uint8_t, download_priority_tag>;
using download_priority_t = aux::strong_typedef<std::uint8_t, struct download_priority_tag>;
constexpr download_priority_t dont_download{0};
constexpr download_priority_t default_priority{4};

View File

@ -186,11 +186,9 @@ namespace libtorrent {
struct session_handle;
struct peer_connection_handle;
struct feature_flags_tag;
// these are flags that can be returned by implemented_features()
// indicating which callbacks this plugin is interested in
using feature_flags_t = flags::bitfield_flag<std::uint8_t, feature_flags_tag>;
using feature_flags_t = flags::bitfield_flag<std::uint8_t, struct feature_flags_tag>;
// this is the base class for a session plugin. One primary feature
// is that it is notified of all torrents that are added to the session,
@ -279,8 +277,7 @@ namespace libtorrent {
virtual void load_state(bdecode_node const&) {}
};
struct add_peer_flags_tag;
using add_peer_flags_t = flags::bitfield_flag<std::uint8_t, add_peer_flags_tag>;
using add_peer_flags_t = flags::bitfield_flag<std::uint8_t, struct add_peer_flags_tag>;
// Torrent plugins are associated with a single torrent and have a number
// of functions called at certain events. Many of its functions have the

View File

@ -128,8 +128,7 @@ namespace libtorrent {
using file_handle = std::shared_ptr<file>;
// hidden
struct open_mode_tag;
using open_mode_t = flags::bitfield_flag<std::uint32_t, open_mode_tag>;
using open_mode_t = flags::bitfield_flag<std::uint32_t, struct open_mode_tag>;
// the open mode for files. Used for the file constructor or
// file::open().

View File

@ -193,8 +193,7 @@ namespace libtorrent {
};
// hidden
struct file_flags_tag;
using file_flags_t = flags::bitfield_flag<std::uint8_t, file_flags_tag>;
using file_flags_t = flags::bitfield_flag<std::uint8_t, struct file_flags_tag>;
// The ``file_storage`` class represents a file list and the piece
// size. Everything necessary to interpret a regular bittorrent storage

View File

@ -48,8 +48,7 @@ struct observer;
struct msg;
struct traversal_algorithm;
struct observer_flags_tag;
using observer_flags_t = libtorrent::flags::bitfield_flag<std::uint8_t, observer_flags_tag>;
using observer_flags_t = libtorrent::flags::bitfield_flag<std::uint8_t, struct observer_flags_tag>;
struct TORRENT_EXTRA_EXPORT observer
: std::enable_shared_from_this<observer>

View File

@ -53,8 +53,7 @@ namespace dht {
class node;
struct node_endpoint;
struct traversal_flags_tag;
using traversal_flags_t = libtorrent::flags::bitfield_flag<std::uint8_t, traversal_flags_tag>;
using traversal_flags_t = libtorrent::flags::bitfield_flag<std::uint8_t, struct traversal_flags_tag>;
// this class may not be instantiated as a stack object
struct TORRENT_EXTRA_EXPORT traversal_algorithm

View File

@ -38,8 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct torrent_list_tag;
using torrent_list_index_t = aux::strong_typedef<int, torrent_list_tag>;
using torrent_list_index_t = aux::strong_typedef<int, struct torrent_list_tag>;
struct link
{

View File

@ -46,8 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct slot_index_tag_t {};
using slot_index_t = aux::strong_typedef<int, slot_index_tag_t>;
using slot_index_t = aux::strong_typedef<int, struct slot_index_tag_t>;
struct TORRENT_EXTRA_EXPORT part_file
{

View File

@ -46,12 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
namespace aux {
struct peer_class_tag;
}
using peer_class_t = aux::strong_typedef<std::uint32_t, aux::peer_class_tag>;
using peer_class_t = aux::strong_typedef<std::uint32_t, struct peer_class_tag>;
// holds settings for a peer class. Used in set_peer_class() and
// get_peer_class() calls.

View File

@ -242,8 +242,7 @@ namespace aux {
http_seed
};
struct request_flags_tag;
using request_flags_t = flags::bitfield_flag<std::uint8_t, request_flags_tag>;
using request_flags_t = flags::bitfield_flag<std::uint8_t, struct request_flags_tag>;
class TORRENT_EXTRA_EXPORT peer_connection
: public peer_connection_hot_members

View File

@ -44,24 +44,19 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
// hidden
struct peer_flags_tag;
struct peer_source_flags_tag;
struct bandwidth_state_flags_tag;
// flags for the peer_info::flags field. Indicates various states
// the peer may be in. These flags are not mutually exclusive, but
// not every combination of them makes sense either.
using peer_flags_t = flags::bitfield_flag<std::uint32_t, peer_flags_tag>;
using peer_flags_t = flags::bitfield_flag<std::uint32_t, struct peer_flags_tag>;
// the flags indicating which sources a peer can
// have come from. A peer may have been seen from
// multiple sources
using peer_source_flags_t = flags::bitfield_flag<std::uint8_t, peer_source_flags_tag>;
using peer_source_flags_t = flags::bitfield_flag<std::uint8_t, struct peer_source_flags_tag>;
// flags indicating what is blocking network transfers in up- and down
// direction
using bandwidth_state_flags_t = flags::bitfield_flag<std::uint8_t, bandwidth_state_flags_tag>;
using bandwidth_state_flags_t = flags::bitfield_flag<std::uint8_t, struct bandwidth_state_flags_tag>;
// holds information and statistics about one peer
// that libtorrent is connected to

View File

@ -37,8 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct pex_flags_tag;
using pex_flags_t = flags::bitfield_flag<std::uint8_t, pex_flags_tag>;
using pex_flags_t = flags::bitfield_flag<std::uint8_t, struct pex_flags_tag>;
// these flags match the flags passed in ut_pex
// messages

View File

@ -63,11 +63,8 @@ namespace libtorrent {
struct counters;
struct torrent_peer;
struct prio_index_tag_t {};
using prio_index_t = aux::strong_typedef<int, prio_index_tag_t>;
struct picker_options_tag;
using picker_options_t = flags::bitfield_flag<std::uint16_t, picker_options_tag>;
using prio_index_t = aux::strong_typedef<int, struct prio_index_tag_t>;
using picker_options_t = flags::bitfield_flag<std::uint16_t, struct picker_options_tag>;
class TORRENT_EXTRA_EXPORT piece_picker
{

View File

@ -37,9 +37,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/units.hpp"
namespace libtorrent {
namespace aux {
struct port_mapping_tag;
}
enum class portmap_transport : std::uint8_t
{
@ -52,7 +49,7 @@ namespace aux {
};
// this type represents an index referring to a port mapping
using port_mapping_t = aux::strong_typedef<int, aux::port_mapping_tag>;
using port_mapping_t = aux::strong_typedef<int, struct port_mapping_tag>;
}

View File

@ -44,8 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
// hidden
struct resolver_flag_tag;
using resolver_flags = flags::bitfield_flag<std::uint8_t, resolver_flag_tag>;
using resolver_flags = flags::bitfield_flag<std::uint8_t, struct resolver_flag_tag>;
struct TORRENT_EXTRA_EXPORT resolver_interface
{

View File

@ -39,20 +39,16 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
// hidden
struct save_state_flags_tag;
using save_state_flags_t = flags::bitfield_flag<std::uint32_t, save_state_flags_tag>;
using save_state_flags_t = flags::bitfield_flag<std::uint32_t, struct save_state_flags_tag>;
// hidden
struct session_flags_tag;
using session_flags_t = flags::bitfield_flag<std::uint8_t, session_flags_tag>;
using session_flags_t = flags::bitfield_flag<std::uint8_t, struct session_flags_tag>;
// hidden
struct remove_flags_tag;
using remove_flags_t = flags::bitfield_flag<std::uint8_t, remove_flags_tag>;
using remove_flags_t = flags::bitfield_flag<std::uint8_t, struct remove_flags_tag>;
// hidden
struct reopen_network_flags_tag;
using reopen_network_flags_t = flags::bitfield_flag<std::uint8_t, reopen_network_flags_tag>;
using reopen_network_flags_t = flags::bitfield_flag<std::uint8_t, struct reopen_network_flags_tag>;
}
#endif

View File

@ -48,8 +48,7 @@ namespace libtorrent {
struct file_pool;
class torrent_info;
struct storage_index_tag_t {};
using storage_index_t = aux::strong_typedef<std::uint32_t, storage_index_tag_t>;
using storage_index_t = aux::strong_typedef<std::uint32_t, struct storage_index_tag_t>;
// types of storage allocation used for add_torrent_params::storage_mode.
enum storage_mode_t

View File

@ -37,8 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct torrent_flags_tag;
using torrent_flags_t = flags::bitfield_flag<std::uint64_t, torrent_flags_tag>;
using torrent_flags_t = flags::bitfield_flag<std::uint64_t, struct torrent_flags_tag>;
namespace torrent_flags {

View File

@ -80,33 +80,16 @@ namespace aux {
struct storage_interface;
class torrent;
// hidden
struct status_flags_tag;
using status_flags_t = flags::bitfield_flag<std::uint32_t, status_flags_tag>;
#ifndef BOOST_NO_EXCEPTIONS
void TORRENT_NO_RETURN throw_invalid_handle();
#endif
// hidden
struct add_piece_flags_tag;
using add_piece_flags_t = flags::bitfield_flag<std::uint8_t, add_piece_flags_tag>;
// hidden
struct pause_flags_tag;
using pause_flags_t = flags::bitfield_flag<std::uint8_t, pause_flags_tag>;
// hidden
struct deadline_flags_tag;
using deadline_flags_t = flags::bitfield_flag<std::uint8_t, deadline_flags_tag>;
// hidden
struct resume_data_flags_tag;
using resume_data_flags_t = flags::bitfield_flag<std::uint8_t, resume_data_flags_tag>;
// hidden
struct queue_position_tag;
using queue_position_t = aux::strong_typedef<int, queue_position_tag>;
using status_flags_t = flags::bitfield_flag<std::uint32_t, struct status_flags_tag>;
using add_piece_flags_t = flags::bitfield_flag<std::uint8_t, struct add_piece_flags_tag>;
using pause_flags_t = flags::bitfield_flag<std::uint8_t, struct pause_flags_tag>;
using deadline_flags_t = flags::bitfield_flag<std::uint8_t, struct deadline_flags_tag>;
using resume_data_flags_t = flags::bitfield_flag<std::uint8_t, struct resume_data_flags_tag>;
using queue_position_t = aux::strong_typedef<int, struct queue_position_tag>;
// holds the state of a block in a piece. Who we requested
// it from and how far along we are at downloading it.

View File

@ -48,8 +48,7 @@ namespace libtorrent {
struct socks5;
struct udp_send_flags_tag;
using udp_send_flags_t = flags::bitfield_flag<std::uint8_t, udp_send_flags_tag>;
using udp_send_flags_t = flags::bitfield_flag<std::uint8_t, struct udp_send_flags_tag>;
class TORRENT_EXTRA_EXPORT udp_socket : single_threaded
{

View File

@ -33,16 +33,16 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "libtorrent/flags.hpp"
struct test_flags_tag;
using test_flags_t = libtorrent::flags::bitfield_flag<std::uint32_t, test_flags_tag>;
using test_flags_t = libtorrent::flags::bitfield_flag<std::uint32_t, struct test_flags_tag>;
namespace test_flags
{
constexpr test_flags_t super_seeding{1};
constexpr test_flags_t strict_super_seeding{2};
constexpr test_flags_t seed_mode{4};
constexpr test_flags_t time_critical{8};
constexpr test_flags_t suggest{16};
using libtorrent::operator ""_bit;
constexpr test_flags_t super_seeding = 1_bit;
constexpr test_flags_t strict_super_seeding = 2_bit;
constexpr test_flags_t seed_mode = 3_bit;
constexpr test_flags_t time_critical = 4_bit;
constexpr test_flags_t suggest = 5_bit;
}
EXPORT void test_swarm(test_flags_t flags = test_flags_t{});

View File

@ -938,8 +938,7 @@ TORRENT_TEST(zero_file_prio)
test_zero_file_prio();
}
struct test_mode_tag;
using test_mode_t = flags::bitfield_flag<std::uint8_t, test_mode_tag>;
using test_mode_t = flags::bitfield_flag<std::uint8_t, struct test_mode_tag>;
namespace test_mode {
constexpr test_mode_t file_prio = 0_bit;

View File

@ -122,8 +122,7 @@ storage_interface* test_storage_constructor(storage_params const& params, file_p
return new test_storage(params, pool);
}
struct transfer_tag;
using transfer_flags_t = lt::flags::bitfield_flag<std::uint8_t, transfer_tag>;
using transfer_flags_t = lt::flags::bitfield_flag<std::uint8_t, struct transfer_tag>;
constexpr transfer_flags_t disk_full = 1_bit;
constexpr transfer_flags_t delete_files = 2_bit;