From: g0dil Date: Thu, 15 Nov 2007 10:12:54 +0000 (+0000) Subject: Utils: Fix documentation X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=85dd621b12b8c974b132e6af0818f64a029b081d;p=senf.git Utils: Fix documentation git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@520 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Utils/Exception.hh b/Utils/Exception.hh index a991710..b19c2db 100644 --- a/Utils/Exception.hh +++ b/Utils/Exception.hh @@ -35,6 +35,40 @@ //#include "Exception.mpp" ///////////////////////////////hh.p//////////////////////////////////////// +/** \defgroup exception System exceptions + + The senf::SystemException class and it's derived class template senf::ErrnoException are used to + signal generic system failures based on \c errno codes. + + senf::SystemException is a generic \c errno based exception which carries an error number and + origin information. senf::ErrnoException is a derived class specialized for a specific error + code. This simplifies managing error conditions: + + \code + try { + something.open(path); + // ... + } + catch (senf::ErrnoException & e) { + // Create new file + } + catch (senf::SystemException & e) { + // Catch all other system exceptions + std::cerr << "Error accessing '" << path << "': " << e.what() << std::endl; + } + \endcode + + This exception is normally thrown using the senf::throwErrno() helper: + + \code + if ((fd = ::open(path.c_str(), O_RDWR)) < 0) + senf::throwErrno("::open()"); + \endcode + + The senf::throwErrno() helper will throw the correct exception class based on some \c errno + value. + */ + namespace senf { /** \brief Exception handling standard UNIX errors (errno) @@ -47,6 +81,7 @@ namespace senf { be thrown via one of the senf::throwErrno() helpers. \see ErrnoException + \ingroup exception */ class SystemException : public std::exception { @@ -100,6 +135,7 @@ namespace senf { if ((fd = ::open(filename, O_RDWR)) < 0) senf::throwErrno("open()"); \endcode + \ingroup exception */ template class ErrnoException : public SystemException @@ -114,22 +150,22 @@ namespace senf { /** \brief Throw ErrnoException based on current \c errno value - \related ErrnoException + \ingroup exception */ void throwErrno(); /** \brief Throw ErrnoException based on current \c errno value (with location info) - \related ErrnoException + \ingroup exception */ void throwErrno(char const * where); /** \brief Throw ErrnoException based on given \c errno value - \related ErrnoException + \ingroup exception */ void throwErrno(int code); /** \brief Throw ErrnoException based on given \c errno value (with location info) - \related ErrnoException + \ingroup exception */ void throwErrno(char const * where, int code); diff --git a/Utils/Mainpage.dox b/Utils/Mainpage.dox index bb6435e..db219ff 100644 --- a/Utils/Mainpage.dox +++ b/Utils/Mainpage.dox @@ -58,9 +58,7 @@ namespace senf { \section miscstuff Miscellaneous - - - + diff --git a/Utils/auto_unit_test.hh b/Utils/auto_unit_test.hh index f93ae3c..d785b78 100644 --- a/Utils/auto_unit_test.hh +++ b/Utils/auto_unit_test.hh @@ -27,8 +27,8 @@ unit tests. If the available Boost version is 1.34, this file will automatically take care of any necessary workarounds. - So, instead of #include , you should always write - #include "../Utils/auto_unit_test.hh" (with possibliy adjusted path). + So, instead of \#include , you should always write + \#include "../Utils/auto_unit_test.hh" (with possibliy adjusted path). */ #ifndef HH_auto_unit_test_ diff --git a/Utils/mpl.hh b/Utils/mpl.hh index e1b6e80..5428e1d 100644 --- a/Utils/mpl.hh +++ b/Utils/mpl.hh @@ -105,8 +105,8 @@ namespace mpl { never called. This number is than forwarded as template argument to \c select which is specialized for - each case. Therefore, choice has a \c frobble() member whereas - choice has a \c dazzle() member. + each case. Therefore, choice\ has a \c frobble() member whereas + choice\ has a \c dazzle() member. \see \ref SENF_MPL_RV \ingroup senfmpl
\ref SystemExceptionstandard exception for system errors (errno)
\ref processSome simple process management and daemon helpers
\ref exceptionstandard exception for system errors (errno)
\ref hexdumpa simple but usefull function to write binary data in in hexadecimal format.