<!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"/> <title>glibmm: Glib::IConv Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.1 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="namespaceGlib.html">Glib</a>::<a class="el" href="classGlib_1_1IConv.html">IConv</a> </div> </div> <div class="contents"> <h1>Glib::IConv Class Reference<br/> <small> [<a class="el" href="group__CharsetConv.html">Character Set Conversion</a>]</small> </h1><!-- doxytag: class="Glib::IConv" --> <p>Thin iconv() wrapper. <a href="#_details">More...</a></p> <p><a href="classGlib_1_1IConv-members.html">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1IConv.html#abb841f9db0731eb8cbc4ea2a8a5d23d5">IConv</a> (const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a>& to_codeset, const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a>& from_codeset)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Open new conversion descriptor. <a href="#abb841f9db0731eb8cbc4ea2a8a5d23d5"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1IConv.html#ad2722879e0465fec5d9f2c126a602557">IConv</a> (GIConv gobject)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1IConv.html#ab56fc0ef68a7f7fee554728a16c6cba0">~IConv</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Close conversion descriptor. <a href="#ab56fc0ef68a7f7fee554728a16c6cba0"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1IConv.html#a15b01bcbafa643bb7c748bfe0048cb82">iconv</a> (char** inbuf, gsize* inbytes_left, char** outbuf, gsize* outbytes_left)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Same as the standard UNIX routine iconv(), but may be implemented via libiconv on UNIX flavors that lack a native implementation. <a href="#a15b01bcbafa643bb7c748bfe0048cb82"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1IConv.html#ab0655474f54dd933d3f6959bdafffabe">reset</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Reset conversion descriptor to initial state. <a href="#ab0655474f54dd933d3f6959bdafffabe"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1IConv.html#a82af42360f040532ebd4b215dc89a59d">convert</a> (const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a>& str)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Convert from one encoding to another. <a href="#a82af42360f040532ebd4b215dc89a59d"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">GIConv </td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1IConv.html#a12a8c09489388d1efcf9b70586307614">gobj</a> ()</td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Thin iconv() wrapper. </p> <p>glibmm provides <a class="el" href="group__CharsetConv.html#ga58f7e4556c436a96c64b186bbc8f7f4c" title="Convert from one encoding to another.">Glib::convert()</a> and <a class="el" href="group__CharsetConv.html#ga4517b17f2aad4cd5c0e0640de212d928" title="Convert from the current locale's encoding to UTF-8.">Glib::locale_to_utf8()</a> which are likely more convenient than the raw iconv wrappers. However, creating an <a class="el" href="classGlib_1_1IConv.html" title="Thin iconv() wrapper.">IConv</a> object once and using the <a class="el" href="classGlib_1_1IConv.html#a82af42360f040532ebd4b215dc89a59d" title="Convert from one encoding to another.">convert()</a> method could be useful when converting multiple times between the same charsets. </p> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="abb841f9db0731eb8cbc4ea2a8a5d23d5"></a><!-- doxytag: member="Glib::IConv::IConv" ref="abb841f9db0731eb8cbc4ea2a8a5d23d5" args="(const std::string &to_codeset, const std::string &from_codeset)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Glib::IConv::IConv </td> <td>(</td> <td class="paramtype">const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a> & </td> <td class="paramname"> <em>to_codeset</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a> & </td> <td class="paramname"> <em>from_codeset</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Open new conversion descriptor. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>to_codeset</em> </td><td>Destination codeset. </td></tr> <tr><td valign="top"></td><td valign="top"><em>from_codeset</em> </td><td>Source codeset. </td></tr> </table> </dd> </dl> <dl><dt><b>Exceptions:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classGlib_1_1ConvertError.html" title="Exception class for charset conversion errors.">Glib::ConvertError</a></em> </td><td></td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="ad2722879e0465fec5d9f2c126a602557"></a><!-- doxytag: member="Glib::IConv::IConv" ref="ad2722879e0465fec5d9f2c126a602557" args="(GIConv gobject)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Glib::IConv::IConv </td> <td>(</td> <td class="paramtype">GIConv </td> <td class="paramname"> <em>gobject</em></td> <td> ) </td> <td><code> [explicit]</code></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="ab56fc0ef68a7f7fee554728a16c6cba0"></a><!-- doxytag: member="Glib::IConv::~IConv" ref="ab56fc0ef68a7f7fee554728a16c6cba0" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">Glib::IConv::~IConv </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Close conversion descriptor. </p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a82af42360f040532ebd4b215dc89a59d"></a><!-- doxytag: member="Glib::IConv::convert" ref="a82af42360f040532ebd4b215dc89a59d" args="(const std::string &str)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a> Glib::IConv::convert </td> <td>(</td> <td class="paramtype">const <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a00971.html#a32db3d9898c44d3b3a578b560f7758cc">std::string</a> & </td> <td class="paramname"> <em>str</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Convert from one encoding to another. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>str</em> </td><td>The string to convert. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>The converted string. </dd></dl> <dl><dt><b>Exceptions:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classGlib_1_1ConvertError.html" title="Exception class for charset conversion errors.">Glib::ConvertError</a></em> </td><td></td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a12a8c09489388d1efcf9b70586307614"></a><!-- doxytag: member="Glib::IConv::gobj" ref="a12a8c09489388d1efcf9b70586307614" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">GIConv Glib::IConv::gobj </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="a15b01bcbafa643bb7c748bfe0048cb82"></a><!-- doxytag: member="Glib::IConv::iconv" ref="a15b01bcbafa643bb7c748bfe0048cb82" args="(char **inbuf, gsize *inbytes_left, char **outbuf, gsize *outbytes_left)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">size_t Glib::IConv::iconv </td> <td>(</td> <td class="paramtype">char ** </td> <td class="paramname"> <em>inbuf</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">gsize * </td> <td class="paramname"> <em>inbytes_left</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char ** </td> <td class="paramname"> <em>outbuf</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">gsize * </td> <td class="paramname"> <em>outbytes_left</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Same as the standard UNIX routine iconv(), but may be implemented via libiconv on UNIX flavors that lack a native implementation. </p> <p>glibmm provides <a class="el" href="group__CharsetConv.html#ga58f7e4556c436a96c64b186bbc8f7f4c" title="Convert from one encoding to another.">Glib::convert()</a> and <a class="el" href="group__CharsetConv.html#ga4517b17f2aad4cd5c0e0640de212d928" title="Convert from the current locale's encoding to UTF-8.">Glib::locale_to_utf8()</a> which are likely more convenient than the raw iconv wrappers. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>inbuf</em> </td><td>Bytes to convert. </td></tr> <tr><td valign="top"></td><td valign="top"><em>inbytes_left</em> </td><td>In/out parameter, bytes remaining to convert in <em>inbuf</em>. </td></tr> <tr><td valign="top"></td><td valign="top"><em>outbuf</em> </td><td>Converted output bytes. </td></tr> <tr><td valign="top"></td><td valign="top"><em>outbytes_left</em> </td><td>In/out parameter, bytes available to fill in <em>outbuf</em>. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>Count of non-reversible conversions, or <code>static_cast<size_t>(-1)</code> on error. </dd></dl> </div> </div> <a class="anchor" id="ab0655474f54dd933d3f6959bdafffabe"></a><!-- doxytag: member="Glib::IConv::reset" ref="ab0655474f54dd933d3f6959bdafffabe" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void Glib::IConv::reset </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Reset conversion descriptor to initial state. </p> <p>Same as <code>iconv(0, 0, 0, 0)</code>, but implemented slightly differently in order to work on Sun Solaris <= 7. It's also more obvious so you're encouraged to use it. </p> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li>glibmm/convert.h</li> </ul> </div> <hr size="1"/><address style="text-align: right;"><small>Generated on Mon Sep 21 11:07:24 2009 for glibmm by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> </body> </html>