Utils: Revamp documentation overview and add some missing docs
[senf.git] / Socket / Protocols / UN / UNAddress.hh
1 // Copyright (C) 2007 
2 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
3 // Kompetenzzentrum NETwork research (NET)
4 //     David Wagner <david.wagner@fokus.fraunhofer.de>
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the
18 // Free Software Foundation, Inc.,
19 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
21 /** \file
22     \brief UNAddress public header */
23
24 #ifndef HH_UNAddress_
25 #define HH_UNAddress_ 1
26
27 // Custom includes
28 #include <string>
29 #include <boost/operators.hpp>
30 #include <boost/filesystem/path.hpp>
31 #include "../../../Utils/safe_bool.hh"
32
33 //#include "UNAddress.mpp"
34 ///////////////////////////////hh.p////////////////////////////////////////
35 namespace senf {
36     /** \brief Unix domain address
37         
38         UNAddress represents a simple unix domain address which is given by a path to a socket. 
39         It is modelled as a boost::filesystem::path.
40
41         \ingroup addr_group
42       */
43     class UNAddress 
44         : public boost::filesystem::path,
45           public comparable_safe_bool<UNAddress>
46     {   
47     public: 
48         UNAddress(); ///< Construct an empty address
49         explicit UNAddress(boost::filesystem::path);///< Construct an address constant from given path
50         static UNAddress fromString(std::string & s); ///< Convert string to address by interpreting the string as path
51         static UNAddress fromPath(boost::filesystem::path & p);///< Convert path to address 
52         UNAddress clone(); ///< Clone object 
53         std::string pathString() const; ///< Return the path of the address as string
54
55         /** \brief Base-class for UNAddress exceptions */
56         struct AddressException : public std::exception {}; 
57
58     private:
59         boost::filesystem::path path;
60     };
61
62 std::ostream & operator<<(std::ostream & os, UNAddress const & addr);
63 }
64
65 ///////////////////////////////hh.e////////////////////////////////////////
66 //#include "UNAddress.cci"
67 //#include "UNAddress.ct"
68 //#include "UNAddress.cti"
69 #endif
70
71 \f
72 // Local Variables:
73 // mode: c++
74 // fill-column: 100
75 // comment-column: 40
76 // c-file-style: "senf"
77 // indent-tabs-mode: nil
78 // ispell-local-dictionary: "american"
79 // compile-command: "scons -u test"
80 // End: