From: tho Date: Tue, 19 Feb 2008 10:21:25 +0000 (+0000) Subject: cleanup UNAdressing X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=c7a635681a11cfa870626e3a5af8de150a6dc826;p=senf.git cleanup UNAdressing git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@701 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Socket/Protocols/UN/UNAddressing.cc b/Socket/Protocols/UN/UNAddressing.cc index 2ebb560..1e01e51 100644 --- a/Socket/Protocols/UN/UNAddressing.cc +++ b/Socket/Protocols/UN/UNAddressing.cc @@ -27,8 +27,7 @@ //#include "UNAddressing.ih" // Custom includes -#include -#include + #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// @@ -36,18 +35,13 @@ prefix_ senf::UNSocketAddress::UNSocketAddress() {} -prefix_ senf::UNSocketAddress::UNSocketAddress(std::string p) +prefix_ senf::UNSocketAddress::UNSocketAddress(std::string const & path) { clear(); - ::strncpy(addr_.sun_path, p.c_str(), sizeof(addr_.sun_path)); + ::strncpy(addr_.sun_path, path.c_str(), sizeof(addr_.sun_path)); addr_.sun_path[sizeof(addr_.sun_path)-1] = 0; } -prefix_ senf::UNSocketAddress fromString(std::string s) -{ - return senf::UNSocketAddress::UNSocketAddress(s); -} - prefix_ bool senf::UNSocketAddress::operator==(UNSocketAddress const & other) const { @@ -55,7 +49,7 @@ prefix_ bool senf::UNSocketAddress::operator==(UNSocketAddress const & other) } prefix_ std::string senf::UNSocketAddress::path() - const + const { return std::string(addr_.sun_path); } @@ -77,7 +71,7 @@ prefix_ sockaddr * senf::UNSocketAddress::sockaddr_p() return reinterpret_cast (&addr_); } -prefix_ sockaddr const * senf::UNSocketAddress::sockaddr_p() +prefix_ sockaddr const * senf::UNSocketAddress::sockaddr_p() const { return reinterpret_cast (&addr_); diff --git a/Socket/Protocols/UN/UNAddressing.hh b/Socket/Protocols/UN/UNAddressing.hh index 82109e0..c3d56bb 100644 --- a/Socket/Protocols/UN/UNAddressing.hh +++ b/Socket/Protocols/UN/UNAddressing.hh @@ -31,11 +31,6 @@ #include #include #include -#include -#include -#include "../../../Socket/SocketPolicy.hh" -#include "../../../Socket/ClientSocketHandle.hh" -#include "../../../Socket/CommunicationPolicy.hh" #include "../../../Socket/Protocols/GenericAddressingPolicy.hh" #include "../../../Utils/safe_bool.hh" @@ -52,18 +47,14 @@ namespace senf { \implementation This implementation is based on sockaddr_un. \ingroup addr_group - - \fixme Why both std::string constructor and from_string member ? */ class UNSocketAddress : public comparable_safe_bool { public: UNSocketAddress(); - explicit UNSocketAddress(std::string p); + explicit UNSocketAddress(std::string const & path); ///< Construct an address constant from given path - static UNSocketAddress from_string(std::string const s); - ///< Create UNSocketAddress from string bool operator==(UNSocketAddress const & other) const; ///< Compare UNSocketAddress for equality