Files
system/doc/system_error.html

127 lines
6.0 KiB
HTML
Raw Normal View History

<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 system/system_error.hpp documentation
</title>
</head>
<body bgcolor="#FFFFFF">
<h1>Header <a href="../../../boost/system/system_error.hpp">boost/system/system_error.hpp</a></h1>
<p><a href="#Introduction">Introduction</a><br>
<a href="#Synopsis">Synopsis</a><br>
<a href="#Class-system_error">Class <code>system_error</code></a><br>
&nbsp;&nbsp;&nbsp; <a href="#Class-system_error-members">Members</a><br>
<a href="#Acknowledgements">Acknowledgements</a></p>
<h2><a name="Introduction">Introduction</a></h2>
<p>This header provides components used to report errors originating from the
operating system or other low-level application program interfaces (API's). It is based on the <i>Diagnostics</i>
portion of the TR2 filesystem proposal.</p>
<h2><a name="Synopsis">Synopsis</a></h2>
<pre>namespace boost
{
namespace system
{
enum message_action { append_message, no_message };
class system_error : public std::runtime_error
{
public:
explicit <a href="#system_error-1">system_error</a>( error_code ec );
<a href="#system_error-2">system_error</a>( error_code ec, const std::string &amp; what_arg,
message_action ma = append_message );
<a href="#system_error-3">system_error</a>( error_code::value_type ev, error_category ecat );
<a href="#system_error-4">system_error</a>( error_code::value_type ev, error_category ecat,
const std::string &amp; what_arg, message_action ma = append_message );
virtual ~system_error() throw() {}
const error_code &amp; <a href="#code">code</a>() const throw();
const char * <a href="#what">what</a>() const throw();
private:
error_code m_error_code; // for exposition only
bool m_append_message; // for exposition only
mutable std::string m_what; // for exposition only
};
} // namespace system
} // namespace boost</pre>
<h2><a name="Class-system_error">Class <code>system_error</code></a></h2>
<p>Class <code><a href="#Class-system_error-members">system_error</a></code> defines
the type of an object that may be thrown as
an exception to report errors originating from the operating system or other
low-level API's, or used as a base class for more refined exception classes. It
encapsulates an <code><a href="error_code.html">error_code</a></code> object.</p>
<blockquote>
<p><i>[Note:</i> A single low-level class, rather than a higher level exception
class hierarchy, is provided to allow users access to low-level error codes
originating from the operating system or other low-level API's, and to
accommodate the open-ended set of errors that may be reported by such API's. <i>
--end note.]</i></p>
</blockquote>
<h2><a name="Class-system_error-members">Class <code>system_error</code> Members</a></h2>
<p><code>explicit <a name="system_error-1">system_error</a>( error_code ec );</code></p>
<blockquote>
<p><i>Effects:</i> Constructs an object of class <code>system_error</code>.</p>
<p><i>Postcondition:</i> <code>code() == ec &amp;&amp; *runtime_error::what() == '\0'
&amp;&amp; </code><code>m_append_message</code>.</p>
</blockquote>
<pre><a name="system_error-2">system_error</a>( error_code ec, const std::string &amp; what_arg, message_action ma = append_message );</pre>
<blockquote>
<p><i>Effects:</i> Constructs an object of class <code>system_error</code>.</p>
<p><i>Postcondition:</i> <code>code() == ec &amp;&amp; std::string(runtime_error::what())
== </code><code>what_arg</code><code> &amp;&amp; m_append_message == ma</code>.</p>
</blockquote>
<pre><a name="system_error-3">system_error</a>( error_code::value_type ev, error_category ecat );</pre>
<blockquote>
<p><i>Effects:</i> Constructs an object of class <code>system_error</code>.</p>
<p><i>Postcondition:</i> <code>code() == error_code(ev,ecat) &amp;&amp; *runtime_error::what()
== '\0' &amp;&amp; m_append_message</code>.</p>
</blockquote>
<pre><a name="system_error-4">system_error</a>( error_code::value_type ev, error_category ecat,
const std::string &amp; what_arg, message_action ma = append_message );</pre>
<blockquote>
<p><i>Effects:</i> Constructs an object of class <code>system_error</code>.</p>
<p><i>Postcondition:</i> <code>code() == error_code(ev,ecat) &amp;&amp; std::string(runtime_error::what())
== </code><code>what_arg</code><code> &amp;&amp; m_append_message == ma</code>.</p>
</blockquote>
<pre>const error_code &amp; <a name="code">code</a>() const throw();</pre>
<blockquote>
<p><i>Returns: </i>&nbsp;<code>m_error_code</code></p>
</blockquote>
<pre>const char * <a name="what">what</a>() const throw();</pre>
<blockquote>
<p><i>Returns: </i>If <code>!m_error_code || !m_append_message</code>, <code>
runtime_error::what()</code>. Otherwise, a string as if computed by:</p>
<blockquote>
<pre>m_what = runtime_error::what();
if ( !m_what.empty() ) m_what += &quot;: &quot;;
m_what += m_error_code.message();
return m_what.c_str();</pre>
</blockquote>
</blockquote>
<h2><a name="Acknowledgements">Acknowledgements</a></h2>
<p>Christopher Kohlhoff and Peter Dimov made important contributions to the
design. Comments and suggestions were also received from Pavel Vozenilek,
Gennaro Prota, Dave Abrahams, Jeff Garland, Iain Hanson, Jeremy Day, Bo
Persson, Oliver Kowalke, and
Oleg Abrosimov.</p>
<hr>
<p>Last revised:
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->22 July, 2006<!--webbot bot="Timestamp" endspan i-checksum="21146" --></p>
<p><EFBFBD> Copyright Beman Dawes, 2006</p>
<p>Distributed under 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>