From 012458a0283a7f2a176b503b1cac6fb1b3b2b9f8 Mon Sep 17 00:00:00 2001 From: g0dil <g0dil@wiback.org> Date: Thu, 14 Jun 2007 12:34:24 +0000 Subject: [PATCH] Get rid of obsolete StateMapOrdering for SocketHandle::dumpState --- Socket/ProtocolServerSocketHandle.test.cc | 2 +- Socket/SocketHandle.cc | 36 ----------------------- Socket/SocketHandle.ih | 15 +--------- Socket/SocketHandle.test.cc | 2 +- Socket/SocketProtocol.hh | 3 +- doclib/SConscript | 1 + 6 files changed, 6 insertions(+), 53 deletions(-) diff --git a/Socket/ProtocolServerSocketHandle.test.cc b/Socket/ProtocolServerSocketHandle.test.cc index 384d98919..e960e025d 100644 --- a/Socket/ProtocolServerSocketHandle.test.cc +++ b/Socket/ProtocolServerSocketHandle.test.cc @@ -66,9 +66,9 @@ BOOST_AUTO_UNIT_TEST(protocolServerSocketHandle) BOOST_CHECK_EQUAL( client.fd(), -1 ); BOOST_CHECK_EQUAL( h.dumpState(), - "handle: senf::ProtocolServerSocketHandle<(anonymous namespace)::MyProtocol>\n" "file.handle: -1\n" "file.refcount: 2\n" + "handle: senf::ProtocolServerSocketHandle<(anonymous namespace)::MyProtocol>\n" "socket.policy: senf::SocketPolicy<senf::test::SomeAddressingPolicy, senf::test::SomeFramingPolicy, senf::test::SomeCommunicationPolicy, senf::test::SomeReadPolicy, senf::test::SomeWritePolicy, senf::test::SomeBufferingPolicy>\n" "socket.protocol: (anonymous namespace)::MyProtocol\n" "socket.server: true\n" ); diff --git a/Socket/SocketHandle.cc b/Socket/SocketHandle.cc index 8b39e32f3..74803af0e 100644 --- a/Socket/SocketHandle.cc +++ b/Socket/SocketHandle.cc @@ -87,42 +87,6 @@ namespace { } } -prefix_ bool senf::detail::StateMapOrdering::operator()(std::string const & a1, - std::string const & a2) - const -{ - std::string::const_iterator i1 (a1.begin()); - std::string::const_iterator const i1_end (a1.end()); - std::string::const_iterator i2 (a2.begin()); - std::string::const_iterator const i2_end (a2.end()); - for(; i1 != i1_end && i2 != i2_end && *i1 == *i2; ++i1, ++i2) ; - if (i1 == i1_end) { - if (i2 == i2_end) - // the strings are equal - return false; - if (contains(i2,i2_end,'.')) - // the longer string is a sub-'directory' of the shorter - /** \fixme shouldn't this be *i2 == '.' ? */ - return true; - return *i1 < *i2; - } - else if (i2 == i2_end) { // && i1 != i1_end - if (contains(i1,i1_end,'.')) - // the longer string is a sub-'directory' of the shorter - /** \fixme shouldn't this be *i1 == '.' ? */ - return false; - return *i1 < *i2; - } - if (contains(i1,i1_end,'.')) { - if (contains(i2,i2_end,'.')) - return *i1 < *i2; - return false; - } - else if (contains(i2,i2_end,'.')) - return true; - return *i1 < *i2; -} - prefix_ std::string senf::detail::dumpState(SocketStateMap const & map) { std::stringstream s; diff --git a/Socket/SocketHandle.ih b/Socket/SocketHandle.ih index 1ca7cdd14..cfa7bc80a 100644 --- a/Socket/SocketHandle.ih +++ b/Socket/SocketHandle.ih @@ -80,22 +80,9 @@ namespace senf { non-empty). */ }; - /** \brief Special ordering for the SocketStateMap - \internal - - This special ordering will sort 'hierarchical' strings correctly. A hierarchical string - in this context is a string like a path- or hostname with '.' as the hierarchical - separator. - */ - struct StateMapOrdering - : public std::binary_function<std::string,std::string,bool> - { - bool operator()(std::string const & a1, std::string const & a2) const; - }; - } - typedef std::map< std::string, detail::ConvertibleString, detail::StateMapOrdering > SocketStateMap; + typedef std::map< std::string, detail::ConvertibleString > SocketStateMap; namespace detail { /** \brief Helper to convert SocketStateMap to multiline string representation diff --git a/Socket/SocketHandle.test.cc b/Socket/SocketHandle.test.cc index 39510d98b..4ab96ddde 100644 --- a/Socket/SocketHandle.test.cc +++ b/Socket/SocketHandle.test.cc @@ -88,9 +88,9 @@ BOOST_AUTO_UNIT_TEST(socketHandle) std::bad_cast ); BOOST_CHECK_EQUAL( myh.dumpState(), - "handle: senf::SocketHandle<senf::SocketPolicy<senf::test::SomeAddressingPolicy, senf::test::SomeFramingPolicy, senf::test::SomeCommunicationPolicy, senf::test::SomeReadPolicy, senf::test::SomeWritePolicy, senf::test::SomeBufferingPolicy> >\n" "file.handle: -1\n" "file.refcount: 3\n" + "handle: senf::SocketHandle<senf::SocketPolicy<senf::test::SomeAddressingPolicy, senf::test::SomeFramingPolicy, senf::test::SomeCommunicationPolicy, senf::test::SomeReadPolicy, senf::test::SomeWritePolicy, senf::test::SomeBufferingPolicy> >\n" "socket.policy: senf::SocketPolicy<senf::test::SomeAddressingPolicy, senf::test::SomeFramingPolicy, senf::test::SomeCommunicationPolicy, senf::test::SomeReadPolicy, senf::test::SomeWritePolicy, senf::test::SomeBufferingPolicy>\n" "socket.protocol: senf::test::SomeProtocol\n" "socket.server: false\n" ); diff --git a/Socket/SocketProtocol.hh b/Socket/SocketProtocol.hh index 25316deca..6ce9c6119 100644 --- a/Socket/SocketProtocol.hh +++ b/Socket/SocketProtocol.hh @@ -90,7 +90,8 @@ // Custom includes #include <boost/utility.hpp> -/** \fixme this is not nice. The includes and predefs should be restructured */ +// Hrmpf ... I have tried very hard, but I just can't find a nice, generic way to clean +// up this include #include "SocketHandle.ih" //#include "SocketProtocol.mpp" diff --git a/doclib/SConscript b/doclib/SConscript index bb8c9986a..61b7eba64 100644 --- a/doclib/SConscript +++ b/doclib/SConscript @@ -69,6 +69,7 @@ div.tabs ul li.$projectname a { background-color: #EDE497; } <li><a class="ext" href="http://svn.berlios.de/wsvn/senf/?op=log&rev=0&sc=0&isdir=1">SVN ChangeLog</a></li> <li><a class="ext" href="http://developer.berlios.de/projects/senf">SENF @ BerliOS</a></li> <li><a class="ext" href="http://openfacts.berlios.de/index-en.phtml?title=SENF+Network+Framework">Wiki</a></li> + <li><a href="@TOPDIR@/doc/html/index.html">Home</a></li> </ul> <h2>${TITLE}</h2> </div> -- GitLab