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 | #if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) |
9 | #pragma GCC system_header |
10 | #endif |
11 | #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) |
12 | #pragma warning(push,1) |
13 | #endif |
14 | |
15 | #include "boost/exception/info.hpp" |
16 | #include <errno.h> |
17 | #include <string.h> |
18 | |
19 | namespace |
20 | boost |
21 | { |
22 | typedef error_info<struct errinfo_errno_,int> errinfo_errno; |
23 | |
24 | //Usage hint: |
25 | //if( c_function(....)!=0 ) |
26 | // BOOST_THROW_EXCEPTION( |
27 | // failure() << |
28 | // errinfo_errno(errno) << |
29 | // errinfo_api_function("c_function") ); |
30 | inline |
31 | std::string |
32 | to_string( errinfo_errno const & e ) |
33 | { |
34 | std::ostringstream tmp; |
35 | int v=e.value(); |
36 | tmp << v << ", \"" << strerror(errnum: v) << "\"" ; |
37 | return tmp.str(); |
38 | } |
39 | } |
40 | |
41 | #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) |
42 | #pragma warning(pop) |
43 | #endif |
44 | #endif |
45 | |