| 1 | <html> |
|---|
| 2 | <head> |
|---|
| 3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|---|
| 4 | <title>Struct template regex_compiler</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.regex_compiler.hpp" title="Header <boost/xpressive/regex_compiler.hpp>"> |
|---|
| 9 | <link rel="prev" href="regex_replace.html" title="Function regex_replace"> |
|---|
| 10 | <link rel="next" href="regex_constants/syntax_option_type.html" title="Type syntax_option_type"> |
|---|
| 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="regex_replace.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../../xpressive/reference.html#header.boost.xpressive.regex_compiler.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_constants/syntax_option_type.html"><img src="../../images/next.png" alt="Next"></a> |
|---|
| 24 | </div> |
|---|
| 25 | <div class="refentry" lang="en"> |
|---|
| 26 | <a name="boost.xpressive.regex_compiler"></a><div class="titlepage"></div> |
|---|
| 27 | <div class="refnamediv"> |
|---|
| 28 | <h2><span class="refentrytitle">Struct template regex_compiler</span></h2> |
|---|
| 29 | <p>boost::xpressive::regex_compiler — Class template regex_compiler is a factory for building basic_regex objects from a string. </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><<span class="bold"><strong>typename</strong></span> BidiIter, <span class="bold"><strong>typename</strong></span> RegexTraits, <span class="bold"><strong>typename</strong></span> CompilerTraits> |
|---|
| 33 | <span class="bold"><strong>struct</strong></span> regex_compiler { |
|---|
| 34 | <span class="emphasis"><em>// types</em></span> |
|---|
| 35 | <span class="bold"><strong>typedef</strong></span> BidiIter iterator_type; |
|---|
| 36 | <span class="bold"><strong>typedef</strong></span> iterator_value< BidiIter >::type char_type; |
|---|
| 37 | <span class="bold"><strong>typedef</strong></span> std::basic_string< char_type > string_type; |
|---|
| 38 | <span class="bold"><strong>typedef</strong></span> regex_constants::syntax_option_type flag_type; |
|---|
| 39 | <span class="bold"><strong>typedef</strong></span> RegexTraits traits_type; |
|---|
| 40 | <span class="bold"><strong>typedef</strong></span> traits_type::char_class_type char_class_type; |
|---|
| 41 | <span class="bold"><strong>typedef</strong></span> traits_type::locale_type locale_type; |
|---|
| 42 | |
|---|
| 43 | <span class="emphasis"><em>// <a href="regex_compiler.html#boost.xpressive.regex_compilerconstruct-copy-destruct">construct/copy/destruct</a></em></span> |
|---|
| 44 | <a href="regex_compiler.html#id1215036-bb">regex_compiler</a>(RegexTraits <span class="bold"><strong>const</strong></span> & = RegexTraits()); |
|---|
| 45 | |
|---|
| 46 | <span class="emphasis"><em>// <a href="regex_compiler.html#id1218774-bb">public member functions</a></em></span> |
|---|
| 47 | <span class="type">locale_type</span> <a href="regex_compiler.html#id1218777-bb">imbue</a>(locale_type) ; |
|---|
| 48 | <span class="type">locale_type</span> <a href="regex_compiler.html#id622609-bb">getloc</a>() <span class="bold"><strong>const</strong></span>; |
|---|
| 49 | <span class="type"><a href="basic_regex.html" title="Struct template basic_regex">basic_regex</a>< BidiIter ></span> |
|---|
| 50 | <a href="regex_compiler.html#id622623-bb">compile</a>(string_type, flag_type = regex_constants::ECMAScript) ; |
|---|
| 51 | };</pre></div> |
|---|
| 52 | <div class="refsect1" lang="en"> |
|---|
| 53 | <a name="id2024385"></a><h2>Description</h2> |
|---|
| 54 | <p>Class template regex_compiler is used to construct a basic_regex object from a string. The string should contain a valid regular expression. You can imbue a regex_compiler object with a locale, after which all basic_regex objects created with that regex_compiler object will use that locale. After creating a regex_compiler object, and optionally imbueing it with a locale, you can call the compile() method to construct a basic_regex object, passing it the string representing the regular expression. You can call compile() multiple times on the same regex_compiler object. Two basic_regex objects compiled from the same string will have different regex_id's. </p> |
|---|
| 55 | <div class="refsect2" lang="en"> |
|---|
| 56 | <a name="id2024390"></a><h3> |
|---|
| 57 | <a name="boost.xpressive.regex_compilerconstruct-copy-destruct"></a><code class="computeroutput">regex_compiler</code> construct/copy/destruct</h3> |
|---|
| 58 | <div class="orderedlist"><ol type="1"><li><pre class="literallayout"><a name="id1215036-bb"></a>regex_compiler(RegexTraits <span class="bold"><strong>const</strong></span> & traits = RegexTraits());</pre></li></ol></div> |
|---|
| 59 | </div> |
|---|
| 60 | <div class="refsect2" lang="en"> |
|---|
| 61 | <a name="id2024430"></a><h3> |
|---|
| 62 | <a name="id1218774-bb"></a><code class="computeroutput">regex_compiler</code> public member functions</h3> |
|---|
| 63 | <div class="orderedlist"><ol type="1"> |
|---|
| 64 | <li> |
|---|
| 65 | <pre class="literallayout"><span class="type">locale_type</span> <a name="id1218777-bb"></a>imbue(locale_type loc) ;</pre> |
|---|
| 66 | <p>Specify the locale to be used by a regex_compiler.</p> |
|---|
| 67 | <p> |
|---|
| 68 | |
|---|
| 69 | </p> |
|---|
| 70 | <div class="variablelist"><table border="0"> |
|---|
| 71 | <col align="left" valign="top"> |
|---|
| 72 | <tbody> |
|---|
| 73 | <tr> |
|---|
| 74 | <td> |
|---|
| 75 | <span class="term">Parameters:</span></td> |
|---|
| 76 | <td><div class="variablelist"><table border="0"> |
|---|
| 77 | <col align="left" valign="top"> |
|---|
| 78 | <tbody><tr> |
|---|
| 79 | <td> |
|---|
| 80 | <span class="term"><code class="computeroutput">loc</code></span></td> |
|---|
| 81 | <td><p>The locale that this regex_compiler should use. </p></td> |
|---|
| 82 | </tr></tbody> |
|---|
| 83 | </table></div></td> |
|---|
| 84 | </tr> |
|---|
| 85 | <tr> |
|---|
| 86 | <td> |
|---|
| 87 | <span class="term">Returns:</span></td> |
|---|
| 88 | <td><p>The previous locale. </p></td> |
|---|
| 89 | </tr> |
|---|
| 90 | </tbody> |
|---|
| 91 | </table></div> |
|---|
| 92 | </li> |
|---|
| 93 | <li> |
|---|
| 94 | <pre class="literallayout"><span class="type">locale_type</span> <a name="id622609-bb"></a>getloc() <span class="bold"><strong>const</strong></span>;</pre> |
|---|
| 95 | <p>Get the locale used by a regex_compiler.</p> |
|---|
| 96 | <p> |
|---|
| 97 | </p> |
|---|
| 98 | </li> |
|---|
| 99 | <li> |
|---|
| 100 | <pre class="literallayout"><span class="type"><a href="basic_regex.html" title="Struct template basic_regex">basic_regex</a>< BidiIter ></span> |
|---|
| 101 | <a name="id622623-bb"></a>compile(string_type pat, flag_type flags = regex_constants::ECMAScript) ;</pre> |
|---|
| 102 | <p>Builds a basic_regex object from a std::string.</p> |
|---|
| 103 | <p> |
|---|
| 104 | |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | </p> |
|---|
| 108 | <div class="variablelist"><table border="0"> |
|---|
| 109 | <col align="left" valign="top"> |
|---|
| 110 | <tbody> |
|---|
| 111 | <tr> |
|---|
| 112 | <td> |
|---|
| 113 | <span class="term">Parameters:</span></td> |
|---|
| 114 | <td><div class="variablelist"><table border="0"> |
|---|
| 115 | <col align="left" valign="top"> |
|---|
| 116 | <tbody> |
|---|
| 117 | <tr> |
|---|
| 118 | <td> |
|---|
| 119 | <span class="term"><code class="computeroutput">flags</code></span></td> |
|---|
| 120 | <td><p>Optional bitmask that determines how the pat string is interpreted. (See syntax_option_type.) </p></td> |
|---|
| 121 | </tr> |
|---|
| 122 | <tr> |
|---|
| 123 | <td> |
|---|
| 124 | <span class="term"><code class="computeroutput">pat</code></span></td> |
|---|
| 125 | <td><p>A std::string containing the regular expression pattern. </p></td> |
|---|
| 126 | </tr> |
|---|
| 127 | </tbody> |
|---|
| 128 | </table></div></td> |
|---|
| 129 | </tr> |
|---|
| 130 | <tr> |
|---|
| 131 | <td> |
|---|
| 132 | <span class="term">Requires:</span></td> |
|---|
| 133 | <td><p>The std::string pat contains a valid string-based representation of a regular expression. </p></td> |
|---|
| 134 | </tr> |
|---|
| 135 | <tr> |
|---|
| 136 | <td> |
|---|
| 137 | <span class="term">Returns:</span></td> |
|---|
| 138 | <td><p>A basic_regex object corresponding to the regular expression represented by the string. </p></td> |
|---|
| 139 | </tr> |
|---|
| 140 | <tr> |
|---|
| 141 | <td> |
|---|
| 142 | <span class="term">Throws:</span></td> |
|---|
| 143 | <td> |
|---|
| 144 | <a href="regex_error.html" title="Struct regex_error">regex_error</a> when the string has invalid regular expression syntax. </td> |
|---|
| 145 | </tr> |
|---|
| 146 | </tbody> |
|---|
| 147 | </table></div> |
|---|
| 148 | </li> |
|---|
| 149 | </ol></div> |
|---|
| 150 | </div> |
|---|
| 151 | </div> |
|---|
| 152 | </div> |
|---|
| 153 | <table width="100%"><tr> |
|---|
| 154 | <td align="left"></td> |
|---|
| 155 | <td align="right"><small>Copyright © 2003, 2004 Eric Niebler</small></td> |
|---|
| 156 | </tr></table> |
|---|
| 157 | <hr> |
|---|
| 158 | <div class="spirit-nav"> |
|---|
| 159 | <a accesskey="p" href="regex_replace.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../../xpressive/reference.html#header.boost.xpressive.regex_compiler.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_constants/syntax_option_type.html"><img src="../../images/next.png" alt="Next"></a> |
|---|
| 160 | </div> |
|---|
| 161 | </body> |
|---|
| 162 | </html> |
|---|