From: g0dil Date: Mon, 31 Mar 2008 12:12:00 +0000 (+0000) Subject: Socket/Protocols/INet: Fix INet6Address in6_addr constructor X-Git-Url: http://g0dil.de/git?p=senf.git;a=commitdiff_plain;h=f85e1ac1d9bddeafd54b2171b8c7dd611842f7d3 Socket/Protocols/INet: Fix INet6Address in6_addr constructor Console: Documentation git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@771 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Console/Node.hh b/Console/Node.hh index cadc057..0bed22b 100644 --- a/Console/Node.hh +++ b/Console/Node.hh @@ -33,6 +33,67 @@ \section console_tree The tree + We will start by giving a more complete example. This example contains most of the stuff needed + for using the console/config library. + + \code + // Define callback function. + void mycommand(std::ostream & os, senf::console::Arguments const & args) + { + // ... + os << "!! Important message ...\n"; + } + + class SomeClass + { + public: + // Declare a directory node (proxy) for use by this class. This must be public so we can add + // it to the node tree later. + senf::console::ObjectDirectory dir; + + SomeClass() : dir(this) + { + // You may document the directory here or later when adding it to the tree + dir.doc("Manager for something"); + + // Add a member function (the pointer-to-member is automatically bound to this instance) + dir.add("member", &SomeClass::member) + .doc("Do the member operation"); + } + + void member(std::ostream & os, senf::console::Arguments const & args) + { + // ... + } + }; + + int main(int, char**) + { + // Provide global documentation + senf::console::root() + .doc("This is someServer server"); + + // Add a new directory to the root and document it. All the mutators return the node object + // itself so operations can be chained. + senf::console::DirectoryNode & mydir ( + .mkdir("myserver") + .doc("My server specific directory")); + + // Add a command to that directory + mydir.add("mycommand", &mycommand) + .doc("mycommand []\n\n" + "If is given, flurgle the , otherwise burgle it"); + + // Create a SomeClass instance and add it's directory. + SomeClass someClass; + mydir.add("someClass", someClass.dir); + + // Start the interactive console server + senf::console::Server::start(senf::INet4SocketAddress(senf::INet4Address::None, 23232u)) + .name("someServer"); + } + \endcode + \subsection console_nodes Node types The console/config library tree consists of two basic node types: @@ -123,69 +184,6 @@ The senf::console::ObjectDirectory member should be declared public. This allows the user of the class to add the node to the tree. - - \section console_long_example Example - - The following is a more complete example. It uses most of the features you will be using from - the console library. - - \code - // Define callback function. - void mycommand(std::ostream & os, senf::console::Arguments const & args) - { - // ... - os << "!! Important message ...\n"; - } - - class SomeClass - { - public: - // Declare a directory node (proxy) for use by this class. This must be public so we can add - // it to the node tree later. - senf::console::ObjectDirectory dir; - - SomeClass() : dir(this) - { - // You may document the directory here or later when adding it to the tree - dir.doc("Manager for something"); - - // Add a member function (the pointer-to-member is automatically bound to this instance) - dir.add("member", &SomeClass::member) - .doc("Do the member operation"); - } - - void member(std::ostream & os, senf::console::Arguments const & args) - { - // ... - } - }; - - int main(int, char**) - { - // Provide global documentation - senf::console::root() - .doc("This is someServer server"); - - // Add a new directory to the root and document it. All the mutators return the node object - // itself so operations can be chained. - senf::console::DirectoryNode & mydir ( - .mkdir("myserver") - .doc("My server specific directory")); - - // Add a command to that directory - mydir.add("mycommand", &mycommand) - .doc("mycommand []\n\n" - "If is given, flurgle the , otherwise burgle it"); - - // Create a SomeClass instance and add it's directory. - SomeClass someClass; - mydir.add("someClass", someClass.dir); - - // Start the interactive console server - senf::console::Server::start(senf::INet4SocketAddress(senf::INet4Address::None, 23232u)) - .name("someServer"); - } - \endcode */ #ifndef HH_Node_ diff --git a/Console/Server.ih b/Console/Server.ih index 57e0f5c..eb6ab72 100644 --- a/Console/Server.ih +++ b/Console/Server.ih @@ -36,6 +36,10 @@ namespace senf { namespace console { namespace detail { + /** \brief Internal: Nonblocking boost::iostreams::sink + + The sink discards data if the output socket would. + */ class NonblockingSocketSink : public boost::iostreams::sink { diff --git a/Socket/Protocols/INet/INet6Address.cci b/Socket/Protocols/INet/INet6Address.cci index 96e87f5..408d0ac 100644 --- a/Socket/Protocols/INet/INet6Address.cci +++ b/Socket/Protocols/INet/INet6Address.cci @@ -58,12 +58,11 @@ prefix_ senf::INet6Address::INet6Address(boost::uint16_t a0, boost::uint16_t a1, (*this)[15] = boost::uint8_t(a7); } -prefix_ senf::INet6Address::INet6Address(in6_addr in6addr){ - senf::INet6Address::from_data(&in6addr.s6_addr[0]); +prefix_ senf::INet6Address senf::INet6Address::from_in6addr(in6_addr const & in6addr) +{ + return senf::INet6Address::from_data(&in6addr.s6_addr[0]); } - - prefix_ senf::INet6Address senf::INet6Address::from_inet4address(INet4Address addr4) { INet6Address addr; diff --git a/Socket/Protocols/INet/INet6Address.hh b/Socket/Protocols/INet/INet6Address.hh index 16d2e44..1beecf9 100644 --- a/Socket/Protocols/INet/INet6Address.hh +++ b/Socket/Protocols/INet/INet6Address.hh @@ -162,12 +162,12 @@ namespace senf { ///@{ explicit INet6Address(senf::NoInit_t); ///< Construct uninitialized (!) address - INet6Address(boost::uint16_t a0=0u, boost::uint16_t a1=0u, boost::uint16_t a2=0u, - boost::uint16_t a3=0u, boost::uint16_t a4=0u, boost::uint16_t a5=0u, - boost::uint16_t a6=0u, boost::uint16_t a7=0u); + explicit INet6Address(boost::uint16_t a0=0u, boost::uint16_t a1=0u, boost::uint16_t a2=0u, + boost::uint16_t a3=0u, boost::uint16_t a4=0u, boost::uint16_t a5=0u, + boost::uint16_t a6=0u, boost::uint16_t a7=0u); ///< Construct an address constant - INet6Address(in6_addr in6addr); ///< Construct from std c struct + static INet6Address from_in6addr(in6_addr const & in6addr); ///< Construct from std C struct static INet6Address from_string(std::string const & s, Resolve_t resolve = ResolveINet6); ///< Convert string to address diff --git a/Utils/Externals.dox b/Utils/Externals.dox index 9d1dc8a..3c1e96c 100644 --- a/Utils/Externals.dox +++ b/Utils/Externals.dox @@ -14,6 +14,7 @@ namespace boost { class true_type {}; } namespace boost { class enable_shared_from_this {}; } namespace boost { namespace spirit { class grammar {}; } } namespace boost { namespace spirit { class grammar_def {}; } } +namespace boost { namespace iostreams { class sink {}; } } namespace std { class exception {}; } namespace std { class string {}; } ///\} diff --git a/doclib/senf.css b/doclib/senf.css index e97f83f..fe51388 100644 --- a/doclib/senf.css +++ b/doclib/senf.css @@ -512,6 +512,14 @@ p.commalist { text-indent: -4em; } +#autotoc { + width: 20em; + background-color: #F5F5F5; + border: 1px solid #CCC; + padding: 0 1em; + margin: 1em 0; +} + #autotoc h1 { font-size: 120%; text-align: left; @@ -520,7 +528,12 @@ p.commalist { #autotoc ul { list-style-type: none; padding: 0; - margin: 1em 0 1em 2em; + margin: 1em 0 1em 1em; +} + +#autotoc li { + padding: 0 0 0 3em; + text-indent: -3em; } #autotoc ul li.level_h2 {