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">
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/utf8_codecvt.hpp Source File
</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);
18 <link href=
"doxygen.css" rel=
"stylesheet" type=
"text/css" />
21 <div id=
"top"><!-- do not remove this div, it is closed by doxygen! -->
23 <table cellspacing=
"0" cellpadding=
"0">
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
35 <!-- end header part -->
36 <!-- Generated by Doxygen 1.8.6 -->
37 <div id=
"navrow1" class=
"tabs">
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><a href=
"namespaces.html"><span>Namespaces
</span></a></li>
43 <li><a href=
"annotated.html"><span>Classes
</span></a></li>
44 <li class=
"current"><a href=
"files.html"><span>Files
</span></a></li>
45 <li><a href=
"examples.html"><span>Examples
</span></a></li>
48 <div id=
"navrow2" class=
"tabs2">
50 <li><a href=
"files.html"><span>File
 List
</span></a></li>
54 <div id=
"side-nav" class=
"ui-resizable side-nav-resizable">
56 <div id=
"nav-tree-contents">
57 <div id=
"nav-sync" class=
"sync"></div>
60 <div id=
"splitbar" style=
"-moz-user-select:none;"
61 class=
"ui-resizable-handle">
64 <script type=
"text/javascript">
65 $(document).ready(function(){initNavTree('utf8__codecvt_8hpp_source.html','');});
67 <div id=
"doc-content">
69 <div class=
"headertitle">
70 <div class=
"title">utf8_codecvt.hpp
</div> </div>
72 <div class=
"contents">
73 <div class=
"fragment"><div class=
"line"><a name=
"l00001"></a><span class=
"lineno"> 1</span> <span class=
"comment">//
</span></div>
74 <div class=
"line"><a name=
"l00002"></a><span class=
"lineno"> 2</span> <span class=
"comment">// Copyright (c)
2015 Artyom Beilis (Tonkikh)
</span></div>
75 <div class=
"line"><a name=
"l00003"></a><span class=
"lineno"> 3</span> <span class=
"comment">//
</span></div>
76 <div class=
"line"><a name=
"l00004"></a><span class=
"lineno"> 4</span> <span class=
"comment">// Distributed under the Boost Software License, Version
1.0. (See
</span></div>
77 <div class=
"line"><a name=
"l00005"></a><span class=
"lineno"> 5</span> <span class=
"comment">// accompanying file LICENSE_1_0.txt or copy at
</span></div>
78 <div class=
"line"><a name=
"l00006"></a><span class=
"lineno"> 6</span> <span class=
"comment">// http://www.boost.org/LICENSE_1_0.txt)
</span></div>
79 <div class=
"line"><a name=
"l00007"></a><span class=
"lineno"> 7</span> <span class=
"comment">//
</span></div>
80 <div class=
"line"><a name=
"l00008"></a><span class=
"lineno"> 8</span> <span class=
"preprocessor">#ifndef BOOST_LOCALE_UTF8_CODECVT_HPP
</span></div>
81 <div class=
"line"><a name=
"l00009"></a><span class=
"lineno"> 9</span> <span class=
"preprocessor"></span><span class=
"preprocessor">#define BOOST_LOCALE_UTF8_CODECVT_HPP
</span></div>
82 <div class=
"line"><a name=
"l00010"></a><span class=
"lineno"> 10</span> <span class=
"preprocessor"></span></div>
83 <div class=
"line"><a name=
"l00011"></a><span class=
"lineno"> 11</span> <span class=
"preprocessor">#include
<boost/locale/utf.hpp
></span></div>
84 <div class=
"line"><a name=
"l00012"></a><span class=
"lineno"> 12</span> <span class=
"preprocessor">#include
<boost/locale/generic_codecvt.hpp
></span></div>
85 <div class=
"line"><a name=
"l00013"></a><span class=
"lineno"> 13</span> <span class=
"preprocessor">#include
<boost/cstdint.hpp
></span></div>
86 <div class=
"line"><a name=
"l00014"></a><span class=
"lineno"> 14</span> <span class=
"preprocessor">#include
<locale
></span></div>
87 <div class=
"line"><a name=
"l00015"></a><span class=
"lineno"> 15</span> </div>
88 <div class=
"line"><a name=
"l00016"></a><span class=
"lineno"> 16</span> <span class=
"keyword">namespace
</span>boost {
</div>
89 <div class=
"line"><a name=
"l00017"></a><span class=
"lineno"> 17</span> <span class=
"keyword">namespace
</span>locale {
</div>
90 <div class=
"line"><a name=
"l00018"></a><span class=
"lineno"> 18</span> </div>
91 <div class=
"line"><a name=
"l00022"></a><span class=
"lineno"> 22</span> <span class=
"keyword">template
</span><<span class=
"keyword">typename
</span> CharType
></div>
92 <div class=
"line"><a name=
"l00023"></a><span class=
"lineno"><a class=
"line" href=
"classboost_1_1locale_1_1utf8__codecvt.html"> 23</a></span> <span class=
"keyword">class
</span><a class=
"code" href=
"classboost_1_1locale_1_1utf8__codecvt.html">utf8_codecvt
</a> :
<span class=
"keyword">public
</span> <a class=
"code" href=
"classboost_1_1locale_1_1generic__codecvt.html">generic_codecvt
</a><CharType,utf8_codecvt
<CharType
> > </div>
93 <div class=
"line"><a name=
"l00024"></a><span class=
"lineno"> 24</span> {
</div>
94 <div class=
"line"><a name=
"l00025"></a><span class=
"lineno"> 25</span> <span class=
"keyword">public
</span>:
</div>
95 <div class=
"line"><a name=
"l00026"></a><span class=
"lineno"> 26</span>  </div>
96 <div class=
"line"><a name=
"l00027"></a><span class=
"lineno"><a class=
"line" href=
"structboost_1_1locale_1_1utf8__codecvt_1_1state__type.html"> 27</a></span>  <span class=
"keyword">struct
</span><a class=
"code" href=
"structboost_1_1locale_1_1utf8__codecvt_1_1state__type.html">state_type
</a> {};
</div>
97 <div class=
"line"><a name=
"l00028"></a><span class=
"lineno"> 28</span> </div>
98 <div class=
"line"><a name=
"l00029"></a><span class=
"lineno"> 29</span>  <a class=
"code" href=
"classboost_1_1locale_1_1utf8__codecvt.html">utf8_codecvt
</a>(
<span class=
"keywordtype">size_t
</span> refs =
0) :
<a class=
"code" href=
"classboost_1_1locale_1_1generic__codecvt.html">generic_codecvt
</a><CharType,
<a class=
"code" href=
"classboost_1_1locale_1_1utf8__codecvt.html">utf8_codecvt
</a><CharType
> >(refs)
</div>
99 <div class=
"line"><a name=
"l00030"></a><span class=
"lineno"> 30</span>  {
</div>
100 <div class=
"line"><a name=
"l00031"></a><span class=
"lineno"> 31</span>  }
</div>
101 <div class=
"line"><a name=
"l00032"></a><span class=
"lineno"> 32</span> </div>
102 <div class=
"line"><a name=
"l00033"></a><span class=
"lineno"> 33</span>  <span class=
"keyword">static
</span> <span class=
"keywordtype">int
</span> max_encoding_length()
</div>
103 <div class=
"line"><a name=
"l00034"></a><span class=
"lineno"> 34</span>  {
</div>
104 <div class=
"line"><a name=
"l00035"></a><span class=
"lineno"> 35</span>  <span class=
"keywordflow">return
</span> 4;
</div>
105 <div class=
"line"><a name=
"l00036"></a><span class=
"lineno"> 36</span>  }
</div>
106 <div class=
"line"><a name=
"l00037"></a><span class=
"lineno"> 37</span> </div>
107 <div class=
"line"><a name=
"l00038"></a><span class=
"lineno"> 38</span>  <span class=
"keyword">static
</span> state_type initial_state(
<a class=
"code" href=
"classboost_1_1locale_1_1generic__codecvt__base.html#af28c4b64af6cbf2eb01c444e2cdf08c3">generic_codecvt_base::initial_convertion_state
</a> <span class=
"comment">/* unused */
</span>)
</div>
108 <div class=
"line"><a name=
"l00039"></a><span class=
"lineno"> 39</span>  {
</div>
109 <div class=
"line"><a name=
"l00040"></a><span class=
"lineno"> 40</span>  <span class=
"keywordflow">return
</span> state_type();
</div>
110 <div class=
"line"><a name=
"l00041"></a><span class=
"lineno"> 41</span>  }
</div>
111 <div class=
"line"><a name=
"l00042"></a><span class=
"lineno"> 42</span>  <span class=
"keyword">static
</span> <a class=
"code" href=
"namespaceboost_1_1locale_1_1utf.html#a068111a6b9d6d465a63893ed5c05e2f8">utf::code_point
</a> to_unicode(state_type
&,
<span class=
"keywordtype">char
</span> <span class=
"keyword">const
</span> *
&begin,
<span class=
"keywordtype">char
</span> <span class=
"keyword">const
</span> *end)
</div>
112 <div class=
"line"><a name=
"l00043"></a><span class=
"lineno"> 43</span>  {
</div>
113 <div class=
"line"><a name=
"l00044"></a><span class=
"lineno"> 44</span>  <span class=
"keywordtype">char
</span> <span class=
"keyword">const
</span> *p=begin;
</div>
114 <div class=
"line"><a name=
"l00045"></a><span class=
"lineno"> 45</span> </div>
115 <div class=
"line"><a name=
"l00046"></a><span class=
"lineno"> 46</span>  <a class=
"code" href=
"namespaceboost_1_1locale_1_1utf.html#a068111a6b9d6d465a63893ed5c05e2f8">utf::code_point
</a> c =
<a class=
"code" href=
"structboost_1_1locale_1_1utf_1_1utf__traits.html#a9b6b01fa6705ba67ac78359ddee03213">utf::utf_traits
<char
>::decode
</a>(p,end);
</div>
116 <div class=
"line"><a name=
"l00047"></a><span class=
"lineno"> 47</span>  <span class=
"keywordflow">if
</span>(c!=
<a class=
"code" href=
"namespaceboost_1_1locale_1_1utf.html#a30010000878c7732340bda8956b844fb">utf::illegal
</a> && c!=
<a class=
"code" href=
"namespaceboost_1_1locale_1_1utf.html#a20dbe458fd18229a0e6c09888d031b38">utf::incomplete
</a>)
</div>
117 <div class=
"line"><a name=
"l00048"></a><span class=
"lineno"> 48</span>  begin = p;
</div>
118 <div class=
"line"><a name=
"l00049"></a><span class=
"lineno"> 49</span>  <span class=
"keywordflow">return
</span> c;
</div>
119 <div class=
"line"><a name=
"l00050"></a><span class=
"lineno"> 50</span>  }
</div>
120 <div class=
"line"><a name=
"l00051"></a><span class=
"lineno"> 51</span> </div>
121 <div class=
"line"><a name=
"l00052"></a><span class=
"lineno"> 52</span>  <span class=
"keyword">static
</span> <a class=
"code" href=
"namespaceboost_1_1locale_1_1utf.html#a068111a6b9d6d465a63893ed5c05e2f8">utf::code_point
</a> from_unicode(state_type
&,
<a class=
"code" href=
"namespaceboost_1_1locale_1_1utf.html#a068111a6b9d6d465a63893ed5c05e2f8">utf::code_point
</a> u,
<span class=
"keywordtype">char
</span> *begin,
<span class=
"keywordtype">char
</span> <span class=
"keyword">const
</span> *end)
</div>
122 <div class=
"line"><a name=
"l00053"></a><span class=
"lineno"> 53</span>  {
</div>
123 <div class=
"line"><a name=
"l00054"></a><span class=
"lineno"> 54</span>  <span class=
"keywordflow">if
</span>(!
<a class=
"code" href=
"namespaceboost_1_1locale_1_1utf.html#a189805c4e9f4c033ce5f88daf780e08e">utf::is_valid_codepoint
</a>(u))
</div>
124 <div class=
"line"><a name=
"l00055"></a><span class=
"lineno"> 55</span>  <span class=
"keywordflow">return
</span> <a class=
"code" href=
"namespaceboost_1_1locale_1_1utf.html#a30010000878c7732340bda8956b844fb">utf::illegal
</a>;
</div>
125 <div class=
"line"><a name=
"l00056"></a><span class=
"lineno"> 56</span>  <span class=
"keywordtype">int
</span> width;
</div>
126 <div class=
"line"><a name=
"l00057"></a><span class=
"lineno"> 57</span>  <span class=
"keywordflow">if
</span>((width=utf::utf_traits
<char
>::width(u))
> end - begin)
</div>
127 <div class=
"line"><a name=
"l00058"></a><span class=
"lineno"> 58</span>  <span class=
"keywordflow">return
</span> <a class=
"code" href=
"namespaceboost_1_1locale_1_1utf.html#a20dbe458fd18229a0e6c09888d031b38">utf::incomplete
</a>;
</div>
128 <div class=
"line"><a name=
"l00059"></a><span class=
"lineno"> 59</span>  <a class=
"code" href=
"structboost_1_1locale_1_1utf_1_1utf__traits.html#acd59f628af084f800f8a86cdd8124fd8">utf::utf_traits
<char
>::encode
</a>(u,begin);
</div>
129 <div class=
"line"><a name=
"l00060"></a><span class=
"lineno"> 60</span>  <span class=
"keywordflow">return
</span> width;
</div>
130 <div class=
"line"><a name=
"l00061"></a><span class=
"lineno"> 61</span>  }
</div>
131 <div class=
"line"><a name=
"l00062"></a><span class=
"lineno"> 62</span> };
</div>
132 <div class=
"line"><a name=
"l00063"></a><span class=
"lineno"> 63</span> </div>
133 <div class=
"line"><a name=
"l00064"></a><span class=
"lineno"> 64</span> }
<span class=
"comment">// locale
</span></div>
134 <div class=
"line"><a name=
"l00065"></a><span class=
"lineno"> 65</span> }
<span class=
"comment">// namespace boost
</span></div>
135 <div class=
"line"><a name=
"l00066"></a><span class=
"lineno"> 66</span> </div>
136 <div class=
"line"><a name=
"l00067"></a><span class=
"lineno"> 67</span> <span class=
"preprocessor">#endif
</span></div>
137 <div class=
"line"><a name=
"l00068"></a><span class=
"lineno"> 68</span> <span class=
"preprocessor"></span><span class=
"comment">// vim: tabstop=
4 expandtab shiftwidth=
4 softtabstop=
4</span></div>
138 <div class=
"ttc" id=
"structboost_1_1locale_1_1utf_1_1utf__traits_html_a9b6b01fa6705ba67ac78359ddee03213"><div class=
"ttname"><a href=
"structboost_1_1locale_1_1utf_1_1utf__traits.html#a9b6b01fa6705ba67ac78359ddee03213">boost::locale::utf::utf_traits::decode
</a></div><div class=
"ttdeci">static code_point decode(Iterator
&p, Iterator e)
</div></div>
139 <div class=
"ttc" id=
"namespaceboost_1_1locale_1_1utf_html_a189805c4e9f4c033ce5f88daf780e08e"><div class=
"ttname"><a href=
"namespaceboost_1_1locale_1_1utf.html#a189805c4e9f4c033ce5f88daf780e08e">boost::locale::utf::is_valid_codepoint
</a></div><div class=
"ttdeci">bool is_valid_codepoint(code_point v)
</div><div class=
"ttdoc">the function checks if v is a valid code point
</div><div class=
"ttdef"><b>Definition:
</b> utf.hpp:
49</div></div>
140 <div class=
"ttc" id=
"structboost_1_1locale_1_1utf_1_1utf__traits_html_acd59f628af084f800f8a86cdd8124fd8"><div class=
"ttname"><a href=
"structboost_1_1locale_1_1utf_1_1utf__traits.html#acd59f628af084f800f8a86cdd8124fd8">boost::locale::utf::utf_traits::encode
</a></div><div class=
"ttdeci">static Iterator encode(code_point value, Iterator out)
</div></div>
141 <div class=
"ttc" id=
"namespaceboost_1_1locale_1_1utf_html_a20dbe458fd18229a0e6c09888d031b38"><div class=
"ttname"><a href=
"namespaceboost_1_1locale_1_1utf.html#a20dbe458fd18229a0e6c09888d031b38">boost::locale::utf::incomplete
</a></div><div class=
"ttdeci">static const code_point incomplete
</div><div class=
"ttdoc">Special constant that defines incomplete code point.
</div><div class=
"ttdef"><b>Definition:
</b> utf.hpp:
44</div></div>
142 <div class=
"ttc" id=
"classboost_1_1locale_1_1utf8__codecvt_html"><div class=
"ttname"><a href=
"classboost_1_1locale_1_1utf8__codecvt.html">boost::locale::utf8_codecvt
</a></div><div class=
"ttdoc">Geneneric utf8 codecvt facet, it allows to convert UTF-
8 strings to UTF-
16 and UTF-
32 using wchar_t...
</div><div class=
"ttdef"><b>Definition:
</b> utf8_codecvt.hpp:
23</div></div>
143 <div class=
"ttc" id=
"namespaceboost_1_1locale_1_1utf_html_a068111a6b9d6d465a63893ed5c05e2f8"><div class=
"ttname"><a href=
"namespaceboost_1_1locale_1_1utf.html#a068111a6b9d6d465a63893ed5c05e2f8">boost::locale::utf::code_point
</a></div><div class=
"ttdeci">uint32_t code_point
</div><div class=
"ttdoc">The integral type that can hold a Unicode code point.
</div><div class=
"ttdef"><b>Definition:
</b> utf.hpp:
34</div></div>
144 <div class=
"ttc" id=
"classboost_1_1locale_1_1generic__codecvt__base_html_af28c4b64af6cbf2eb01c444e2cdf08c3"><div class=
"ttname"><a href=
"classboost_1_1locale_1_1generic__codecvt__base.html#af28c4b64af6cbf2eb01c444e2cdf08c3">boost::locale::generic_codecvt_base::initial_convertion_state
</a></div><div class=
"ttdeci">initial_convertion_state
</div><div class=
"ttdef"><b>Definition:
</b> generic_codecvt.hpp:
39</div></div>
145 <div class=
"ttc" id=
"namespaceboost_1_1locale_1_1utf_html_a30010000878c7732340bda8956b844fb"><div class=
"ttname"><a href=
"namespaceboost_1_1locale_1_1utf.html#a30010000878c7732340bda8956b844fb">boost::locale::utf::illegal
</a></div><div class=
"ttdeci">static const code_point illegal
</div><div class=
"ttdoc">Special constant that defines illegal code point.
</div><div class=
"ttdef"><b>Definition:
</b> utf.hpp:
39</div></div>
146 <div class=
"ttc" id=
"structboost_1_1locale_1_1utf8__codecvt_1_1state__type_html"><div class=
"ttname"><a href=
"structboost_1_1locale_1_1utf8__codecvt_1_1state__type.html">boost::locale::utf8_codecvt::state_type
</a></div><div class=
"ttdef"><b>Definition:
</b> utf8_codecvt.hpp:
27</div></div>
147 <div class=
"ttc" id=
"classboost_1_1locale_1_1generic__codecvt_html"><div class=
"ttname"><a href=
"classboost_1_1locale_1_1generic__codecvt.html">boost::locale::generic_codecvt
</a></div><div class=
"ttdoc">Geneneric generic codecvt facet, various stateless encodings to UTF-
16 and UTF-
32 using wchar_t...
</div><div class=
"ttdef"><b>Definition:
</b> generic_codecvt.hpp:
140</div></div>
148 </div><!-- fragment --></div><!-- contents -->
149 </div><!-- doc-content -->
152 © 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.