blob: a35b18043bf5be5696f359bdfe6d0945f8ac002b [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/gnu_gettext.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('gnu__gettext_8hpp.html','');
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">boost/locale/gnu_gettext.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_LOCLAE_GNU_GETTEXT_HPP</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define BOOST_LOCLAE_GNU_GETTEXT_HPP</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;boost/locale/message.hpp&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;boost/function.hpp&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;stdexcept&gt;</span>
<a name="l00014"></a>00014
<a name="l00015"></a>00015 <span class="keyword">namespace </span>boost {
<a name="l00016"></a>00016 <span class="keyword">namespace </span>locale {
<a name="l00019"></a>00019
<a name="l00020"></a>00020
<a name="l00024"></a><a class="code" href="namespaceboost_1_1locale_1_1gnu__gettext.html">00024</a> <span class="keyword">namespace </span>gnu_gettext {
<a name="l00025"></a>00025
<a name="l00034"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html">00034</a> <span class="keyword">struct </span><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html" title="This structure holds all information required for creating gnu-gettext message catalogs,.">messages_info</a> {
<a name="l00035"></a>00035 <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html" title="This structure holds all information required for creating gnu-gettext message catalogs,.">messages_info</a>() :
<a name="l00036"></a>00036 <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a1afc3be03d4848042e3208d4ca5aec85" title="The language we load the catalog for, like &quot;ru&quot;, &quot;en&quot;, &quot;de&quot;.">language</a>(<span class="stringliteral">&quot;C&quot;</span>),
<a name="l00037"></a>00037 <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a39ea1cfd018c7702d94d03e76042ff10">locale_category</a>(<span class="stringliteral">&quot;LC_MESSAGES&quot;</span>)
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039 }
<a name="l00040"></a>00040
<a name="l00041"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a1afc3be03d4848042e3208d4ca5aec85">00041</a> std::string <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a1afc3be03d4848042e3208d4ca5aec85" title="The language we load the catalog for, like &quot;ru&quot;, &quot;en&quot;, &quot;de&quot;.">language</a>;
<a name="l00042"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#ae939e0c5dbabba7fb4cc2872f4e7dac2">00042</a> std::string <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#ae939e0c5dbabba7fb4cc2872f4e7dac2" title="The country we load the catalog for, like &quot;US&quot;, &quot;IL&quot;.">country</a>;
<a name="l00043"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#af543a11d3ff1d12e24c06306b30f8fb8">00043</a> std::string <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#af543a11d3ff1d12e24c06306b30f8fb8" title="Language variant, like &quot;euro&quot; so it would look for catalog like de_DE@euro.">variant</a>;
<a name="l00044"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a4a7406581c6c7975c90db9d2d157d384">00044</a> std::string <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a4a7406581c6c7975c90db9d2d157d384">encoding</a>;
<a name="l00045"></a>00045
<a name="l00046"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a39ea1cfd018c7702d94d03e76042ff10">00046</a> std::string <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a39ea1cfd018c7702d94d03e76042ff10">locale_category</a>;
<a name="l00047"></a>00047
<a name="l00048"></a>00048
<a name="l00049"></a>00049
<a name="l00050"></a>00050
<a name="l00051"></a>00051
<a name="l00052"></a>00052
<a name="l00053"></a>00053
<a name="l00054"></a>00054
<a name="l00055"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html">00055</a> <span class="keyword">struct </span><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html" title="This type represents GNU Gettext domain name for the messages.">domain</a> {
<a name="l00056"></a>00056
<a name="l00057"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#ae2d68e6e122c01aa07e60142d8af54fc">00057</a> std::string <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#ae2d68e6e122c01aa07e60142d8af54fc" title="The name of the domain.">name</a>;
<a name="l00058"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#a7004c3d4bb7ff1ebdba50535723d84a5">00058</a> std::string <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#a7004c3d4bb7ff1ebdba50535723d84a5" title="The character encoding for the domain.">encoding</a>;
<a name="l00059"></a>00059 <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html" title="This type represents GNU Gettext domain name for the messages.">domain</a>() {}
<a name="l00066"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#a08bbb38698a079239430066b688d28ab">00066</a> <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html" title="This type represents GNU Gettext domain name for the messages.">domain</a>(std::string <span class="keyword">const</span> &amp;n)
<a name="l00067"></a>00067 {
<a name="l00068"></a>00068 <span class="keywordtype">size_t</span> pos = n.find(<span class="stringliteral">&quot;/&quot;</span>);
<a name="l00069"></a>00069 <span class="keywordflow">if</span>(pos==std::string::npos) {
<a name="l00070"></a>00070 <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#ae2d68e6e122c01aa07e60142d8af54fc" title="The name of the domain.">name</a> = n;
<a name="l00071"></a>00071 <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#a7004c3d4bb7ff1ebdba50535723d84a5" title="The character encoding for the domain.">encoding</a> = <span class="stringliteral">&quot;UTF-8&quot;</span>;
<a name="l00072"></a>00072 }
<a name="l00073"></a>00073 <span class="keywordflow">else</span> {
<a name="l00074"></a>00074 <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#ae2d68e6e122c01aa07e60142d8af54fc" title="The name of the domain.">name</a> = n.substr(0,pos);
<a name="l00075"></a>00075 <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#a7004c3d4bb7ff1ebdba50535723d84a5" title="The character encoding for the domain.">encoding</a> = n.substr(pos+1);
<a name="l00076"></a>00076 }
<a name="l00077"></a>00077
<a name="l00078"></a>00078 }
<a name="l00079"></a>00079
<a name="l00083"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#a4a361b37db81571d440f0ec4d1e9038f">00083</a> <span class="keywordtype">bool</span> <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#a4a361b37db81571d440f0ec4d1e9038f">operator==</a>(<a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html" title="This type represents GNU Gettext domain name for the messages.">domain</a> <span class="keyword">const</span> &amp;other)<span class="keyword"> const</span>
<a name="l00084"></a>00084 <span class="keyword"> </span>{
<a name="l00085"></a>00085 <span class="keywordflow">return</span> <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#ae2d68e6e122c01aa07e60142d8af54fc" title="The name of the domain.">name</a>==other.<a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#ae2d68e6e122c01aa07e60142d8af54fc" title="The name of the domain.">name</a>;
<a name="l00086"></a>00086 }
<a name="l00090"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#a26442fe81a0ce8c51775b1267455ecbe">00090</a> <span class="keywordtype">bool</span> <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html#a26442fe81a0ce8c51775b1267455ecbe">operator!=</a>(<a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info_1_1domain.html" title="This type represents GNU Gettext domain name for the messages.">domain</a> <span class="keyword">const</span> &amp;other)<span class="keyword"> const</span>
<a name="l00091"></a>00091 <span class="keyword"> </span>{
<a name="l00092"></a>00092 <span class="keywordflow">return</span> !(*<span class="keyword">this</span>==other);
<a name="l00093"></a>00093 }
<a name="l00094"></a>00094
<a name="l00095"></a>00095 };
<a name="l00096"></a>00096
<a name="l00097"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#ac3bfe22cf949ed3f87ee28fa0c983502">00097</a> <span class="keyword">typedef</span> std::vector&lt;domain&gt; <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#ac3bfe22cf949ed3f87ee28fa0c983502">domains_type</a>;
<a name="l00098"></a>00098
<a name="l00099"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a1ca79b90b4b8dbc924e5eb1b42188311">00099</a> <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#ac3bfe22cf949ed3f87ee28fa0c983502">domains_type</a> <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a1ca79b90b4b8dbc924e5eb1b42188311">domains</a>;
<a name="l00100"></a>00100
<a name="l00101"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a263d9d2c359ae7730e6d5bba54bb3022">00101</a> std::vector&lt;std::string&gt; <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a263d9d2c359ae7730e6d5bba54bb3022">paths</a>;
<a name="l00102"></a>00102
<a name="l00103"></a>00103
<a name="l00114"></a>00114 <span class="keyword">typedef</span> <span class="keyword">function</span>&lt;
<a name="l00115"></a>00115 std::vector&lt;char&gt;(
<a name="l00116"></a>00116 std::string <span class="keyword">const</span> &amp;file_name,
<a name="l00117"></a>00117 std::string <span class="keyword">const</span> &amp;<a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a4a7406581c6c7975c90db9d2d157d384">encoding</a>
<a name="l00118"></a>00118 )
<a name="l00119"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a4dfe37c5a392e5106e65b396a5288b76">00119</a> &gt; <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a4dfe37c5a392e5106e65b396a5288b76">callback_type</a>;
<a name="l00120"></a>00120
<a name="l00125"></a><a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a63bd8b01ca532a2657186bab3fa396a2">00125</a> <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a4dfe37c5a392e5106e65b396a5288b76">callback_type</a> <a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html#a63bd8b01ca532a2657186bab3fa396a2">callback</a>;
<a name="l00126"></a>00126
<a name="l00127"></a>00127 };
<a name="l00128"></a>00128
<a name="l00133"></a>00133
<a name="l00134"></a>00134 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> CharType&gt;
<a name="l00135"></a>00135 <a class="code" href="classboost_1_1locale_1_1message__format.html" title="This facet provides message formatting abilities.">message_format&lt;CharType&gt;</a> *<a class="code" href="namespaceboost_1_1locale_1_1gnu__gettext.html#a6793c9f58e61e745205f3a2678b41a11">create_messages_facet</a>(<a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html" title="This structure holds all information required for creating gnu-gettext message catalogs,.">messages_info</a> <span class="keyword">const</span> &amp;<a class="code" href="classboost_1_1locale_1_1info.html" title="a facet that holds general information about locale">info</a>);
<a name="l00136"></a>00136
<a name="l00138"></a>00138
<a name="l00139"></a>00139 <span class="keyword">template</span>&lt;&gt;
<a name="l00140"></a>00140 BOOST_LOCALE_DECL <a class="code" href="classboost_1_1locale_1_1message__format.html" title="This facet provides message formatting abilities.">message_format&lt;char&gt;</a> *<a class="code" href="namespaceboost_1_1locale_1_1gnu__gettext.html#a6793c9f58e61e745205f3a2678b41a11">create_messages_facet</a>(<a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html" title="This structure holds all information required for creating gnu-gettext message catalogs,.">messages_info</a> <span class="keyword">const</span> &amp;<a class="code" href="classboost_1_1locale_1_1info.html" title="a facet that holds general information about locale">info</a>);
<a name="l00141"></a>00141
<a name="l00142"></a>00142 <span class="keyword">template</span>&lt;&gt;
<a name="l00143"></a>00143 BOOST_LOCALE_DECL <a class="code" href="classboost_1_1locale_1_1message__format.html" title="This facet provides message formatting abilities.">message_format&lt;wchar_t&gt;</a> *<a class="code" href="namespaceboost_1_1locale_1_1gnu__gettext.html#a6793c9f58e61e745205f3a2678b41a11">create_messages_facet</a>(<a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html" title="This structure holds all information required for creating gnu-gettext message catalogs,.">messages_info</a> <span class="keyword">const</span> &amp;<a class="code" href="classboost_1_1locale_1_1info.html" title="a facet that holds general information about locale">info</a>);
<a name="l00144"></a>00144
<a name="l00145"></a>00145 <span class="preprocessor"> #ifdef BOOST_HAS_CHAR16_T</span>
<a name="l00146"></a>00146 <span class="preprocessor"></span> <span class="keyword">template</span>&lt;&gt;
<a name="l00147"></a>00147 BOOST_LOCALE_DECL <a class="code" href="classboost_1_1locale_1_1message__format.html" title="This facet provides message formatting abilities.">message_format&lt;char16_t&gt;</a> *<a class="code" href="namespaceboost_1_1locale_1_1gnu__gettext.html#a6793c9f58e61e745205f3a2678b41a11">create_messages_facet</a>(<a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html" title="This structure holds all information required for creating gnu-gettext message catalogs,.">messages_info</a> <span class="keyword">const</span> &amp;<a class="code" href="classboost_1_1locale_1_1info.html" title="a facet that holds general information about locale">info</a>);
<a name="l00148"></a>00148 <span class="preprocessor"> #endif</span>
<a name="l00149"></a>00149 <span class="preprocessor"></span>
<a name="l00150"></a>00150 <span class="preprocessor"> #ifdef BOOST_HAS_CHAR32_T</span>
<a name="l00151"></a>00151 <span class="preprocessor"></span> <span class="keyword">template</span>&lt;&gt;
<a name="l00152"></a>00152 BOOST_LOCALE_DECL <a class="code" href="classboost_1_1locale_1_1message__format.html" title="This facet provides message formatting abilities.">message_format&lt;char32_t&gt;</a> *<a class="code" href="namespaceboost_1_1locale_1_1gnu__gettext.html#a6793c9f58e61e745205f3a2678b41a11">create_messages_facet</a>(<a class="code" href="structboost_1_1locale_1_1gnu__gettext_1_1messages__info.html" title="This structure holds all information required for creating gnu-gettext message catalogs,.">messages_info</a> <span class="keyword">const</span> &amp;<a class="code" href="classboost_1_1locale_1_1info.html" title="a facet that holds general information about locale">info</a>);
<a name="l00153"></a>00153 <span class="preprocessor"> #endif</span>
<a name="l00154"></a>00154 <span class="preprocessor"></span>
<a name="l00156"></a>00156
<a name="l00157"></a>00157 } <span class="comment">// gnu_gettext</span>
<a name="l00158"></a>00158
<a name="l00160"></a>00160
<a name="l00161"></a>00161 } <span class="comment">// locale</span>
<a name="l00162"></a>00162 } <span class="comment">// boost</span>
<a name="l00163"></a>00163
<a name="l00164"></a>00164 <span class="preprocessor">#endif</span>
<a name="l00165"></a>00165 <span class="preprocessor"></span>
<a name="l00166"></a>00166 <span class="comment">// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4</span>
<a name="l00167"></a>00167
</pre></div></div><!-- contents -->
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>gnu_gettext.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>