1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xmlns="http://www.w3.org/1999/xhtml"> 3<head> 4<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> 5<meta http-equiv="X-UA-Compatible" content="IE=9"/> 6<meta name="generator" content="Doxygen 1.8.6"/> 7<title>Boost.Locale: boost::locale::util Namespace Reference</title> 8<link href="tabs.css" rel="stylesheet" type="text/css"/> 9<script type="text/javascript" src="jquery.js"></script> 10<script type="text/javascript" src="dynsections.js"></script> 11<link href="navtree.css" rel="stylesheet" type="text/css"/> 12<script type="text/javascript" src="resize.js"></script> 13<script type="text/javascript" src="navtree.js"></script> 14<script type="text/javascript"> 15 $(document).ready(initResizable); 16 $(window).load(resizeHeight); 17</script> 18<link href="doxygen.css" rel="stylesheet" type="text/css" /> 19</head> 20<body> 21<div id="top"><!-- do not remove this div, it is closed by doxygen! --> 22<div id="titlearea"> 23<table cellspacing="0" cellpadding="0"> 24 <tbody> 25 <tr style="height: 56px;"> 26 <td id="projectlogo"><img alt="Logo" src="boost-small.png"/></td> 27 <td style="padding-left: 0.5em;"> 28 <div id="projectname">Boost.Locale 29 </div> 30 </td> 31 </tr> 32 </tbody> 33</table> 34</div> 35<!-- end header part --> 36<!-- Generated by Doxygen 1.8.6 --> 37 <div id="navrow1" class="tabs"> 38 <ul class="tablist"> 39 <li><a href="index.html"><span>Main Page</span></a></li> 40 <li><a href="pages.html"><span>Related Pages</span></a></li> 41 <li><a href="modules.html"><span>Modules</span></a></li> 42 <li class="current"><a href="namespaces.html"><span>Namespaces</span></a></li> 43 <li><a href="annotated.html"><span>Classes</span></a></li> 44 <li><a href="files.html"><span>Files</span></a></li> 45 <li><a href="examples.html"><span>Examples</span></a></li> 46 </ul> 47 </div> 48 <div id="navrow2" class="tabs2"> 49 <ul class="tablist"> 50 <li><a href="namespaces.html"><span>Namespace List</span></a></li> 51 <li><a href="namespacemembers.html"><span>Namespace Members</span></a></li> 52 </ul> 53 </div> 54</div><!-- top --> 55<div id="side-nav" class="ui-resizable side-nav-resizable"> 56 <div id="nav-tree"> 57 <div id="nav-tree-contents"> 58 <div id="nav-sync" class="sync"></div> 59 </div> 60 </div> 61 <div id="splitbar" style="-moz-user-select:none;" 62 class="ui-resizable-handle"> 63 </div> 64</div> 65<script type="text/javascript"> 66$(document).ready(function(){initNavTree('namespaceboost_1_1locale_1_1util.html','');}); 67</script> 68<div id="doc-content"> 69<div class="header"> 70 <div class="summary"> 71<a href="#nested-classes">Classes</a> | 72<a href="#func-members">Functions</a> </div> 73 <div class="headertitle"> 74<div class="title">boost::locale::util Namespace Reference</div> </div> 75</div><!--header--> 76<div class="contents"> 77 78<p>This namespace provides various utility function useful for Boost.Locale backends implementations. 79<a href="#details">More...</a></p> 80<table class="memberdecls"> 81<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> 82Classes</h2></td></tr> 83<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classboost_1_1locale_1_1util_1_1base__converter.html">base_converter</a></td></tr> 84<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">This class represent a simple stateless converter from UCS-4 and to UCS-4 for each single code point. <a href="classboost_1_1locale_1_1util_1_1base__converter.html#details">More...</a><br/></td></tr> 85<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> 86</table><table class="memberdecls"> 87<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> 88Functions</h2></td></tr> 89<tr class="memitem:ad9737569d0e2d6b08885b01aba308365"><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1locale_1_1util.html#ad9737569d0e2d6b08885b01aba308365">get_system_locale</a> (bool use_utf8_on_windows=false)</td></tr> 90<tr class="memdesc:ad9737569d0e2d6b08885b01aba308365"><td class="mdescLeft"> </td><td class="mdescRight">Return default system locale name in POSIX format. <a href="#ad9737569d0e2d6b08885b01aba308365">More...</a><br/></td></tr> 91<tr class="separator:ad9737569d0e2d6b08885b01aba308365"><td class="memSeparator" colspan="2"> </td></tr> 92<tr class="memitem:a8322299021a4af3cdbb8b31e775e77f4"><td class="memItemLeft" align="right" valign="top">std::locale </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1locale_1_1util.html#a8322299021a4af3cdbb8b31e775e77f4">create_info</a> (std::locale const &in, std::string const &name)</td></tr> 93<tr class="memdesc:a8322299021a4af3cdbb8b31e775e77f4"><td class="mdescLeft"> </td><td class="mdescRight">Installs information facet to locale in based on locale name <em>name</em>. <a href="#a8322299021a4af3cdbb8b31e775e77f4">More...</a><br/></td></tr> 94<tr class="separator:a8322299021a4af3cdbb8b31e775e77f4"><td class="memSeparator" colspan="2"> </td></tr> 95<tr class="memitem:aa8e8480ddadc3e972aeb4d468446db64"><td class="memItemLeft" align="right" valign="top">std::auto_ptr< <a class="el" href="classboost_1_1locale_1_1util_1_1base__converter.html">base_converter</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1locale_1_1util.html#aa8e8480ddadc3e972aeb4d468446db64">create_utf8_converter</a> ()</td></tr> 96<tr class="separator:aa8e8480ddadc3e972aeb4d468446db64"><td class="memSeparator" colspan="2"> </td></tr> 97<tr class="memitem:a79624ad8d782ad41d5edf90b6c830631"><td class="memItemLeft" align="right" valign="top">std::auto_ptr< <a class="el" href="classboost_1_1locale_1_1util_1_1base__converter.html">base_converter</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1locale_1_1util.html#a79624ad8d782ad41d5edf90b6c830631">create_simple_converter</a> (std::string const &encoding)</td></tr> 98<tr class="separator:a79624ad8d782ad41d5edf90b6c830631"><td class="memSeparator" colspan="2"> </td></tr> 99<tr class="memitem:a3e6728910dc947c3062c6bfd28b70fc4"><td class="memItemLeft" align="right" valign="top">std::locale </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1locale_1_1util.html#a3e6728910dc947c3062c6bfd28b70fc4">create_codecvt</a> (std::locale const &in, std::auto_ptr< <a class="el" href="classboost_1_1locale_1_1util_1_1base__converter.html">base_converter</a> > cvt, <a class="el" href="namespaceboost_1_1locale.html#a8c993aaf15e683e97d062560ccf914d8">character_facet_type</a> type)</td></tr> 100<tr class="separator:a3e6728910dc947c3062c6bfd28b70fc4"><td class="memSeparator" colspan="2"> </td></tr> 101<tr class="memitem:aedf56793c0804295e06cf97300b991f8"><td class="memItemLeft" align="right" valign="top">std::locale </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1locale_1_1util.html#aedf56793c0804295e06cf97300b991f8">create_utf8_codecvt</a> (std::locale const &in, <a class="el" href="namespaceboost_1_1locale.html#a8c993aaf15e683e97d062560ccf914d8">character_facet_type</a> type)</td></tr> 102<tr class="separator:aedf56793c0804295e06cf97300b991f8"><td class="memSeparator" colspan="2"> </td></tr> 103<tr class="memitem:a674c01466528780b9076a191e84e05fa"><td class="memItemLeft" align="right" valign="top">std::locale </td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1locale_1_1util.html#a674c01466528780b9076a191e84e05fa">create_simple_codecvt</a> (std::locale const &in, std::string const &encoding, <a class="el" href="namespaceboost_1_1locale.html#a8c993aaf15e683e97d062560ccf914d8">character_facet_type</a> type)</td></tr> 104<tr class="separator:a674c01466528780b9076a191e84e05fa"><td class="memSeparator" colspan="2"> </td></tr> 105</table> 106<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> 107<div class="textblock"><p>This namespace provides various utility function useful for Boost.Locale backends implementations. </p> 108</div><h2 class="groupheader">Function Documentation</h2> 109<a class="anchor" id="a3e6728910dc947c3062c6bfd28b70fc4"></a> 110<div class="memitem"> 111<div class="memproto"> 112 <table class="memname"> 113 <tr> 114 <td class="memname">std::locale boost::locale::util::create_codecvt </td> 115 <td>(</td> 116 <td class="paramtype">std::locale const & </td> 117 <td class="paramname"><em>in</em>, </td> 118 </tr> 119 <tr> 120 <td class="paramkey"></td> 121 <td></td> 122 <td class="paramtype">std::auto_ptr< base_converter > </td> 123 <td class="paramname"><em>cvt</em>, </td> 124 </tr> 125 <tr> 126 <td class="paramkey"></td> 127 <td></td> 128 <td class="paramtype">character_facet_type </td> 129 <td class="paramname"><em>type</em> </td> 130 </tr> 131 <tr> 132 <td></td> 133 <td>)</td> 134 <td></td><td></td> 135 </tr> 136 </table> 137</div><div class="memdoc"> 138<p>Install codecvt facet into locale <em>in</em> and return new locale that is based on <em>in</em> and uses new facet.</p> 139<p>codecvt facet would convert between narrow and wide/char16_t/char32_t encodings using <em>cvt</em> converter. If <em>cvt</em> is null pointer, always failure conversion would be used that fails on every first input or output.</p> 140<p>Note: the codecvt facet handles both UTF-16 and UTF-32 wide encodings, it knows to break and join Unicode code-points above 0xFFFF to and from surrogate pairs correctly. <em>cvt</em> should be unaware of wide encoding type </p> 141 142</div> 143</div> 144<a class="anchor" id="a8322299021a4af3cdbb8b31e775e77f4"></a> 145<div class="memitem"> 146<div class="memproto"> 147 <table class="memname"> 148 <tr> 149 <td class="memname">std::locale boost::locale::util::create_info </td> 150 <td>(</td> 151 <td class="paramtype">std::locale const & </td> 152 <td class="paramname"><em>in</em>, </td> 153 </tr> 154 <tr> 155 <td class="paramkey"></td> 156 <td></td> 157 <td class="paramtype">std::string const & </td> 158 <td class="paramname"><em>name</em> </td> 159 </tr> 160 <tr> 161 <td></td> 162 <td>)</td> 163 <td></td><td></td> 164 </tr> 165 </table> 166</div><div class="memdoc"> 167 168<p>Installs information facet to locale in based on locale name <em>name</em>. </p> 169<p>This function installs <a class="el" href="classboost_1_1locale_1_1info.html" title="a facet that holds general information about locale ">boost::locale::info</a> facet into the locale <em>in</em> and returns newly created locale.</p> 170<p>Note: all information is based only on parsing of string <em>name</em>;</p> 171<p>The name has following format: language[_COUNTRY][.encoding][@variant] Where language is ISO-639 language code like "en" or "ru", COUNTRY is ISO-3166 country identifier like "US" or "RU". the Encoding is a charracter set name like UTF-8 or ISO-8859-1. Variant is backend specific variant like <code>euro</code> or calendar=hebrew.</p> 172<p>If some parameters are missing they are specified as blanks, default encoding is assumed to be US-ASCII and missing language is assumed to be "C" </p> 173 174</div> 175</div> 176<a class="anchor" id="a674c01466528780b9076a191e84e05fa"></a> 177<div class="memitem"> 178<div class="memproto"> 179 <table class="memname"> 180 <tr> 181 <td class="memname">std::locale boost::locale::util::create_simple_codecvt </td> 182 <td>(</td> 183 <td class="paramtype">std::locale const & </td> 184 <td class="paramname"><em>in</em>, </td> 185 </tr> 186 <tr> 187 <td class="paramkey"></td> 188 <td></td> 189 <td class="paramtype">std::string const & </td> 190 <td class="paramname"><em>encoding</em>, </td> 191 </tr> 192 <tr> 193 <td class="paramkey"></td> 194 <td></td> 195 <td class="paramtype">character_facet_type </td> 196 <td class="paramname"><em>type</em> </td> 197 </tr> 198 <tr> 199 <td></td> 200 <td>)</td> 201 <td></td><td></td> 202 </tr> 203 </table> 204</div><div class="memdoc"> 205<p>This function installs codecvt that can be used for conversion between single byte character encodings like ISO-8859-1, koi8-r, windows-1255 and Unicode code points,</p> 206<p>Throws <a class="el" href="classboost_1_1locale_1_1conv_1_1invalid__charset__error.html" title="This exception is thrown in case of use of unsupported or invalid character set. ">boost::locale::conv::invalid_charset_error</a> if the chacater set is not supported or isn't single byte character set </p> 207 208</div> 209</div> 210<a class="anchor" id="a79624ad8d782ad41d5edf90b6c830631"></a> 211<div class="memitem"> 212<div class="memproto"> 213 <table class="memname"> 214 <tr> 215 <td class="memname">std::auto_ptr<<a class="el" href="classboost_1_1locale_1_1util_1_1base__converter.html">base_converter</a>> boost::locale::util::create_simple_converter </td> 216 <td>(</td> 217 <td class="paramtype">std::string const & </td> 218 <td class="paramname"><em>encoding</em></td><td>)</td> 219 <td></td> 220 </tr> 221 </table> 222</div><div class="memdoc"> 223<p>This function creates a <em><a class="el" href="classboost_1_1locale_1_1util_1_1base__converter.html" title="This class represent a simple stateless converter from UCS-4 and to UCS-4 for each single code point...">base_converter</a></em> that can be used for conversion between single byte character encodings like ISO-8859-1, koi8-r, windows-1255 and Unicode code points,</p> 224<p>If <em>encoding</em> is not supported, empty pointer is returned. You should check if std::auto_ptr<base_converter>::get() != 0 </p> 225 226</div> 227</div> 228<a class="anchor" id="aedf56793c0804295e06cf97300b991f8"></a> 229<div class="memitem"> 230<div class="memproto"> 231 <table class="memname"> 232 <tr> 233 <td class="memname">std::locale boost::locale::util::create_utf8_codecvt </td> 234 <td>(</td> 235 <td class="paramtype">std::locale const & </td> 236 <td class="paramname"><em>in</em>, </td> 237 </tr> 238 <tr> 239 <td class="paramkey"></td> 240 <td></td> 241 <td class="paramtype">character_facet_type </td> 242 <td class="paramname"><em>type</em> </td> 243 </tr> 244 <tr> 245 <td></td> 246 <td>)</td> 247 <td></td><td></td> 248 </tr> 249 </table> 250</div><div class="memdoc"> 251<p>Install utf8 codecvt to UTF-16 or UTF-32 into locale <em>in</em> and return new locale that is based on <em>in</em> and uses new facet. </p> 252 253</div> 254</div> 255<a class="anchor" id="aa8e8480ddadc3e972aeb4d468446db64"></a> 256<div class="memitem"> 257<div class="memproto"> 258 <table class="memname"> 259 <tr> 260 <td class="memname">std::auto_ptr<<a class="el" href="classboost_1_1locale_1_1util_1_1base__converter.html">base_converter</a>> boost::locale::util::create_utf8_converter </td> 261 <td>(</td> 262 <td class="paramname"></td><td>)</td> 263 <td></td> 264 </tr> 265 </table> 266</div><div class="memdoc"> 267<p>This function creates a <em><a class="el" href="classboost_1_1locale_1_1util_1_1base__converter.html" title="This class represent a simple stateless converter from UCS-4 and to UCS-4 for each single code point...">base_converter</a></em> that can be used for conversion between UTF-8 and unicode code points </p> 268 269</div> 270</div> 271<a class="anchor" id="ad9737569d0e2d6b08885b01aba308365"></a> 272<div class="memitem"> 273<div class="memproto"> 274 <table class="memname"> 275 <tr> 276 <td class="memname">std::string boost::locale::util::get_system_locale </td> 277 <td>(</td> 278 <td class="paramtype">bool </td> 279 <td class="paramname"><em>use_utf8_on_windows</em> = <code>false</code></td><td>)</td> 280 <td></td> 281 </tr> 282 </table> 283</div><div class="memdoc"> 284 285<p>Return default system locale name in POSIX format. </p> 286<p>This function tries to detect the locale using, LC_CTYPE, LC_ALL and LANG environment variables in this order and if all of them unset, in POSIX platforms it returns "C"</p> 287<p>On Windows additionally to check the above environment variables, this function tries to creates locale name from ISO-339 and ISO-3199 country codes defined for user default locale. If <em>use_utf8_on_windows</em> is true it sets the encoding to UTF-8, otherwise, if system locale supports ANSI code-page it defines the ANSI encoding like windows-1252, otherwise it fall-backs to UTF-8 encoding if ANSI code-page is not available. </p> 288 289</div> 290</div> 291</div><!-- contents --> 292</div><!-- doc-content --> 293 294 <li class="footer"> 295© Copyright 2009-2012 Artyom Beilis, Distributed under the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License</a>, Version 1.0. 296 </li> 297 </ul> 298 </div> 299</body> 300</html> 301