]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/exception/doc/errinfo_file_name.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / exception / doc / errinfo_file_name.html
CommitLineData
7c673cae
FG
1<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
2'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
3<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
4<head>
5 <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
6 <title>errinfo_file_name</title>
7 <link href='reno.css' type='text/css' rel='stylesheet'/>
8</head>
9<body>
10<div class="body-0">
11<div class="body-1">
12<div class="body-2">
13<div>
14<div id="boost_logo">
15<a href="http://www.boost.org"><img style="border:0" src="../../../boost.png" alt="Boost" width="277" height="86"/></a>
16</div>
17<h1>Boost Exception</h1>
18</div>
19<!-- Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. -->
20<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
21<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
22<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>errinfo_file_name</h3>
23</div>
24<div class="RenoIncludeDIV"><p><span class="RenoEscape">&#35;<!--<wiki>`&#35;</wiki>--></span>include &lt;<span class="RenoLink"><a href="boost_exception_errinfo_file_name_hpp.html">boost/exception/errinfo_file_name.hpp</a></span>&gt;</p>
25<div class="RenoIncludeDIV"><pre>#include &lt;<span class="RenoLink"><a href="boost_exception_error_info_hpp.html">boost/exception/error_info.hpp</a></span>&gt;
26#include &lt;string&gt;
27
28namespace
29boost
30 {
31<span class="RenoIncludeSPAN"> <span class="RenoIncludeSPAN">typedef <span class="RenoLink"><a href="error_info.html">error_info</a></span>&lt;struct errinfo_file_name_,std::string&gt; <span class="RenoLink">errinfo_file_name</span>;</span></span>
32 }</pre>
33</div></div><p>This type is designed to be used as a standard <span class="RenoLink"><a href="error_info.html">error_info</a></span> instance for transporting a relevant file name in exceptions deriving from boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.</p>
34<h3>Example:</h3>
35<div class="RenoIncludeDIV"><pre>#include &lt;<span class="RenoLink"><a href="boost_exception_errinfo_api_function_hpp.html">boost/exception/errinfo_api_function.hpp</a></span>&gt;
36#include &lt;<span class="RenoLink"><a href="boost_exception_errinfo_at_line_hpp.html">boost/exception/errinfo_at_line.hpp</a></span>&gt;
37#include &lt;<span class="RenoLink"><a href="boost_exception_errinfo_errno_hpp.html">boost/exception/errinfo_errno.hpp</a></span>&gt;
38#include &lt;<span class="RenoLink"><a href="boost_exception_errinfo_file_handle_hpp.html">boost/exception/errinfo_file_handle.hpp</a></span>&gt;
39#include &lt;<span class="RenoLink"><a href="boost_exception_errinfo_file_name_hpp.html">boost/exception/errinfo_file_name.hpp</a></span>&gt;
40#include &lt;<span class="RenoLink"><a href="boost_exception_errinfo_file_open_mode_hpp.html">boost/exception/errinfo_file_open_mode.hpp</a></span>&gt;
41#include &lt;<span class="RenoLink"><a href="boost_exception_info_hpp.html">boost/exception/info.hpp</a></span>&gt;
42#include &lt;<span class="RenoLink"><a href="boost_throw_exception_hpp.html">boost/throw_exception.hpp</a></span>&gt;
43#include &lt;boost/shared_ptr.hpp&gt;
44#include &lt;boost/weak_ptr.hpp&gt;
45#include &lt;stdio.h&gt;
46#include &lt;errno.h&gt;
47#include &lt;exception&gt;
48
49struct error : virtual std::exception, virtual boost::<span class="RenoLink"><a href="exception.html">exception</a></span> { };
50struct file_error : virtual error { };
51struct file_open_error: virtual file_error { };
52struct file_read_error: virtual file_error { };
53
54boost::shared_ptr&lt;FILE&gt;
55open_file( char const * file, char const * mode )
56 {
57 if( FILE * f=fopen(file,mode) )
58 return boost::shared_ptr&lt;FILE&gt;(f,fclose);
59 else
60 <span class="RenoLink"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION</a></span>(
61 file_open_error() &lt;&lt;
62 boost::<span class="RenoLink"><a href="errinfo_api_function.html">errinfo_api_function</a></span>("fopen") &lt;&lt;
63 boost::<span class="RenoLink"><a href="errinfo_errno.html">errinfo_errno</a></span>(errno) &lt;&lt;
64 boost::<span class="RenoLink">errinfo_file_name</span>(file) &lt;&lt;
65 boost::<span class="RenoLink"><a href="errinfo_file_open_mode.html">errinfo_file_open_mode</a></span>(mode) );
66 }
67
68size_t
69read_file( boost::shared_ptr&lt;FILE&gt; const &amp; f, void * buf, size_t size )
70 {
71 size_t nr=fread(buf,1,size,f.get());
72 if( ferror(f.get()) )
73 <span class="RenoLink"><a href="BOOST_THROW_EXCEPTION.html">BOOST_THROW_EXCEPTION</a></span>(
74 file_read_error() &lt;&lt;
75 boost::<span class="RenoLink"><a href="errinfo_api_function.html">errinfo_api_function</a></span>("fread") &lt;&lt;
76 boost::<span class="RenoLink"><a href="errinfo_errno.html">errinfo_errno</a></span>(errno) &lt;&lt;
77 boost::<span class="RenoLink"><a href="errinfo_file_handle.html">errinfo_file_handle</a></span>(f) );
78 return nr;
79 }</pre>
80</div></div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div>
81See also: <span class="RenoPageList"><a href="boost_exception_errinfo_file_name_hpp.html">boost/exception/errinfo_file_name.hpp</a>&nbsp;| <a href="frequently_asked_questions.html">Frequently Asked Questions</a></span>
82</div>
83<!-- Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. -->
84<!-- Distributed under the Boost Software License, Version 1.0. (See accompanying -->
85<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
86<div id="footer">
87<p>
88<a class="logo" href="http://jigsaw.w3.org/css-validator/check/referer"><img class="logo_pic" src="valid-css.png" alt="Valid CSS" height="31" width="88"/></a>
89<a class="logo" href="http://validator.w3.org/check?uri=referer"><img class="logo_pic" src="valid-xhtml.png" alt="Valid XHTML 1.0" height="31" width="88"/></a>
90<small>Copyright (c) 2006-2009 by Emil Dotchevski and Reverge Studios, Inc.<br/>
91Distributed under the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License, Version 1.0</a>.</small>
92</p>
93</div>
94</div>
95</div>
96</div>
97</body>
98</html>