]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <html> |
2 | <head> | |
3 | <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> | |
4 | <title>regex_format (Deprecated)</title> | |
5 | <link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css"> | |
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> | |
7 | <link rel="home" href="../../../index.html" title="Boost.Regex 5.1.2"> | |
8 | <link rel="up" href="../deprecated_interfaces.html" title="Deprecated Interfaces"> | |
9 | <link rel="prev" href="../deprecated_interfaces.html" title="Deprecated Interfaces"> | |
10 | <link rel="next" href="regex_grep.html" title="regex_grep (Deprecated)"> | |
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="../deprecated_interfaces.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../deprecated_interfaces.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="regex_grep.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> | |
24 | </div> | |
25 | <div class="section"> | |
26 | <div class="titlepage"><div><div><h4 class="title"> | |
27 | <a name="boost_regex.ref.deprecated_interfaces.regex_format"></a><a class="link" href="regex_format.html" title="regex_format (Deprecated)">regex_format | |
28 | (Deprecated)</a> | |
29 | </h4></div></div></div> | |
30 | <p> | |
31 | The algorithm <code class="computeroutput"><span class="identifier">regex_format</span></code> | |
32 | is deprecated; new code should use <a class="link" href="../match_results.html#boost_regex.match_results_format"><code class="computeroutput"><span class="identifier">match_results</span><span class="special"><>::</span><span class="identifier">format</span></code></a> instead. Existing code | |
33 | will continue to compile, the following documentation is taken from the | |
34 | previous version of Boost.Regex and will not be further updated: | |
35 | </p> | |
36 | <h5> | |
37 | <a name="boost_regex.ref.deprecated_interfaces.regex_format.h0"></a> | |
38 | <span class="phrase"><a name="boost_regex.ref.deprecated_interfaces.regex_format.algorithm_regex_format"></a></span><a class="link" href="regex_format.html#boost_regex.ref.deprecated_interfaces.regex_format.algorithm_regex_format">Algorithm | |
39 | regex_format</a> | |
40 | </h5> | |
41 | <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">regex</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> | |
42 | </pre> | |
43 | <p> | |
44 | The algorithm <code class="computeroutput"><span class="identifier">regex_format</span></code> | |
45 | takes the results of a match and creates a new string based upon a format | |
46 | string, <code class="computeroutput"><span class="identifier">regex_format</span></code> can | |
47 | be used for search and replace operations: | |
48 | </p> | |
49 | <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Formatter</span><span class="special">></span> | |
50 | <span class="identifier">OutputIterator</span> <span class="identifier">regex_format</span><span class="special">(</span><span class="identifier">OutputIterator</span> <span class="identifier">out</span><span class="special">,</span> | |
51 | <span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">,</span> | |
52 | <span class="identifier">Formatter</span> <span class="identifier">fmt</span><span class="special">,</span> | |
53 | <span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="number">0</span><span class="special">);</span> | |
54 | </pre> | |
55 | <p> | |
56 | The library also defines the following convenience variation of <code class="computeroutput"><span class="identifier">regex_format</span></code>, which returns the result | |
57 | directly as a string, rather than outputting to an iterator. | |
58 | </p> | |
59 | <div class="note"><table border="0" summary="Note"> | |
60 | <tr> | |
61 | <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td> | |
62 | <th align="left">Note</th> | |
63 | </tr> | |
64 | <tr><td align="left" valign="top"><p> | |
65 | This version may not be available, or may be available in a more limited | |
66 | form, depending upon your compilers capabilities | |
67 | </p></td></tr> | |
68 | </table></div> | |
69 | <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Formatter</span><span class="special">></span> | |
70 | <span class="identifier">std</span><span class="special">::</span><span class="identifier">basic_string</span><span class="special"><</span><span class="identifier">charT</span><span class="special">></span> <span class="identifier">regex_format</span> | |
71 | <span class="special">(</span><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span><span class="special">,</span> | |
72 | <span class="identifier">Formatter</span> <span class="identifier">fmt</span><span class="special">,</span> | |
73 | <span class="identifier">match_flag_type</span> <span class="identifier">flags</span> <span class="special">=</span> <span class="number">0</span><span class="special">);</span> | |
74 | </pre> | |
75 | <p> | |
76 | Parameters to the main version of the function are passed as follows: | |
77 | </p> | |
78 | <div class="informaltable"><table class="table"> | |
79 | <colgroup> | |
80 | <col> | |
81 | <col> | |
82 | </colgroup> | |
83 | <thead><tr> | |
84 | <th> | |
85 | <p> | |
86 | Parameter | |
87 | </p> | |
88 | </th> | |
89 | <th> | |
90 | <p> | |
91 | Description | |
92 | </p> | |
93 | </th> | |
94 | </tr></thead> | |
95 | <tbody> | |
96 | <tr> | |
97 | <td> | |
98 | <p> | |
99 | <code class="computeroutput"><span class="identifier">OutputIterator</span> <span class="identifier">out</span></code> | |
100 | </p> | |
101 | </td> | |
102 | <td> | |
103 | <p> | |
104 | An output iterator type, the output string is sent to this iterator. | |
105 | Typically this would be a std::ostream_iterator. | |
106 | </p> | |
107 | </td> | |
108 | </tr> | |
109 | <tr> | |
110 | <td> | |
111 | <p> | |
112 | <code class="computeroutput"><span class="keyword">const</span> <span class="identifier">match_results</span><span class="special"><</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">Allocator</span><span class="special">>&</span> <span class="identifier">m</span></code> | |
113 | </p> | |
114 | </td> | |
115 | <td> | |
116 | <p> | |
117 | An instance of <a class="link" href="../match_results.html" title="match_results"><code class="computeroutput"><span class="identifier">match_results</span></code></a> obtained | |
118 | from one of the matching algorithms above, and denoting what | |
119 | matched. | |
120 | </p> | |
121 | </td> | |
122 | </tr> | |
123 | <tr> | |
124 | <td> | |
125 | <p> | |
126 | <code class="computeroutput"><span class="identifier">Formatter</span> <span class="identifier">fmt</span></code> | |
127 | </p> | |
128 | </td> | |
129 | <td> | |
130 | <p> | |
131 | Either a format string that determines how the match is transformed | |
132 | into the new string, or a functor that computes the new string | |
133 | from <span class="emphasis"><em>m</em></span> - see <a class="link" href="../match_results.html#boost_regex.match_results_format"><code class="computeroutput"><span class="identifier">match_results</span><span class="special"><>::</span><span class="identifier">format</span></code></a>. | |
134 | </p> | |
135 | </td> | |
136 | </tr> | |
137 | <tr> | |
138 | <td> | |
139 | <p> | |
140 | <code class="computeroutput"><span class="keyword">unsigned</span> <span class="identifier">flags</span></code> | |
141 | </p> | |
142 | </td> | |
143 | <td> | |
144 | <p> | |
145 | Optional flags which describe how the format string is to be | |
146 | interpreted. | |
147 | </p> | |
148 | </td> | |
149 | </tr> | |
150 | </tbody> | |
151 | </table></div> | |
152 | <p> | |
153 | Format flags are described under <a class="link" href="../match_flag_type.html" title="match_flag_type"><code class="computeroutput"><span class="identifier">match_flag_type</span></code></a>. | |
154 | </p> | |
155 | <p> | |
156 | The format string syntax (and available options) is described more fully | |
157 | under <a class="link" href="../../format.html" title="Search and Replace Format String Syntax">format strings</a>. | |
158 | </p> | |
159 | </div> | |
160 | <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> | |
161 | <td align="left"></td> | |
162 | <td align="right"><div class="copyright-footer">Copyright © 1998-2013 John Maddock<p> | |
163 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
164 | 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>) | |
165 | </p> | |
166 | </div></td> | |
167 | </tr></table> | |
168 | <hr> | |
169 | <div class="spirit-nav"> | |
170 | <a accesskey="p" href="../deprecated_interfaces.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../deprecated_interfaces.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="regex_grep.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> | |
171 | </div> | |
172 | </body> | |
173 | </html> |