blob: c1dbd099af5d4b30ecb493de154226c39de26ffc [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Boost.Locale: boost/locale/message.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="boost-small.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Boost.Locale
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.6.1 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
</ul>
</div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
initNavTree('message_8hpp.html','');
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">boost/locale/message.hpp</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//</span>
<a name="l00002"></a>00002 <span class="comment">// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)</span>
<a name="l00003"></a>00003 <span class="comment">//</span>
<a name="l00004"></a>00004 <span class="comment">// Distributed under the Boost Software License, Version 1.0. (See</span>
<a name="l00005"></a>00005 <span class="comment">// accompanying file LICENSE_1_0.txt or copy at</span>
<a name="l00006"></a>00006 <span class="comment">// http://www.boost.org/LICENSE_1_0.txt)</span>
<a name="l00007"></a>00007 <span class="comment">//</span>
<a name="l00008"></a>00008 <span class="preprocessor">#ifndef BOOST_LOCALE_MESSAGE_HPP_INCLUDED</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define BOOST_LOCALE_MESSAGE_HPP_INCLUDED</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;boost/locale/config.hpp&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#ifdef BOOST_MSVC</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor"># pragma warning(push)</span>
<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor"># pragma warning(disable : 4275 4251 4231 4660)</span>
<a name="l00015"></a>00015 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#include &lt;locale&gt;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;set&gt;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;memory&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;boost/locale/formatting.hpp&gt;</span>
<a name="l00022"></a>00022
<a name="l00023"></a>00023
<a name="l00024"></a>00024 <span class="keyword">namespace </span>boost {
<a name="l00025"></a>00025 <span class="keyword">namespace </span>locale {
<a name="l00033"></a>00033
<a name="l00035"></a>00035
<a name="l00036"></a>00036 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00037"></a>00037 <span class="keyword">struct </span>base_message_format: <span class="keyword">public</span> std::locale::facet
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039 };
<a name="l00040"></a>00040
<a name="l00042"></a>00042
<a name="l00046"></a>00046 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00047"></a><a class="code" href="classboost_1_1locale_1_1message__format.html">00047</a> <span class="keyword">class </span><a class="code" href="classboost_1_1locale_1_1message__format.html" title="This facet provides message formatting abilities.">message_format</a> : <span class="keyword">public</span> base_message_format&lt;CharType&gt;
<a name="l00048"></a>00048 {
<a name="l00049"></a>00049 <span class="keyword">public</span>:
<a name="l00050"></a>00050
<a name="l00054"></a><a class="code" href="group__message.html#ga83f473295edf14b9e1ae1476b81231bc">00054</a> <span class="keyword">typedef</span> CharType <a class="code" href="group__message.html#ga83f473295edf14b9e1ae1476b81231bc">char_type</a>;
<a name="l00058"></a><a class="code" href="group__message.html#gaaa932705310ce196fccc9d672b25518f">00058</a> <span class="keyword">typedef</span> std::basic_string&lt;CharType&gt; <a class="code" href="group__message.html#gaaa932705310ce196fccc9d672b25518f">string_type</a>;
<a name="l00059"></a>00059
<a name="l00063"></a><a class="code" href="group__message.html#gafa681d0df94a35f9d75c16dea099d03e">00063</a> <a class="code" href="group__message.html#gafa681d0df94a35f9d75c16dea099d03e">message_format</a>(<span class="keywordtype">size_t</span> refs = 0) :
<a name="l00064"></a>00064 base_message_format&lt;CharType&gt;(refs)
<a name="l00065"></a>00065 {
<a name="l00066"></a>00066 }
<a name="l00067"></a>00067
<a name="l00078"></a>00078 <span class="keyword">virtual</span> <a class="code" href="group__message.html#ga83f473295edf14b9e1ae1476b81231bc">char_type</a> <span class="keyword">const</span> *<span class="keyword">get</span>(<span class="keywordtype">int</span> domain_id,<a class="code" href="group__message.html#ga83f473295edf14b9e1ae1476b81231bc">char_type</a> <span class="keyword">const</span> *context,<a class="code" href="group__message.html#ga83f473295edf14b9e1ae1476b81231bc">char_type</a> <span class="keyword">const</span> *id) <span class="keyword">const</span> = 0;
<a name="l00092"></a>00092 <span class="keyword">virtual</span> <a class="code" href="group__message.html#ga83f473295edf14b9e1ae1476b81231bc">char_type</a> <span class="keyword">const</span> *<span class="keyword">get</span>(<span class="keywordtype">int</span> domain_id,<a class="code" href="group__message.html#ga83f473295edf14b9e1ae1476b81231bc">char_type</a> <span class="keyword">const</span> *context,<a class="code" href="group__message.html#ga83f473295edf14b9e1ae1476b81231bc">char_type</a> <span class="keyword">const</span> *single_id,<span class="keywordtype">int</span> n) <span class="keyword">const</span> = 0;
<a name="l00093"></a>00093
<a name="l00097"></a>00097 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="group__message.html#ga73e25178ba9ef91ebe1df0aade4d8ae6">domain</a>(std::string <span class="keyword">const</span> &amp;<a class="code" href="group__message.html#ga73e25178ba9ef91ebe1df0aade4d8ae6">domain</a>) <span class="keyword">const</span> = 0;
<a name="l00098"></a>00098
<a name="l00107"></a>00107 <span class="keyword">virtual</span> <a class="code" href="group__message.html#ga83f473295edf14b9e1ae1476b81231bc">char_type</a> <span class="keyword">const</span> *<a class="code" href="group__message.html#ga3f2c9d7f9a363efa607738083a986251">convert</a>(<a class="code" href="group__message.html#ga83f473295edf14b9e1ae1476b81231bc">char_type</a> <span class="keyword">const</span> *msg,<a class="code" href="group__message.html#gaaa932705310ce196fccc9d672b25518f">string_type</a> &amp;buffer) <span class="keyword">const</span> = 0;
<a name="l00108"></a>00108
<a name="l00109"></a>00109 <span class="preprocessor">#if defined (__SUNPRO_CC) &amp;&amp; defined (_RWSTD_VER)</span>
<a name="l00110"></a>00110 <span class="preprocessor"></span> std::locale::id&amp; __get_id (<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> id; }
<a name="l00111"></a>00111 <span class="preprocessor">#endif</span>
<a name="l00112"></a>00112 <span class="preprocessor"></span> <span class="keyword">protected</span>:
<a name="l00113"></a>00113 <span class="keyword">virtual</span> ~<a class="code" href="group__message.html#gafa681d0df94a35f9d75c16dea099d03e">message_format</a>()
<a name="l00114"></a>00114 {
<a name="l00115"></a>00115 }
<a name="l00116"></a>00116
<a name="l00117"></a>00117 };
<a name="l00118"></a>00118
<a name="l00120"></a>00120
<a name="l00121"></a>00121 <span class="keyword">namespace </span>details {
<a name="l00122"></a>00122 <span class="keyword">inline</span> <span class="keywordtype">bool</span> is_us_ascii_char(<span class="keywordtype">char</span> c)
<a name="l00123"></a>00123 {
<a name="l00124"></a>00124 <span class="comment">// works for null terminated strings regardless char &quot;signness&quot;</span>
<a name="l00125"></a>00125 <span class="keywordflow">return</span> 0&lt;c &amp;&amp; c&lt;0x7F;
<a name="l00126"></a>00126 }
<a name="l00127"></a>00127 <span class="keyword">inline</span> <span class="keywordtype">bool</span> is_us_ascii_string(<span class="keywordtype">char</span> <span class="keyword">const</span> *msg)
<a name="l00128"></a>00128 {
<a name="l00129"></a>00129 <span class="keywordflow">while</span>(*msg) {
<a name="l00130"></a>00130 <span class="keywordflow">if</span>(!is_us_ascii_char(*msg++))
<a name="l00131"></a>00131 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00132"></a>00132 }
<a name="l00133"></a>00133 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00134"></a>00134 }
<a name="l00135"></a>00135
<a name="l00136"></a>00136 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00137"></a>00137 <span class="keyword">struct </span>string_cast_traits {
<a name="l00138"></a>00138 <span class="keyword">static</span> CharType <span class="keyword">const</span> *cast(CharType <span class="keyword">const</span> *msg,std::basic_string&lt;CharType&gt; &amp;<span class="comment">/*unused*/</span>)
<a name="l00139"></a>00139 {
<a name="l00140"></a>00140 <span class="keywordflow">return</span> msg;
<a name="l00141"></a>00141 }
<a name="l00142"></a>00142 };
<a name="l00143"></a>00143
<a name="l00144"></a>00144 <span class="keyword">template</span>&lt;&gt;
<a name="l00145"></a>00145 <span class="keyword">struct </span>string_cast_traits&lt;char&gt; {
<a name="l00146"></a>00146 <span class="keyword">static</span> <span class="keywordtype">char</span> <span class="keyword">const</span> *cast(<span class="keywordtype">char</span> <span class="keyword">const</span> *msg,std::string &amp;buffer)
<a name="l00147"></a>00147 {
<a name="l00148"></a>00148 <span class="keywordflow">if</span>(is_us_ascii_string(msg))
<a name="l00149"></a>00149 <span class="keywordflow">return</span> msg;
<a name="l00150"></a>00150 buffer.reserve(strlen(msg));
<a name="l00151"></a>00151 <span class="keywordtype">char</span> c;
<a name="l00152"></a>00152 <span class="keywordflow">while</span>((c=*msg++)!=0) {
<a name="l00153"></a>00153 <span class="keywordflow">if</span>(is_us_ascii_char(c))
<a name="l00154"></a>00154 buffer+=c;
<a name="l00155"></a>00155 }
<a name="l00156"></a>00156 <span class="keywordflow">return</span> buffer.c_str();
<a name="l00157"></a>00157 }
<a name="l00158"></a>00158 };
<a name="l00159"></a>00159 } <span class="comment">// details</span>
<a name="l00160"></a>00160
<a name="l00162"></a>00162
<a name="l00170"></a>00170 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00171"></a><a class="code" href="classboost_1_1locale_1_1basic__message.html">00171</a> <span class="keyword">class </span><a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message</a> {
<a name="l00172"></a>00172 <span class="keyword">public</span>:
<a name="l00173"></a>00173
<a name="l00174"></a><a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db">00174</a> <span class="keyword">typedef</span> CharType <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a>;
<a name="l00175"></a><a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3">00175</a> <span class="keyword">typedef</span> std::basic_string&lt;char_type&gt; <a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a>;
<a name="l00176"></a><a class="code" href="group__message.html#gaa63527cb368d0bcd4cb0809138c927df">00176</a> <span class="keyword">typedef</span> <a class="code" href="classboost_1_1locale_1_1message__format.html" title="This facet provides message formatting abilities.">message_format&lt;char_type&gt;</a> <a class="code" href="group__message.html#gaa63527cb368d0bcd4cb0809138c927df" title="The type of the facet the messages are fetched with.">facet_type</a>;
<a name="l00177"></a>00177
<a name="l00181"></a><a class="code" href="group__message.html#ga33bdf7fbb164a96a8685b5747afc2b45">00181</a> <a class="code" href="group__message.html#ga33bdf7fbb164a96a8685b5747afc2b45">basic_message</a>() :
<a name="l00182"></a>00182 n_(0),
<a name="l00183"></a>00183 c_id_(0),
<a name="l00184"></a>00184 c_context_(0),
<a name="l00185"></a>00185 c_plural_(0)
<a name="l00186"></a>00186 {
<a name="l00187"></a>00187 }
<a name="l00188"></a>00188
<a name="l00193"></a><a class="code" href="group__message.html#gae32d7f89d5f268e8d6bae662d8008bae">00193</a> <span class="keyword">explicit</span> <a class="code" href="group__message.html#ga33bdf7fbb164a96a8685b5747afc2b45">basic_message</a>(<a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *<span class="keywordtype">id</span>) :
<a name="l00194"></a>00194 n_(0),
<a name="l00195"></a>00195 c_id_(id),
<a name="l00196"></a>00196 c_context_(0),
<a name="l00197"></a>00197 c_plural_(0)
<a name="l00198"></a>00198 {
<a name="l00199"></a>00199 }
<a name="l00200"></a>00200
<a name="l00207"></a><a class="code" href="group__message.html#ga40bf56415a235f13ee666d51f645f280">00207</a> <span class="keyword">explicit</span> <a class="code" href="group__message.html#ga33bdf7fbb164a96a8685b5747afc2b45">basic_message</a>(<a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *single,<a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *plural,<span class="keywordtype">int</span> n) :
<a name="l00208"></a>00208 n_(n),
<a name="l00209"></a>00209 c_id_(single),
<a name="l00210"></a>00210 c_context_(0),
<a name="l00211"></a>00211 c_plural_(plural)
<a name="l00212"></a>00212 {
<a name="l00213"></a>00213 }
<a name="l00214"></a>00214
<a name="l00220"></a><a class="code" href="group__message.html#ga4d78f8f45467984d7244e2ddbb9e0f6e">00220</a> <span class="keyword">explicit</span> <a class="code" href="group__message.html#ga33bdf7fbb164a96a8685b5747afc2b45">basic_message</a>(<a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *context,<a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *<span class="keywordtype">id</span>) :
<a name="l00221"></a>00221 n_(0),
<a name="l00222"></a>00222 c_id_(id),
<a name="l00223"></a>00223 c_context_(context),
<a name="l00224"></a>00224 c_plural_(0)
<a name="l00225"></a>00225 {
<a name="l00226"></a>00226 }
<a name="l00227"></a>00227
<a name="l00234"></a><a class="code" href="group__message.html#gabf9afe77f0254397389289c386bf8a73">00234</a> <span class="keyword">explicit</span> <a class="code" href="group__message.html#ga33bdf7fbb164a96a8685b5747afc2b45">basic_message</a>(<a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *context,<a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *single,<a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *plural,<span class="keywordtype">int</span> n) :
<a name="l00235"></a>00235 n_(n),
<a name="l00236"></a>00236 c_id_(single),
<a name="l00237"></a>00237 c_context_(context),
<a name="l00238"></a>00238 c_plural_(plural)
<a name="l00239"></a>00239 {
<a name="l00240"></a>00240 }
<a name="l00241"></a>00241
<a name="l00242"></a>00242
<a name="l00246"></a><a class="code" href="group__message.html#gabbb4365d621a33442ae34ac7c17a9d74">00246</a> <span class="keyword">explicit</span> <a class="code" href="group__message.html#ga33bdf7fbb164a96a8685b5747afc2b45">basic_message</a>(<a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> <span class="keyword">const</span> &amp;<span class="keywordtype">id</span>) :
<a name="l00247"></a>00247 n_(0),
<a name="l00248"></a>00248 c_id_(0),
<a name="l00249"></a>00249 c_context_(0),
<a name="l00250"></a>00250 c_plural_(0),
<a name="l00251"></a>00251 id_(id)
<a name="l00252"></a>00252 {
<a name="l00253"></a>00253 }
<a name="l00254"></a>00254
<a name="l00260"></a><a class="code" href="group__message.html#ga380f3a258b3b28929bbf01f4e622e71a">00260</a> <span class="keyword">explicit</span> <a class="code" href="group__message.html#ga33bdf7fbb164a96a8685b5747afc2b45">basic_message</a>(<a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> <span class="keyword">const</span> &amp;single,<a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> <span class="keyword">const</span> &amp;plural,<span class="keywordtype">int</span> <a class="code" href="group__manipulators.html#gaee05db73f5525d9a010cdc3aa02f634f">number</a>) :
<a name="l00261"></a>00261 n_(number),
<a name="l00262"></a>00262 c_id_(0),
<a name="l00263"></a>00263 c_context_(0),
<a name="l00264"></a>00264 c_plural_(0),
<a name="l00265"></a>00265 id_(single),
<a name="l00266"></a>00266 plural_(plural)
<a name="l00267"></a>00267 {
<a name="l00268"></a>00268 }
<a name="l00269"></a>00269
<a name="l00273"></a><a class="code" href="group__message.html#ga8c2fab962e10a46ea85f0188d08e499d">00273</a> <span class="keyword">explicit</span> <a class="code" href="group__message.html#ga33bdf7fbb164a96a8685b5747afc2b45">basic_message</a>(<a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> <span class="keyword">const</span> &amp;context,<a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> <span class="keyword">const</span> &amp;<span class="keywordtype">id</span>) :
<a name="l00274"></a>00274 n_(0),
<a name="l00275"></a>00275 c_id_(0),
<a name="l00276"></a>00276 c_context_(0),
<a name="l00277"></a>00277 c_plural_(0),
<a name="l00278"></a>00278 id_(id),
<a name="l00279"></a>00279 context_(context)
<a name="l00280"></a>00280 {
<a name="l00281"></a>00281 }
<a name="l00282"></a>00282
<a name="l00288"></a><a class="code" href="group__message.html#gaf8ba10b7b1d45e6c78b84d77e8175d5d">00288</a> <span class="keyword">explicit</span> <a class="code" href="group__message.html#ga33bdf7fbb164a96a8685b5747afc2b45">basic_message</a>(<a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> <span class="keyword">const</span> &amp;context,<a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> <span class="keyword">const</span> &amp;single,<a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> <span class="keyword">const</span> &amp;plural,<span class="keywordtype">int</span> <a class="code" href="group__manipulators.html#gaee05db73f5525d9a010cdc3aa02f634f">number</a>) :
<a name="l00289"></a>00289 n_(number),
<a name="l00290"></a>00290 c_id_(0),
<a name="l00291"></a>00291 c_context_(0),
<a name="l00292"></a>00292 c_plural_(0),
<a name="l00293"></a>00293 id_(single),
<a name="l00294"></a>00294 context_(context),
<a name="l00295"></a>00295 plural_(plural)
<a name="l00296"></a>00296 {
<a name="l00297"></a>00297 }
<a name="l00298"></a>00298
<a name="l00302"></a><a class="code" href="group__message.html#gae6ed9dded4ab78ff28e994b48c766c84">00302</a> <a class="code" href="group__message.html#ga33bdf7fbb164a96a8685b5747afc2b45">basic_message</a>(<a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message</a> <span class="keyword">const</span> &amp;other) :
<a name="l00303"></a>00303 n_(other.n_),
<a name="l00304"></a>00304 c_id_(other.c_id_),
<a name="l00305"></a>00305 c_context_(other.c_context_),
<a name="l00306"></a>00306 c_plural_(other.c_plural_),
<a name="l00307"></a>00307 id_(other.id_),
<a name="l00308"></a>00308 context_(other.context_),
<a name="l00309"></a>00309 plural_(other.plural_)
<a name="l00310"></a>00310 {
<a name="l00311"></a>00311 }
<a name="l00312"></a>00312
<a name="l00316"></a><a class="code" href="group__message.html#gae0e786e45ef32cf73efd8495cae45aed">00316</a> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message</a> <span class="keyword">const</span> &amp;<a class="code" href="group__message.html#gae0e786e45ef32cf73efd8495cae45aed">operator=</a>(<a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message</a> <span class="keyword">const</span> &amp;other)
<a name="l00317"></a>00317 {
<a name="l00318"></a>00318 <span class="keywordflow">if</span>(<span class="keyword">this</span>==&amp;other) {
<a name="l00319"></a>00319 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00320"></a>00320 }
<a name="l00321"></a>00321 <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message</a> tmp(other);
<a name="l00322"></a>00322 <a class="code" href="group__message.html#gac204b563c7c9bd86e5555f129350f0e3">swap</a>(tmp);
<a name="l00323"></a>00323 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00324"></a>00324 }
<a name="l00325"></a>00325
<a name="l00329"></a><a class="code" href="group__message.html#gac204b563c7c9bd86e5555f129350f0e3">00329</a> <span class="keywordtype">void</span> <a class="code" href="group__message.html#gac204b563c7c9bd86e5555f129350f0e3">swap</a>(<a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message</a> &amp;other)
<a name="l00330"></a>00330 {
<a name="l00331"></a>00331 <a class="code" href="group__message.html#gac204b563c7c9bd86e5555f129350f0e3">std::swap</a>(n_,other.n_);
<a name="l00332"></a>00332 <a class="code" href="group__message.html#gac204b563c7c9bd86e5555f129350f0e3">std::swap</a>(c_id_,other.c_id_);
<a name="l00333"></a>00333 <a class="code" href="group__message.html#gac204b563c7c9bd86e5555f129350f0e3">std::swap</a>(c_context_,other.c_context_);
<a name="l00334"></a>00334 <a class="code" href="group__message.html#gac204b563c7c9bd86e5555f129350f0e3">std::swap</a>(c_plural_,other.c_plural_);
<a name="l00335"></a>00335
<a name="l00336"></a>00336 id_.swap(other.id_);
<a name="l00337"></a>00337 context_.swap(other.context_);
<a name="l00338"></a>00338 plural_.swap(other.plural_);
<a name="l00339"></a>00339 }
<a name="l00340"></a>00340
<a name="l00344"></a>00344
<a name="l00345"></a><a class="code" href="group__message.html#ga8da81038939b85ca248cba50f1deacf1">00345</a> <a class="code" href="group__message.html#ga8da81038939b85ca248cba50f1deacf1">operator string_type </a>()<span class="keyword"> const</span>
<a name="l00346"></a>00346 <span class="keyword"> </span>{
<a name="l00347"></a>00347 <span class="keywordflow">return</span> <a class="code" href="group__message.html#ga11c5f400e03e0b16b9a60bd3fae3f168">str</a>();
<a name="l00348"></a>00348 }
<a name="l00349"></a>00349
<a name="l00353"></a><a class="code" href="group__message.html#ga11c5f400e03e0b16b9a60bd3fae3f168">00353</a> <a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> <a class="code" href="group__message.html#ga11c5f400e03e0b16b9a60bd3fae3f168">str</a>()<span class="keyword"> const</span>
<a name="l00354"></a>00354 <span class="keyword"> </span>{
<a name="l00355"></a>00355 std::locale loc;
<a name="l00356"></a>00356 <span class="keywordflow">return</span> <a class="code" href="group__message.html#ga11c5f400e03e0b16b9a60bd3fae3f168">str</a>(loc,0);
<a name="l00357"></a>00357 }
<a name="l00358"></a>00358
<a name="l00362"></a><a class="code" href="group__message.html#ga26c6489f8269096f835abfb268498fdd">00362</a> <a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> <a class="code" href="group__message.html#ga11c5f400e03e0b16b9a60bd3fae3f168">str</a>(std::locale <span class="keyword">const</span> &amp;locale)<span class="keyword"> const</span>
<a name="l00363"></a>00363 <span class="keyword"> </span>{
<a name="l00364"></a>00364 <span class="keywordflow">return</span> <a class="code" href="group__message.html#ga11c5f400e03e0b16b9a60bd3fae3f168">str</a>(locale,0);
<a name="l00365"></a>00365 }
<a name="l00366"></a>00366
<a name="l00370"></a><a class="code" href="group__message.html#gaa907a1d3f43fe59cea938e1606f004ee">00370</a> <a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> <a class="code" href="group__message.html#ga11c5f400e03e0b16b9a60bd3fae3f168">str</a>(std::locale <span class="keyword">const</span> &amp;locale,std::string <span class="keyword">const</span> &amp;domain_id)<span class="keyword"> const</span>
<a name="l00371"></a>00371 <span class="keyword"> </span>{
<a name="l00372"></a>00372 <span class="keywordtype">int</span> <span class="keywordtype">id</span>=0;
<a name="l00373"></a>00373 <span class="keywordflow">if</span>(std::has_facet&lt;facet_type&gt;(locale))
<a name="l00374"></a>00374 <span class="keywordtype">id</span>=std::use_facet&lt;facet_type&gt;(locale).<a class="code" href="group__manipulators.html#gab522188e3d82f1d2898b290b9132925e">domain</a>(domain_id);
<a name="l00375"></a>00375 <span class="keywordflow">return</span> <a class="code" href="group__message.html#ga11c5f400e03e0b16b9a60bd3fae3f168">str</a>(locale,<span class="keywordtype">id</span>);
<a name="l00376"></a>00376 }
<a name="l00377"></a>00377
<a name="l00381"></a><a class="code" href="group__message.html#ga2d2ca0fe119e4ce4766fd3d42b549314">00381</a> <a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> <a class="code" href="group__message.html#ga11c5f400e03e0b16b9a60bd3fae3f168">str</a>(std::string <span class="keyword">const</span> &amp;domain_id)<span class="keyword"> const</span>
<a name="l00382"></a>00382 <span class="keyword"> </span>{
<a name="l00383"></a>00383 <span class="keywordtype">int</span> <span class="keywordtype">id</span>=0;
<a name="l00384"></a>00384 std::locale loc;
<a name="l00385"></a>00385 <span class="keywordflow">if</span>(std::has_facet&lt;facet_type&gt;(loc))
<a name="l00386"></a>00386 <span class="keywordtype">id</span>=std::use_facet&lt;facet_type&gt;(loc).<a class="code" href="group__manipulators.html#gab522188e3d82f1d2898b290b9132925e">domain</a>(domain_id);
<a name="l00387"></a>00387 <span class="keywordflow">return</span> <a class="code" href="group__message.html#ga11c5f400e03e0b16b9a60bd3fae3f168">str</a>(loc,<span class="keywordtype">id</span>);
<a name="l00388"></a>00388 }
<a name="l00389"></a>00389
<a name="l00390"></a>00390
<a name="l00394"></a><a class="code" href="group__message.html#gaa51c0f65363d8d1cee83bb07fe45ced5">00394</a> <a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> <a class="code" href="group__message.html#ga11c5f400e03e0b16b9a60bd3fae3f168">str</a>(std::locale <span class="keyword">const</span> &amp;loc,<span class="keywordtype">int</span> <span class="keywordtype">id</span>)<span class="keyword"> const</span>
<a name="l00395"></a>00395 <span class="keyword"> </span>{
<a name="l00396"></a>00396 <a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> buffer;
<a name="l00397"></a>00397 <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *ptr = <a class="code" href="group__message.html#ga4dd81f4d40c4e8871bb1bf02bbc8e968">write</a>(loc,<span class="keywordtype">id</span>,buffer);
<a name="l00398"></a>00398 <span class="keywordflow">if</span>(ptr == buffer.c_str())
<a name="l00399"></a>00399 <span class="keywordflow">return</span> buffer;
<a name="l00400"></a>00400 <span class="keywordflow">else</span>
<a name="l00401"></a>00401 buffer = ptr;
<a name="l00402"></a>00402 <span class="keywordflow">return</span> buffer;
<a name="l00403"></a>00403 }
<a name="l00404"></a>00404
<a name="l00405"></a>00405
<a name="l00410"></a><a class="code" href="group__message.html#ga4dd81f4d40c4e8871bb1bf02bbc8e968">00410</a> <span class="keywordtype">void</span> <a class="code" href="group__message.html#ga4dd81f4d40c4e8871bb1bf02bbc8e968">write</a>(std::basic_ostream&lt;char_type&gt; &amp;out)<span class="keyword"> const</span>
<a name="l00411"></a>00411 <span class="keyword"> </span>{
<a name="l00412"></a>00412 std::locale <span class="keyword">const</span> &amp;loc = out.getloc();
<a name="l00413"></a>00413 <span class="keywordtype">int</span> <span class="keywordtype">id</span> = <a class="code" href="classboost_1_1locale_1_1ios__info.html#a02f6979dffc2df97c3612d72b7c7241b">ios_info::get</a>(out).<a class="code" href="classboost_1_1locale_1_1ios__info.html#a08b1bb49e5806900bfa1901e869497a6">domain_id</a>();
<a name="l00414"></a>00414 <a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> buffer;
<a name="l00415"></a>00415 out &lt;&lt; <a class="code" href="group__message.html#ga4dd81f4d40c4e8871bb1bf02bbc8e968">write</a>(loc,<span class="keywordtype">id</span>,buffer);
<a name="l00416"></a>00416 }
<a name="l00417"></a>00417
<a name="l00418"></a>00418 <span class="keyword">private</span>:
<a name="l00419"></a>00419 <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *plural()<span class="keyword"> const</span>
<a name="l00420"></a>00420 <span class="keyword"> </span>{
<a name="l00421"></a>00421 <span class="keywordflow">if</span>(c_plural_)
<a name="l00422"></a>00422 <span class="keywordflow">return</span> c_plural_;
<a name="l00423"></a>00423 <span class="keywordflow">if</span>(plural_.empty())
<a name="l00424"></a>00424 <span class="keywordflow">return</span> 0;
<a name="l00425"></a>00425 <span class="keywordflow">return</span> plural_.c_str();
<a name="l00426"></a>00426 }
<a name="l00427"></a>00427 <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *context()<span class="keyword"> const</span>
<a name="l00428"></a>00428 <span class="keyword"> </span>{
<a name="l00429"></a>00429 <span class="keywordflow">if</span>(c_context_)
<a name="l00430"></a>00430 <span class="keywordflow">return</span> c_context_;
<a name="l00431"></a>00431 <span class="keywordflow">if</span>(context_.empty())
<a name="l00432"></a>00432 <span class="keywordflow">return</span> 0;
<a name="l00433"></a>00433 <span class="keywordflow">return</span> context_.c_str();
<a name="l00434"></a>00434 }
<a name="l00435"></a>00435
<a name="l00436"></a>00436 <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *id()<span class="keyword"> const</span>
<a name="l00437"></a>00437 <span class="keyword"> </span>{
<a name="l00438"></a>00438 <span class="keywordflow">return</span> c_id_ ? c_id_ : id_.c_str();
<a name="l00439"></a>00439 }
<a name="l00440"></a>00440
<a name="l00441"></a>00441 <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *<a class="code" href="group__message.html#ga4dd81f4d40c4e8871bb1bf02bbc8e968">write</a>(std::locale <span class="keyword">const</span> &amp;loc,<span class="keywordtype">int</span> domain_id,<a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> &amp;buffer)<span class="keyword"> const</span>
<a name="l00442"></a>00442 <span class="keyword"> </span>{
<a name="l00443"></a>00443 <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *translated = 0;
<a name="l00444"></a>00444 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> empty_string[1] = {0};
<a name="l00445"></a>00445
<a name="l00446"></a>00446 <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *<span class="keywordtype">id</span> = this-&gt;id();
<a name="l00447"></a>00447 <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *context = this-&gt;context();
<a name="l00448"></a>00448 <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *plural = this-&gt;plural();
<a name="l00449"></a>00449
<a name="l00450"></a>00450 <span class="keywordflow">if</span>(*<span class="keywordtype">id</span> == 0)
<a name="l00451"></a>00451 <span class="keywordflow">return</span> empty_string;
<a name="l00452"></a>00452
<a name="l00453"></a>00453 <a class="code" href="group__message.html#gaa63527cb368d0bcd4cb0809138c927df" title="The type of the facet the messages are fetched with.">facet_type</a> <span class="keyword">const</span> *facet = 0;
<a name="l00454"></a>00454 <span class="keywordflow">if</span>(std::has_facet&lt;facet_type&gt;(loc))
<a name="l00455"></a>00455 facet = &amp;std::use_facet&lt;facet_type&gt;(loc);
<a name="l00456"></a>00456
<a name="l00457"></a>00457 <span class="keywordflow">if</span>(facet) {
<a name="l00458"></a>00458 <span class="keywordflow">if</span>(!plural) {
<a name="l00459"></a>00459 translated = facet-&gt;get(domain_id,context,<span class="keywordtype">id</span>);
<a name="l00460"></a>00460 }
<a name="l00461"></a>00461 <span class="keywordflow">else</span> {
<a name="l00462"></a>00462 translated = facet-&gt;get(domain_id,context,<span class="keywordtype">id</span>,n_);
<a name="l00463"></a>00463 }
<a name="l00464"></a>00464 }
<a name="l00465"></a>00465
<a name="l00466"></a>00466 <span class="keywordflow">if</span>(!translated) {
<a name="l00467"></a>00467 <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *msg = plural ? ( n_ == 1 ? <span class="keywordtype">id</span> : plural) : <span class="keywordtype">id</span>;
<a name="l00468"></a>00468
<a name="l00469"></a>00469 <span class="keywordflow">if</span>(facet) {
<a name="l00470"></a>00470 translated = facet-&gt;convert(msg,buffer);
<a name="l00471"></a>00471 }
<a name="l00472"></a>00472 <span class="keywordflow">else</span> {
<a name="l00473"></a>00473 translated = details::string_cast_traits&lt;char_type&gt;::cast(msg,buffer);
<a name="l00474"></a>00474 }
<a name="l00475"></a>00475 }
<a name="l00476"></a>00476 <span class="keywordflow">return</span> translated;
<a name="l00477"></a>00477 }
<a name="l00478"></a>00478
<a name="l00480"></a>00480
<a name="l00481"></a>00481 <span class="keywordtype">int</span> n_;
<a name="l00482"></a>00482 <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *c_id_;
<a name="l00483"></a>00483 <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *c_context_;
<a name="l00484"></a>00484 <a class="code" href="group__message.html#gaa5d8dcf9d7aa01abbe73c841299345db" title="The character this message object is used with.">char_type</a> <span class="keyword">const</span> *c_plural_;
<a name="l00485"></a>00485 <a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> id_;
<a name="l00486"></a>00486 <a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> context_;
<a name="l00487"></a>00487 <a class="code" href="group__message.html#ga529423e08fc9a8ca9ceef5c56181c6d3" title="The string type this object can be used with.">string_type</a> plural_;
<a name="l00488"></a>00488 };
<a name="l00489"></a>00489
<a name="l00490"></a>00490
<a name="l00494"></a><a class="code" href="group__message.html#ga556e3e7696302902b2242a7a94516dee">00494</a> <span class="keyword">typedef</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;char&gt;</a> <a class="code" href="group__message.html#ga556e3e7696302902b2242a7a94516dee">message</a>;
<a name="l00498"></a><a class="code" href="group__message.html#gafea131aa123d666905076f34b77326a9">00498</a> <span class="keyword">typedef</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;wchar_t&gt;</a> <a class="code" href="group__message.html#gafea131aa123d666905076f34b77326a9">wmessage</a>;
<a name="l00499"></a>00499 <span class="preprocessor"> #ifdef BOOST_HAS_CHAR16_T</span>
<a name="l00500"></a>00500 <span class="preprocessor"></span>
<a name="l00501"></a>00501
<a name="l00502"></a>00502
<a name="l00503"></a><a class="code" href="group__message.html#ga43ddf342eec2ab9145d04727f8161e1c">00503</a> <span class="keyword">typedef</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;char16_t&gt;</a> <a class="code" href="group__message.html#ga43ddf342eec2ab9145d04727f8161e1c">u16message</a>;
<a name="l00504"></a>00504 <span class="preprocessor"> #endif</span>
<a name="l00505"></a>00505 <span class="preprocessor"></span><span class="preprocessor"> #ifdef BOOST_HAS_CHAR32_T</span>
<a name="l00506"></a>00506 <span class="preprocessor"></span>
<a name="l00507"></a>00507
<a name="l00508"></a>00508
<a name="l00509"></a><a class="code" href="group__message.html#ga6c0b40121a07c13de9e712845b43468f">00509</a> <span class="keyword">typedef</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;char32_t&gt;</a> <a class="code" href="group__message.html#ga6c0b40121a07c13de9e712845b43468f">u32message</a>;
<a name="l00510"></a>00510 <span class="preprocessor"> #endif</span>
<a name="l00511"></a>00511 <span class="preprocessor"></span>
<a name="l00515"></a>00515 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00516"></a><a class="code" href="group__message.html#ga6989a96196696d891accb078788e2a6b">00516</a> std::basic_ostream&lt;CharType&gt; &amp;operator&lt;&lt;(std::basic_ostream&lt;CharType&gt; &amp;out,<a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a> <span class="keyword">const</span> &amp;msg)
<a name="l00517"></a>00517 {
<a name="l00518"></a>00518 msg.<a class="code" href="group__message.html#ga4dd81f4d40c4e8871bb1bf02bbc8e968">write</a>(out);
<a name="l00519"></a>00519 <span class="keywordflow">return</span> out;
<a name="l00520"></a>00520 }
<a name="l00521"></a>00521
<a name="l00525"></a>00525
<a name="l00529"></a>00529 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00530"></a><a class="code" href="group__message.html#ga58e9599005608845d2b022d499dc97f6">00530</a> <span class="keyword">inline</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a> <a class="code" href="group__message.html#ga58e9599005608845d2b022d499dc97f6" title="Translate a message, msg is not copied.">translate</a>(CharType <span class="keyword">const</span> *msg)
<a name="l00531"></a>00531 {
<a name="l00532"></a>00532 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(msg);
<a name="l00533"></a>00533 }
<a name="l00537"></a>00537 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00538"></a><a class="code" href="group__message.html#ga5fb25c892b2487d437c53cf68836d204">00538</a> <span class="keyword">inline</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a> <a class="code" href="group__message.html#ga58e9599005608845d2b022d499dc97f6" title="Translate a message, msg is not copied.">translate</a>( CharType <span class="keyword">const</span> *context,
<a name="l00539"></a>00539 CharType <span class="keyword">const</span> *msg)
<a name="l00540"></a>00540 {
<a name="l00541"></a>00541 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(context,msg);
<a name="l00542"></a>00542 }
<a name="l00546"></a>00546 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00547"></a><a class="code" href="group__message.html#ga4f0b199ac8500821ab1106a59f565fb3">00547</a> <span class="keyword">inline</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a> <a class="code" href="group__message.html#ga58e9599005608845d2b022d499dc97f6" title="Translate a message, msg is not copied.">translate</a>( CharType <span class="keyword">const</span> *single,
<a name="l00548"></a>00548 CharType <span class="keyword">const</span> *plural,
<a name="l00549"></a>00549 <span class="keywordtype">int</span> n)
<a name="l00550"></a>00550 {
<a name="l00551"></a>00551 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(single,plural,n);
<a name="l00552"></a>00552 }
<a name="l00556"></a>00556 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00557"></a><a class="code" href="group__message.html#ga46f884a060b76ce4f71bf66605bc6546">00557</a> <span class="keyword">inline</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a> <a class="code" href="group__message.html#ga58e9599005608845d2b022d499dc97f6" title="Translate a message, msg is not copied.">translate</a>( CharType <span class="keyword">const</span> *context,
<a name="l00558"></a>00558 CharType <span class="keyword">const</span> *single,
<a name="l00559"></a>00559 CharType <span class="keyword">const</span> *plural,
<a name="l00560"></a>00560 <span class="keywordtype">int</span> n)
<a name="l00561"></a>00561 {
<a name="l00562"></a>00562 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(context,single,plural,n);
<a name="l00563"></a>00563 }
<a name="l00564"></a>00564
<a name="l00568"></a>00568 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00569"></a><a class="code" href="group__message.html#ga8cd3b2dc8d53c6bd05e5f1fc059882d4">00569</a> <span class="keyword">inline</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a> <a class="code" href="group__message.html#ga58e9599005608845d2b022d499dc97f6" title="Translate a message, msg is not copied.">translate</a>(std::basic_string&lt;CharType&gt; <span class="keyword">const</span> &amp;msg)
<a name="l00570"></a>00570 {
<a name="l00571"></a>00571 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(msg);
<a name="l00572"></a>00572 }
<a name="l00573"></a>00573
<a name="l00577"></a>00577 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00578"></a><a class="code" href="group__message.html#ga1dd13eea287051c834bee6bedc38e798">00578</a> <span class="keyword">inline</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a> <a class="code" href="group__message.html#ga58e9599005608845d2b022d499dc97f6" title="Translate a message, msg is not copied.">translate</a>( std::basic_string&lt;CharType&gt; <span class="keyword">const</span> &amp;context,
<a name="l00579"></a>00579 std::basic_string&lt;CharType&gt; <span class="keyword">const</span> &amp;msg)
<a name="l00580"></a>00580 {
<a name="l00581"></a>00581 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(context,msg);
<a name="l00582"></a>00582 }
<a name="l00586"></a>00586 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00587"></a><a class="code" href="group__message.html#ga4703ec0c6627f9ef55f3ffe2968973f8">00587</a> <span class="keyword">inline</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a> <a class="code" href="group__message.html#ga58e9599005608845d2b022d499dc97f6" title="Translate a message, msg is not copied.">translate</a>( std::basic_string&lt;CharType&gt; <span class="keyword">const</span> &amp;context,
<a name="l00588"></a>00588 std::basic_string&lt;CharType&gt; <span class="keyword">const</span> &amp;single,
<a name="l00589"></a>00589 std::basic_string&lt;CharType&gt; <span class="keyword">const</span> &amp;plural,
<a name="l00590"></a>00590 <span class="keywordtype">int</span> n)
<a name="l00591"></a>00591 {
<a name="l00592"></a>00592 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(context,single,plural,n);
<a name="l00593"></a>00593 }
<a name="l00594"></a>00594
<a name="l00598"></a>00598
<a name="l00599"></a>00599 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00600"></a><a class="code" href="group__message.html#gab1ccc4a7a60200be76d4a4bf3f8e2217">00600</a> <span class="keyword">inline</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a> <a class="code" href="group__message.html#ga58e9599005608845d2b022d499dc97f6" title="Translate a message, msg is not copied.">translate</a>( std::basic_string&lt;CharType&gt; <span class="keyword">const</span> &amp;single,
<a name="l00601"></a>00601 std::basic_string&lt;CharType&gt; <span class="keyword">const</span> &amp;plural,
<a name="l00602"></a>00602 <span class="keywordtype">int</span> n)
<a name="l00603"></a>00603 {
<a name="l00604"></a>00604 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(single,plural,n);
<a name="l00605"></a>00605 }
<a name="l00606"></a>00606
<a name="l00608"></a>00608
<a name="l00612"></a>00612
<a name="l00616"></a>00616 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00617"></a><a class="code" href="group__message.html#ga1121f0001ff0f3b9455390b6412c6a2c">00617</a> std::basic_string&lt;CharType&gt; <a class="code" href="group__message.html#ga1121f0001ff0f3b9455390b6412c6a2c">gettext</a>(CharType <span class="keyword">const</span> *<span class="keywordtype">id</span>,
<a name="l00618"></a>00618 std::locale <span class="keyword">const</span> &amp;loc=std::locale())
<a name="l00619"></a>00619 {
<a name="l00620"></a>00620 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(id).str(loc);
<a name="l00621"></a>00621 }
<a name="l00625"></a>00625 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00626"></a><a class="code" href="group__message.html#gaab79a005dda921603eead4839c116c52">00626</a> std::basic_string&lt;CharType&gt; <a class="code" href="group__message.html#gaab79a005dda921603eead4839c116c52">ngettext</a>( CharType <span class="keyword">const</span> *s,
<a name="l00627"></a>00627 CharType <span class="keyword">const</span> *p,
<a name="l00628"></a>00628 <span class="keywordtype">int</span> n,
<a name="l00629"></a>00629 std::locale <span class="keyword">const</span> &amp;loc=std::locale())
<a name="l00630"></a>00630 {
<a name="l00631"></a>00631 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(s,p,n).str(loc);
<a name="l00632"></a>00632 }
<a name="l00636"></a>00636 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00637"></a><a class="code" href="group__message.html#ga0c4c54c5562ecc56396ef1c53582c799">00637</a> std::basic_string&lt;CharType&gt; <a class="code" href="group__message.html#ga0c4c54c5562ecc56396ef1c53582c799">dgettext</a>( <span class="keywordtype">char</span> <span class="keyword">const</span> *<a class="code" href="group__manipulators.html#gab522188e3d82f1d2898b290b9132925e">domain</a>,
<a name="l00638"></a>00638 CharType <span class="keyword">const</span> *<span class="keywordtype">id</span>,
<a name="l00639"></a>00639 std::locale <span class="keyword">const</span> &amp;loc=std::locale())
<a name="l00640"></a>00640 {
<a name="l00641"></a>00641 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(id).str(loc,domain);
<a name="l00642"></a>00642 }
<a name="l00643"></a>00643
<a name="l00647"></a>00647 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00648"></a><a class="code" href="group__message.html#ga90b0cac98c7d6cd0e5157c10ba15ea29">00648</a> std::basic_string&lt;CharType&gt; <a class="code" href="group__message.html#ga90b0cac98c7d6cd0e5157c10ba15ea29">dngettext</a>( <span class="keywordtype">char</span> <span class="keyword">const</span> *domain,
<a name="l00649"></a>00649 CharType <span class="keyword">const</span> *s,
<a name="l00650"></a>00650 CharType <span class="keyword">const</span> *p,
<a name="l00651"></a>00651 <span class="keywordtype">int</span> n,
<a name="l00652"></a>00652 std::locale <span class="keyword">const</span> &amp;loc=std::locale())
<a name="l00653"></a>00653 {
<a name="l00654"></a>00654 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(s,p,n).str(loc,domain);
<a name="l00655"></a>00655 }
<a name="l00659"></a>00659 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00660"></a><a class="code" href="group__message.html#gab2362c5a15141d3d58dbf731e6ef6bad">00660</a> std::basic_string&lt;CharType&gt; <a class="code" href="group__message.html#gab2362c5a15141d3d58dbf731e6ef6bad">pgettext</a>( CharType <span class="keyword">const</span> *context,
<a name="l00661"></a>00661 CharType <span class="keyword">const</span> *<span class="keywordtype">id</span>,
<a name="l00662"></a>00662 std::locale <span class="keyword">const</span> &amp;loc=std::locale())
<a name="l00663"></a>00663 {
<a name="l00664"></a>00664 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(context,id).str(loc);
<a name="l00665"></a>00665 }
<a name="l00669"></a>00669 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00670"></a><a class="code" href="group__message.html#ga5023a270956a2febe1cd86c717d570a7">00670</a> std::basic_string&lt;CharType&gt; <a class="code" href="group__message.html#ga5023a270956a2febe1cd86c717d570a7">npgettext</a>( CharType <span class="keyword">const</span> *context,
<a name="l00671"></a>00671 CharType <span class="keyword">const</span> *s,
<a name="l00672"></a>00672 CharType <span class="keyword">const</span> *p,
<a name="l00673"></a>00673 <span class="keywordtype">int</span> n,
<a name="l00674"></a>00674 std::locale <span class="keyword">const</span> &amp;loc=std::locale())
<a name="l00675"></a>00675 {
<a name="l00676"></a>00676 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(context,s,p,n).str(loc);
<a name="l00677"></a>00677 }
<a name="l00681"></a>00681 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00682"></a><a class="code" href="group__message.html#ga0f9df82da4f38d900500a284cf1ab18f">00682</a> std::basic_string&lt;CharType&gt; <a class="code" href="group__message.html#ga0f9df82da4f38d900500a284cf1ab18f">dpgettext</a>( <span class="keywordtype">char</span> <span class="keyword">const</span> *domain,
<a name="l00683"></a>00683 CharType <span class="keyword">const</span> *context,
<a name="l00684"></a>00684 CharType <span class="keyword">const</span> *<span class="keywordtype">id</span>,
<a name="l00685"></a>00685 std::locale <span class="keyword">const</span> &amp;loc=std::locale())
<a name="l00686"></a>00686 {
<a name="l00687"></a>00687 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(context,id).str(loc,domain);
<a name="l00688"></a>00688 }
<a name="l00692"></a>00692 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00693"></a><a class="code" href="group__message.html#gae017bbb838e35f1e9b4864e822d8f5f6">00693</a> std::basic_string&lt;CharType&gt; <a class="code" href="group__message.html#gae017bbb838e35f1e9b4864e822d8f5f6">dnpgettext</a>(<span class="keywordtype">char</span> <span class="keyword">const</span> *domain,
<a name="l00694"></a>00694 CharType <span class="keyword">const</span> *context,
<a name="l00695"></a>00695 CharType <span class="keyword">const</span> *s,
<a name="l00696"></a>00696 CharType <span class="keyword">const</span> *p,
<a name="l00697"></a>00697 <span class="keywordtype">int</span> n,
<a name="l00698"></a>00698 std::locale <span class="keyword">const</span> &amp;loc=std::locale())
<a name="l00699"></a>00699 {
<a name="l00700"></a>00700 <span class="keywordflow">return</span> <a class="code" href="classboost_1_1locale_1_1basic__message.html" title="This class represents a message that can be converted to a specific locale message.">basic_message&lt;CharType&gt;</a>(context,s,p,n).str(loc,domain);
<a name="l00701"></a>00701 }
<a name="l00702"></a>00702
<a name="l00706"></a>00706
<a name="l00707"></a>00707 <span class="keyword">template</span>&lt;&gt;
<a name="l00708"></a>00708 <span class="keyword">struct </span>BOOST_LOCALE_DECL base_message_format&lt;char&gt; : <span class="keyword">public</span> std::locale::facet
<a name="l00709"></a>00709 {
<a name="l00710"></a>00710 base_message_format(<span class="keywordtype">size_t</span> refs = 0) : std::locale::facet(refs)
<a name="l00711"></a>00711 {
<a name="l00712"></a>00712 }
<a name="l00713"></a>00713 <span class="keyword">static</span> std::locale::id id;
<a name="l00714"></a>00714 };
<a name="l00715"></a>00715
<a name="l00716"></a>00716 <span class="keyword">template</span>&lt;&gt;
<a name="l00717"></a>00717 <span class="keyword">struct </span>BOOST_LOCALE_DECL base_message_format&lt;wchar_t&gt; : <span class="keyword">public</span> std::locale::facet
<a name="l00718"></a>00718 {
<a name="l00719"></a>00719 base_message_format(<span class="keywordtype">size_t</span> refs = 0) : std::locale::facet(refs)
<a name="l00720"></a>00720 {
<a name="l00721"></a>00721 }
<a name="l00722"></a>00722 <span class="keyword">static</span> std::locale::id id;
<a name="l00723"></a>00723 };
<a name="l00724"></a>00724
<a name="l00725"></a>00725 <span class="preprocessor"> #ifdef BOOST_HAS_CHAR16_T</span>
<a name="l00726"></a>00726 <span class="preprocessor"></span>
<a name="l00727"></a>00727 <span class="keyword">template</span>&lt;&gt;
<a name="l00728"></a>00728 <span class="keyword">struct </span>BOOST_LOCALE_DECL base_message_format&lt;char16_t&gt; : <span class="keyword">public</span> std::locale::facet
<a name="l00729"></a>00729 {
<a name="l00730"></a>00730 base_message_format(<span class="keywordtype">size_t</span> refs = 0) : std::locale::facet(refs)
<a name="l00731"></a>00731 {
<a name="l00732"></a>00732 }
<a name="l00733"></a>00733 <span class="keyword">static</span> std::locale::id id;
<a name="l00734"></a>00734 };
<a name="l00735"></a>00735
<a name="l00736"></a>00736 <span class="preprocessor"> #endif</span>
<a name="l00737"></a>00737 <span class="preprocessor"></span>
<a name="l00738"></a>00738 <span class="preprocessor"> #ifdef BOOST_HAS_CHAR32_T</span>
<a name="l00739"></a>00739 <span class="preprocessor"></span>
<a name="l00740"></a>00740 <span class="keyword">template</span>&lt;&gt;
<a name="l00741"></a>00741 <span class="keyword">struct </span>BOOST_LOCALE_DECL base_message_format&lt;char32_t&gt; : <span class="keyword">public</span> std::locale::facet
<a name="l00742"></a>00742 {
<a name="l00743"></a>00743 base_message_format(<span class="keywordtype">size_t</span> refs = 0) : std::locale::facet(refs)
<a name="l00744"></a>00744 {
<a name="l00745"></a>00745 }
<a name="l00746"></a>00746 <span class="keyword">static</span> std::locale::id id;
<a name="l00747"></a>00747 };
<a name="l00748"></a>00748
<a name="l00749"></a>00749 <span class="preprocessor"> #endif</span>
<a name="l00750"></a>00750 <span class="preprocessor"></span>
<a name="l00752"></a>00752
<a name="l00756"></a>00756
<a name="l00757"></a>00757 <span class="keyword">namespace </span>as {
<a name="l00759"></a>00759 <span class="keyword">namespace </span>details {
<a name="l00760"></a>00760 <span class="keyword">struct </span>set_domain {
<a name="l00761"></a>00761 std::string domain_id;
<a name="l00762"></a>00762 };
<a name="l00763"></a>00763 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00764"></a>00764 std::basic_ostream&lt;CharType&gt; &amp;operator&lt;&lt;(std::basic_ostream&lt;CharType&gt; &amp;out, set_domain <span class="keyword">const</span> &amp;dom)
<a name="l00765"></a>00765 {
<a name="l00766"></a>00766 <span class="keywordtype">int</span> <span class="keywordtype">id</span> = std::use_facet&lt;message_format&lt;CharType&gt; &gt;(out.getloc()).<a class="code" href="group__manipulators.html#gab522188e3d82f1d2898b290b9132925e">domain</a>(dom.domain_id);
<a name="l00767"></a>00767 <a class="code" href="classboost_1_1locale_1_1ios__info.html#a02f6979dffc2df97c3612d72b7c7241b">ios_info::get</a>(out).<a class="code" href="classboost_1_1locale_1_1ios__info.html#a08b1bb49e5806900bfa1901e869497a6">domain_id</a>(<span class="keywordtype">id</span>);
<a name="l00768"></a>00768 <span class="keywordflow">return</span> out;
<a name="l00769"></a>00769 }
<a name="l00770"></a>00770 } <span class="comment">// details</span>
<a name="l00772"></a>00772 <span class="comment"></span>
<a name="l00777"></a>00777
<a name="l00783"></a>00783 <span class="keyword">inline</span>
<a name="l00784"></a>00784 <span class="preprocessor"> #ifdef BOOST_LOCALE_DOXYGEN</span>
<a name="l00785"></a>00785 <span class="preprocessor"></span> unspecified_type
<a name="l00786"></a>00786 <span class="preprocessor"> #else</span>
<a name="l00787"></a>00787 <span class="preprocessor"></span> details::set_domain
<a name="l00788"></a>00788 <span class="preprocessor"> #endif</span>
<a name="l00789"></a><a class="code" href="group__manipulators.html#gab522188e3d82f1d2898b290b9132925e">00789</a> <span class="preprocessor"></span> <a class="code" href="group__manipulators.html#gab522188e3d82f1d2898b290b9132925e">domain</a>(std::string <span class="keyword">const</span> &amp;<span class="keywordtype">id</span>)
<a name="l00790"></a>00790 {
<a name="l00791"></a>00791 details::set_domain tmp = { <span class="keywordtype">id</span> };
<a name="l00792"></a>00792 <span class="keywordflow">return</span> tmp;
<a name="l00793"></a>00793 }
<a name="l00795"></a>00795 } <span class="comment">// as</span>
<a name="l00796"></a>00796 } <span class="comment">// locale </span>
<a name="l00797"></a>00797 } <span class="comment">// boost</span>
<a name="l00798"></a>00798
<a name="l00799"></a>00799 <span class="preprocessor">#ifdef BOOST_MSVC</span>
<a name="l00800"></a>00800 <span class="preprocessor"></span><span class="preprocessor">#pragma warning(pop)</span>
<a name="l00801"></a>00801 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00802"></a>00802 <span class="preprocessor"></span>
<a name="l00803"></a>00803
<a name="l00804"></a>00804 <span class="preprocessor">#endif</span>
<a name="l00805"></a>00805 <span class="preprocessor"></span>
<a name="l00806"></a>00806 <span class="comment">// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4</span>
<a name="l00807"></a>00807
</pre></div></div><!-- contents -->
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>message.hpp</b> </li>
<li class="footer">
&copy; 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.
</li>
</ul>
</div>
</body>
</html>