regex/doc/html/boost_regex/ref/internals/uni_iter.html
2019-10-26 10:51:25 +01:00

178 lines
17 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Unicode Iterators</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Boost.Regex 5.1.4">
<link rel="up" href="../internals.html" title="Internal Details">
<link rel="prev" href="../internals.html" title="Internal Details">
<link rel="next" href="../../background.html" title="Background Information">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../internals.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../internals.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="../../background.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="boost_regex.ref.internals.uni_iter"></a><a class="link" href="uni_iter.html" title="Unicode Iterators">Unicode Iterators</a>
</h4></div></div></div>
<h5>
<a name="boost_regex.ref.internals.uni_iter.h0"></a>
<span class="phrase"><a name="boost_regex.ref.internals.uni_iter.synopsis"></a></span><a class="link" href="uni_iter.html#boost_regex.ref.internals.uni_iter.synopsis">Synopsis</a>
</h5>
<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">regex</span><span class="special">/</span><span class="identifier">pending</span><span class="special">/</span><span class="identifier">unicode_iterator</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></pre>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BaseIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U16Type</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint16_t</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">u32_to_u16_iterator</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BaseIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U32Type</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint32_t</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">u16_to_u32_iterator</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BaseIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U8Type</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint8_t</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">u32_to_u8_iterator</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BaseIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U32Type</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint32_t</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">u8_to_u32_iterator</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BaseIterator</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">utf16_output_iterator</span><span class="special">;</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BaseIterator</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">utf8_output_iterator</span><span class="special">;</span>
</pre>
<h5>
<a name="boost_regex.ref.internals.uni_iter.h1"></a>
<span class="phrase"><a name="boost_regex.ref.internals.uni_iter.description"></a></span><a class="link" href="uni_iter.html#boost_regex.ref.internals.uni_iter.description">Description</a>
</h5>
<p>
This header contains a selection of iterator adaptors that make a sequence
of characters in one encoding "look like" a read-only sequence
of characters in another encoding.
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BaseIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U16Type</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint16_t</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">u32_to_u16_iterator</span>
<span class="special">{</span>
<span class="identifier">u32_to_u16_iterator</span><span class="special">();</span>
<span class="identifier">u32_to_u16_iterator</span><span class="special">(</span><span class="identifier">BaseIterator</span> <span class="identifier">start_position</span><span class="special">);</span>
<span class="comment">// Other standard BidirectionalIterator members here...</span>
<span class="special">};</span>
</pre>
<p>
A Bidirectional iterator adapter that makes an underlying sequence of UTF32
characters look like a (read-only) sequence of UTF16 characters. The UTF16
characters are encoded in the platforms native byte order.
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BaseIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U32Type</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint32_t</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">u16_to_u32_iterator</span>
<span class="special">{</span>
<span class="identifier">u16_to_u32_iterator</span><span class="special">();</span>
<span class="identifier">u16_to_u32_iterator</span><span class="special">(</span><span class="identifier">BaseIterator</span> <span class="identifier">start_position</span><span class="special">);</span>
<span class="identifier">u16_to_u32_iterator</span><span class="special">(</span><span class="identifier">BaseIterator</span> <span class="identifier">start_position</span><span class="special">,</span> <span class="identifier">BaseIterator</span> <span class="identifier">start_range</span><span class="special">,</span> <span class="identifier">BaseIterator</span> <span class="identifier">end_range</span><span class="special">);</span>
<span class="comment">// Other standard BidirectionalIterator members here...</span>
<span class="special">};</span>
</pre>
<p>
A Bidirectional iterator adapter that makes an underlying sequence of UTF16
characters (in the platforms native byte order) look like a (read-only)
sequence of UTF32 characters.
</p>
<p>
The three-arg constructor of this class takes the start and end of the
underlying sequence as well as the position to start iteration from. This
constructor validates that the underlying sequence has validly encoded
endpoints: this prevents accidentally incrementing/decrementing past the
end of the underlying sequence as a result of invalid UTF16 code sequences
at the endpoints of the underlying range.
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BaseIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U8Type</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint8_t</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">u32_to_u8_iterator</span>
<span class="special">{</span>
<span class="identifier">u32_to_u8_iterator</span><span class="special">();</span>
<span class="identifier">u32_to_u8_iterator</span><span class="special">(</span><span class="identifier">BaseIterator</span> <span class="identifier">start_position</span><span class="special">);</span>
<span class="comment">// Other standard BidirectionalIterator members here...</span>
<span class="special">};</span>
</pre>
<p>
A Bidirectional iterator adapter that makes an underlying sequence of UTF32
characters look like a (read-only) sequence of UTF8 characters.
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BaseIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">U32Type</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uint32_t</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">u8_to_u32_iterator</span>
<span class="special">{</span>
<span class="identifier">u8_to_u32_iterator</span><span class="special">();</span>
<span class="identifier">u8_to_u32_iterator</span><span class="special">(</span><span class="identifier">BaseIterator</span> <span class="identifier">start_position</span><span class="special">);</span>
<span class="identifier">u8_to_u32_iterator</span><span class="special">(</span><span class="identifier">BaseIterator</span> <span class="identifier">start_position</span><span class="special">,</span> <span class="identifier">BaseIterator</span> <span class="identifier">start_range</span><span class="special">,</span> <span class="identifier">BaseIterator</span> <span class="identifier">end_range</span><span class="special">);</span>
<span class="comment">// Other standard BidirectionalIterator members here...</span>
<span class="special">};</span>
</pre>
<p>
A Bidirectional iterator adapter that makes an underlying sequence of UTF8
characters look like a (read-only) sequence of UTF32 characters.
</p>
<p>
The three-arg constructor of this class takes the start and end of the
underlying sequence as well as the position to start iteration from. This
constructor validates that the underlying sequence has validly encoded
endpoints: this prevents accidentally incrementing/decrementing past the
end of the underlying sequence as a result of invalid UTF8 code sequences
at the endpoints of the underlying range.
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BaseIterator</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">utf16_output_iterator</span>
<span class="special">{</span>
<span class="identifier">utf16_output_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">BaseIterator</span><span class="special">&amp;</span> <span class="identifier">b</span><span class="special">);</span>
<span class="identifier">utf16_output_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">utf16_output_iterator</span><span class="special">&amp;</span> <span class="identifier">that</span><span class="special">);</span>
<span class="identifier">utf16_output_iterator</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">utf16_output_iterator</span><span class="special">&amp;</span> <span class="identifier">that</span><span class="special">);</span>
<span class="comment">// Other standard OutputIterator members here...</span>
<span class="special">};</span>
</pre>
<p>
Simple OutputIterator adapter - accepts UTF32 values as input, and forwards
them to <span class="emphasis"><em>BaseIterator b</em></span> as UTF16. Both UTF32 and UTF16
values are in native byte order.
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BaseIterator</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">utf8_output_iterator</span>
<span class="special">{</span>
<span class="identifier">utf8_output_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">BaseIterator</span><span class="special">&amp;</span> <span class="identifier">b</span><span class="special">);</span>
<span class="identifier">utf8_output_iterator</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">utf8_output_iterator</span><span class="special">&amp;</span> <span class="identifier">that</span><span class="special">);</span>
<span class="identifier">utf8_output_iterator</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">utf8_output_iterator</span><span class="special">&amp;</span> <span class="identifier">that</span><span class="special">);</span>
<span class="comment">// Other standard OutputIterator members here...</span>
<span class="special">};</span>
</pre>
<p>
Simple OutputIterator adapter - accepts UTF32 values as input, and forwards
them to <span class="emphasis"><em>BaseIterator b</em></span> as UTF8. The UTF32 input values
must be in native byte order.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 1998-2013 John Maddock<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../internals.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../internals.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="../../background.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>