1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
|
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Boost Filesystem exception.hpp Header</title>
</head>
<body bgcolor="#FFFFFF">
<h1>
<img border="0" src="../../../boost.png" align="center" width="277" height="86"><a href="../../../boost/filesystem/exception.hpp">boost/filesystem/exception.hpp</a></h1>
<p><a href="#Introduction">Introduction</a><br>
<a href="#Synopsis">Synopsis</a><br>
<a href="#Members">Member functions</a><br>
<a href="#Acknowledgements">Acknowledgements</a></p>
<h2><a name="Introduction">Introduction</a></h2>
<p>The header provides class <i>filesystem_error</i>, publicly derived from <i>
std::runtime_error</i>, which is used by functions in the Filesystem Library to
report operational errors.</p>
<p>The design evolved based on user requests to ease portability and
internationalization. See the Boost <a href="../../../more/error_handling.html">
Error and Exception Handling</a> guidelines.</p>
<h2><a name="Synopsis">Synopsis</a></h2>
<pre>namespace boost
{
namespace filesystem
{
enum <a name="error_code">error_code</a>
{
no_error = 0,
system_error, // system generated error; if possible, is translated
// to one of the more specific errors below.
other_error, // library generated error
security_error, // includes access rights, permissions failures
read_only_error,
io_error,
path_error,
not_found_error,
not_directory_error,
busy_error, // implies trying again might succeed
already_exists_error,
not_empty_error,
is_directory_error,
out_of_space_error,
out_of_memory_error,
out_of_resource_error
};
class filesystem_error : public std::exception
{
public:
<a href="#Constructors">filesystem_error</a>(
const std::string & who,
const std::string & message );
<a href="#Constructors">filesystem_error</a>(
const std::string & who,
const path & path1,
const std::string & message,
error_code ec = other_error );
<a href="#Constructors">filesystem_error</a>(
const std::string & who,
const path & path1,
<i>sys_err</i> sys_err_code );
<a href="#Constructors">filesystem_error</a>(
const std::string & who,
const path & path1,
const path & path2,
<i>sys_err</i> sys_err_code );
~filesystem_error() throw();
virtual const char * what() const throw();
<i>sys_err</i> <a href="#native_error">native_error</a>() const;
error_code <a href="#error">error</a>() const;
const std::string & <a href="#who">who</a>() const;
const path & <a href="#path1">path1</a>() const;
const path & <a href="#path2">path2</a>() const;
};
} // namespace filesystem
} // namespace boost
</pre>
<p>For POSIX and Windows, <i><code>sys_err</code></i> is <code>int</code>. For
other operating systems, it is implementation defined.</p>
<h2><a name="Members">Member functions</a></h2>
<h3><a name="Constructors">Constructors</a></h3>
<pre> filesystem_error(
const std::string & who,
const std::string & message );
filesystem_error(
const std::string & who,
const path & path1,
const std::string & message,
error_code ec = other_error );
filesystem_error(
const std::string & who,
const path & path1,
<i>sys_err</i> sys_err_code );
filesystem_error(
const std::string & who,
const path & path1,
const path & path2,
<i>sys_err</i> sys_err_code );
</pre>
<blockquote>
<p><b>Precondition:</b> The <code>who</code> argument is in the form, as
appropriate:</p>
<ul>
<li>boost::filesystem::class-name::function-name for errors from public
member functions.</li>
<li>boost::filesystem::class-name for errors not identified with a
particular member function.</li>
<li>boost::filesystem::function-name for errors from non-member functions.</li>
</ul>
<p>These forms are explicitly specified to ensure portability of user programs
between library implementations. </p>
<p><b>Effects:</b> Constructs a <i>filesystem_error</i> object, initialized
from the appropriate arguments.</p>
</blockquote>
<h3><a name="what">what</a></h3>
<blockquote>
<p><code>virtual const char * what() const throw();</code></p>
<p><b>Returns:</b> A string identifying the error, including who(), path1(),
path2(), and related messages. If an error occurs in the preparation of the
string, particularly in low-memory situations, an implementation is permitted to
return a simpler static string.</p>
</blockquote>
<h3><a name="native_error">native_error</a></h3>
<blockquote>
<p><i><code>sys_err</code></i><code> native_error() const;</code></p>
<p><b>Returns:</b> The <code>sys_err_code</code> argument to the constructor,
if any. Otherwise, 0.</p>
</blockquote>
<h3><a name="error">error</a></h3>
<blockquote>
<pre>error_code error() const;</pre>
<p><b>Returns:</b> <code>native_error()</code> translated to <code>
<a href="#error_code">error_code</a></code>. The translation is
implementation-defined. For the POSIX and Windows implementations, see
<a href="../src/exception.cpp">libs/filesystem/src/exception.cpp</a>.</p>
</blockquote>
<h3><a name="who">who</a></h3>
<blockquote>
<pre>const std::string & who() const;</pre>
<p><b>Returns:</b> The <code>who</code> argument to the constructor. An
implementation is permitted to return an empty string if an exception, for
example, std::bad_alloc, occurs during processing.</p>
</blockquote>
<h3><a name="path1">path1</a></h3>
<blockquote>
<pre>const path & path1() const;</pre>
<p><b>Returns:</b> The <code>path1</code> argument to the constructor, if any,
otherwise <code>path()</code>. An implementation is permitted to return an empty
path if an exception, for example, std::bad_alloc, occurs during
processing.</p>
</blockquote>
<h3><a name="path2">path2</a></h3>
<blockquote>
<pre>const path & path2() const;</pre>
<p><b>Returns:</b> The <code>path2</code> argument to the constructor, if any,
otherwise <code>path()</code>. An implementation is permitted to return an empty
path if an exception, for example, std::bad_alloc, occurs during
processing.</p>
</blockquote>
<h2><a name="Acknowledgements">Acknowledgements</a></h2>
<p>Peter Dimov patiently identified requirements for portability and
internationalization of error messages. </p>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->28 February, 2005<!--webbot bot="Timestamp" endspan i-checksum="40416" --></p>
<p> Copyright Beman Dawes, 2002</p>
<p> Use, modification, and distribution are subject to the Boost Software
License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
www.boost.org/LICENSE_1_0.txt</a>)</p>
</body>
</html>
|