blob: 98a6d53656c4fe2d16f0e56cbb6cf7b6df18bdfd (
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
|
// Copyright 2005-2017 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#include "murmur_pch.h"
#include "ServerAddress.h"
ServerAddress::ServerAddress()
: port(0) {}
ServerAddress::ServerAddress(HostAddress host_, unsigned short port_)
: host(host_)
, port(port_) {}
bool ServerAddress::isValid() const {
return host.isValid() && port != 0;
}
bool operator==(const ServerAddress &lhs, const ServerAddress &rhs) {
return lhs.host == rhs.host && lhs.port == rhs.port;
}
bool operator!=(const ServerAddress &lhs, const ServerAddress &rhs) {
return !operator==(lhs, rhs);
}
bool operator<(const ServerAddress &lhs, const ServerAddress &rhs) {
if (lhs.host < rhs.host) {
return true;
} else if (lhs.host == rhs.host) {
if (lhs.port < lhs.port) {
return true;
}
}
return false;
}
uint qHash(const ServerAddress &key) {
return qHash(key.host) ^ uint(key.port);
}
|