• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>bad_expression</title>
5<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../index.html" title="Boost.Regex 5.1.4">
8<link rel="up" href="../ref.html" title="Reference">
9<link rel="prev" href="regex_token_iterator.html" title="regex_token_iterator">
10<link rel="next" href="syntax_option_type.html" title="syntax_option_type">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="regex_token_iterator.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="boost_regex.ref.bad_expression"></a><a class="link" href="bad_expression.html" title="bad_expression">bad_expression</a>
28</h3></div></div></div>
29<h5>
30<a name="boost_regex.ref.bad_expression.h0"></a>
31        <span class="phrase"><a name="boost_regex.ref.bad_expression.synopsis"></a></span><a class="link" href="bad_expression.html#boost_regex.ref.bad_expression.synopsis">Synopsis</a>
32      </h5>
33<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">pattern_except</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
34</pre>
35<p>
36        The class <code class="computeroutput"><span class="identifier">regex_error</span></code> defines
37        the type of objects thrown as exceptions to report errors during the conversion
38        from a string representing a regular expression to a finite state machine.
39      </p>
40<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span>
41
42<span class="keyword">class</span> <span class="identifier">regex_error</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span>
43<span class="special">{</span>
44<span class="keyword">public</span><span class="special">:</span>
45   <span class="keyword">explicit</span> <span class="identifier">regex_error</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">error_type</span> <span class="identifier">err</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ptrdiff_t</span> <span class="identifier">pos</span><span class="special">);</span>
46   <span class="keyword">explicit</span> <span class="identifier">regex_error</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">error_type</span> <span class="identifier">err</span><span class="special">);</span>
47   <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">error_type</span> <span class="identifier">code</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
48   <span class="identifier">std</span><span class="special">::</span><span class="identifier">ptrdiff_t</span> <span class="identifier">position</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
49<span class="special">};</span>
50
51<span class="keyword">typedef</span> <span class="identifier">regex_error</span> <span class="identifier">bad_pattern</span><span class="special">;</span> <span class="comment">// for backwards compatibility</span>
52<span class="keyword">typedef</span> <span class="identifier">regex_error</span> <span class="identifier">bad_expression</span><span class="special">;</span> <span class="comment">// for backwards compatibility</span>
53
54<span class="special">}</span> <span class="comment">// namespace boost</span>
55</pre>
56<h5>
57<a name="boost_regex.ref.bad_expression.h1"></a>
58        <span class="phrase"><a name="boost_regex.ref.bad_expression.description"></a></span><a class="link" href="bad_expression.html#boost_regex.ref.bad_expression.description">Description</a>
59      </h5>
60<pre class="programlisting"><span class="identifier">regex_error</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">&amp;</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">error_type</span> <span class="identifier">err</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ptrdiff_t</span> <span class="identifier">pos</span><span class="special">);</span>
61<span class="identifier">regex_error</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">error_type</span> <span class="identifier">err</span><span class="special">);</span>
62</pre>
63<p>
64        <span class="bold"><strong>Effects:</strong></span> Constructs an object of class regex_error.
65      </p>
66<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">error_type</span> <span class="identifier">code</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
67</pre>
68<p>
69        <span class="bold"><strong>Effects:</strong></span> returns the error code that represents
70        parsing error that occurred.
71      </p>
72<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">ptrdiff_t</span> <span class="identifier">position</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
73</pre>
74<p>
75        <span class="bold"><strong>Effects:</strong></span> returns the location in the expression
76        where parsing stopped.
77      </p>
78<p>
79        Footnotes: the choice of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">runtime_error</span></code>
80        as the base class for <code class="computeroutput"><span class="identifier">regex_error</span></code>
81        is moot; depending upon how the library is used exceptions may be either
82        logic errors (programmer supplied expressions) or run time errors (user supplied
83        expressions). The library previously used <code class="computeroutput"><span class="identifier">bad_pattern</span></code>
84        and <code class="computeroutput"><span class="identifier">bad_expression</span></code> for errors,
85        these have been replaced by the single class <code class="computeroutput"><span class="identifier">regex_error</span></code>
86        to keep the library in synchronization with the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf" target="_top">Technical
87        Report on C++ Library Extensions</a>.
88      </p>
89</div>
90<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
91<td align="left"></td>
92<td align="right"><div class="copyright-footer">Copyright © 1998-2013 John Maddock<p>
93        Distributed under the Boost Software License, Version 1.0. (See accompanying
94        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
95      </p>
96</div></td>
97</tr></table>
98<hr>
99<div class="spirit-nav">
100<a accesskey="p" href="regex_token_iterator.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="syntax_option_type.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
101</div>
102</body>
103</html>
104