summaryrefslogtreecommitdiff
path: root/src/serverinfo.cpp
blob: 67a80b9e457ab6d1d4f5f4ae13572a189092413d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "serverinfo.h"

ServerInfo::ServerInfo()
  : ServerInfo({}, false, {}, 0, 0, 0.0)
{
}

ServerInfo::ServerInfo(
  QString name, bool premium, QDate last, int preferred,
  int count, double speed) :
    m_name(std::move(name)), m_premium(premium), m_lastSeen(std::move(last)),
    m_preferred(preferred), m_downloadCount(count), m_downloadSpeed(speed)
{
}

const QString& ServerInfo::name() const
{
  return m_name;
}

bool ServerInfo::isPremium() const
{
  return m_premium;
}

const QDate& ServerInfo::lastSeen() const
{
  return m_lastSeen;
}

int ServerInfo::preferred() const
{
  return m_preferred;
}

int ServerInfo::downloadCount() const
{
  return m_downloadCount;
}

double ServerInfo::downloadSpeed() const
{
  return m_downloadSpeed;
}

void ServerInfo::setPreferred(int i)
{
  m_preferred = i;
}


void ServerList::add(ServerInfo s)
{
  m_servers.push_back(std::move(s));
}

ServerList::iterator ServerList::begin()
{
  return m_servers.begin();
}

ServerList::const_iterator ServerList::begin() const
{
  return m_servers.begin();
}

ServerList::iterator ServerList::end()
{
  return m_servers.end();
}

ServerList::const_iterator ServerList::end() const
{
  return m_servers.end();
}

std::size_t ServerList::size() const
{
  return m_servers.size();
}

bool ServerList::empty() const
{
  return m_servers.empty();
}