source: trunk/src/halPeers.hpp @ 659

Revision 659, 1.4 KB checked in by Eoin, 11 years ago (diff)

Peer list sorting fixed and so more naming conventions consistency work.

Line 
1
2//         Copyright Eóin O'Callaghan 2006 - 2008.
3// Distributed under the Boost Software License, Version 1.0.
4//    (See accompanying file LICENSE_1_0.txt or copy at
5//          http://www.boost.org/LICENSE_1_0.txt)
6
7#pragma once
8
9#include <stlsoft/properties/method_properties.hpp>
10#include <stlsoft/util/operator_bool_adaptor.hpp>
11
12#include <boost/asio/ip/tcp.hpp>
13#include <boost/asio/ip/udp.hpp>
14
15#include "halTypes.hpp"
16
17namespace libtorrent { struct peer_info; }
18
19namespace hal
20{
21
22struct peer_detail
23{
24        enum details
25        {
26                ip_address_e = 0,
27                country_e,
28                speed_down_e,
29                speed_up_e,
30                seed_e,
31                client_e,
32                status_e
33        };
34
35        peer_detail(const std::wstring& ip_address) :
36                ip_address(ip_address)
37        {}
38        peer_detail(libtorrent::peer_info& peer_info);
39       
40        bool operator==(const peer_detail& peer) const
41        {
42                return (ip_address == peer.ip_address);
43        }
44       
45        bool operator<(const peer_detail& peer) const
46        {
47                return (ip_address < peer.ip_address);
48        }
49       
50        bool less(const peer_detail& r, size_t index = 0) const;
51        std::wstring to_wstring(size_t index = 0);
52       
53        std::wstring ip_address;
54        std::wstring country;
55        std::pair<float,float> speed;
56        bool seed;
57        std::wstring client;
58        std::wstring status;
59};
60
61typedef boost::shared_ptr<peer_detail> peer_detail_ptr;
62typedef std::vector<peer_detail> peer_details_vec;
63
64void peer_details_sort(peer_details_vec& p, size_t index, bool cmp_less = true);
65
66};
Note: See TracBrowser for help on using the repository browser.