summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-06-02 16:40:22 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-06-17 07:34:57 (GMT)
commitf171bc207c2a7371ac6924ff467049dd0258aa00 (patch)
treeeda5b5feb94dea264ea26b839b6f9ef5e32c915f /Swiften/Network/HostNameOrAddress.cpp
parent5a1bdf2f6a4842176be5938f8db5cb9d151aceb5 (diff)
downloadswift-f171bc207c2a7371ac6924ff467049dd0258aa00.zip
swift-f171bc207c2a7371ac6924ff467049dd0258aa00.tar.bz2
Allow different connection methods for Client.
Diffstat (limited to 'Swiften/Network/HostNameOrAddress.cpp')
-rw-r--r--Swiften/Network/HostNameOrAddress.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/Swiften/Network/HostNameOrAddress.cpp b/Swiften/Network/HostNameOrAddress.cpp
new file mode 100644
index 0000000..bc2737d
--- /dev/null
+++ b/Swiften/Network/HostNameOrAddress.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2012 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Network/HostNameOrAddress.h>
+
+using namespace Swift;
+
+namespace {
+ struct ToStringVisitor : public boost::static_visitor<std::string> {
+ std::string operator()(const HostAddress& address) const {
+ return address.toString();
+ }
+
+ std::string operator()(const std::string & str) const {
+ return str;
+ }
+ };
+}
+
+namespace Swift {
+
+std::string toString(const HostNameOrAddress& address) {
+ return boost::apply_visitor(ToStringVisitor(), address);
+}
+
+}