summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network/HostAddressPort.h')
-rw-r--r--Swiften/Network/HostAddressPort.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/Swiften/Network/HostAddressPort.h b/Swiften/Network/HostAddressPort.h
index e42e1d1..759af01 100644
--- a/Swiften/Network/HostAddressPort.h
+++ b/Swiften/Network/HostAddressPort.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -14,14 +14,14 @@
namespace Swift {
class SWIFTEN_API HostAddressPort {
public:
- HostAddressPort(const HostAddress& address = HostAddress(), int port = -1);
+ HostAddressPort(const HostAddress& address = HostAddress(), unsigned short port = 0);
HostAddressPort(const boost::asio::ip::tcp::endpoint& endpoint);
const HostAddress& getAddress() const {
return address_;
}
- int getPort() const {
+ unsigned short getPort() const {
return port_;
}
@@ -29,6 +29,13 @@ namespace Swift {
return address_ == o.address_ && port_ == o.port_;
}
+ bool operator<(const HostAddressPort& o) const {
+ if (address_ < o.address_) {
+ return true;
+ }
+ return address_ == o.address_ && port_ < o.port_;
+ }
+
bool isValid() const {
return address_.isValid() && port_ > 0;
}
@@ -37,6 +44,6 @@ namespace Swift {
private:
HostAddress address_;
- int port_;
+ unsigned short port_;
};
}