]> git.lyx.org Git - features.git/blob - boost/boost/exception/errinfo_errno.hpp
boost: add eol property
[features.git] / boost / boost / exception / errinfo_errno.hpp
1 //Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
2
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #ifndef UUID_F0EE17BE6C1211DE87FF459155D89593
7 #define UUID_F0EE17BE6C1211DE87FF459155D89593
8
9 #include "boost/exception/info.hpp"
10 #include <errno.h>
11 #include <string.h>
12
13 namespace
14 boost
15     {
16     typedef error_info<struct errinfo_errno_,int> errinfo_errno;
17
18     //Usage hint:
19     //if( c_function(....)!=0 )
20     //    BOOST_THROW_EXCEPTION(
21     //        failure() <<
22     //        errinfo_errno(errno) <<
23     //        errinfo_api_function("c_function") );
24     inline
25     std::string
26     to_string( errinfo_errno const & e )
27         {
28         std::ostringstream tmp;
29         int v=e.value();
30         tmp << v << ", \"" << strerror(v) << "\"";
31         return tmp.str();
32         }
33     }
34
35 #endif