Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > 23fdeec2afeeb035357795bcffb419c6 > files > 127

libmtp-doc-1.0.2-1mdv2010.1.x86_64.rpm

<!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>libmtp: /home/mandrake/rpm/BUILD/libmtp-1.0.2/src/unicode.h File 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.2 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_afadb87d2fbfeb62b40078349a549d44.html">src</a>
  </div>
</div>
<div class="contents">
<h1>unicode.h File Reference</h1>
<p><a href="unicode_8h_source.html">Go to the source code of this file.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="unicode_8h.html#a226cb048c203fcc9d61c49bdc99e5817">ucs2_strlen</a> (uint16_t const *const)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="unicode_8h.html#a595da47b34b255f94fc67d857abb84b1">utf16_to_utf8</a> (<a class="el" href="structLIBMTP__mtpdevice__struct.html">LIBMTP_mtpdevice_t</a> *, const uint16_t *)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint16_t *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="unicode_8h.html#a810010c679a0153fc648553ba8ca7c2a">utf8_to_utf16</a> (<a class="el" href="structLIBMTP__mtpdevice__struct.html">LIBMTP_mtpdevice_t</a> *, const char *)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="unicode_8h.html#a2bda980f6207cb48ca2e8103f07dfb58">strip_7bit_from_utf8</a> (char *str)</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>This file contains general Unicode string manipulation functions. It mainly consist of functions for converting between UCS-2 (used on the devices) and UTF-8 (used by several applications).</p>
<p>For a deeper understanding of Unicode encoding formats see the Wikipedia entries for <a href="http://en.wikipedia.org/wiki/UTF-16/UCS-2">UTF-16/UCS-2</a> and <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a>.</p>
<p>Copyright (C) 2005-2007 Linus Walleij &lt;<a href="mailto:triad@df.lth.se">triad@df.lth.se</a>&gt;</p>
<p>This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.</p>
<p>This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</p>
<p>You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. </p>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="a2bda980f6207cb48ca2e8103f07dfb58"></a><!-- doxytag: member="unicode.h::strip_7bit_from_utf8" ref="a2bda980f6207cb48ca2e8103f07dfb58" args="(char *str)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void strip_7bit_from_utf8 </td>
          <td>(</td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>str</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>This helper function simply removes any consecutive chars &gt; 0x7F and replace then with an underscore. In UTF-8 consequtive chars &gt; 0x7F represent one single character so it has to be done like this (and it's elegant). It will only shrink the string in size so no copying is needed. </p>

<p>Referenced by <a class="el" href="libmtp_8c_source.html#l06691">LIBMTP_Create_Folder()</a>.</p>

</div>
</div>
<a class="anchor" id="a226cb048c203fcc9d61c49bdc99e5817"></a><!-- doxytag: member="unicode.h::ucs2_strlen" ref="a226cb048c203fcc9d61c49bdc99e5817" args="(uint16_t const *const)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int ucs2_strlen </td>
          <td>(</td>
          <td class="paramtype">uint16_t const *const &nbsp;</td>
          <td class="paramname"> <em>unicstr</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Gets the length (in characters, not bytes) of a unicode UCS-2 string, eg a string which physically is 0x00 0x41 0x00 0x00 will return a value of 1.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>unicstr</em>&nbsp;</td><td>a UCS-2 Unicode string </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the length of the string, in number of characters. If you want to know the length in bytes, multiply this by two and add two (for zero terminator). </dd></dl>

<p>Referenced by <a class="el" href="unicode_8c_source.html#l00078">utf16_to_utf8()</a>, and <a class="el" href="unicode_8c_source.html#l00111">utf8_to_utf16()</a>.</p>

</div>
</div>
<a class="anchor" id="a595da47b34b255f94fc67d857abb84b1"></a><!-- doxytag: member="unicode.h::utf16_to_utf8" ref="a595da47b34b255f94fc67d857abb84b1" args="(LIBMTP_mtpdevice_t *, const uint16_t *)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* utf16_to_utf8 </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structLIBMTP__mtpdevice__struct.html">LIBMTP_mtpdevice_t</a> *&nbsp;</td>
          <td class="paramname"> <em>device</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint16_t *&nbsp;</td>
          <td class="paramname"> <em>unicstr</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Converts a big-endian UTF-16 2-byte string to a UTF-8 string. Actually just a UCS-2 internal conversion routine that strips off the BOM if there is one.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>device</em>&nbsp;</td><td>a pointer to the current device. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>unicstr</em>&nbsp;</td><td>the UTF-16 unicode string to convert </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>a UTF-8 string. </dd></dl>

<p>References <a class="el" href="libmtp_8h_source.html#l00580">LIBMTP_mtpdevice_struct::params</a>, <a class="el" href="unicode_8c_source.html#l00048">STRING_BUFFER_LENGTH</a>, and <a class="el" href="unicode_8c_source.html#l00060">ucs2_strlen()</a>.</p>

</div>
</div>
<a class="anchor" id="a810010c679a0153fc648553ba8ca7c2a"></a><!-- doxytag: member="unicode.h::utf8_to_utf16" ref="a810010c679a0153fc648553ba8ca7c2a" args="(LIBMTP_mtpdevice_t *, const char *)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint16_t* utf8_to_utf16 </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structLIBMTP__mtpdevice__struct.html">LIBMTP_mtpdevice_t</a> *&nbsp;</td>
          <td class="paramname"> <em>device</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>localstr</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Converts a UTF-8 string to a big-endian UTF-16 2-byte string Actually just a UCS-2 internal conversion.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>device</em>&nbsp;</td><td>a pointer to the current device. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>localstr</em>&nbsp;</td><td>the UTF-8 unicode string to convert </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>a UTF-16 string. </dd></dl>

<p>References <a class="el" href="libmtp_8h_source.html#l00580">LIBMTP_mtpdevice_struct::params</a>, <a class="el" href="unicode_8c_source.html#l00048">STRING_BUFFER_LENGTH</a>, and <a class="el" href="unicode_8c_source.html#l00060">ucs2_strlen()</a>.</p>

</div>
</div>
</div>
<hr size="1"/><address style="text-align: right;"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address>
</body>
</html>