summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-04-16 09:32:09 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-04-18 19:11:46 (GMT)
commitb9a883751584f7bd5d24786b52c2f78757ef7829 (patch)
treeefacf179beeece3db7219ad6eade997835d0b1db /Swiften/Network
parent427db871922a028bb299dd66c37f3cca4010fd47 (diff)
downloadswift-contrib-b9a883751584f7bd5d24786b52c2f78757ef7829.zip
swift-contrib-b9a883751584f7bd5d24786b52c2f78757ef7829.tar.bz2
Outline some HostAddressPort code.
Diffstat (limited to 'Swiften/Network')
-rw-r--r--Swiften/Network/HostAddressPort.cpp23
-rw-r--r--Swiften/Network/HostAddressPort.h15
-rw-r--r--Swiften/Network/SConscript1
3 files changed, 27 insertions, 12 deletions
diff --git a/Swiften/Network/HostAddressPort.cpp b/Swiften/Network/HostAddressPort.cpp
new file mode 100644
index 0000000..e2e6012
--- /dev/null
+++ b/Swiften/Network/HostAddressPort.cpp
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Network/HostAddressPort.h>
+
+#include <boost/lexical_cast.hpp>
+
+using namespace Swift;
+
+HostAddressPort::HostAddressPort(const HostAddress& address, int port) : address_(address), port_(port) {
+}
+
+HostAddressPort::HostAddressPort(const boost::asio::ip::tcp::endpoint& endpoint) {
+ address_ = HostAddress(endpoint.address());
+ port_ = endpoint.port();
+}
+
+std::string HostAddressPort::toString() const {
+ return getAddress().toString() + ":" + boost::lexical_cast<std::string>(getPort());
+}
diff --git a/Swiften/Network/HostAddressPort.h b/Swiften/Network/HostAddressPort.h
index 5655f4d..23a81b8 100644
--- a/Swiften/Network/HostAddressPort.h
+++ b/Swiften/Network/HostAddressPort.h
@@ -7,21 +7,14 @@
#pragma once
#include <boost/asio/ip/tcp.hpp>
-#include <boost/lexical_cast.hpp>
#include "Swiften/Network/HostAddress.h"
namespace Swift {
class HostAddressPort {
public:
- HostAddressPort(const HostAddress& address = HostAddress(), int port = -1) : address_(address), port_(port) {
- }
-
- HostAddressPort(const boost::asio::ip::tcp::endpoint& endpoint) {
- address_ = HostAddress(endpoint.address());
- port_ = endpoint.port();
- }
-
+ HostAddressPort(const HostAddress& address = HostAddress(), int port = -1);
+ HostAddressPort(const boost::asio::ip::tcp::endpoint& endpoint);
const HostAddress& getAddress() const {
return address_;
@@ -39,9 +32,7 @@ namespace Swift {
return address_.isValid() && port_ > 0;
}
- std::string toString() const {
- return getAddress().toString() + ":" + boost::lexical_cast<std::string>(getPort());
- }
+ std::string toString() const;
private:
HostAddress address_;
diff --git a/Swiften/Network/SConscript b/Swiften/Network/SConscript
index 426118b..61eb69a 100644
--- a/Swiften/Network/SConscript
+++ b/Swiften/Network/SConscript
@@ -31,6 +31,7 @@ sourceList = [
"PlatformDomainNameAddressQuery.cpp",
"StaticDomainNameResolver.cpp",
"HostAddress.cpp",
+ "HostAddressPort.cpp",
"NetworkFactories.cpp",
"BoostNetworkFactories.cpp",
"Timer.cpp",