Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/doc/html/boost/xpressive/match_results.html @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 20.6 KB
Line 
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4<title>Struct template match_results</title>
5<link rel="stylesheet" href="../../boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
7<link rel="start" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
8<link rel="up" href="../../xpressive/reference.html#header.boost.xpressive.match_results.hpp" title="Header &lt;boost/xpressive/match_results.hpp&gt;">
9<link rel="prev" href="cpp_regex_traits.html" title="Struct template cpp_regex_traits">
10<link rel="next" href="regex_id_filter_predicate.html" title="Struct template regex_id_filter_predicate">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%">
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
15<td align="center"><a href="../../../../index.htm">Home</a></td>
16<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="../../../../people/people.htm">People</a></td>
18<td align="center"><a href="../../../../more/faq.htm">FAQ</a></td>
19<td align="center"><a href="../../../../more/index.htm">More</a></td>
20</table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="cpp_regex_traits.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../../xpressive/reference.html#header.boost.xpressive.match_results.hpp"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="regex_id_filter_predicate.html"><img src="../../images/next.png" alt="Next"></a>
24</div>
25<div class="refentry" lang="en">
26<a name="boost.xpressive.match_results"></a><div class="titlepage"></div>
27<div class="refnamediv">
28<h2><span class="refentrytitle">Struct template match_results</span></h2>
29<p>boost::xpressive::match_results &#8212; Class template match_results&lt;&gt; holds the results of a regex_match() or a regex_search() as a collection of sub_match objects. </p>
30</div>
31<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
32<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> BidiIter&gt; 
33<span class="bold"><strong>struct</strong></span> match_results {
34  <span class="emphasis"><em>// types</em></span>
35  <span class="bold"><strong>typedef</strong></span> iterator_value&lt; BidiIter &gt;::type      char_type;          
36  <span class="bold"><strong>typedef</strong></span> std::basic_string&lt; char_type &gt;        string_type;        
37  <span class="bold"><strong>typedef</strong></span> std::size_t                           size_type;          
38  <span class="bold"><strong>typedef</strong></span> <a href="sub_match.html" title="Struct template sub_match">sub_match</a>&lt; BidiIter &gt;                 value_type;         
39  <span class="bold"><strong>typedef</strong></span> iterator_difference&lt; BidiIter &gt;::type difference_type;    
40  <span class="bold"><strong>typedef</strong></span> value_type <span class="bold"><strong>const</strong></span> &amp;                    reference;          
41  <span class="bold"><strong>typedef</strong></span> value_type <span class="bold"><strong>const</strong></span> &amp;                    const_reference;    
42  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>unspecified</em></span>                           iterator;           
43  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>unspecified</em></span>                           const_iterator;     
44  <span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>unspecified</em></span>                           nested_results_type;
45
46  <span class="emphasis"><em>// <a href="match_results.html#boost.xpressive.match_resultsconstruct-copy-destruct">construct/copy/destruct</a></em></span>
47  <a href="match_results.html#id1661134-bb">match_results</a>();
48  <a href="match_results.html#id1636723-bb">match_results</a>(<a href="match_results.html" title="Struct template match_results">match_results</a>&lt; BidiIter &gt; <span class="bold"><strong>const</strong></span> &amp;);
49  match_results&amp; <a href="match_results.html#id1636770-bb"><span class="bold"><strong>operator</strong></span>=</a>(<a href="match_results.html" title="Struct template match_results">match_results</a>&lt; BidiIter &gt; <span class="bold"><strong>const</strong></span> &amp;);
50  <a href="match_results.html#id1636769-bb">~match_results</a>();
51
52  <span class="emphasis"><em>// <a href="match_results.html#id1218576-bb">public member functions</a></em></span>
53  <span class="type">size_type</span> <a href="match_results.html#id1218580-bb">size</a>() <span class="bold"><strong>const</strong></span>;
54  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="match_results.html#id1218592-bb">empty</a>() <span class="bold"><strong>const</strong></span>;
55  <span class="type">difference_type</span> <a href="match_results.html#id1256438-bb">length</a>(size_type = 0) <span class="bold"><strong>const</strong></span>;
56  <span class="type">difference_type</span> <a href="match_results.html#id1318693-bb">position</a>(size_type = 0) <span class="bold"><strong>const</strong></span>;
57  <span class="type">string_type</span> <a href="match_results.html#id1318717-bb">str</a>(size_type = 0) <span class="bold"><strong>const</strong></span>;
58  <span class="type">const_reference</span> <a href="match_results.html#id902146-bb"><span class="bold"><strong>operator</strong></span>[]</a>(size_type) <span class="bold"><strong>const</strong></span>;
59  <span class="type">const_reference</span> <a href="match_results.html#id962843-bb"><span class="bold"><strong>operator</strong></span>[]</a>(<span class="emphasis"><em>unspecified</em></span>) <span class="bold"><strong>const</strong></span>;
60  <span class="type">const_reference</span> <a href="match_results.html#id1005369-bb">prefix</a>() <span class="bold"><strong>const</strong></span>;
61  <span class="type">const_reference</span> <a href="match_results.html#id622959-bb">suffix</a>() <span class="bold"><strong>const</strong></span>;
62  <span class="type">const_iterator</span> <a href="match_results.html#id622973-bb">begin</a>() <span class="bold"><strong>const</strong></span>;
63  <span class="type">const_iterator</span> <a href="match_results.html#id653657-bb">end</a>() <span class="bold"><strong>const</strong></span>;
64  <a href="match_results.html#id1243857-bb"><span class="bold"><strong>operator</strong></span> bool_type</a>() <span class="bold"><strong>const</strong></span>;
65  <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="match_results.html#id1243870-bb"><span class="bold"><strong>operator</strong></span>!</a>() <span class="bold"><strong>const</strong></span>;
66  <span class="type">regex_id_type</span> <a href="match_results.html#id928834-bb">regex_id</a>() <span class="bold"><strong>const</strong></span>;
67  <span class="type">nested_results_type <span class="bold"><strong>const</strong></span> &amp;</span> <a href="match_results.html#id1007710-bb">nested_results</a>() <span class="bold"><strong>const</strong></span>;
68  <span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> <a href="../../OutputIterator.html" title="Concept OutputIterator">OutputIterator</a>&gt; 
69    <span class="type">OutputIterator</span> 
70    <a href="match_results.html#id1007722-bb">format</a>(OutputIterator, <span class="bold"><strong>const</strong></span> string_type &amp;,
71           regex_constants::match_flag_type = regex_constants::format_default) <span class="bold"><strong>const</strong></span>;
72  <span class="type">string_type</span> <a href="match_results.html#id1661066-bb">format</a>(<span class="bold"><strong>const</strong></span> string_type &amp;,
73                     regex_constants::match_flag_type = regex_constants::format_default) <span class="bold"><strong>const</strong></span>;
74  <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="match_results.html#id1661099-bb">swap</a>(<a href="match_results.html" title="Struct template match_results">match_results</a>&lt; BidiIter &gt; &amp;) ;
75};</pre></div>
76<div class="refsect1" lang="en">
77<a name="id2019016"></a><h2>Description</h2>
78<p>Class template match_results&lt;&gt; denotes a collection of sequences representing the result of a regular expression match. Storage for the collection is allocated and freed as necessary by the member functions of class match_results&lt;&gt;.</p>
79<p>The class template match_results&lt;&gt; conforms to the requirements of a Sequence, as specified in (lib.sequence.reqmts), except that only operations defined for const-qualified Sequences are supported. </p>
80<div class="refsect2" lang="en">
81<a name="id2019034"></a><h3>
82<a name="boost.xpressive.match_resultsconstruct-copy-destruct"></a><code class="computeroutput">match_results</code> construct/copy/destruct</h3>
83<div class="orderedlist"><ol type="1">
84<li>
85<pre class="literallayout"><a name="id1661134-bb"></a>match_results();</pre>
86<p>
87</p>
88<div class="variablelist"><table border="0">
89<col align="left" valign="top">
90<tbody><tr>
91<td>
92<span class="term">Postconditions:</span></td>
93<td>
94<p>regex_id() == 0 </p>
95<p>size() == 0 </p>
96<p>empty() == true </p>
97</td>
98</tr></tbody>
99</table></div>
100</li>
101<li>
102<pre class="literallayout"><a name="id1636723-bb"></a>match_results(<a href="match_results.html" title="Struct template match_results">match_results</a>&lt; BidiIter &gt; <span class="bold"><strong>const</strong></span> &amp; that);</pre>
103<p>
104
105</p>
106<div class="variablelist"><table border="0">
107<col align="left" valign="top">
108<tbody>
109<tr>
110<td>
111<span class="term">Parameters:</span></td>
112<td><div class="variablelist"><table border="0">
113<col align="left" valign="top">
114<tbody><tr>
115<td>
116<span class="term"><code class="computeroutput">that</code></span></td>
117<td><p>The match_results object to copy </p></td>
118</tr></tbody>
119</table></div></td>
120</tr>
121<tr>
122<td>
123<span class="term">Postconditions:</span></td>
124<td>
125<p>regex_id() == that.regex_id(). </p>
126<p>size() == that.size(). </p>
127<p>empty() == that.empty(). </p>
128<p>str(n) == that.str(n) for all positive integers n &lt; that.size(). </p>
129<p>prefix() == that.prefix(). </p>
130<p>suffix() == that.suffix(). </p>
131<p>(*this)[n] == that[n] for all positive integers n &lt; that.size(). </p>
132<p>length(n) == that.length(n) for all positive integers n &lt; that.size(). </p>
133<p>position(n) == that.position(n) for all positive integers n &lt; that.size(). </p>
134</td>
135</tr>
136</tbody>
137</table></div>
138</li>
139<li>
140<pre class="literallayout">match_results&amp; <a name="id1636770-bb"></a><span class="bold"><strong>operator</strong></span>=(<a href="match_results.html" title="Struct template match_results">match_results</a>&lt; BidiIter &gt; <span class="bold"><strong>const</strong></span> &amp; that);</pre>
141<p>
142
143</p>
144<div class="variablelist"><table border="0">
145<col align="left" valign="top">
146<tbody>
147<tr>
148<td>
149<span class="term">Parameters:</span></td>
150<td><div class="variablelist"><table border="0">
151<col align="left" valign="top">
152<tbody><tr>
153<td>
154<span class="term"><code class="computeroutput">that</code></span></td>
155<td><p>The match_results object to copy. </p></td>
156</tr></tbody>
157</table></div></td>
158</tr>
159<tr>
160<td>
161<span class="term">Postconditions:</span></td>
162<td>
163<p>regex_id() == that.regex_id(). </p>
164<p>size() == that.size(). </p>
165<p>empty() == that.empty(). </p>
166<p>str(n) == that.str(n) for all positive integers n &lt; that.size(). </p>
167<p>prefix() == that.prefix(). </p>
168<p>suffix() == that.suffix(). </p>
169<p>(*this)[n] == that[n] for all positive integers n &lt; that.size(). </p>
170<p>length(n) == that.length(n) for all positive integers n &lt; that.size(). </p>
171<p>position(n) == that.position(n) for all positive integers n &lt; that.size(). </p>
172</td>
173</tr>
174</tbody>
175</table></div>
176</li>
177<li><pre class="literallayout"><a name="id1636769-bb"></a>~match_results();</pre></li>
178</ol></div>
179</div>
180<div class="refsect2" lang="en">
181<a name="id2019281"></a><h3>
182<a name="id1218576-bb"></a><code class="computeroutput">match_results</code> public member functions</h3>
183<div class="orderedlist"><ol type="1">
184<li>
185<pre class="literallayout"><span class="type">size_type</span> <a name="id1218580-bb"></a>size() <span class="bold"><strong>const</strong></span>;</pre>
186<p>Returns the number of sub_match elements stored in *this. </p>
187</li>
188<li>
189<pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id1218592-bb"></a>empty() <span class="bold"><strong>const</strong></span>;</pre>
190<p>Returns size() == 0. </p>
191</li>
192<li>
193<pre class="literallayout"><span class="type">difference_type</span> <a name="id1256438-bb"></a>length(size_type sub = 0) <span class="bold"><strong>const</strong></span>;</pre>
194<p>Returns (*this)[sub].length(). </p>
195</li>
196<li>
197<pre class="literallayout"><span class="type">difference_type</span> <a name="id1318693-bb"></a>position(size_type sub = 0) <span class="bold"><strong>const</strong></span>;</pre>
198<p>If !(*this)[sub].matched then returns -1. Otherwise returns std::distance(base, (*this)[sub].first), where base is the start iterator of the sequence that was searched. [Note – unless this is part of a repeated search with a regex_iterator then base is the same as prefix().first – end note] </p>
199</li>
200<li>
201<pre class="literallayout"><span class="type">string_type</span> <a name="id1318717-bb"></a>str(size_type sub = 0) <span class="bold"><strong>const</strong></span>;</pre>
202<p>Returns string_type((*this)[sub]). </p>
203</li>
204<li>
205<pre class="literallayout"><span class="type">const_reference</span> <a name="id902146-bb"></a><span class="bold"><strong>operator</strong></span>[](size_type sub) <span class="bold"><strong>const</strong></span>;</pre>
206<p>Returns a reference to the sub_match object representing the sequence that matched marked sub-expression sub. If sub == 0 then returns a reference to a sub_match object representing the sequence that matched the whole regular expression.
207</p>
208<div class="variablelist"><table border="0">
209<col align="left" valign="top">
210<tbody><tr>
211<td>
212<span class="term">Requires:</span></td>
213<td><p>sub &lt; (*this).size(). </p></td>
214</tr></tbody>
215</table></div>
216</li>
217<li>
218<pre class="literallayout"><span class="type">const_reference</span> <a name="id962843-bb"></a><span class="bold"><strong>operator</strong></span>[](<span class="emphasis"><em>unspecified</em></span> mark) <span class="bold"><strong>const</strong></span>;</pre>
219<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. </p>
220</li>
221<li>
222<pre class="literallayout"><span class="type">const_reference</span> <a name="id1005369-bb"></a>prefix() <span class="bold"><strong>const</strong></span>;</pre>
223<p>Returns a reference to the sub_match object representing the character sequence from the start of the string being matched/searched, to the start of the match found. </p>
224</li>
225<li>
226<pre class="literallayout"><span class="type">const_reference</span> <a name="id622959-bb"></a>suffix() <span class="bold"><strong>const</strong></span>;</pre>
227<p>Returns a reference to the sub_match object representing the character sequence from the end of the match found to the end of the string being matched/searched. </p>
228</li>
229<li>
230<pre class="literallayout"><span class="type">const_iterator</span> <a name="id622973-bb"></a>begin() <span class="bold"><strong>const</strong></span>;</pre>
231<p>Returns a starting iterator that enumerates over all the marked sub-expression matches stored in *this. </p>
232</li>
233<li>
234<pre class="literallayout"><span class="type">const_iterator</span> <a name="id653657-bb"></a>end() <span class="bold"><strong>const</strong></span>;</pre>
235<p>Returns a terminating iterator that enumerates over all the marked sub-expression matches stored in *this. </p>
236</li>
237<li>
238<pre class="literallayout"><a name="id1243857-bb"></a><span class="bold"><strong>operator</strong></span> bool_type() <span class="bold"><strong>const</strong></span>;</pre>
239<p>Returns a true value if(*this)[0].matched, else returns a false value. </p>
240</li>
241<li>
242<pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id1243870-bb"></a><span class="bold"><strong>operator</strong></span>!() <span class="bold"><strong>const</strong></span>;</pre>
243<p>Returns true if empty() || !(*this)[0].matched, else returns false. </p>
244</li>
245<li>
246<pre class="literallayout"><span class="type">regex_id_type</span> <a name="id928834-bb"></a>regex_id() <span class="bold"><strong>const</strong></span>;</pre>
247<p>Returns the id of the basic_regex object most recently used with this match_results object. </p>
248</li>
249<li>
250<pre class="literallayout"><span class="type">nested_results_type <span class="bold"><strong>const</strong></span> &amp;</span> <a name="id1007710-bb"></a>nested_results() <span class="bold"><strong>const</strong></span>;</pre>
251<p>Returns a Sequence of nested match_results elements. </p>
252</li>
253<li>
254<pre class="literallayout"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> <a href="../../OutputIterator.html" title="Concept OutputIterator">OutputIterator</a>&gt; 
255  <span class="type">OutputIterator</span> 
256  <a name="id1007722-bb"></a>format(OutputIterator out, <span class="bold"><strong>const</strong></span> string_type &amp; fmt,
257         regex_constants::match_flag_type flags = regex_constants::format_default) <span class="bold"><strong>const</strong></span>;</pre>
258<p>Copies the character sequence [fmt.begin(), fmt.end()) to OutputIterator out. For each format specifier or escape sequence in fmt, replace that sequence with either the character(s) it represents, or the sequence within *this to which it refers. The bitmasks specified in flags determines what format specifiers or escape sequences are recognized, by default this is the format used by ECMA-262, ECMAScript Language Specification, Chapter 15 part 5.4.11 String.prototype.replace. </p>
259</li>
260<li>
261<pre class="literallayout"><span class="type">string_type</span> <a name="id1661066-bb"></a>format(<span class="bold"><strong>const</strong></span> string_type &amp; fmt,
262                   regex_constants::match_flag_type flags = regex_constants::format_default) <span class="bold"><strong>const</strong></span>;</pre>
263<p>Returns a copy of the string fmt. For each format specifier or escape sequence in fmt, replace that sequence with either the character(s) it represents, or the sequence within this to which it refers. The bitmasks specified in flags determines what format specifiers or escape sequences are recognized, by default this is the format used by ECMA-262, ECMAScript Language Specification, Chapter 15 part 5.4.11 String.prototype.replace. </p>
264</li>
265<li>
266<pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id1661099-bb"></a>swap(<a href="match_results.html" title="Struct template match_results">match_results</a>&lt; BidiIter &gt; &amp; that) ;</pre>
267<p>Swaps the contents of two match_results objects. Guaranteed not to throw.
268
269
270</p>
271<div class="variablelist"><table border="0">
272<col align="left" valign="top">
273<tbody>
274<tr>
275<td>
276<span class="term">Parameters:</span></td>
277<td><div class="variablelist"><table border="0">
278<col align="left" valign="top">
279<tbody><tr>
280<td>
281<span class="term"><code class="computeroutput">that</code></span></td>
282<td><p>The match_results object to swap with. </p></td>
283</tr></tbody>
284</table></div></td>
285</tr>
286<tr>
287<td>
288<span class="term">Postconditions:</span></td>
289<td><p>*this contains the sequence of matched sub-expressions that were in that, that contains the sequence of matched sub-expressions that were in *this. </p></td>
290</tr>
291<tr>
292<td>
293<span class="term">Throws:</span></td>
294<td>Will not throw.</td>
295</tr>
296</tbody>
297</table></div>
298</li>
299</ol></div>
300</div>
301</div>
302</div>
303<table width="100%"><tr>
304<td align="left"></td>
305<td align="right"><small>Copyright © 2003, 2004 Eric Niebler</small></td>
306</tr></table>
307<hr>
308<div class="spirit-nav">
309<a accesskey="p" href="cpp_regex_traits.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../../xpressive/reference.html#header.boost.xpressive.match_results.hpp"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="regex_id_filter_predicate.html"><img src="../../images/next.png" alt="Next"></a>
310</div>
311</body>
312</html>
Note: See TracBrowser for help on using the repository browser.