summaryrefslogtreecommitdiff
path: root/doc/html/Unicode_8inl-source.htm
diff options
context:
space:
mode:
Diffstat (limited to 'doc/html/Unicode_8inl-source.htm')
-rwxr-xr-xdoc/html/Unicode_8inl-source.htm468
1 files changed, 0 insertions, 468 deletions
diff --git a/doc/html/Unicode_8inl-source.htm b/doc/html/Unicode_8inl-source.htm
deleted file mode 100755
index f78482c..0000000
--- a/doc/html/Unicode_8inl-source.htm
+++ /dev/null
@@ -1,468 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
- <head>
- <title>SFML - Simple and Fast Multimedia Library</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
- <link href="doxygen.css" rel="stylesheet" type="text/css" />
- <link href="tabs.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="logo">
- <img src="./logo.jpg" width="770" height="200" title="SFML home" alt="SFML logo" />
- </div>
-<!-- Generated by Doxygen 1.5.8 -->
-<div class="navigation" id="top">
- <div class="tabs">
- <ul>
- <li><a href="index.htm"><span>Main&nbsp;Page</span></a></li>
- <li><a href="namespaces.htm"><span>Namespaces</span></a></li>
- <li><a href="annotated.htm"><span>Classes</span></a></li>
- <li class="current"><a href="files.htm"><span>Files</span></a></li>
- </ul>
- </div>
- <div class="tabs">
- <ul>
- <li><a href="files.htm"><span>File&nbsp;List</span></a></li>
- </ul>
- </div>
-<h1>Unicode.inl</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
-<a name="l00002"></a>00002 <span class="comment">//</span>
-<a name="l00003"></a>00003 <span class="comment">// SFML - Simple and Fast Multimedia Library</span>
-<a name="l00004"></a>00004 <span class="comment">// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)</span>
-<a name="l00005"></a>00005 <span class="comment">//</span>
-<a name="l00006"></a>00006 <span class="comment">// This software is provided 'as-is', without any express or implied warranty.</span>
-<a name="l00007"></a>00007 <span class="comment">// In no event will the authors be held liable for any damages arising from the use of this software.</span>
-<a name="l00008"></a>00008 <span class="comment">//</span>
-<a name="l00009"></a>00009 <span class="comment">// Permission is granted to anyone to use this software for any purpose,</span>
-<a name="l00010"></a>00010 <span class="comment">// including commercial applications, and to alter it and redistribute it freely,</span>
-<a name="l00011"></a>00011 <span class="comment">// subject to the following restrictions:</span>
-<a name="l00012"></a>00012 <span class="comment">//</span>
-<a name="l00013"></a>00013 <span class="comment">// 1. The origin of this software must not be misrepresented;</span>
-<a name="l00014"></a>00014 <span class="comment">// you must not claim that you wrote the original software.</span>
-<a name="l00015"></a>00015 <span class="comment">// If you use this software in a product, an acknowledgment</span>
-<a name="l00016"></a>00016 <span class="comment">// in the product documentation would be appreciated but is not required.</span>
-<a name="l00017"></a>00017 <span class="comment">//</span>
-<a name="l00018"></a>00018 <span class="comment">// 2. Altered source versions must be plainly marked as such,</span>
-<a name="l00019"></a>00019 <span class="comment">// and must not be misrepresented as being the original software.</span>
-<a name="l00020"></a>00020 <span class="comment">//</span>
-<a name="l00021"></a>00021 <span class="comment">// 3. This notice may not be removed or altered from any source distribution.</span>
-<a name="l00022"></a>00022 <span class="comment">//</span>
-<a name="l00024"></a>00024 <span class="comment"></span>
-<a name="l00025"></a>00025
-<a name="l00030"></a>00030 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> In, <span class="keyword">typename</span> Out&gt;
-<a name="l00031"></a><a class="code" href="classsf_1_1Unicode.htm#37628016674129d709a01a7e82cc19d4">00031</a> <span class="keyword">inline</span> Out Unicode::UTF32ToANSI(In Begin, In End, Out Output, <span class="keywordtype">char</span> Replacement, <span class="keyword">const</span> std::locale&amp; Locale)
-<a name="l00032"></a>00032 {
-<a name="l00033"></a>00033 <span class="preprocessor"> #ifdef __MINGW32__</span>
-<a name="l00034"></a>00034 <span class="preprocessor"></span>
-<a name="l00035"></a>00035 <span class="comment">// MinGW has a almost no support for unicode stuff</span>
-<a name="l00036"></a>00036 <span class="comment">// As a consequence, the MinGW version of this function can only use the default locale</span>
-<a name="l00037"></a>00037 <span class="comment">// and ignores the one passed as parameter</span>
-<a name="l00038"></a>00038 <span class="keywordflow">while</span> (Begin &lt; End)
-<a name="l00039"></a>00039 {
-<a name="l00040"></a>00040 <span class="keywordtype">char</span> Char = 0;
-<a name="l00041"></a>00041 <span class="keywordflow">if</span> (wctomb(&amp;Char, static_cast&lt;wchar_t&gt;(*Begin++)) &gt;= 0)
-<a name="l00042"></a>00042 *Output++ = Char;
-<a name="l00043"></a>00043 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (Replacement)
-<a name="l00044"></a>00044 *Output++ = Replacement;
-<a name="l00045"></a>00045 }
-<a name="l00046"></a>00046
-<a name="l00047"></a>00047 <span class="preprocessor"> #else</span>
-<a name="l00048"></a>00048 <span class="preprocessor"></span>
-<a name="l00049"></a>00049 <span class="comment">// Get the facet of the locale which deals with character conversion</span>
-<a name="l00050"></a>00050 <span class="keyword">const</span> std::ctype&lt;wchar_t&gt;&amp; Facet = std::use_facet&lt; std::ctype&lt;wchar_t&gt; &gt;(Locale);
-<a name="l00051"></a>00051
-<a name="l00052"></a>00052 <span class="comment">// Use the facet to convert each character of the input string</span>
-<a name="l00053"></a>00053 <span class="keywordflow">while</span> (Begin &lt; End)
-<a name="l00054"></a>00054 *Output++ = Facet.narrow(static_cast&lt;wchar_t&gt;(*Begin++), Replacement);
-<a name="l00055"></a>00055
-<a name="l00056"></a>00056 <span class="preprocessor"> #endif</span>
-<a name="l00057"></a>00057 <span class="preprocessor"></span>
-<a name="l00058"></a>00058 <span class="keywordflow">return</span> Output;
-<a name="l00059"></a>00059 }
-<a name="l00060"></a>00060
-<a name="l00061"></a>00061
-<a name="l00066"></a>00066 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> In, <span class="keyword">typename</span> Out&gt;
-<a name="l00067"></a><a class="code" href="classsf_1_1Unicode.htm#5390e635f81fe5961899080c91b1c40a">00067</a> <span class="keyword">inline</span> Out <a class="code" href="classsf_1_1Unicode.htm#164436a4e19c18cc518e9d8d921481f1" title="Generic function to convert an ANSI characters range to an UTF-32 characters range...">Unicode::ANSIToUTF32</a>(In Begin, In End, Out Output, <span class="keyword">const</span> std::locale&amp; Locale)
-<a name="l00068"></a>00068 {
-<a name="l00069"></a>00069 <span class="preprocessor"> #ifdef __MINGW32__</span>
-<a name="l00070"></a>00070 <span class="preprocessor"></span>
-<a name="l00071"></a>00071 <span class="comment">// MinGW has a almost no support for unicode stuff</span>
-<a name="l00072"></a>00072 <span class="comment">// As a consequence, the MinGW version of this function can only use the default locale</span>
-<a name="l00073"></a>00073 <span class="comment">// and ignores the one passed as parameter</span>
-<a name="l00074"></a>00074 <span class="keywordflow">while</span> (Begin &lt; End)
-<a name="l00075"></a>00075 {
-<a name="l00076"></a>00076 <span class="keywordtype">wchar_t</span> Char = 0;
-<a name="l00077"></a>00077 mbtowc(&amp;Char, &amp;*Begin, 1);
-<a name="l00078"></a>00078 Begin++;
-<a name="l00079"></a>00079 *Output++ = <span class="keyword">static_cast&lt;</span>Uint32<span class="keyword">&gt;</span>(Char);
-<a name="l00080"></a>00080 }
-<a name="l00081"></a>00081
-<a name="l00082"></a>00082 <span class="preprocessor"> #else</span>
-<a name="l00083"></a>00083 <span class="preprocessor"></span>
-<a name="l00084"></a>00084 <span class="comment">// Get the facet of the locale which deals with character conversion</span>
-<a name="l00085"></a>00085 <span class="keyword">const</span> std::ctype&lt;wchar_t&gt;&amp; Facet = std::use_facet&lt; std::ctype&lt;wchar_t&gt; &gt;(Locale);
-<a name="l00086"></a>00086
-<a name="l00087"></a>00087 <span class="comment">// Use the facet to convert each character of the input string</span>
-<a name="l00088"></a>00088 <span class="keywordflow">while</span> (Begin &lt; End)
-<a name="l00089"></a>00089 *Output++ = <span class="keyword">static_cast&lt;</span>Uint32<span class="keyword">&gt;</span>(Facet.widen(*Begin++));
-<a name="l00090"></a>00090
-<a name="l00091"></a>00091 <span class="preprocessor"> #endif</span>
-<a name="l00092"></a>00092 <span class="preprocessor"></span>
-<a name="l00093"></a>00093 <span class="keywordflow">return</span> Output;
-<a name="l00094"></a>00094 }
-<a name="l00095"></a>00095
-<a name="l00096"></a>00096
-<a name="l00101"></a>00101 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> In, <span class="keyword">typename</span> Out&gt;
-<a name="l00102"></a><a class="code" href="classsf_1_1Unicode.htm#86ba5a2f4d2a85b287d1f0ff94f1eb5e">00102</a> <span class="keyword">inline</span> Out <a class="code" href="classsf_1_1Unicode.htm#576b17100b065f65f3594c50a070b378" title="Generic function to convert an UTF-8 characters range to an UTF-16 characters range...">Unicode::UTF8ToUTF16</a>(In Begin, In End, Out Output, Uint16 Replacement)
-<a name="l00103"></a>00103 {
-<a name="l00104"></a>00104 <span class="keywordflow">while</span> (Begin &lt; End)
-<a name="l00105"></a>00105 {
-<a name="l00106"></a>00106 Uint32 c = 0;
-<a name="l00107"></a>00107 <span class="keywordtype">int</span> TrailingBytes = UTF8TrailingBytes[<span class="keyword">static_cast&lt;</span><span class="keywordtype">int</span><span class="keyword">&gt;</span>(*Begin)];
-<a name="l00108"></a>00108 <span class="keywordflow">if</span> (Begin + TrailingBytes &lt; End)
-<a name="l00109"></a>00109 {
-<a name="l00110"></a>00110 <span class="comment">// First decode the UTF-8 character</span>
-<a name="l00111"></a>00111 <span class="keywordflow">switch</span> (TrailingBytes)
-<a name="l00112"></a>00112 {
-<a name="l00113"></a>00113 <span class="keywordflow">case</span> 5 : c += *Begin++; c &lt;&lt;= 6;
-<a name="l00114"></a>00114 <span class="keywordflow">case</span> 4 : c += *Begin++; c &lt;&lt;= 6;
-<a name="l00115"></a>00115 <span class="keywordflow">case</span> 3 : c += *Begin++; c &lt;&lt;= 6;
-<a name="l00116"></a>00116 <span class="keywordflow">case</span> 2 : c += *Begin++; c &lt;&lt;= 6;
-<a name="l00117"></a>00117 <span class="keywordflow">case</span> 1 : c += *Begin++; c &lt;&lt;= 6;
-<a name="l00118"></a>00118 <span class="keywordflow">case</span> 0 : c += *Begin++;
-<a name="l00119"></a>00119 }
-<a name="l00120"></a>00120 c -= UTF8Offsets[TrailingBytes];
-<a name="l00121"></a>00121
-<a name="l00122"></a>00122 <span class="comment">// Then encode it in UTF-16</span>
-<a name="l00123"></a>00123 <span class="keywordflow">if</span> (c &lt; 0xFFFF)
-<a name="l00124"></a>00124 {
-<a name="l00125"></a>00125 <span class="comment">// Character can be converted directly to 16 bits, just need to check it's in the valid range</span>
-<a name="l00126"></a>00126 <span class="keywordflow">if</span> ((c &gt;= 0xD800) &amp;&amp; (c &lt;= 0xDFFF))
-<a name="l00127"></a>00127 {
-<a name="l00128"></a>00128 <span class="comment">// Invalid character (this range is reserved)</span>
-<a name="l00129"></a>00129 <span class="keywordflow">if</span> (Replacement)
-<a name="l00130"></a>00130 *Output++ = Replacement;
-<a name="l00131"></a>00131 }
-<a name="l00132"></a>00132 <span class="keywordflow">else</span>
-<a name="l00133"></a>00133 {
-<a name="l00134"></a>00134 <span class="comment">// Valid character directly convertible to 16 bits</span>
-<a name="l00135"></a>00135 *Output++ = <span class="keyword">static_cast&lt;</span>Uint16<span class="keyword">&gt;</span>(c);
-<a name="l00136"></a>00136 }
-<a name="l00137"></a>00137 }
-<a name="l00138"></a>00138 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c &gt; 0x0010FFFF)
-<a name="l00139"></a>00139 {
-<a name="l00140"></a>00140 <span class="comment">// Invalid character (greater than the maximum unicode value)</span>
-<a name="l00141"></a>00141 <span class="keywordflow">if</span> (Replacement)
-<a name="l00142"></a>00142 *Output++ = Replacement;
-<a name="l00143"></a>00143 }
-<a name="l00144"></a>00144 <span class="keywordflow">else</span>
-<a name="l00145"></a>00145 {
-<a name="l00146"></a>00146 <span class="comment">// Character will be converted to 2 UTF-16 elements</span>
-<a name="l00147"></a>00147 c -= 0x0010000;
-<a name="l00148"></a>00148 *Output++ = <span class="keyword">static_cast&lt;</span>Uint16<span class="keyword">&gt;</span>((c &gt;&gt; 10) + 0xD800);
-<a name="l00149"></a>00149 *Output++ = <span class="keyword">static_cast&lt;</span>Uint16<span class="keyword">&gt;</span>((c &amp; 0x3FFUL) + 0xDC00);
-<a name="l00150"></a>00150 }
-<a name="l00151"></a>00151 }
-<a name="l00152"></a>00152 }
-<a name="l00153"></a>00153
-<a name="l00154"></a>00154 <span class="keywordflow">return</span> Output;
-<a name="l00155"></a>00155 }
-<a name="l00156"></a>00156
-<a name="l00157"></a>00157
-<a name="l00162"></a>00162 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> In, <span class="keyword">typename</span> Out&gt;
-<a name="l00163"></a><a class="code" href="classsf_1_1Unicode.htm#6dc3254ad3495eeca06443cbee0298be">00163</a> <span class="keyword">inline</span> Out <a class="code" href="classsf_1_1Unicode.htm#c4a67f01b57053b697c573b0ab6a9545" title="Generic function to convert an UTF-8 characters range to an UTF-32 characters range...">Unicode::UTF8ToUTF32</a>(In Begin, In End, Out Output, Uint32 Replacement)
-<a name="l00164"></a>00164 {
-<a name="l00165"></a>00165 <span class="keywordflow">while</span> (Begin &lt; End)
-<a name="l00166"></a>00166 {
-<a name="l00167"></a>00167 Uint32 c = 0;
-<a name="l00168"></a>00168 <span class="keywordtype">int</span> TrailingBytes = UTF8TrailingBytes[<span class="keyword">static_cast&lt;</span><span class="keywordtype">int</span><span class="keyword">&gt;</span>(*Begin)];
-<a name="l00169"></a>00169 <span class="keywordflow">if</span> (Begin + TrailingBytes &lt; End)
-<a name="l00170"></a>00170 {
-<a name="l00171"></a>00171 <span class="comment">// First decode the UTF-8 character</span>
-<a name="l00172"></a>00172 <span class="keywordflow">switch</span> (TrailingBytes)
-<a name="l00173"></a>00173 {
-<a name="l00174"></a>00174 <span class="keywordflow">case</span> 5 : c += *Begin++; c &lt;&lt;= 6;
-<a name="l00175"></a>00175 <span class="keywordflow">case</span> 4 : c += *Begin++; c &lt;&lt;= 6;
-<a name="l00176"></a>00176 <span class="keywordflow">case</span> 3 : c += *Begin++; c &lt;&lt;= 6;
-<a name="l00177"></a>00177 <span class="keywordflow">case</span> 2 : c += *Begin++; c &lt;&lt;= 6;
-<a name="l00178"></a>00178 <span class="keywordflow">case</span> 1 : c += *Begin++; c &lt;&lt;= 6;
-<a name="l00179"></a>00179 <span class="keywordflow">case</span> 0 : c += *Begin++;
-<a name="l00180"></a>00180 }
-<a name="l00181"></a>00181 c -= UTF8Offsets[TrailingBytes];
-<a name="l00182"></a>00182
-<a name="l00183"></a>00183 <span class="comment">// Then write it if valid</span>
-<a name="l00184"></a>00184 <span class="keywordflow">if</span> ((c &lt; 0xD800) || (c &gt; 0xDFFF))
-<a name="l00185"></a>00185 {
-<a name="l00186"></a>00186 <span class="comment">// Valid UTF-32 character</span>
-<a name="l00187"></a>00187 *Output++ = c;
-<a name="l00188"></a>00188 }
-<a name="l00189"></a>00189 <span class="keywordflow">else</span>
-<a name="l00190"></a>00190 {
-<a name="l00191"></a>00191 <span class="comment">// Invalid UTF-32 character</span>
-<a name="l00192"></a>00192 <span class="keywordflow">if</span> (Replacement)
-<a name="l00193"></a>00193 *Output++ = Replacement;
-<a name="l00194"></a>00194 }
-<a name="l00195"></a>00195 }
-<a name="l00196"></a>00196 }
-<a name="l00197"></a>00197
-<a name="l00198"></a>00198 <span class="keywordflow">return</span> Output;
-<a name="l00199"></a>00199 }
-<a name="l00200"></a>00200
-<a name="l00201"></a>00201
-<a name="l00206"></a>00206 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> In, <span class="keyword">typename</span> Out&gt;
-<a name="l00207"></a><a class="code" href="classsf_1_1Unicode.htm#70dd49ecc62e55bcda250d789371dc56">00207</a> <span class="keyword">inline</span> Out <a class="code" href="classsf_1_1Unicode.htm#ffa58d1796721da957505354d48e2e74" title="Generic function to convert an UTF-16 characters range to an UTF-8 characters range...">Unicode::UTF16ToUTF8</a>(In Begin, In End, Out Output, Uint8 Replacement)
-<a name="l00208"></a>00208 {
-<a name="l00209"></a>00209 <span class="keywordflow">while</span> (Begin &lt; End)
-<a name="l00210"></a>00210 {
-<a name="l00211"></a>00211 Uint32 c = *Begin++;
-<a name="l00212"></a>00212
-<a name="l00213"></a>00213 <span class="comment">// If it's a surrogate pair, first convert to a single UTF-32 character</span>
-<a name="l00214"></a>00214 <span class="keywordflow">if</span> ((c &gt;= 0xD800) &amp;&amp; (c &lt;= 0xDBFF))
-<a name="l00215"></a>00215 {
-<a name="l00216"></a>00216 <span class="keywordflow">if</span> (Begin &lt; End)
-<a name="l00217"></a>00217 {
-<a name="l00218"></a>00218 <span class="comment">// The second element is valid : convert the two elements to a UTF-32 character</span>
-<a name="l00219"></a>00219 Uint32 d = *Begin++;
-<a name="l00220"></a>00220 <span class="keywordflow">if</span> ((d &gt;= 0xDC00) &amp;&amp; (d &lt;= 0xDFFF))
-<a name="l00221"></a>00221 c = <span class="keyword">static_cast&lt;</span>Uint32<span class="keyword">&gt;</span>(((c - 0xD800) &lt;&lt; 10) + (d - 0xDC00) + 0x0010000);
-<a name="l00222"></a>00222 }
-<a name="l00223"></a>00223 <span class="keywordflow">else</span>
-<a name="l00224"></a>00224 {
-<a name="l00225"></a>00225 <span class="comment">// Invalid second element</span>
-<a name="l00226"></a>00226 <span class="keywordflow">if</span> (Replacement)
-<a name="l00227"></a>00227 *Output++ = Replacement;
-<a name="l00228"></a>00228 }
-<a name="l00229"></a>00229 }
-<a name="l00230"></a>00230
-<a name="l00231"></a>00231 <span class="comment">// Then convert to UTF-8</span>
-<a name="l00232"></a>00232 <span class="keywordflow">if</span> (c &gt; 0x0010FFFF)
-<a name="l00233"></a>00233 {
-<a name="l00234"></a>00234 <span class="comment">// Invalid character (greater than the maximum unicode value)</span>
-<a name="l00235"></a>00235 <span class="keywordflow">if</span> (Replacement)
-<a name="l00236"></a>00236 *Output++ = Replacement;
-<a name="l00237"></a>00237 }
-<a name="l00238"></a>00238 <span class="keywordflow">else</span>
-<a name="l00239"></a>00239 {
-<a name="l00240"></a>00240 <span class="comment">// Valid character</span>
-<a name="l00241"></a>00241
-<a name="l00242"></a>00242 <span class="comment">// Get number of bytes to write</span>
-<a name="l00243"></a>00243 <span class="keywordtype">int</span> BytesToWrite = 1;
-<a name="l00244"></a>00244 <span class="keywordflow">if</span> (c &lt; 0x80) BytesToWrite = 1;
-<a name="l00245"></a>00245 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c &lt; 0x800) BytesToWrite = 2;
-<a name="l00246"></a>00246 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c &lt; 0x10000) BytesToWrite = 3;
-<a name="l00247"></a>00247 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c &lt;= 0x0010FFFF) BytesToWrite = 4;
-<a name="l00248"></a>00248
-<a name="l00249"></a>00249 <span class="comment">// Extract bytes to write</span>
-<a name="l00250"></a>00250 Uint8 Bytes[4];
-<a name="l00251"></a>00251 <span class="keywordflow">switch</span> (BytesToWrite)
-<a name="l00252"></a>00252 {
-<a name="l00253"></a>00253 <span class="keywordflow">case</span> 4 : Bytes[3] = <span class="keyword">static_cast&lt;</span>Uint8<span class="keyword">&gt;</span>((c | 0x80) &amp; 0xBF); c &gt;&gt;= 6;
-<a name="l00254"></a>00254 <span class="keywordflow">case</span> 3 : Bytes[2] = <span class="keyword">static_cast&lt;</span>Uint8<span class="keyword">&gt;</span>((c | 0x80) &amp; 0xBF); c &gt;&gt;= 6;
-<a name="l00255"></a>00255 <span class="keywordflow">case</span> 2 : Bytes[1] = <span class="keyword">static_cast&lt;</span>Uint8<span class="keyword">&gt;</span>((c | 0x80) &amp; 0xBF); c &gt;&gt;= 6;
-<a name="l00256"></a>00256 <span class="keywordflow">case</span> 1 : Bytes[0] = <span class="keyword">static_cast&lt;</span>Uint8<span class="keyword">&gt;</span> (c | UTF8FirstBytes[BytesToWrite]);
-<a name="l00257"></a>00257 }
-<a name="l00258"></a>00258
-<a name="l00259"></a>00259 <span class="comment">// Add them to the output</span>
-<a name="l00260"></a>00260 <span class="keyword">const</span> Uint8* CurByte = Bytes;
-<a name="l00261"></a>00261 <span class="keywordflow">switch</span> (BytesToWrite)
-<a name="l00262"></a>00262 {
-<a name="l00263"></a>00263 <span class="keywordflow">case</span> 4 : *Output++ = *CurByte++;
-<a name="l00264"></a>00264 <span class="keywordflow">case</span> 3 : *Output++ = *CurByte++;
-<a name="l00265"></a>00265 <span class="keywordflow">case</span> 2 : *Output++ = *CurByte++;
-<a name="l00266"></a>00266 <span class="keywordflow">case</span> 1 : *Output++ = *CurByte++;
-<a name="l00267"></a>00267 }
-<a name="l00268"></a>00268 }
-<a name="l00269"></a>00269 }
-<a name="l00270"></a>00270
-<a name="l00271"></a>00271 <span class="keywordflow">return</span> Output;
-<a name="l00272"></a>00272 }
-<a name="l00273"></a>00273
-<a name="l00274"></a>00274
-<a name="l00279"></a>00279 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> In, <span class="keyword">typename</span> Out&gt;
-<a name="l00280"></a><a class="code" href="classsf_1_1Unicode.htm#836263c4d41ef7b2d146e6564a9e0fe8">00280</a> <span class="keyword">inline</span> Out <a class="code" href="classsf_1_1Unicode.htm#5e9edaac35984964ef3ad353f98f9f73" title="Generic function to convert an UTF-16 characters range to an UTF-32 characters range...">Unicode::UTF16ToUTF32</a>(In Begin, In End, Out Output, Uint32 Replacement)
-<a name="l00281"></a>00281 {
-<a name="l00282"></a>00282 <span class="keywordflow">while</span> (Begin &lt; End)
-<a name="l00283"></a>00283 {
-<a name="l00284"></a>00284 Uint16 c = *Begin++;
-<a name="l00285"></a>00285 <span class="keywordflow">if</span> ((c &gt;= 0xD800) &amp;&amp; (c &lt;= 0xDBFF))
-<a name="l00286"></a>00286 {
-<a name="l00287"></a>00287 <span class="comment">// We have a surrogate pair, ie. a character composed of two elements</span>
-<a name="l00288"></a>00288 <span class="keywordflow">if</span> (Begin &lt; End)
-<a name="l00289"></a>00289 {
-<a name="l00290"></a>00290 Uint16 d = *Begin++;
-<a name="l00291"></a>00291 <span class="keywordflow">if</span> ((d &gt;= 0xDC00) &amp;&amp; (d &lt;= 0xDFFF))
-<a name="l00292"></a>00292 {
-<a name="l00293"></a>00293 <span class="comment">// The second element is valid : convert the two elements to a UTF-32 character</span>
-<a name="l00294"></a>00294 *Output++ = <span class="keyword">static_cast&lt;</span>Uint32<span class="keyword">&gt;</span>(((c - 0xD800) &lt;&lt; 10) + (d - 0xDC00) + 0x0010000);
-<a name="l00295"></a>00295 }
-<a name="l00296"></a>00296 <span class="keywordflow">else</span>
-<a name="l00297"></a>00297 {
-<a name="l00298"></a>00298 <span class="comment">// Invalid second element</span>
-<a name="l00299"></a>00299 <span class="keywordflow">if</span> (Replacement)
-<a name="l00300"></a>00300 *Output++ = Replacement;
-<a name="l00301"></a>00301 }
-<a name="l00302"></a>00302 }
-<a name="l00303"></a>00303 }
-<a name="l00304"></a>00304 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ((c &gt;= 0xDC00) &amp;&amp; (c &lt;= 0xDFFF))
-<a name="l00305"></a>00305 {
-<a name="l00306"></a>00306 <span class="comment">// Invalid character</span>
-<a name="l00307"></a>00307 <span class="keywordflow">if</span> (Replacement)
-<a name="l00308"></a>00308 *Output++ = Replacement;
-<a name="l00309"></a>00309 }
-<a name="l00310"></a>00310 <span class="keywordflow">else</span>
-<a name="l00311"></a>00311 {
-<a name="l00312"></a>00312 <span class="comment">// Valid character directly convertible to UTF-32</span>
-<a name="l00313"></a>00313 *Output++ = <span class="keyword">static_cast&lt;</span>Uint32<span class="keyword">&gt;</span>(c);
-<a name="l00314"></a>00314 }
-<a name="l00315"></a>00315 }
-<a name="l00316"></a>00316
-<a name="l00317"></a>00317 <span class="keywordflow">return</span> Output;
-<a name="l00318"></a>00318 }
-<a name="l00319"></a>00319
-<a name="l00320"></a>00320
-<a name="l00325"></a>00325 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> In, <span class="keyword">typename</span> Out&gt;
-<a name="l00326"></a><a class="code" href="classsf_1_1Unicode.htm#456a48adebef490996f82f4841e26081">00326</a> <span class="keyword">inline</span> Out <a class="code" href="classsf_1_1Unicode.htm#46bba10d3a323183c29b4cb288d053c1" title="Generic function to convert an UTF-32 characters range to an UTF-8 characters range...">Unicode::UTF32ToUTF8</a>(In Begin, In End, Out Output, Uint8 Replacement)
-<a name="l00327"></a>00327 {
-<a name="l00328"></a>00328 <span class="keywordflow">while</span> (Begin &lt; End)
-<a name="l00329"></a>00329 {
-<a name="l00330"></a>00330 Uint32 c = *Begin++;
-<a name="l00331"></a>00331 <span class="keywordflow">if</span> (c &gt; 0x0010FFFF)
-<a name="l00332"></a>00332 {
-<a name="l00333"></a>00333 <span class="comment">// Invalid character (greater than the maximum unicode value)</span>
-<a name="l00334"></a>00334 <span class="keywordflow">if</span> (Replacement)
-<a name="l00335"></a>00335 *Output++ = Replacement;
-<a name="l00336"></a>00336 }
-<a name="l00337"></a>00337 <span class="keywordflow">else</span>
-<a name="l00338"></a>00338 {
-<a name="l00339"></a>00339 <span class="comment">// Valid character</span>
-<a name="l00340"></a>00340
-<a name="l00341"></a>00341 <span class="comment">// Get number of bytes to write</span>
-<a name="l00342"></a>00342 <span class="keywordtype">int</span> BytesToWrite = 1;
-<a name="l00343"></a>00343 <span class="keywordflow">if</span> (c &lt; 0x80) BytesToWrite = 1;
-<a name="l00344"></a>00344 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c &lt; 0x800) BytesToWrite = 2;
-<a name="l00345"></a>00345 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c &lt; 0x10000) BytesToWrite = 3;
-<a name="l00346"></a>00346 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c &lt;= 0x0010FFFF) BytesToWrite = 4;
-<a name="l00347"></a>00347
-<a name="l00348"></a>00348 <span class="comment">// Extract bytes to write</span>
-<a name="l00349"></a>00349 Uint8 Bytes[4];
-<a name="l00350"></a>00350 <span class="keywordflow">switch</span> (BytesToWrite)
-<a name="l00351"></a>00351 {
-<a name="l00352"></a>00352 <span class="keywordflow">case</span> 4 : Bytes[3] = <span class="keyword">static_cast&lt;</span>Uint8<span class="keyword">&gt;</span>((c | 0x80) &amp; 0xBF); c &gt;&gt;= 6;
-<a name="l00353"></a>00353 <span class="keywordflow">case</span> 3 : Bytes[2] = <span class="keyword">static_cast&lt;</span>Uint8<span class="keyword">&gt;</span>((c | 0x80) &amp; 0xBF); c &gt;&gt;= 6;
-<a name="l00354"></a>00354 <span class="keywordflow">case</span> 2 : Bytes[1] = <span class="keyword">static_cast&lt;</span>Uint8<span class="keyword">&gt;</span>((c | 0x80) &amp; 0xBF); c &gt;&gt;= 6;
-<a name="l00355"></a>00355 <span class="keywordflow">case</span> 1 : Bytes[0] = <span class="keyword">static_cast&lt;</span>Uint8<span class="keyword">&gt;</span> (c | UTF8FirstBytes[BytesToWrite]);
-<a name="l00356"></a>00356 }
-<a name="l00357"></a>00357
-<a name="l00358"></a>00358 <span class="comment">// Add them to the output</span>
-<a name="l00359"></a>00359 <span class="keyword">const</span> Uint8* CurByte = Bytes;
-<a name="l00360"></a>00360 <span class="keywordflow">switch</span> (BytesToWrite)
-<a name="l00361"></a>00361 {
-<a name="l00362"></a>00362 <span class="keywordflow">case</span> 4 : *Output++ = *CurByte++;
-<a name="l00363"></a>00363 <span class="keywordflow">case</span> 3 : *Output++ = *CurByte++;
-<a name="l00364"></a>00364 <span class="keywordflow">case</span> 2 : *Output++ = *CurByte++;
-<a name="l00365"></a>00365 <span class="keywordflow">case</span> 1 : *Output++ = *CurByte++;
-<a name="l00366"></a>00366 }
-<a name="l00367"></a>00367 }
-<a name="l00368"></a>00368 }
-<a name="l00369"></a>00369
-<a name="l00370"></a>00370 <span class="keywordflow">return</span> Output;
-<a name="l00371"></a>00371 }
-<a name="l00372"></a>00372
-<a name="l00373"></a>00373
-<a name="l00378"></a>00378 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> In, <span class="keyword">typename</span> Out&gt;
-<a name="l00379"></a><a class="code" href="classsf_1_1Unicode.htm#c11fc704e8e94baf623553807fe1ddde">00379</a> <span class="keyword">inline</span> Out <a class="code" href="classsf_1_1Unicode.htm#b4b5c6e82a1ab1d9ed775653f082d58b" title="Generic function to convert an UTF-32 characters range to an UTF-16 characters range...">Unicode::UTF32ToUTF16</a>(In Begin, In End, Out Output, Uint16 Replacement)
-<a name="l00380"></a>00380 {
-<a name="l00381"></a>00381 <span class="keywordflow">while</span> (Begin &lt; End)
-<a name="l00382"></a>00382 {
-<a name="l00383"></a>00383 Uint32 c = *Begin++;
-<a name="l00384"></a>00384 <span class="keywordflow">if</span> (c &lt; 0xFFFF)
-<a name="l00385"></a>00385 {
-<a name="l00386"></a>00386 <span class="comment">// Character can be converted directly to 16 bits, just need to check it's in the valid range</span>
-<a name="l00387"></a>00387 <span class="keywordflow">if</span> ((c &gt;= 0xD800) &amp;&amp; (c &lt;= 0xDFFF))
-<a name="l00388"></a>00388 {
-<a name="l00389"></a>00389 <span class="comment">// Invalid character (this range is reserved)</span>
-<a name="l00390"></a>00390 <span class="keywordflow">if</span> (Replacement)
-<a name="l00391"></a>00391 *Output++ = Replacement;
-<a name="l00392"></a>00392 }
-<a name="l00393"></a>00393 <span class="keywordflow">else</span>
-<a name="l00394"></a>00394 {
-<a name="l00395"></a>00395 <span class="comment">// Valid character directly convertible to 16 bits</span>
-<a name="l00396"></a>00396 *Output++ = <span class="keyword">static_cast&lt;</span>Uint16<span class="keyword">&gt;</span>(c);
-<a name="l00397"></a>00397 }
-<a name="l00398"></a>00398 }
-<a name="l00399"></a>00399 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c &gt; 0x0010FFFF)
-<a name="l00400"></a>00400 {
-<a name="l00401"></a>00401 <span class="comment">// Invalid character (greater than the maximum unicode value)</span>
-<a name="l00402"></a>00402 <span class="keywordflow">if</span> (Replacement)
-<a name="l00403"></a>00403 *Output++ = Replacement;
-<a name="l00404"></a>00404 }
-<a name="l00405"></a>00405 <span class="keywordflow">else</span>
-<a name="l00406"></a>00406 {
-<a name="l00407"></a>00407 <span class="comment">// Character will be converted to 2 UTF-16 elements</span>
-<a name="l00408"></a>00408 c -= 0x0010000;
-<a name="l00409"></a>00409 *Output++ = <span class="keyword">static_cast&lt;</span>Uint16<span class="keyword">&gt;</span>((c &gt;&gt; 10) + 0xD800);
-<a name="l00410"></a>00410 *Output++ = <span class="keyword">static_cast&lt;</span>Uint16<span class="keyword">&gt;</span>((c &amp; 0x3FFUL) + 0xDC00);
-<a name="l00411"></a>00411 }
-<a name="l00412"></a>00412 }
-<a name="l00413"></a>00413
-<a name="l00414"></a>00414 <span class="keywordflow">return</span> Output;
-<a name="l00415"></a>00415 }
-<a name="l00416"></a>00416
-<a name="l00417"></a>00417
-<a name="l00421"></a>00421 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> In&gt;
-<a name="l00422"></a><a class="code" href="classsf_1_1Unicode.htm#e527bd860c1755db62bd30153abf06cd">00422</a> <span class="keyword">inline</span> std::size_t <a class="code" href="classsf_1_1Unicode.htm#3fc67af453a678d16c4913197ddbe5c3" title="Get the number of characters composing an UTF-8 string.">Unicode::GetUTF8Length</a>(In Begin, In End)
-<a name="l00423"></a>00423 {
-<a name="l00424"></a>00424 std::size_t Length = 0;
-<a name="l00425"></a>00425 <span class="keywordflow">while</span> (Begin &lt; End)
-<a name="l00426"></a>00426 {
-<a name="l00427"></a>00427 <span class="keywordtype">int</span> NbBytes = UTF8TrailingBytes[<span class="keyword">static_cast&lt;</span><span class="keywordtype">int</span><span class="keyword">&gt;</span>(*Begin)];
-<a name="l00428"></a>00428 <span class="keywordflow">if</span> (Begin + NbBytes &lt; End)
-<a name="l00429"></a>00429 ++Length;
-<a name="l00430"></a>00430
-<a name="l00431"></a>00431 Begin += NbBytes + 1;
-<a name="l00432"></a>00432 }
-<a name="l00433"></a>00433
-<a name="l00434"></a>00434 <span class="keywordflow">return</span> Length;
-<a name="l00435"></a>00435 }
-<a name="l00436"></a>00436
-<a name="l00437"></a>00437
-<a name="l00441"></a>00441 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> In&gt;
-<a name="l00442"></a><a class="code" href="classsf_1_1Unicode.htm#27699a022a186db9eb6a8d3c973ec995">00442</a> <span class="keyword">inline</span> std::size_t <a class="code" href="classsf_1_1Unicode.htm#42fea8bee18a53d10bf858273e4714a5" title="Get the number of characters composing an UTF-16 string.">Unicode::GetUTF16Length</a>(In Begin, In End)
-<a name="l00443"></a>00443 {
-<a name="l00444"></a>00444 std::size_t Length = 0;
-<a name="l00445"></a>00445 <span class="keywordflow">while</span> (Begin &lt; End)
-<a name="l00446"></a>00446 {
-<a name="l00447"></a>00447 <span class="keywordflow">if</span> ((*Begin &gt;= 0xD800) &amp;&amp; (*Begin &lt;= 0xDBFF))
-<a name="l00448"></a>00448 {
-<a name="l00449"></a>00449 ++Begin;
-<a name="l00450"></a>00450 <span class="keywordflow">if</span> ((Begin &lt; End) &amp;&amp; ((*Begin &gt;= 0xDC00) &amp;&amp; (*Begin &lt;= 0xDFFF)))
-<a name="l00451"></a>00451 {
-<a name="l00452"></a>00452 ++Length;
-<a name="l00453"></a>00453 }
-<a name="l00454"></a>00454 }
-<a name="l00455"></a>00455 <span class="keywordflow">else</span>
-<a name="l00456"></a>00456 {
-<a name="l00457"></a>00457 ++Length;
-<a name="l00458"></a>00458 }
-<a name="l00459"></a>00459
-<a name="l00460"></a>00460 ++Begin;
-<a name="l00461"></a>00461 }
-<a name="l00462"></a>00462
-<a name="l00463"></a>00463 <span class="keywordflow">return</span> Length;
-<a name="l00464"></a>00464 }
-<a name="l00465"></a>00465
-<a name="l00466"></a>00466
-<a name="l00470"></a>00470 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> In&gt;
-<a name="l00471"></a><a class="code" href="classsf_1_1Unicode.htm#65205382fffa75bbc3137b89be329845">00471</a> <span class="keyword">inline</span> std::size_t <a class="code" href="classsf_1_1Unicode.htm#f5c502326c638af92a8ef7d40b119637" title="Get the number of characters composing an UTF-32 string.">Unicode::GetUTF32Length</a>(In Begin, In End)
-<a name="l00472"></a>00472 {
-<a name="l00473"></a>00473 <span class="keywordflow">return</span> End - Begin;
-<a name="l00474"></a>00474 }
-</pre></div></div>
-
- <p id="footer">
- &nbsp;::&nbsp; Copyright &copy; 2007-2008 Laurent Gomila, all rights reserved &nbsp;::&nbsp;
- Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a> &nbsp;::&nbsp;
- </p>
-
- </body>
-</html>